move RegExp to FbTk
This commit is contained in:
parent
39224b0142
commit
32eb2a148e
6 changed files with 16 additions and 30 deletions
|
@ -23,7 +23,6 @@
|
||||||
// $Id$
|
// $Id$
|
||||||
|
|
||||||
#include "ClientPattern.hh"
|
#include "ClientPattern.hh"
|
||||||
#include "RegExp.hh"
|
|
||||||
|
|
||||||
#include "FocusControl.hh"
|
#include "FocusControl.hh"
|
||||||
#include "Layer.hh"
|
#include "Layer.hh"
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#ifndef CLIENTPATTERN_HH
|
#ifndef CLIENTPATTERN_HH
|
||||||
#define CLIENTPATTERN_HH
|
#define CLIENTPATTERN_HH
|
||||||
|
|
||||||
#include "RegExp.hh"
|
#include "FbTk/RegExp.hh"
|
||||||
#include "NotCopyable.hh"
|
#include "NotCopyable.hh"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -99,7 +99,7 @@ private:
|
||||||
struct Term {
|
struct Term {
|
||||||
Term(const std::string ®str, bool full_match) :regexp(regstr, full_match){};
|
Term(const std::string ®str, bool full_match) :regexp(regstr, full_match){};
|
||||||
std::string orig;
|
std::string orig;
|
||||||
RegExp regexp;
|
FbTk::RegExp regexp;
|
||||||
WinProperty prop;
|
WinProperty prop;
|
||||||
bool negate;
|
bool negate;
|
||||||
};
|
};
|
||||||
|
|
|
@ -41,6 +41,7 @@ libFbTk_a_SOURCES = App.hh App.cc Color.cc Color.hh Command.hh \
|
||||||
XLayer.cc XLayer.hh XLayerItem.cc XLayerItem.hh \
|
XLayer.cc XLayer.hh XLayerItem.cc XLayerItem.hh \
|
||||||
Resource.hh Resource.cc \
|
Resource.hh Resource.cc \
|
||||||
StringUtil.hh StringUtil.cc Parser.hh Parser.cc \
|
StringUtil.hh StringUtil.cc Parser.hh Parser.cc \
|
||||||
|
RegExp.hh RegExp.cc \
|
||||||
FbString.hh FbString.cc \
|
FbString.hh FbString.cc \
|
||||||
Subject.hh Subject.cc Observer.hh Observer.cc \
|
Subject.hh Subject.cc Observer.hh Observer.cc \
|
||||||
Transparent.hh Transparent.cc \
|
Transparent.hh Transparent.cc \
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// RegExp.cc for Fluxbox Window Manager
|
// RegExp.cc for FbTk
|
||||||
// Copyright (c) 2003 Henrik Kinnunen (fluxgen at fluxbox dot org)
|
// Copyright (c) 2003 Henrik Kinnunen (fluxgen at fluxbox dot org)
|
||||||
// and Simon Bowden (rathnor at users.sourceforge.net)
|
// and Simon Bowden (rathnor at users.sourceforge.net)
|
||||||
//
|
//
|
||||||
|
@ -20,10 +20,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id$
|
|
||||||
|
|
||||||
#include "RegExp.hh"
|
#include "RegExp.hh"
|
||||||
#include "FbTk/I18n.hh"
|
|
||||||
|
|
||||||
//use GNU extensions
|
//use GNU extensions
|
||||||
#ifndef _GNU_SOURCE
|
#ifndef _GNU_SOURCE
|
||||||
|
@ -40,10 +37,7 @@ using std::cerr;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
#endif // USE_REGEXP
|
#endif // USE_REGEXP
|
||||||
|
|
||||||
|
namespace FbTk {
|
||||||
/********************************************************
|
|
||||||
* RegExp *
|
|
||||||
**********/
|
|
||||||
|
|
||||||
// full_match is to say if we match on this regexp using the full string
|
// full_match is to say if we match on this regexp using the full string
|
||||||
// or just a substring. Substrings aren't supported if not HAVE_REGEXP
|
// or just a substring. Substrings aren't supported if not HAVE_REGEXP
|
||||||
|
@ -62,15 +56,6 @@ m_regex(0) {
|
||||||
m_regex = new regex_t;
|
m_regex = new regex_t;
|
||||||
int ret = regcomp(m_regex, match.c_str(), REG_NOSUB | REG_EXTENDED);
|
int ret = regcomp(m_regex, match.c_str(), REG_NOSUB | REG_EXTENDED);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
char *errstr = 0;
|
|
||||||
_FB_USES_NLS;
|
|
||||||
// gives us the length of the string
|
|
||||||
unsigned int size = regerror(ret, m_regex, errstr, 0);
|
|
||||||
errstr = new char[size];
|
|
||||||
|
|
||||||
regerror(ret, m_regex, errstr, size);
|
|
||||||
cerr<<_FB_CONSOLETEXT(Fluxbox, ErrorRegexp, "Error parsing regular expression", "Error parsing regular expression (following)")<<": "<<errstr<<endl;
|
|
||||||
delete [] errstr;
|
|
||||||
delete m_regex; // I don't think I regfree a failed compile?
|
delete m_regex; // I don't think I regfree a failed compile?
|
||||||
m_regex = 0;
|
m_regex = 0;
|
||||||
}
|
}
|
||||||
|
@ -107,3 +92,5 @@ bool RegExp::error() const {
|
||||||
return m_str == "";
|
return m_str == "";
|
||||||
#endif // USE_REGEXP
|
#endif // USE_REGEXP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}; // end namespace FbTk
|
|
@ -1,4 +1,4 @@
|
||||||
// RegExp.hh for Fluxbox Window Manager
|
// RegExp.hh for FbTk
|
||||||
// Copyright (c) 2002 Xavier Brouckaert
|
// Copyright (c) 2002 Xavier Brouckaert
|
||||||
// Copyright (c) 2003 Henrik Kinnunen (fluxgen at fluxbox dot org)
|
// Copyright (c) 2003 Henrik Kinnunen (fluxgen at fluxbox dot org)
|
||||||
// and Simon Bowden (rathnor at users.sourceforge.net)
|
// and Simon Bowden (rathnor at users.sourceforge.net)
|
||||||
|
@ -21,10 +21,8 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id$
|
#ifndef FBTK_REGEXP_HH
|
||||||
|
#define FBTK_REGEXP_HH
|
||||||
#ifndef REGEXP_HH
|
|
||||||
#define REGEXP_HH
|
|
||||||
|
|
||||||
#include "NotCopyable.hh"
|
#include "NotCopyable.hh"
|
||||||
|
|
||||||
|
@ -43,9 +41,9 @@
|
||||||
#include <regex.h>
|
#include <regex.h>
|
||||||
#endif // USE_REGEXP
|
#endif // USE_REGEXP
|
||||||
|
|
||||||
class WinClient;
|
namespace FbTk {
|
||||||
|
|
||||||
class RegExp:private FbTk::NotCopyable {
|
class RegExp: private NotCopyable {
|
||||||
public:
|
public:
|
||||||
RegExp(const std::string &str, bool full_match = true);
|
RegExp(const std::string &str, bool full_match = true);
|
||||||
~RegExp();
|
~RegExp();
|
||||||
|
@ -63,4 +61,6 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // REGEXP_HH
|
}; // end namespace FbTk
|
||||||
|
|
||||||
|
#endif // FBTK_REGEXP_HH
|
|
@ -78,9 +78,8 @@ if GNOME
|
||||||
gnome_SOURCE= Gnome.hh Gnome.cc
|
gnome_SOURCE= Gnome.hh Gnome.cc
|
||||||
endif
|
endif
|
||||||
if REMEMBER_SRC
|
if REMEMBER_SRC
|
||||||
# For now we only want regexp if we have remember
|
|
||||||
REMEMBER_SOURCE= Remember.hh Remember.cc \
|
REMEMBER_SOURCE= Remember.hh Remember.cc \
|
||||||
RegExp.hh RegExp.cc ClientPattern.hh ClientPattern.cc
|
ClientPattern.hh ClientPattern.cc
|
||||||
endif
|
endif
|
||||||
if TOOLBAR_SRC
|
if TOOLBAR_SRC
|
||||||
TOOLBAR_SOURCE = Toolbar.hh Toolbar.cc \
|
TOOLBAR_SOURCE = Toolbar.hh Toolbar.cc \
|
||||||
|
|
Loading…
Reference in a new issue