OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
RegularExpression.h
Go to the documentation of this file.
1 #ifndef OPAL_RegularExpression_HH
2 #define OPAL_RegularExpression_HH 1
3 
4 // ------------------------------------------------------------------------
5 // $RCSfile: RegularExpression.h,v $
6 // ------------------------------------------------------------------------
7 // $Revision: 1.1.1.1 $
8 // ------------------------------------------------------------------------
9 // Copyright: see Copyright.readme
10 // ------------------------------------------------------------------------
11 //
12 // Class: RegularExpression.
13 //
14 // ------------------------------------------------------------------------
15 //
16 // $Date: 2000/03/27 09:33:48 $
17 // $Author: Andreas Adelmann $
18 //
19 // ------------------------------------------------------------------------
20 
21 #include <string>
22 
23 
24 // Class RegularExpression
25 // ------------------------------------------------------------------------
27 // This class encapsulates the UNIX regular expressions as defined in
28 // regexp(5). It provides a simple interface to the POSIX-compliant
29 // regcomp/regexec package.
30 
32 
33 public:
34 
36  // Construct regular expression from [b]pattern[/b].
37  // If [b]ignore[/b] is true, the expression ignores upper/lower case.
38  RegularExpression(const std::string &pattern, bool ignore = false);
39 
42 
44  bool match(const std::string &s) const;
45 
47  bool OK() const;
48 
49 private:
50 
51  // Not implemented.
53 
54  // Initialise.
55  void init();
56 
57  // A copy of the pattern string.
58  const std::string patt;
59 
60  // The flag to ignore case.
61  bool caseIgnore;
62 
63  // The compiled regular expression.
64  class Expression;
66 
67  // The state flag, indicating any error condition.
68  int state;
69 };
70 
71 #endif // OPAL_RegularExpressions_HH
A regular expression.
bool match(const std::string &s) const
Match a string against the pattern.
RegularExpression(const std::string &pattern, bool ignore=false)
Constructor.
const std::string patt
bool OK() const
Check the regular expression for sanity.
void operator=(const RegularExpression &)