22 GlobPattern(
const string &pattern) : _pattern(pattern) {
23 _case_sensitive =
true;
33 _pattern(copy._pattern),
34 _case_sensitive(copy._case_sensitive)
43 INLINE
void GlobPattern::
45 _pattern = copy._pattern;
46 _case_sensitive = copy._case_sensitive;
54 INLINE
bool GlobPattern::
56 return (_pattern == other._pattern && _case_sensitive == other._case_sensitive);
64 INLINE
bool GlobPattern::
66 return !operator == (other);
74 INLINE
bool GlobPattern::
76 if (_case_sensitive != other._case_sensitive) {
77 return (
int)_case_sensitive < (int)other._case_sensitive;
79 return _pattern < other._pattern;
113 _case_sensitive = case_sensitive;
125 return _case_sensitive;
136 _nomatch_chars = nomatch_chars;
147 return _nomatch_chars;
158 return matches_substr(_pattern.begin(), _pattern.end(),
159 candidate.begin(), candidate.end());
167 INLINE
void GlobPattern::
168 output(ostream &out)
const {
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 set_case_sensitive(bool case_sensitive)
Sets whether the match is case sensitive (true) or case insensitive (false).
void set_nomatch_chars(const string &nomatch_chars)
Specifies a set of characters that are not matched by or ?.
bool get_case_sensitive() const
Returns whether the match is case sensitive (true) or case insensitive (false).
const string & get_nomatch_chars() const
Returns the set of characters that are not matched by or ?.
void set_pattern(const string &pattern)
Changes the pattern string that the GlobPattern object matches.
This class can be used to test for string matches against standard Unix-shell filename globbing conve...