14 , relaxed_regex_(NULL)
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)
28 ElementPatterns::const_iterator i =
patterns_.begin();
29 const ElementPatterns::const_iterator iend =
patterns_.end();
30 for (; i != iend; ++i) {
40 : patterns_(other.patterns_)
42 , relaxed_regex_(NULL)
44 , glob_string_(other.glob_string_)
45 , glob_string_sequence_(other.glob_string_sequence_)
46 , regex_compiled_(false)
47 , relaxed_regex_compiled_(false)
48 , prefix_regex_compiled_(false)
49 , glob_string_compiled_(other.glob_string_compiled_)
50 , glob_string_sequence_compiled_(other.glob_string_sequence_compiled_)
51 , valid_(other.valid_)
52 , absolute_(other.absolute_) { }
79 std::string::const_iterator itr = spec.begin();
80 const std::string::const_iterator end = spec.end();
93 std::string::const_iterator *itr) {
95 const std::string::const_iterator begin_element = *itr;
99 const std::string::const_iterator end_element = *itr;
108 if (query_path.empty()) {
112 const bool query_is_absolute = (query_path[0] ==
kSeparator);
113 return (!query_is_absolute || this->
IsAbsolute())
121 if (query_path.empty()) {
125 const bool query_is_absolute = (query_path[0] ==
kSeparator);
132 if (query_path.empty()) {
152 regex_t *regex)
const {
153 const char *path = query_path.c_str();
154 const int retval = regexec(regex, path, 0, NULL, 0);
156 if (retval != 0 && retval != REG_NOMATCH) {
160 return (retval == 0);
165 const bool is_relaxed =
false;
178 const bool is_relaxed =
false;
179 const bool is_prefix =
true;
192 const bool is_relaxed =
true;
205 const bool is_prefix)
const {
207 std::string regex =
"^";
215 ElementPatterns::const_iterator i =
patterns_.begin();
216 const ElementPatterns::const_iterator iend =
patterns_.end();
217 for (; i != iend; ++i) {
218 regex += i->GenerateRegularExpression(is_relaxed);
239 regex_t *result =
reinterpret_cast<regex_t *
>(smalloc(
sizeof(regex_t)));
240 const int flags = REG_NOSUB | REG_NEWLINE | REG_EXTENDED;
241 const int retval = regcomp(result, regex.c_str(), flags);
245 assert(
false &&
"failed to compile regex");
273 ElementPatterns::const_iterator i =
patterns_.begin();
274 const ElementPatterns::const_iterator iend =
patterns_.end();
275 ElementPatterns::const_iterator j = other.
patterns_.begin();
276 const ElementPatterns::const_iterator jend = other.
patterns_.end();
278 for (; i != iend && j != jend; ++i, ++j) {
289 const size_t errbuf_size = 1024;
290 char error[errbuf_size];
291 regerror(error_code,
regex_, error, errbuf_size);
306 ElementPatterns::const_iterator i =
patterns_.begin();
307 const ElementPatterns::const_iterator iend =
patterns_.end();
308 for (; i != iend; ++i) {
309 const std::string glob_string = i->GenerateGlobString();
327 bool is_first =
true;
329 GlobStringSequence::const_iterator i = seq.begin();
330 const GlobStringSequence::const_iterator iend = seq.end();
331 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,...)