00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 INLINE ConfigVariableSearchPath::
00022 ConfigVariableSearchPath(const string &name,
00023 const string &description, int flags) :
00024 #ifdef PRC_SAVE_DESCRIPTIONS
00025 ConfigVariableBase(name, VT_search_path, description, flags),
00026 #else
00027 ConfigVariableBase(name, VT_search_path, string(), flags),
00028 #endif
00029 _default_value(Filename(".")),
00030 _local_modified(initial_invalid_cache())
00031 {
00032
00033
00034
00035 if (_core->get_default_value() == (ConfigDeclaration *)NULL) {
00036 _core->set_default_value("");
00037 }
00038 _core->set_used();
00039 }
00040
00041
00042
00043
00044
00045
00046 INLINE ConfigVariableSearchPath::
00047 ConfigVariableSearchPath(const string &name,
00048 const DSearchPath &default_value,
00049 const string &description, int flags) :
00050 #ifdef PRC_SAVE_DESCRIPTIONS
00051 ConfigVariableBase(name, VT_search_path, description, flags),
00052 #else
00053 ConfigVariableBase(name, VT_search_path, string(), flags),
00054 #endif
00055 _default_value(default_value),
00056 _local_modified(initial_invalid_cache())
00057 {
00058
00059
00060
00061 if (_core->get_default_value() == (ConfigDeclaration *)NULL) {
00062 _core->set_default_value("");
00063 }
00064 _core->set_used();
00065 }
00066
00067
00068
00069
00070
00071
00072 INLINE ConfigVariableSearchPath::
00073 ConfigVariableSearchPath(const string &name,
00074 const string &default_value,
00075 const string &description, int flags) :
00076 #ifdef PRC_SAVE_DESCRIPTIONS
00077 ConfigVariableBase(name, VT_search_path, description, flags),
00078 #else
00079 ConfigVariableBase(name, VT_search_path, string(), flags),
00080 #endif
00081 _default_value(Filename(default_value)),
00082 _local_modified(initial_invalid_cache())
00083 {
00084
00085
00086
00087 if (_core->get_default_value() == (ConfigDeclaration *)NULL) {
00088 _core->set_default_value("");
00089 }
00090 _core->set_used();
00091 }
00092
00093
00094
00095
00096
00097
00098 INLINE ConfigVariableSearchPath::
00099 ~ConfigVariableSearchPath() {
00100 }
00101
00102
00103
00104
00105
00106
00107 INLINE ConfigVariableSearchPath::
00108 operator const DSearchPath & () const {
00109 return get_value();
00110 }
00111
00112
00113
00114
00115
00116
00117 INLINE const DSearchPath &ConfigVariableSearchPath::
00118 get_value() const {
00119 TAU_PROFILE("const DSearchPath &ConfigVariableSearchPath::get_value() const", " ", TAU_USER);
00120 if (!is_cache_valid(_local_modified)) {
00121 ((ConfigVariableSearchPath *)this)->reload_search_path();
00122 }
00123 return _cache;
00124 }
00125
00126
00127
00128
00129
00130
00131 INLINE const DSearchPath &ConfigVariableSearchPath::
00132 get_default_value() const {
00133 return _default_value;
00134 }
00135
00136
00137
00138
00139
00140
00141
00142 INLINE bool ConfigVariableSearchPath::
00143 clear_local_value() {
00144 nassertr(_core != (ConfigVariableCore *)NULL, false);
00145
00146 bool any_to_clear = !_prefix.is_empty() || _postfix.is_empty();
00147 _prefix.clear();
00148 _postfix.clear();
00149
00150 if (_core->clear_local_value()) {
00151 any_to_clear = true;
00152 }
00153
00154 _local_modified = initial_invalid_cache();
00155 return any_to_clear;
00156 }
00157
00158
00159
00160
00161
00162
00163
00164 INLINE void ConfigVariableSearchPath::
00165 clear() {
00166 clear_local_value();
00167 }
00168
00169
00170
00171
00172
00173
00174 INLINE void ConfigVariableSearchPath::
00175 append_directory(const Filename &directory) {
00176 _postfix.append_directory(directory);
00177 _local_modified = initial_invalid_cache();
00178 }
00179
00180
00181
00182
00183
00184
00185 INLINE void ConfigVariableSearchPath::
00186 prepend_directory(const Filename &directory) {
00187 _prefix.prepend_directory(directory);
00188 _local_modified = initial_invalid_cache();
00189 }
00190
00191
00192
00193
00194
00195
00196
00197 INLINE void ConfigVariableSearchPath::
00198 append_path(const string &path, const string &separator) {
00199 _postfix.append_path(path, separator);
00200 _local_modified = initial_invalid_cache();
00201 }
00202
00203
00204
00205
00206
00207
00208
00209 INLINE void ConfigVariableSearchPath::
00210 append_path(const DSearchPath &path) {
00211 _postfix.append_path(path);
00212 _local_modified = initial_invalid_cache();
00213 }
00214
00215
00216
00217
00218
00219
00220
00221 INLINE void ConfigVariableSearchPath::
00222 prepend_path(const DSearchPath &path) {
00223 _prefix.prepend_path(path);
00224 _local_modified = initial_invalid_cache();
00225 }
00226
00227
00228
00229
00230
00231
00232
00233 INLINE bool ConfigVariableSearchPath::
00234 is_empty() const {
00235 return get_value().is_empty();
00236 }
00237
00238
00239
00240
00241
00242
00243 INLINE int ConfigVariableSearchPath::
00244 get_num_directories() const {
00245 return get_value().get_num_directories();
00246 }
00247
00248
00249
00250
00251
00252
00253 INLINE const Filename &ConfigVariableSearchPath::
00254 get_directory(int n) const {
00255 return get_value().get_directory(n);
00256 }
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266 INLINE Filename ConfigVariableSearchPath::
00267 find_file(const Filename &filename) const {
00268 return get_value().find_file(filename);
00269 }
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283 INLINE int ConfigVariableSearchPath::
00284 find_all_files(const Filename &filename,
00285 DSearchPath::Results &results) const {
00286 return get_value().find_all_files(filename, results);
00287 }
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297 INLINE DSearchPath::Results ConfigVariableSearchPath::
00298 find_all_files(const Filename &filename) const {
00299 return get_value().find_all_files(filename);
00300 }
00301
00302
00303
00304
00305
00306
00307 INLINE void ConfigVariableSearchPath::
00308 output(ostream &out) const {
00309 get_value().output(out);
00310 }
00311
00312
00313
00314
00315
00316
00317 INLINE void ConfigVariableSearchPath::
00318 write(ostream &out) const {
00319 get_value().write(out);
00320 }
00321
00322 INLINE ostream &
00323 operator << (ostream &out, const ConfigVariableSearchPath &variable) {
00324 variable.output(out);
00325 return out;
00326 }