CARMA C++
RegExpParser.h
Go to the documentation of this file.
1 #ifndef SZA_UTIL_REGEXPPARSER_H
2 #define SZA_UTIL_REGEXPPARSER_H
3 
11 #include <string>
12 
13 namespace sza {
14  namespace util {
15 
16  class RegExpParser {
17  public:
18 
22  RegExpParser(std::string regexp);
23 
27  virtual ~RegExpParser();
28 
34  bool matches(std::string matchString);
35 
36  private:
37 
38  // The reg exp string to match
39 
40  std::string regExpString_;
41 
42  // Utility pointer to the above
43 
44  char* regExpPtr_;
45 
46  // Private recursion method for matching a string
47 
48  bool matches(char* matchString, bool incrementRegExpPtr=true);
49 
65  bool matchSingle(char *start_ptr, char *end_ptr, char ch);
66 
77  char getNextChar(char *string, char **tail, bool& wasEscaped);
78 
79  }; // End class RegExpParser
80 
81  } // End namespace util
82 } // End namespace sza
83 
84 
85 
86 #endif // End #ifndef SZA_UTIL_REGEXPPARSER_H