#include <globPattern.h>
Public Member Functions | |
GlobPattern (const string &pattern=string()) | |
GlobPattern (const GlobPattern ©) | |
void | operator= (const GlobPattern ©) |
void | set_pattern (const string &pattern) |
Changes the pattern string that the GlobPattern object matches. | |
const string & | get_pattern () const |
Returns the pattern string that the GlobPattern object matches. | |
bool | matches (const string &candidate) const |
Returns true if the candidate string matches the pattern, false otherwise. | |
void | output (ostream &out) const |
bool | has_glob_characters () const |
Returns true if the pattern includes any special globbing characters, or false if it is just a literal string. | |
int | match_files (vector_string &results, const Filename &cwd=Filename()) |
Treats the GlobPattern as a filename pattern, and returns a list of any actual files that match the pattern. | |
Private Member Functions | |
bool | matches_substr (string::const_iterator pi, string::const_iterator pend, string::const_iterator ci, string::const_iterator cend) const |
The recursive implementation of matches(). | |
bool | matches_set (string::const_iterator &pi, string::const_iterator pend, char ch) const |
Called when an unescaped open square bracked is scanned, this is called with pi positioned after the opening square bracket, scans the set sequence, leaving pi positioned on the closing square bracket, and returns true if the indicated character matches the set of characters indicated, false otherwise. | |
int | r_match_files (const Filename &prefix, const string &suffix, vector_string &results, const Filename &cwd) |
The recursive implementation of match_files(). | |
Private Attributes | |
string | _pattern |
It serves as a portable standin for the Posix fnmatch() call.
A GlobPattern is given a pattern string, which can contain operators like *, ?, and []. Then it can be tested against any number of candidate strings; for each candidate, it will indicate whether the string matches the pattern or not. It can be used, for example, to scan a directory for all files matching a particular pattern.
Definition at line 58 of file globPattern.h.
|
Definition at line 31 of file globPattern.I. References INLINE. |
|
Definition at line 42 of file globPattern.I. |
|
Returns the pattern string that the GlobPattern object matches.
Definition at line 83 of file globPattern.I. |
|
Returns true if the pattern includes any special globbing characters, or false if it is just a literal string.
Definition at line 37 of file globPattern.cxx. Referenced by match_files(). |
|
Treats the GlobPattern as a filename pattern, and returns a list of any actual files that match the pattern. This is the behavior of the standard Posix glob() function. Any part of the filename may contain glob characters, including intermediate directory names. If cwd is specified, it is the directory that relative filenames are taken to be relative to; otherwise, the actual current working directory is assumed. The return value is the number of files matched, which are added to the results vector. Definition at line 93 of file globPattern.cxx. References _pattern, Filename::empty(), has_glob_characters(), Filename::is_local(), and size_t. |
|
Returns true if the candidate string matches the pattern, false otherwise.
Definition at line 98 of file globPattern.I. Referenced by FindApproxPath::Component::matches(), NodePath::set_color(), and NodePath::set_transparency(). |
|
Called when an unescaped open square bracked is scanned, this is called with pi positioned after the opening square bracket, scans the set sequence, leaving pi positioned on the closing square bracket, and returns true if the indicated character matches the set of characters indicated, false otherwise.
Definition at line 298 of file globPattern.cxx. Referenced by matches_substr(). |
|
The recursive implementation of matches(). This returns true if the pattern substring [pi, pend) matches the candidate substring [ci, cend), false otherwise. Definition at line 211 of file globPattern.cxx. References matches_set(). |
|
Definition at line 53 of file globPattern.I. |
|
Definition at line 111 of file globPattern.I. |
|
The recursive implementation of match_files().
Definition at line 124 of file globPattern.cxx. References _pattern. |
|
Changes the pattern string that the GlobPattern object matches.
Definition at line 68 of file globPattern.I. |
|
Definition at line 87 of file globPattern.h. Referenced by get_pattern(), GlobPattern(), match_files(), operator=(), and r_match_files(). |