ConfigVariableSearchPath

class ConfigVariableSearchPath

Bases: ConfigVariableBase

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.

Inheritance diagram

Inheritance diagram of ConfigVariableSearchPath

ConfigVariableSearchPath(std::string const &name, std::string const &description = string(), int flags = 0)
ConfigVariableSearchPath(std::string const &name, DSearchPath const &default_value, std::string const &description, int flags = 0)
ConfigVariableSearchPath(std::string const &name, std::string const &default_value, std::string const &description, int flags = 0)
void append_directory(Filename const &directory)

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

void append_path(std::string const &path, std::string const &separator = string())
void append_path(DSearchPath const &path)

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

void clear(void)

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

bool clear_local_value(void)

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

std::size_t find_all_files(Filename const &filename, DSearchPath::Results &results) const
DSearchPath::Results find_all_files(Filename const &filename) const

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.

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 find_file(Filename const &filename) const

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 &get_default_value(void) const
Filename get_directory(std::size_t n) const

Returns the nth directory on the search list.

std::size_t get_num_directories(void) const

Returns the number of directories on the search list.

DSearchPath get_value(void) const
bool is_empty(void) const

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

void output(std::ostream &out) const
void prepend_directory(Filename const &directory)

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

void prepend_path(DSearchPath const &path)

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

void write(std::ostream &out) const