Panda3D
Public Member Functions | List of all members
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

Public Member Functions

 __init__ (str name, const DSearchPath default_value, str description, int flags)
 
 __init__ (str name, str description, int flags)
 
 __init__ (str name, str default_value, str description, int flags)
 
 appendDirectory (const Filename directory)
 Adds a new directory to the end of the search list. More...
 
 appendPath (const DSearchPath path)
 Adds all of the directories listed in the search path to the end of the search list. More...
 
 appendPath (str path, str separator)
 Adds all of the directories listed in the search path to the end of the search list. More...
 
 clear ()
 Removes all the directories locally added to the search list, and restores it to its original form. More...
 
bool clearLocalValue ()
 Removes all the directories locally added to the search list, and restores it to its original form. More...
 
DSearchPath::Results findAllFiles (const Filename 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. More...
 
int findAllFiles (const Filename filename, DSearchPath::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. More...
 
Filename findFile (const Filename 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. More...
 
const DSearchPath getDefaultValue ()
 
list getDirectories ()
 
const Filename getDirectory (int n)
 Returns the nth directory on the search list. More...
 
int getNumDirectories ()
 Returns the number of directories on the search list. More...
 
const DSearchPath getValue ()
 
bool isEmpty ()
 Returns true if the search list is empty, false otherwise. More...
 
 output (Ostream out)
 
 prependDirectory (const Filename directory)
 Adds a new directory to the front of the search list. More...
 
 prependPath (const DSearchPath path)
 Adds all of the directories listed in the search path to the beginning of the search list. More...
 
 write (Ostream out)
 
- Public Member Functions inherited from ConfigVariableBase
bool clearLocalValue ()
 Removes the local value defined for this variable, and allows its value to be once again retrieved from the .prc files. More...
 
str getDescription ()
 Returns the brief description of this variable, if it has been defined. More...
 
int getFlags ()
 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. More...
 
str getName ()
 Returns the name of the variable. More...
 
int getTrustLevel ()
 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. More...
 
ConfigFlags::ValueType getValueType ()
 Returns the stated type of this variable. This should be VT_list, unless a later variable declaration has changed it. More...
 
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. More...
 
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. More...
 
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()). More...
 
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. More...
 
 output (Ostream out)
 
 write (Ostream out)
 

Additional Inherited Members

- Public Types inherited from ConfigFlags
enum  ValueType {
  VT_undefined = 0, VT_list = 1, VT_string = 2, VT_filename = 3,
  VT_bool = 4, VT_int = 5, VT_double = 6, VT_enum = 7,
  VT_search_path = 8, VT_int64 = 9, VT_color = 10
}
 
enum  VariableFlags {
  F_trust_level_mask = 4095, F_open = 4096, F_closed = 8192, F_dynamic = 16384,
  F_dconfig = 32768
}
 

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 Function Documentation

◆ __init__() [1/3]

__init__ ( str  name,
const DSearchPath  default_value,
str  description,
int  flags 
)

◆ __init__() [2/3]

__init__ ( str  name,
str  description,
int  flags 
)

◆ __init__() [3/3]

__init__ ( str  name,
str  default_value,
str  description,
int  flags 
)

◆ appendDirectory()

appendDirectory ( const Filename  directory)

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

◆ appendPath() [1/2]

appendPath ( const DSearchPath  path)

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

◆ appendPath() [2/2]

appendPath ( str  path,
str  separator 
)

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

◆ clear()

clear ( )

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

◆ clearLocalValue()

bool clearLocalValue ( )

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

◆ findAllFiles() [1/2]

DSearchPath::Results findAllFiles ( const Filename  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.

◆ findAllFiles() [2/2]

int findAllFiles ( const Filename  filename,
DSearchPath::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.

◆ findFile()

Filename findFile ( const Filename  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.

◆ getDefaultValue()

const DSearchPath getDefaultValue ( )

◆ getDirectories()

list getDirectories ( )

◆ getDirectory()

const Filename getDirectory ( int  n)

Returns the nth directory on the search list.

◆ getNumDirectories()

int getNumDirectories ( )

Returns the number of directories on the search list.

◆ getValue()

const DSearchPath getValue ( )

◆ isEmpty()

bool isEmpty ( )

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

◆ output()

output ( Ostream  out)

◆ prependDirectory()

prependDirectory ( const Filename  directory)

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

◆ prependPath()

prependPath ( const DSearchPath  path)

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

◆ write()

write ( Ostream  out)