Panda3D
Public Types | Public Member Functions

ConfigVariableSearchPath Class Reference

This is similar to a ConfigVariableList, but it returns its list as a DSearchPath, as a list of directories. More...

Inheritance diagram for ConfigVariableSearchPath:
ConfigVariableBase ConfigFlags

List of all members.

Public Types

enum  ValueType {
  VTUndefined = 0, VTList = 1, VTString = 2, VTFilename = 3,
  VTBool = 4, VTInt = 5, VTDouble = 6, VTEnum = 7,
  VTSearchPath = 8, VTInt64 = 9
}
enum  VariableFlags {
  FTrustLevelMask = 4095, FOpen = 4096, FClosed = 8192, FDynamic = 16384,
  FDconfig = 32768
}

Public Member Functions

 ConfigVariableSearchPath (string name, DSearchPath const default_value, string description, int flags)
 ConfigVariableSearchPath (string name, DSearchPath const default_value, string description)
 ConfigVariableSearchPath (string name, string default_value, string description)
 ConfigVariableSearchPath (string name, string description, int flags)
 ConfigVariableSearchPath (string name, string default_value, string description, int flags)
 ConfigVariableSearchPath (string name, string description)
 ConfigVariableSearchPath (string name)
 appendDirectory (Filename const directory)
 Adds a new directory to the end of the search list.
 appendPath (string path)
 Adds all of the directories listed in the search path to the end of the search list.
 appendPath (DSearchPath const path)
 Adds all of the directories listed in the search path to the end of the search list.
 appendPath (string path, string separator)
 Adds all of the directories listed in the search path to the end of the search list.
 clear ()
 Removes all the directories locally added to the search list, and restores it to its original form.
bool clearLocalValue ()
 Removes all the directories locally added to the search list, and restores it to its original form.
Results findAllFiles (Filename const filename)
 This variant of find_all_files() returns the new Results object, instead of filling on in on the parameter list.
int findAllFiles (Filename const filename, Results results)
 Searches all the directories in the search list for the indicated file, in order.
Filename findFile (Filename const filename)
 Searches all the directories in the search list for the indicated file, in order.
DSearchPath const getDefaultValue ()
string getDescription ()
 Returns the brief description of this variable, if it has been defined.
list getDirectories ()
Filename const getDirectory (int n)
 Returns the nth directory on the search list.
int getFlags ()
 Returns the flags value as set by set_flags().
string getName ()
 Returns the name of the variable.
int getNumDirectories ()
 Returns the number of directories on the search list.
int getTrustLevel ()
 Returns the minimum trust_level a prc file must demonstrate in order to redefine the value for this variable.
DSearchPath const getValue ()
ValueType getValueType ()
 Returns the stated type of this variable.
bool hasLocalValue ()
 Returns true if this variable's value has been shadowed by a local assignment (as created via make_local_value()), or false otherwise.
bool hasValue ()
 Returns true if this variable has an explicit value, either from a prc file or locally set, or false if variable has its default value.
bool isClosed ()
 Returns true if the variable is not trusted by any prc file (and hence cannot be modified from its compiled-in default value), or false for the normal case, in which the variable can be modified by any prc file at or above its trust level (see get_trust_level()).
bool isDynamic ()
 Returns true if the variable was indicated as "dynamic" by its constructor, indicating that its name was dynamically generated, possibly from a large pool, and it should not be listed along with the other variables.
bool isEmpty ()
 Returns true if the search list is empty, false otherwise.
 output (ostream out)
 prependDirectory (Filename const directory)
 Adds a new directory to the front of the search list.
 prependPath (DSearchPath const path)
 Adds all of the directories listed in the search path to the beginning of the search list.
 write (ostream out)

Detailed Description

This is similar to a ConfigVariableList, but it returns its list as a DSearchPath, as a list of directories.

You may locally append directories to the end of the search path with the methods here, or prepend them to the beginning. Use these methods to make adjustments to the path; do not attempt to directly modify the const DSearchPath object returned by get_value().

Unlike other ConfigVariable types, local changes (made by calling append_directory() and prepend_directory()) are specific to this particular instance of the ConfigVariableSearchPath. A separate instance of the same variable, created by using the same name to the constructor, will not reflect the local changes.


Member Enumeration Documentation

enum ValueType [inherited]
Enumerator:
VTUndefined 
VTList 
VTString 
VTFilename 
VTBool 
VTInt 
VTDouble 
VTEnum 
VTSearchPath 
VTInt64 
enum VariableFlags [inherited]
Enumerator:
FTrustLevelMask 
FOpen 
FClosed 
FDynamic 
FDconfig 

Constructor & Destructor Documentation

ConfigVariableSearchPath ( string  name,
DSearchPath const  default_value,
string  description,
int  flags 
)
ConfigVariableSearchPath ( string  name,
DSearchPath const  default_value,
string  description 
)
ConfigVariableSearchPath ( string  name,
string  default_value,
string  description,
int  flags 
)
ConfigVariableSearchPath ( string  name,
string  default_value,
string  description 
)
ConfigVariableSearchPath ( string  name,
string  description,
int  flags 
)
ConfigVariableSearchPath ( string  name,
string  description 
)
ConfigVariableSearchPath ( string  name)

Member Function Documentation

appendDirectory ( Filename const  directory)

Adds a new directory to the end of the search list.

appendPath ( string  path,
string  separator 
)

Adds all of the directories listed in the search path to the end of the search list.

appendPath ( string  path)

Adds all of the directories listed in the search path to the end of the search list.

appendPath ( DSearchPath const  path)

Adds all of the directories listed in the search path to the end of the search list.

clear ( )

Removes all the directories locally added to the search list, and restores it to its original form.

bool clearLocalValue ( )

Removes all the directories locally added to the search list, and restores it to its original form.

Reimplemented from ConfigVariableBase.

int findAllFiles ( Filename const  filename,
Results  results 
)

Searches all the directories in the search list for the indicated file, in order.

Fills up the results list with *all* of the matching filenames found, if any. Returns the number of matches found.

It is the responsibility of the the caller to clear the results list first; otherwise, the newly-found files will be appended to the list.

Results findAllFiles ( Filename const  filename)

This variant of find_all_files() returns the new Results object, instead of filling on in on the parameter list.

This is a little more convenient to call from Python.

Filename findFile ( Filename const  filename)

Searches all the directories in the search list for the indicated file, in order.

Returns the full matching pathname of the first match if found, or the empty string if not found.

DSearchPath const getDefaultValue ( )
string getDescription ( ) [inherited]

Returns the brief description of this variable, if it has been defined.

list getDirectories ( )
Filename const getDirectory ( int  n)

Returns the nth directory on the search list.

int getFlags ( ) [inherited]

Returns the flags value as set by set_flags().

This includes the trust level and some other settings. See the individual methods is_closed(), get_trust_level(), etc. to pull out the semantic meaning of these flags individually.

string getName ( ) [inherited]

Returns the name of the variable.

int getNumDirectories ( )

Returns the number of directories on the search list.

int getTrustLevel ( ) [inherited]

Returns the minimum trust_level a prc file must demonstrate in order to redefine the value for this variable.

Arguably, this should be called the "mistrust level", since the larger the value, the more suspicious we are of prc files. This value is not used if is_closed() returns true, which indicates no file may be trusted.

This value only has effect in a release build (specifically, when PRC_RESPECT_TRUST_LEVEL is defined true in Config.pp).

DSearchPath const getValue ( )
ValueType getValueType ( ) [inherited]

Returns the stated type of this variable.

This should be VT_list, unless a later variable declaration has changed it.

bool hasLocalValue ( ) [inherited]

Returns true if this variable's value has been shadowed by a local assignment (as created via make_local_value()), or false otherwise.

bool hasValue ( ) [inherited]

Returns true if this variable has an explicit value, either from a prc file or locally set, or false if variable has its default value.

bool isClosed ( ) [inherited]

Returns true if the variable is not trusted by any prc file (and hence cannot be modified from its compiled-in default value), or false for the normal case, in which the variable can be modified by any prc file at or above its trust level (see get_trust_level()).

This value only has effect in a release build (specifically, when PRC_RESPECT_TRUST_LEVEL is defined true in Config.pp).

bool isDynamic ( ) [inherited]

Returns true if the variable was indicated as "dynamic" by its constructor, indicating that its name was dynamically generated, possibly from a large pool, and it should not be listed along with the other variables.

bool isEmpty ( )

Returns true if the search list is empty, false otherwise.

output ( ostream  out)

Reimplemented from ConfigVariableBase.

prependDirectory ( Filename const  directory)

Adds a new directory to the front of the search list.

prependPath ( DSearchPath const  path)

Adds all of the directories listed in the search path to the beginning of the search list.

write ( ostream  out)

Reimplemented from ConfigVariableBase.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties