aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2007-12-28 06:15:06 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2007-12-28 06:15:06 (GMT)
commit32eb2a148ea7a257a058658af36e9f8c801a524a (patch)
tree1a540358fe1e9afb8566b0bc5a9f134ded2a2f7f /src
parent39224b0142078376d2bd39789b4de24a18377cf0 (diff)
downloadfluxbox-32eb2a148ea7a257a058658af36e9f8c801a524a.zip
fluxbox-32eb2a148ea7a257a058658af36e9f8c801a524a.tar.bz2
move RegExp to FbTk
Diffstat (limited to 'src')
-rw-r--r--src/ClientPattern.cc1
-rw-r--r--src/ClientPattern.hh4
-rw-r--r--src/FbTk/Makefile.am1
-rw-r--r--src/FbTk/RegExp.cc (renamed from src/RegExp.cc)21
-rw-r--r--src/FbTk/RegExp.hh (renamed from src/RegExp.hh)16
-rw-r--r--src/Makefile.am3
6 files changed, 16 insertions, 30 deletions
diff --git a/src/ClientPattern.cc b/src/ClientPattern.cc
index d094e63..fcc2370 100644
--- a/src/ClientPattern.cc
+++ b/src/ClientPattern.cc
@@ -23,7 +23,6 @@
23// $Id$ 23// $Id$
24 24
25#include "ClientPattern.hh" 25#include "ClientPattern.hh"
26#include "RegExp.hh"
27 26
28#include "FocusControl.hh" 27#include "FocusControl.hh"
29#include "Layer.hh" 28#include "Layer.hh"
diff --git a/src/ClientPattern.hh b/src/ClientPattern.hh
index b76aef8..4531c4a 100644
--- a/src/ClientPattern.hh
+++ b/src/ClientPattern.hh
@@ -26,7 +26,7 @@
26#ifndef CLIENTPATTERN_HH 26#ifndef CLIENTPATTERN_HH
27#define CLIENTPATTERN_HH 27#define CLIENTPATTERN_HH
28 28
29#include "RegExp.hh" 29#include "FbTk/RegExp.hh"
30#include "NotCopyable.hh" 30#include "NotCopyable.hh"
31 31
32#include <string> 32#include <string>
@@ -99,7 +99,7 @@ private:
99 struct Term { 99 struct Term {
100 Term(const std::string &regstr, bool full_match) :regexp(regstr, full_match){}; 100 Term(const std::string &regstr, bool full_match) :regexp(regstr, full_match){};
101 std::string orig; 101 std::string orig;
102 RegExp regexp; 102 FbTk::RegExp regexp;
103 WinProperty prop; 103 WinProperty prop;
104 bool negate; 104 bool negate;
105 }; 105 };
diff --git a/src/FbTk/Makefile.am b/src/FbTk/Makefile.am
index 86f8594..5f1c246 100644
--- a/src/FbTk/Makefile.am
+++ b/src/FbTk/Makefile.am
@@ -41,6 +41,7 @@ libFbTk_a_SOURCES = App.hh App.cc Color.cc Color.hh Command.hh \
41 XLayer.cc XLayer.hh XLayerItem.cc XLayerItem.hh \ 41 XLayer.cc XLayer.hh XLayerItem.cc XLayerItem.hh \
42 Resource.hh Resource.cc \ 42 Resource.hh Resource.cc \
43 StringUtil.hh StringUtil.cc Parser.hh Parser.cc \ 43 StringUtil.hh StringUtil.cc Parser.hh Parser.cc \
44 RegExp.hh RegExp.cc \
44 FbString.hh FbString.cc \ 45 FbString.hh FbString.cc \
45 Subject.hh Subject.cc Observer.hh Observer.cc \ 46 Subject.hh Subject.cc Observer.hh Observer.cc \
46 Transparent.hh Transparent.cc \ 47 Transparent.hh Transparent.cc \
diff --git a/src/RegExp.cc b/src/FbTk/RegExp.cc
index 895cc7b..df98982 100644
--- a/src/RegExp.cc
+++ b/src/FbTk/RegExp.cc
@@ -1,4 +1,4 @@
1// RegExp.cc for Fluxbox Window Manager 1// RegExp.cc for FbTk
2// Copyright (c) 2003 Henrik Kinnunen (fluxgen at fluxbox dot org) 2// Copyright (c) 2003 Henrik Kinnunen (fluxgen at fluxbox dot org)
3// and Simon Bowden (rathnor at users.sourceforge.net) 3// and Simon Bowden (rathnor at users.sourceforge.net)
4// 4//
@@ -20,10 +20,7 @@
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE. 21// DEALINGS IN THE SOFTWARE.
22 22
23// $Id$
24
25#include "RegExp.hh" 23#include "RegExp.hh"
26#include "FbTk/I18n.hh"
27 24
28//use GNU extensions 25//use GNU extensions
29#ifndef _GNU_SOURCE 26#ifndef _GNU_SOURCE
@@ -40,10 +37,7 @@ using std::cerr;
40using std::endl; 37using std::endl;
41#endif // USE_REGEXP 38#endif // USE_REGEXP
42 39
43 40namespace FbTk {
44/********************************************************
45 * RegExp *
46 **********/
47 41
48// full_match is to say if we match on this regexp using the full string 42// full_match is to say if we match on this regexp using the full string
49// or just a substring. Substrings aren't supported if not HAVE_REGEXP 43// or just a substring. Substrings aren't supported if not HAVE_REGEXP
@@ -62,15 +56,6 @@ m_regex(0) {
62 m_regex = new regex_t; 56 m_regex = new regex_t;
63 int ret = regcomp(m_regex, match.c_str(), REG_NOSUB | REG_EXTENDED); 57 int ret = regcomp(m_regex, match.c_str(), REG_NOSUB | REG_EXTENDED);
64 if (ret != 0) { 58 if (ret != 0) {
65 char *errstr = 0;
66 _FB_USES_NLS;
67 // gives us the length of the string
68 unsigned int size = regerror(ret, m_regex, errstr, 0);
69 errstr = new char[size];
70
71 regerror(ret, m_regex, errstr, size);
72 cerr<<_FB_CONSOLETEXT(Fluxbox, ErrorRegexp, "Error parsing regular expression", "Error parsing regular expression (following)")<<": "<<errstr<<endl;
73 delete [] errstr;
74 delete m_regex; // I don't think I regfree a failed compile? 59 delete m_regex; // I don't think I regfree a failed compile?
75 m_regex = 0; 60 m_regex = 0;
76 } 61 }
@@ -107,3 +92,5 @@ bool RegExp::error() const {
107 return m_str == ""; 92 return m_str == "";
108#endif // USE_REGEXP 93#endif // USE_REGEXP
109} 94}
95
96}; // end namespace FbTk
diff --git a/src/RegExp.hh b/src/FbTk/RegExp.hh
index e3d0536..0386670 100644
--- a/src/RegExp.hh
+++ b/src/FbTk/RegExp.hh
@@ -1,4 +1,4 @@
1// RegExp.hh for Fluxbox Window Manager 1// RegExp.hh for FbTk
2// Copyright (c) 2002 Xavier Brouckaert 2// Copyright (c) 2002 Xavier Brouckaert
3// Copyright (c) 2003 Henrik Kinnunen (fluxgen at fluxbox dot org) 3// Copyright (c) 2003 Henrik Kinnunen (fluxgen at fluxbox dot org)
4// and Simon Bowden (rathnor at users.sourceforge.net) 4// and Simon Bowden (rathnor at users.sourceforge.net)
@@ -21,10 +21,8 @@
21// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22// DEALINGS IN THE SOFTWARE. 22// DEALINGS IN THE SOFTWARE.
23 23
24// $Id$ 24#ifndef FBTK_REGEXP_HH
25 25#define FBTK_REGEXP_HH
26#ifndef REGEXP_HH
27#define REGEXP_HH
28 26
29#include "NotCopyable.hh" 27#include "NotCopyable.hh"
30 28
@@ -43,9 +41,9 @@
43#include <regex.h> 41#include <regex.h>
44#endif // USE_REGEXP 42#endif // USE_REGEXP
45 43
46class WinClient; 44namespace FbTk {
47 45
48class RegExp:private FbTk::NotCopyable { 46class RegExp: private NotCopyable {
49public: 47public:
50 RegExp(const std::string &str, bool full_match = true); 48 RegExp(const std::string &str, bool full_match = true);
51 ~RegExp(); 49 ~RegExp();
@@ -63,4 +61,6 @@ private:
63 61
64}; 62};
65 63
66#endif // REGEXP_HH 64}; // end namespace FbTk
65
66#endif // FBTK_REGEXP_HH
diff --git a/src/Makefile.am b/src/Makefile.am
index dfed93b..b40affd 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -78,9 +78,8 @@ if GNOME
78gnome_SOURCE= Gnome.hh Gnome.cc 78gnome_SOURCE= Gnome.hh Gnome.cc
79endif 79endif
80if REMEMBER_SRC 80if REMEMBER_SRC
81# For now we only want regexp if we have remember
82REMEMBER_SOURCE= Remember.hh Remember.cc \ 81REMEMBER_SOURCE= Remember.hh Remember.cc \
83 RegExp.hh RegExp.cc ClientPattern.hh ClientPattern.cc 82 ClientPattern.hh ClientPattern.cc
84endif 83endif
85if TOOLBAR_SRC 84if TOOLBAR_SRC
86TOOLBAR_SOURCE = Toolbar.hh Toolbar.cc \ 85TOOLBAR_SOURCE = Toolbar.hh Toolbar.cc \