ADTF  3.18.3
workspace/conan/dev_essential/1.3.4/dw/stable/package/aef85909f792a5a628750d25016a24323084963f/include/a_util/regex/regularexpression.h
Go to the documentation of this file.
1 
15 #ifndef A_UTILS_UTIL_REGEX_SOURCE_INCLUDED_
16 #define A_UTILS_UTIL_REGEX_SOURCE_INCLUDED_
17 
18 #include <memory>
19 #include <string>
20 
21 namespace a_util {
22 namespace regex {
25 public:
27  typedef enum {
30  AT_Both
32 
33 public:
38 
46  RegularExpression(const std::string& pattern, bool case_sensitive = true);
47 
52 
58 
65 
72  bool setPattern(const std::string& pattern, bool case_sensitive = true);
73 
78  std::string getPattern() const;
79 
84  const std::string& getError() const;
85 
91  bool fullMatch(const std::string& text) const;
92 
115  bool fullMatch(const std::string& text,
116  std::string& arg1,
117  std::string& arg2 = noArg(),
118  std::string& arg3 = noArg(),
119  std::string& arg4 = noArg(),
120  std::string& arg5 = noArg(),
121  std::string& arg6 = noArg(),
122  std::string& arg7 = noArg(),
123  std::string& arg8 = noArg(),
124  std::string& arg9 = noArg(),
125  std::string& arg10 = noArg(),
126  std::string& arg11 = noArg(),
127  std::string& arg12 = noArg(),
128  std::string& arg13 = noArg(),
129  std::string& arg14 = noArg(),
130  std::string& arg15 = noArg(),
131  std::string& arg16 = noArg()) const;
132 
140  bool match(const std::string& text, AnchorType anchor, int& consumed) const;
141 
142 private: // static helpers
144  static std::string& noArg();
145 
146 private: // data
147  class Implementation;
148  std::unique_ptr<Implementation> _impl;
149 };
150 
151 } // namespace regex
152 } // namespace a_util
153 
154 #endif // A_UTILS_UTIL_REGEX_SOURCE_INCLUDED_
bool fullMatch(const std::string &text) const
Check if the whole string matches the pattern.
static std::string & noArg()
Empty argument.
RegularExpression(const std::string &pattern, bool case_sensitive=true)
Constructor with a preinitialized pattern.
const std::string & getError() const
Get any error description for the pattern.
RegularExpression & operator=(const RegularExpression &other)
Copy assignment operator.
std::string getPattern() const
Get the current pattern (expression).
bool match(const std::string &text, AnchorType anchor, int &consumed) const
Matches a string.
bool setPattern(const std::string &pattern, bool case_sensitive=true)
Set the regular expression pattern.
RegularExpression()
Default constructor.
bool fullMatch(const std::string &text, std::string &arg1, std::string &arg2=noArg(), std::string &arg3=noArg(), std::string &arg4=noArg(), std::string &arg5=noArg(), std::string &arg6=noArg(), std::string &arg7=noArg(), std::string &arg8=noArg(), std::string &arg9=noArg(), std::string &arg10=noArg(), std::string &arg11=noArg(), std::string &arg12=noArg(), std::string &arg13=noArg(), std::string &arg14=noArg(), std::string &arg15=noArg(), std::string &arg16=noArg()) const
Check if the whole string matches the pattern, extracting up to 16 capture groups.
RegularExpression(const RegularExpression &other)
Copy constructor.
Serves as the root component, with common functionality documented in core functionality.
Definition: base.h:24