17 INLINE ConfigVariableSearchPath::
18 ConfigVariableSearchPath(
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(
"");
40 INLINE ConfigVariableSearchPath::
41 ConfigVariableSearchPath(
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(
"");
64 INLINE ConfigVariableSearchPath::
65 ConfigVariableSearchPath(
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(
"");
88 INLINE ConfigVariableSearchPath::
89 ~ConfigVariableSearchPath() {
95 INLINE ConfigVariableSearchPath::
105 TAU_PROFILE(
"const DSearchPath &ConfigVariableSearchPath::get_value() const",
" ", TAU_USER);
108 if (!is_cache_valid(_local_modified)) {
119 INLINE
const DSearchPath &ConfigVariableSearchPath::
120 get_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();
182 append_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();
224 INLINE
size_t ConfigVariableSearchPath::
225 get_num_directories()
const {
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);
278 INLINE
void ConfigVariableSearchPath::
279 output(std::ostream &out)
const {
280 get_value().output(out);
286 INLINE
void ConfigVariableSearchPath::
287 write(std::ostream &out)
const {
288 get_value().write(out);
291 INLINE std::ostream &
293 variable.output(out);
This is similar to a ConfigVariableList, but it returns its list as a DSearchPath,...
void clear()
Removes all the directories from the search list.
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.
bool clear_local_value()
Removes all the directories locally added to the search list, and restores it to its original form.
void append_directory(const Filename &directory)
Adds a new directory 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.
bool is_empty() const
Returns true if the search list is empty, false otherwise.
The name of a file, such as a texture file or an Egg file.
Filename find_file(const Filename &filename) const
Searches all the directories in the search list for the indicated file, in order.
get_directory
Returns the nth directory on the search list.
void clear()
Removes all the directories locally added to the search list, and restores it to its original form.
get_directory
Returns the nth directory on the search list.
This class stores a list of directories that can be searched, in order, to locate a particular file.
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_path(const DSearchPath &path)
Adds all of the directories listed in the search path to the beginning 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 prepend_directory(const Filename &directory)
Adds a new directory to the front of the search list.
This class is the base class for both ConfigVariableList and ConfigVariable (and hence for all of the...
void append_directory(const Filename &directory)
Adds a new directory to the end of the search list.
void prepend_directory(const Filename &directory)
Adds a new directory to the front of the search list.