47 add_pattern(
const std::string &orig_prefix,
const std::string &replacement_prefix) {
48 _entries.push_back(Entry(orig_prefix, replacement_prefix));
56 return _entries.size();
64 nassertr(n >= 0 && n < (
int)_entries.size(), _entries[0]._orig_prefix);
65 return _entries[n]._orig_prefix;
73 nassertr(n >= 0 && n < (
int)_entries.size(), _entries[0]._replacement_prefix);
74 return _entries[n]._replacement_prefix;
83 return (_entries.empty() && _path.
is_empty() && _path_store == PS_keep);
100 INLINE PathReplace::Component::
101 Component(
const std::string &component) :
102 _orig_prefix(component),
103 _double_star(component ==
"**")
110 INLINE PathReplace::Component::
111 Component(
const PathReplace::Component ©) :
112 _orig_prefix(copy._orig_prefix),
113 _double_star(copy._double_star)
120 INLINE
void PathReplace::Component::
121 operator = (
const PathReplace::Component ©) {
122 _orig_prefix = copy._orig_prefix;
123 _double_star = copy._double_star;
129 INLINE PathReplace::Entry::
130 Entry(
const PathReplace::Entry ©) :
131 _orig_prefix(copy._orig_prefix),
132 _orig_components(copy._orig_components),
133 _is_local(copy._is_local),
134 _replacement_prefix(copy._replacement_prefix)
141 INLINE
void PathReplace::Entry::
142 operator = (
const PathReplace::Entry ©) {
143 _orig_prefix = copy._orig_prefix;
144 _orig_components = copy._orig_components;
145 _is_local = copy._is_local;
146 _replacement_prefix = copy._replacement_prefix;
const std::string & get_orig_prefix(int n) const
Returns the original prefix associated with the nth pattern.
bool is_empty() const
Returns true if the search list is empty, false otherwise.
void full_convert_path(const Filename &orig_filename, const DSearchPath &additional_path, Filename &resolved_path, Filename &output_path)
Converts the input path into two different forms: A resolved path, and an output path.
int get_num_patterns() const
Returns the number of original/replace patterns that have been added.
void add_pattern(const std::string &orig_prefix, const std::string &replacement_prefix)
Adds the indicated original/replace pattern to the specification.
const std::string & get_replacement_prefix(int n) const
Returns the replacement prefix associated with the nth pattern.
The name of a file, such as a texture file or an Egg file.
bool is_empty() const
Returns true if the PathReplace object specifies no action, or false if convert_path() may do somethi...
void clear()
Removes all the patterns from the specification.
This class stores a list of directories that can be searched, in order, to locate a particular file.
void clear_error()
Resets the error flag to the no-error state.
bool had_error() const
Returns true if an error was detected since the last call to clear_error(), false otherwise.
Filename convert_path(const Filename &orig_filename, const DSearchPath &additional_path=DSearchPath())
Calls match_path() followed by store_path(), to replace the initial prefix and then convert the file ...