17INLINE ConfigVariableSearchPath::
18ConfigVariableSearchPath(
const std::string &name,
19 const std::string &description,
int flags) :
20#ifdef PRC_SAVE_DESCRIPTIONS
26 _local_modified(initial_invalid_cache())
31 if (_core->get_default_value() ==
nullptr) {
32 _core->set_default_value(
"");
40INLINE ConfigVariableSearchPath::
41ConfigVariableSearchPath(
const std::string &name,
43 const std::string &description,
int flags) :
44#ifdef PRC_SAVE_DESCRIPTIONS
49 _default_value(default_value),
50 _local_modified(initial_invalid_cache())
55 if (_core->get_default_value() ==
nullptr) {
56 _core->set_default_value(
"");
64INLINE ConfigVariableSearchPath::
65ConfigVariableSearchPath(
const std::string &name,
66 const std::string &default_value,
67 const std::string &description,
int flags) :
68#ifdef PRC_SAVE_DESCRIPTIONS
73 _default_value(
Filename(default_value)),
74 _local_modified(initial_invalid_cache())
79 if (_core->get_default_value() ==
nullptr) {
80 _core->set_default_value(
"");
88INLINE ConfigVariableSearchPath::
89~ConfigVariableSearchPath() {
95INLINE ConfigVariableSearchPath::
105 TAU_PROFILE(
"const DSearchPath &ConfigVariableSearchPath::get_value() const",
" ", TAU_USER);
108 if (!is_cache_valid(_local_modified)) {
119INLINE
const DSearchPath &ConfigVariableSearchPath::
120get_default_value()
const {
121 return _default_value;
131 nassertr(_core !=
nullptr,
false);
137 if (_core->clear_local_value()) {
141 _local_modified = initial_invalid_cache();
162 _local_modified = initial_invalid_cache();
173 _local_modified = initial_invalid_cache();
182append_path(
const std::string &path,
const std::string &separator) {
185 _local_modified = initial_invalid_cache();
197 _local_modified = initial_invalid_cache();
209 _local_modified = initial_invalid_cache();
218 return get_value().is_empty();
226 return get_value().get_num_directories();
248 return get_value().find_file(filename);
262 return get_value().find_all_files(filename, results);
272 return get_value().find_all_files(filename);
278INLINE
void ConfigVariableSearchPath::
279output(std::ostream &out)
const {
280 get_value().output(out);
286INLINE
void ConfigVariableSearchPath::
287write(std::ostream &out)
const {
288 get_value().write(out);
293 variable.output(out);
This class is the base class for both ConfigVariableList and ConfigVariable (and hence for all of the...
This is similar to a ConfigVariableList, but it returns its list as a DSearchPath,...
void clear()
Removes all the directories locally added to the search list, and restores it to its original form.
void prepend_path(const DSearchPath &path)
Adds all of the directories listed in the search path to the beginning of the search list.
void append_directory(const Filename &directory)
Adds a new directory to the end of the search list.
bool clear_local_value()
Removes all the directories locally added to the search list, and restores it to its original form.
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.
void prepend_directory(const Filename &directory)
Adds a new directory to the front of the search list.
get_num_directories
Returns the number of directories on the search list.
bool is_empty() const
Returns true if the search list is empty, false otherwise.
get_directory
Returns the nth directory on 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.
Filename find_file(const Filename &filename) const
Searches all the directories in the search list for the indicated file, in order.
This class stores a list of directories that can be searched, in order, to locate a particular file.
bool is_empty() const
Returns true if the search list is empty, false otherwise.
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 prepend_path(const DSearchPath &path)
Adds all of the directories listed in the search path to the beginning of the search list.
void prepend_directory(const Filename &directory)
Adds a new directory to the front of the search list.
void clear()
Removes all the directories from the search list.
void append_directory(const Filename &directory)
Adds a new directory to the end of the search list.
get_directory
Returns the nth directory on the search list.
The name of a file, such as a texture file or an Egg file.