diff options
Diffstat (limited to 'src/RegExp.hh')
-rw-r--r-- | src/RegExp.hh | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/RegExp.hh b/src/RegExp.hh new file mode 100644 index 0000000..7d424ba --- /dev/null +++ b/src/RegExp.hh | |||
@@ -0,0 +1,66 @@ | |||
1 | // RegExp.hh for Fluxbox Window Manager | ||
2 | // Copyright (c) 2002 Xavier Brouckaert | ||
3 | // Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net) | ||
4 | // and Simon Bowden (rathnor at users.sourceforge.net) | ||
5 | // | ||
6 | // Permission is hereby granted, free of charge, to any person obtaining a | ||
7 | // copy of this software and associated documentation files (the "Software"), | ||
8 | // to deal in the Software without restriction, including without limitation | ||
9 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
10 | // and/or sell copies of the Software, and to permit persons to whom the | ||
11 | // Software is furnished to do so, subject to the following conditions: | ||
12 | // | ||
13 | // The above copyright notice and this permission notice shall be included in | ||
14 | // all copies or substantial portions of the Software. | ||
15 | // | ||
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
19 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
21 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
22 | // DEALINGS IN THE SOFTWARE. | ||
23 | |||
24 | // $Id: RegExp.hh,v 1.3 2003/07/10 19:59:21 fluxgen Exp $ | ||
25 | |||
26 | #ifndef REGEXP_HH | ||
27 | #define REGEXP_HH | ||
28 | |||
29 | #include "NotCopyable.hh" | ||
30 | |||
31 | #ifdef HAVE_CONFIG_H | ||
32 | #include "config.h" | ||
33 | #endif // HAVE_CONFIG_H | ||
34 | |||
35 | #include <string> | ||
36 | |||
37 | /* | ||
38 | * If USE_REGEXP isn't defined, then we match just using simple string equality | ||
39 | */ | ||
40 | |||
41 | #ifdef USE_REGEXP | ||
42 | #include <sys/types.h> | ||
43 | #include <regex.h> | ||
44 | #endif // USE_REGEXP | ||
45 | |||
46 | class WinClient; | ||
47 | |||
48 | class RegExp:private FbTk::NotCopyable { | ||
49 | public: | ||
50 | RegExp(const std::string &str, bool full_match = true); | ||
51 | ~RegExp(); | ||
52 | |||
53 | bool match(const std::string &str) const; | ||
54 | |||
55 | bool error() const; | ||
56 | |||
57 | private: | ||
58 | #ifdef USE_REGEXP | ||
59 | regex_t* m_regex; | ||
60 | #else // notdef USE_REGEXP | ||
61 | std::string m_str; | ||
62 | #endif // USE_REGEXP | ||
63 | |||
64 | }; | ||
65 | |||
66 | #endif // REGEXP_HH | ||