16 regex_compiled_(false),
17 relaxed_regex_compiled_(false),
18 prefix_regex_compiled_(false),
19 glob_string_compiled_(false),
20 glob_string_sequence_compiled_(false),
29 ElementPatterns::const_iterator i =
patterns_.begin();
30 const ElementPatterns::const_iterator iend =
patterns_.end();
31 for (; i != iend; ++i) {
41 patterns_(other.patterns_),
45 glob_string_(other.glob_string_),
46 glob_string_sequence_(other.glob_string_sequence_),
47 regex_compiled_(false),
48 relaxed_regex_compiled_(false),
49 prefix_regex_compiled_(false),
50 glob_string_compiled_(other.glob_string_compiled_),
51 glob_string_sequence_compiled_(other.glob_string_sequence_compiled_),
53 absolute_(other.absolute_) {}
82 std::string::const_iterator itr = spec.begin();
83 const std::string::const_iterator end = spec.end();
96 const std::string::const_iterator &end,
97 std::string::const_iterator *itr
100 const std::string::const_iterator begin_element = *itr;
104 const std::string::const_iterator end_element = *itr;
113 if (query_path.empty()) {
117 const bool query_is_absolute = (query_path[0] ==
kSeparator);
118 return (!query_is_absolute || this->
IsAbsolute()) &&
126 if (query_path.empty()) {
130 const bool query_is_absolute = (query_path[0] ==
kSeparator);
137 if (query_path.empty()) {
157 regex_t *regex)
const {
158 const char *path = query_path.c_str();
159 const int retval = regexec(regex, path, 0, NULL, 0);
161 if (retval != 0 && retval != REG_NOMATCH) {
165 return (retval == 0);
170 const bool is_relaxed =
false;
183 const bool is_relaxed =
false;
184 const bool is_prefix =
true;
197 const bool is_relaxed =
true;
210 const bool is_relaxed,
211 const bool is_prefix)
const
214 std::string regex =
"^";
222 ElementPatterns::const_iterator i =
patterns_.begin();
223 const ElementPatterns::const_iterator iend =
patterns_.end();
224 for (; i != iend; ++i) {
225 regex += i->GenerateRegularExpression(is_relaxed);
246 regex_t *result =
reinterpret_cast<regex_t *
>(smalloc(
sizeof(regex_t)));
247 const int flags = REG_NOSUB | REG_NEWLINE | REG_EXTENDED;
248 const int retval = regcomp(result, regex.c_str(), flags);
252 assert(
false &&
"failed to compile regex");
281 ElementPatterns::const_iterator i =
patterns_.begin();
282 const ElementPatterns::const_iterator iend =
patterns_.end();
283 ElementPatterns::const_iterator j = other.
patterns_.begin();
284 const ElementPatterns::const_iterator jend = other.
patterns_.end();
286 for (; i != iend && j != jend; ++i, ++j) {
297 const size_t errbuf_size = 1024;
298 char error[errbuf_size];
299 regerror(error_code,
regex_, error, errbuf_size);
314 ElementPatterns::const_iterator i =
patterns_.begin();
315 const ElementPatterns::const_iterator iend =
patterns_.end();
316 for (; i != iend; ++i) {
317 const std::string glob_string = i->GenerateGlobString();
335 bool is_first =
true;
337 GlobStringSequence::const_iterator i = seq.begin();
338 const GlobStringSequence::const_iterator iend = seq.end();
339 for (; i != iend; ++i) {
bool glob_string_compiled_
const GlobStringSequence & GetGlobStringSequence() const
bool operator==(const Pathspec &other) const
regex_t * GetRelaxedRegularExpression() const
regex_t * CompileRegularExpression(const std::string ®ex) const
assert((mem||(size==0))&&"Out Of Memory")
void Parse(const std::string &spec)
void ParsePathElement(const std::string::const_iterator &end, std::string::const_iterator *itr)
GlobStringSequence glob_string_sequence_
bool IsPrefixMatching(const std::string &query_path) const
regex_t * GetPrefixRegularExpression() const
bool glob_string_sequence_compiled_
void GenerateGlobString() const
std::string GenerateRegularExpression(const bool is_relaxed=false, const bool is_prefix=false) const
bool IsPathspecMatchingRelaxed(const std::string &query_path) const
bool prefix_regex_compiled_
regex_t * GetRegularExpression() const
void DestroyRegularExpressions()
void PrintRegularExpressionError(const int error_code) const
bool IsPathspecPrefixMatching(const std::string &query_path) const
static const char kSeparator
void GenerateGlobStringSequence() const
bool IsPathspecMatching(const std::string &query_path) const
std::vector< std::string > GlobStringSequence
bool relaxed_regex_compiled_
bool ApplyRegularExpression(const std::string &query_path, regex_t *regex) const
Pathspec & operator=(const Pathspec &other)
bool IsMatchingRelaxed(const std::string &query_path) const
const std::string & GetGlobString() const
ElementPatterns patterns_
bool IsMatching(const std::string &query_path) const
Pathspec(const std::string &spec)
CVMFS_EXPORT void LogCvmfs(const LogSource source, const int mask, const char *format,...)