EPICS ARCHIVER V4
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups
RegularExpression.h
1 // -*- c++ -*-
2 #ifndef _REGULAREXPRESSION_H_
3 #define _REGULAREXPRESSION_H_
4 
5 #include "tools/ToolsConfig.h"
6 
8 
11 
12 public:
13 
18  static std::string fromGlobPattern(const std::string& glob);
19 
23  RegularExpression(const char *pattern, bool case_sensitive=true) {
24  set(pattern, case_sensitive);
25  }
26 
29  set(rhs._pattern.c_str(), rhs._case_sensitive);
30  }
31 
34 
46  bool doesMatch(const char *input);
47 
49  bool doesMatch(const stdString &input) {
50  return doesMatch(input.c_str()); }
51 
52 private:
53 
54  friend class ToRemoveGNUCompilerWarning;
55 
56  void set(const char *pattern, bool case_sensitive=true);
57 
58  // Use create/reference/unreference instead of new/delete:
59  // intentionally not implemented
60  RegularExpression & operator = (const RegularExpression &);
61 
63 
64  std::string _pattern;
65  bool _case_sensitive;
66  void *_compiled_pattern;
67  int _refs;
68 };
69 
70 #endif
71 
RegularExpression(const char *pattern, bool case_sensitive=true)
Create RegularExpression with pattern for further matches.
Definition: RegularExpression.h:23
bool doesMatch(const char *input)
Test if 'input' matches current pattern.
~RegularExpression()
Destructor.
RegularExpression(const RegularExpression &rhs)
Copy constructor.
Definition: RegularExpression.h:28
Wrapper for Unix/GNU regex library.
Definition: RegularExpression.h:10
bool doesMatch(const stdString &input)
Check.
Definition: RegularExpression.h:49
static std::string fromGlobPattern(const std::string &glob)
Create a regular expression for a "glob" pattern: question mark - any character star - many character...