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

#include "configVariableSearchPath.h"

Inheritance diagram for ConfigVariableSearchPath:
ConfigVariableBase ConfigFlags

List of all members.

Public Member Functions

 ConfigVariableSearchPath (const string &name, const string &description=string(), int flags=0)
 ConfigVariableSearchPath (const string &name, const DSearchPath &default_value, const string &description, int flags=0)
 ConfigVariableSearchPath (const string &name, const string &default_value, const string &description, int flags=0)
void append_directory (const Filename &directory)
 Adds a new directory to the end of the search list.
void append_path (const string &path, const string &separator=string())
 Adds all of the directories listed in the search path 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 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.
int find_all_files (const Filename &filename, DSearchPath::Results &results) const
 Searches all the directories in the search list for the indicated file, in order.
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.
Filename find_file (const Filename &filename) const
 Searches all the directories in the search list for the indicated file, in order.
const DSearchPathget_default_value () const
const Filenameget_directory (int n) const
 Returns the nth directory on the search list.
int get_num_directories () const
 Returns the number of directories on the search list.
const DSearchPathget_value () const
bool is_empty () const
 Returns true if the search list is empty, false otherwise.
 MAKE_SEQ (get_directories, get_num_directories, get_directory)
 operator const DSearchPath & () const
 Returns the variable's value.
void output (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 (ostream &out) const

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 42 of file configVariableSearchPath.h.


Member Function Documentation

void ConfigVariableSearchPath::append_directory ( const Filename directory) [inline]

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

Definition at line 175 of file configVariableSearchPath.I.

References DSearchPath::append_directory(), and ConfigFlags::initial_invalid_cache().

void ConfigVariableSearchPath::append_path ( const string &  path,
const string &  separator = string() 
) [inline]

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

Definition at line 198 of file configVariableSearchPath.I.

References DSearchPath::append_path(), and ConfigFlags::initial_invalid_cache().

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 210 of file configVariableSearchPath.I.

References DSearchPath::append_path(), and ConfigFlags::initial_invalid_cache().

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

Definition at line 165 of file configVariableSearchPath.I.

References clear_local_value().

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

Reimplemented from ConfigVariableBase.

Definition at line 143 of file configVariableSearchPath.I.

References DSearchPath::clear(), ConfigVariableCore::clear_local_value(), ConfigFlags::initial_invalid_cache(), and DSearchPath::is_empty().

Referenced by clear().

int 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 284 of file configVariableSearchPath.I.

References DSearchPath::find_all_files().

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 298 of file configVariableSearchPath.I.

References DSearchPath::find_all_files().

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 267 of file configVariableSearchPath.I.

References DSearchPath::find_file().

const Filename & ConfigVariableSearchPath::get_directory ( int  n) const [inline]

Returns the nth directory on the search list.

Definition at line 254 of file configVariableSearchPath.I.

References DSearchPath::get_directory().

Returns the number of directories on the search list.

Definition at line 244 of file configVariableSearchPath.I.

References DSearchPath::get_num_directories().

bool ConfigVariableSearchPath::is_empty ( ) const [inline]

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

Definition at line 234 of file configVariableSearchPath.I.

References DSearchPath::is_empty().

ConfigVariableSearchPath::operator const DSearchPath & ( ) const [inline]

Returns the variable's value.

Definition at line 108 of file configVariableSearchPath.I.

void ConfigVariableSearchPath::prepend_directory ( const Filename directory) [inline]

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

Definition at line 186 of file configVariableSearchPath.I.

References ConfigFlags::initial_invalid_cache(), and DSearchPath::prepend_directory().

Referenced by SomethingToEgg::post_command_line().

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 222 of file configVariableSearchPath.I.

References ConfigFlags::initial_invalid_cache(), and DSearchPath::prepend_path().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations