aboutsummaryrefslogtreecommitdiff
path: root/src/RegExp.hh
diff options
context:
space:
mode:
authorrathnor <rathnor>2003-06-12 15:12:19 (GMT)
committerrathnor <rathnor>2003-06-12 15:12:19 (GMT)
commite139cbb0283f7480fc26c58dc3f8a48e69011eab (patch)
tree2058a848943cb008dfe17270ad49853747212481 /src/RegExp.hh
parent94f1c164161e8faaf064d8b7cdfe36c9ca978055 (diff)
downloadfluxbox-e139cbb0283f7480fc26c58dc3f8a48e69011eab.zip
fluxbox-e139cbb0283f7480fc26c58dc3f8a48e69011eab.tar.bz2
add regular expression support in remember capabilities
see ChangeLog for details
Diffstat (limited to 'src/RegExp.hh')
-rw-r--r--src/RegExp.hh66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/RegExp.hh b/src/RegExp.hh
new file mode 100644
index 0000000..9591bcb
--- /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.1 2003/06/12 15:12:19 rathnor Exp $
25
26#ifndef REGEXP_HH
27#define REGEXP_HH
28
29#include "config.h"
30
31#include <string>
32
33/*
34 * If USE_REGEXP isn't defined, then we match just using simple string equality
35 */
36
37#ifdef USE_REGEXP
38#include <regex.h>
39#include <sys/types.h>
40#endif // USE_REGEXP
41
42class WinClient;
43
44class RegExp {
45public:
46 RegExp(const std::string &str, bool full_match = true);
47 ~RegExp();
48
49 bool match(const std::string &str);
50
51#ifdef USE_REGEXP
52 inline bool error() { return m_regex == 0; }
53#else // notdef USE_REGEXP
54 inline bool error() { return m_str == ""; }
55#endif // USE_REGEXP
56
57private:
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