Panda3D

Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | 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...

`#include "configVariableSearchPath.h"`

Inheritance diagram for ConfigVariableSearchPath:

## Public Member Functions
| ConfigVariableSearchPath (const std::string &name, const DSearchPath &default_value, const std::string &description, int flags=0)
| ConfigVariableSearchPath (const std::string &name, const std::string &default_value, const std::string &description, int flags=0)
| ConfigVariableSearchPath (const std::string &name, const std::string &description=std::string(), int flags=0)
void | append_directory (const Filename &directory)
| Adds a new directory to the end of the search list.
void | append_path (const DSearchPath &path)
| Adds all of the directories listed in the search path to the end of the search list.
void | append_path (const std::string &path, const std::string &separator=std::string())
| Adds all of the directories listed in the search path to the end of the search list.
void | clear ()
| Removes all the directories locally added to the search list, and restores it to its original form.
bool | clear_local_value ()
| Removes all the directories locally added to the search list, and restores it to its original form.
DSearchPath::Results | find_all_files (const Filename &filename) const
| This variant of find_all_files() returns the new Results object, instead of filling on in on the parameter list.
size_t | find_all_files (const Filename &filename, DSearchPath::Results &results) const
| Searches all the directories in the search list for the indicated file, in order.
Filename | find_file (const Filename &filename) const
| Searches all the directories in the search list for the indicated file, in order.
const DSearchPath & | get_default_value () const
Filename | get_directory (size_t n) const
size_t | get_num_directories () const
DSearchPath | get_value () const
bool | is_empty () const
| Returns true if the search list is empty, false otherwise.
| operator DSearchPath () const
| Returns the variable's value.
void | output (std::ostream &out) const
void | prepend_directory (const Filename &directory)
| Adds a new directory to the front of the search list.
void | prepend_path (const DSearchPath &path)
| Adds all of the directories listed in the search path to the beginning of the search list.
void | write (std::ostream &out) const
Public Member Functions inherited from ConfigVariableBase
bool | clear_local_value ()
| Removes the local value defined for this variable, and allows its value to be once again retrieved from the .prc files.
const std::string & | get_description () const
int | get_flags () const
| Returns the flags value as set by set_flags().
const std::string & | get_name () const
int | get_trust_level () const
ValueType | get_value_type () const
bool | has_local_value () const
| Returns true if this variable's value has been shadowed by a local assignment (as created via make_local_value()), or false otherwise.
bool | has_value () const
| 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 | is_closed () const
bool | is_dynamic () const
void | output (std::ostream &out) const
void | write (std::ostream &out) const

## Public Attributes
| get_default_value
| get_directory
| Returns the nth directory on the search list.
| get_num_directories
| Returns the number of directories on the search list.
| get_value
Public Attributes inherited from ConfigVariableBase
| get_description
| Returns the brief description of this variable, if it has been defined.
| get_name
| Returns the name of the variable.
| get_trust_level
| Returns the minimum trust_level a prc file must demonstrate in order to redefine the value for this variable.
| get_value_type
| Returns the stated type of this variable.
| is_closed
| 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()).
| is_dynamic
| 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.

## Additional Inherited Members
Public Types inherited from ConfigFlags
enum | ValueType { VT_undefined , VT_list , VT_string , VT_filename , VT_bool , VT_int , VT_double , VT_enum , VT_search_path , VT_int64 , VT_color }
enum | VariableFlags { F_trust_level_mask = 0x00000fff , F_open = 0x00001000 , F_closed = 0x00002000 , F_dynamic = 0x00004000 , F_dconfig = 0x00008000 }

## 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.

Definition at line 36 of file configVariableSearchPath.h.

## Constructor & Destructor Documentation

## ◆ ConfigVariableSearchPath() [1/3]

ConfigVariableSearchPath::ConfigVariableSearchPath | ( | const std::string & | name,
|  | const std::string & | description = std::string(),
|  | int | flags = 0 )
| inline

Definition at line 17 of file configVariableSearchPath.I.

## ◆ ConfigVariableSearchPath() [2/3]

ConfigVariableSearchPath::ConfigVariableSearchPath | ( | const std::string & | name,
|  | const DSearchPath & | default_value,
|  | const std::string & | description,
|  | int | flags = 0 )
| inline

Definition at line 40 of file configVariableSearchPath.I.

## ◆ ConfigVariableSearchPath() [3/3]

ConfigVariableSearchPath::ConfigVariableSearchPath | ( | const std::string & | name,
|  | const std::string & | default_value,
|  | const std::string & | description,
|  | int | flags = 0 )
| inline

Definition at line 64 of file configVariableSearchPath.I.

## ◆ ~ConfigVariableSearchPath()

ConfigVariableSearchPath::~ConfigVariableSearchPath | ( |  | ) |
| inline

Definition at line 88 of file configVariableSearchPath.I.

## Member Function Documentation

## ◆ append_directory()

void ConfigVariableSearchPath::append_directory | ( | const Filename & | directory | ) |
| inline

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

Definition at line 158 of file configVariableSearchPath.I.

## ◆ append_path() [1/2]

void ConfigVariableSearchPath::append_path | ( | const DSearchPath & | path | ) |
| inline

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

Definition at line 193 of file configVariableSearchPath.I.

## ◆ append_path() [2/2]

void ConfigVariableSearchPath::append_path | ( | const std::string & | path,
|  | const std::string & | separator = std::string() )
| inline

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

Definition at line 181 of file configVariableSearchPath.I.

## ◆ clear()

void ConfigVariableSearchPath::clear | ( |  | ) |
| inline

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

Definition at line 150 of file configVariableSearchPath.I.

References clear_local_value().

## ◆ clear_local_value()

bool ConfigVariableSearchPath::clear_local_value | ( |  | ) |
| inline

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

Definition at line 128 of file configVariableSearchPath.I.

Referenced by clear().

## ◆ find_all_files() [1/2]

DSearchPath::Results ConfigVariableSearchPath::find_all_files | ( | const Filename & | filename | ) | const
| inline

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.

Definition at line 270 of file configVariableSearchPath.I.

## ◆ find_all_files() [2/2]

size_t ConfigVariableSearchPath::find_all_files | ( | const Filename & | filename,
|  | DSearchPath::Results & | results ) const
| inline

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.

Definition at line 259 of file configVariableSearchPath.I.

## ◆ find_file()

Filename ConfigVariableSearchPath::find_file | ( | const Filename & | filename | ) | const
| inline

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.

Definition at line 246 of file configVariableSearchPath.I.

## ◆ is_empty()

bool ConfigVariableSearchPath::is_empty | ( |  | ) | const
| inline

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

Definition at line 216 of file configVariableSearchPath.I.

## ◆ operator DSearchPath()

ConfigVariableSearchPath::operator DSearchPath | ( |  | ) | const
| inline

Returns the variable's value.

Definition at line 95 of file configVariableSearchPath.I.

## ◆ output()

void ConfigVariableSearchPath::output | ( | std::ostream & | out | ) | const
| inline

Definition at line 278 of file configVariableSearchPath.I.

## ◆ prepend_directory()

void ConfigVariableSearchPath::prepend_directory | ( | const Filename & | directory | ) |
| inline

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

Definition at line 169 of file configVariableSearchPath.I.

## ◆ prepend_path()

void ConfigVariableSearchPath::prepend_path | ( | const DSearchPath & | path | ) |
| inline

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

Definition at line 205 of file configVariableSearchPath.I.

## ◆ write()

void ConfigVariableSearchPath::write | ( | std::ostream & | out | ) | const
| inline

Definition at line 286 of file configVariableSearchPath.I.

## Member Data Documentation

## ◆ get_default_value

const DSearchPath & ConfigVariableSearchPath::get_default_value
| inline

Definition at line 55 of file configVariableSearchPath.h.

## ◆ get_directory

Filename ConfigVariableSearchPath::get_directory
| inline

Returns the nth directory on the search list.

Definition at line 70 of file configVariableSearchPath.h.

## ◆ get_num_directories

size_t ConfigVariableSearchPath::get_num_directories
| inline

Returns the number of directories on the search list.

Definition at line 70 of file configVariableSearchPath.h.

## ◆ get_value

DSearchPath ConfigVariableSearchPath::get_value
| inline

Definition at line 54 of file configVariableSearchPath.h.

The documentation for this class was generated from the following files:

- dtool/src/prc/configVariableSearchPath.h
- dtool/src/prc/configVariableSearchPath.cxx
- dtool/src/prc/configVariableSearchPath.I