move RegExp to FbTk
Mark Tiefenbruck mark@fluxbox.org
6 files changed,
16 insertions(+),
30 deletions(-)
M
src/ClientPattern.cc
→
src/ClientPattern.cc
@@ -23,7 +23,6 @@
// $Id$ #include "ClientPattern.hh" -#include "RegExp.hh" #include "FocusControl.hh" #include "Layer.hh"
M
src/ClientPattern.hh
→
src/ClientPattern.hh
@@ -26,7 +26,7 @@
#ifndef CLIENTPATTERN_HH #define CLIENTPATTERN_HH -#include "RegExp.hh" +#include "FbTk/RegExp.hh" #include "NotCopyable.hh" #include <string>@@ -99,7 +99,7 @@ */
struct Term { Term(const std::string ®str, bool full_match) :regexp(regstr, full_match){}; std::string orig; - RegExp regexp; + FbTk::RegExp regexp; WinProperty prop; bool negate; };
M
src/FbTk/Makefile.am
→
src/FbTk/Makefile.am
@@ -41,6 +41,7 @@ Layer.hh LayerItem.hh MultLayers.cc MultLayers.hh \
XLayer.cc XLayer.hh XLayerItem.cc XLayerItem.hh \ Resource.hh Resource.cc \ StringUtil.hh StringUtil.cc Parser.hh Parser.cc \ + RegExp.hh RegExp.cc \ FbString.hh FbString.cc \ Subject.hh Subject.cc Observer.hh Observer.cc \ Transparent.hh Transparent.cc \
M
src/Makefile.am
→
src/Makefile.am
@@ -78,9 +78,8 @@ if GNOME
gnome_SOURCE= Gnome.hh Gnome.cc endif if REMEMBER_SRC -# For now we only want regexp if we have remember REMEMBER_SOURCE= Remember.hh Remember.cc \ - RegExp.hh RegExp.cc ClientPattern.hh ClientPattern.cc + ClientPattern.hh ClientPattern.cc endif if TOOLBAR_SRC TOOLBAR_SOURCE = Toolbar.hh Toolbar.cc \
M
src/RegExp.cc
→
src/FbTk/RegExp.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) // and Simon Bowden (rathnor at users.sourceforge.net) //@@ -20,10 +20,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id$ - #include "RegExp.hh" -#include "FbTk/I18n.hh" //use GNU extensions #ifndef _GNU_SOURCE@@ -40,10 +37,7 @@ using std::cerr;
using std::endl; #endif // USE_REGEXP - -/******************************************************** - * RegExp * - **********/ +namespace FbTk { // 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@@ -62,15 +56,6 @@
m_regex = new regex_t; int ret = regcomp(m_regex, match.c_str(), REG_NOSUB | REG_EXTENDED); 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? m_regex = 0; }@@ -107,3 +92,5 @@ #else
return m_str == ""; #endif // USE_REGEXP } + +}; // end namespace FbTk
M
src/RegExp.hh
→
src/FbTk/RegExp.hh
@@ -1,4 +1,4 @@
-// RegExp.hh for Fluxbox Window Manager +// RegExp.hh for FbTk // Copyright (c) 2002 Xavier Brouckaert // Copyright (c) 2003 Henrik Kinnunen (fluxgen at fluxbox dot org) // and Simon Bowden (rathnor at users.sourceforge.net)@@ -21,10 +21,8 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id$ - -#ifndef REGEXP_HH -#define REGEXP_HH +#ifndef FBTK_REGEXP_HH +#define FBTK_REGEXP_HH #include "NotCopyable.hh"@@ -43,9 +41,9 @@ #include <sys/types.h>
#include <regex.h> #endif // USE_REGEXP -class WinClient; +namespace FbTk { -class RegExp:private FbTk::NotCopyable { +class RegExp: private NotCopyable { public: RegExp(const std::string &str, bool full_match = true); ~RegExp();@@ -63,4 +61,6 @@ #endif // USE_REGEXP
}; -#endif // REGEXP_HH +}; // end namespace FbTk + +#endif // FBTK_REGEXP_HH