diff options
author | fluxgen <fluxgen> | 2003-06-13 11:43:46 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-06-13 11:43:46 (GMT) |
commit | cb14466431e2e1ce56d47fcd3c3ec98d0fa1fa29 (patch) | |
tree | 329ae096c1fa5847eb838972550d7a12ae7adc8d /src | |
parent | 6add92330be5c62d039469d28ce8d899d613bba6 (diff) | |
download | fluxbox-cb14466431e2e1ce56d47fcd3c3ec98d0fa1fa29.zip fluxbox-cb14466431e2e1ce56d47fcd3c3ec98d0fa1fa29.tar.bz2 |
minor fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/RegExp.cc | 14 | ||||
-rw-r--r-- | src/RegExp.hh | 16 |
2 files changed, 19 insertions, 11 deletions
diff --git a/src/RegExp.cc b/src/RegExp.cc index 2e991da..093c53f 100644 --- a/src/RegExp.cc +++ b/src/RegExp.cc | |||
@@ -20,7 +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: RegExp.cc,v 1.1 2003/06/12 15:12:19 rathnor Exp $ | 23 | // $Id: RegExp.cc,v 1.2 2003/06/13 11:43:46 fluxgen Exp $ |
24 | 24 | ||
25 | #include "RegExp.hh" | 25 | #include "RegExp.hh" |
26 | 26 | ||
@@ -81,10 +81,10 @@ RegExp::~RegExp() { | |||
81 | #endif // USE_REGEXP | 81 | #endif // USE_REGEXP |
82 | } | 82 | } |
83 | 83 | ||
84 | bool RegExp::match(const std::string &str) { | 84 | bool RegExp::match(const std::string &str) const { |
85 | #ifdef USE_REGEXP | 85 | #ifdef USE_REGEXP |
86 | if (m_regex) | 86 | if (m_regex) |
87 | return (regexec(m_regex, str.c_str(), 0, 0, 0) == 0); | 87 | return regexec(m_regex, str.c_str(), 0, 0, 0) == 0; |
88 | else | 88 | else |
89 | return false; | 89 | return false; |
90 | #else // notdef USE_REGEXP | 90 | #else // notdef USE_REGEXP |
@@ -92,3 +92,11 @@ bool RegExp::match(const std::string &str) { | |||
92 | #endif // USE_REGEXP | 92 | #endif // USE_REGEXP |
93 | } | 93 | } |
94 | 94 | ||
95 | |||
96 | bool RegExp::error() const { | ||
97 | #ifdef USE_REGEXP | ||
98 | return m_regex == 0; | ||
99 | #else | ||
100 | return return m_str == ""; | ||
101 | #endif // USE_REGEXP | ||
102 | } | ||
diff --git a/src/RegExp.hh b/src/RegExp.hh index 9591bcb..f5f5fd6 100644 --- a/src/RegExp.hh +++ b/src/RegExp.hh | |||
@@ -21,12 +21,16 @@ | |||
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: RegExp.hh,v 1.1 2003/06/12 15:12:19 rathnor Exp $ | 24 | // $Id: RegExp.hh,v 1.2 2003/06/13 11:43:46 fluxgen Exp $ |
25 | 25 | ||
26 | #ifndef REGEXP_HH | 26 | #ifndef REGEXP_HH |
27 | #define REGEXP_HH | 27 | #define REGEXP_HH |
28 | 28 | ||
29 | #include "NotCopyable.hh" | ||
30 | |||
31 | #ifdef HAVE_CONFIG_H | ||
29 | #include "config.h" | 32 | #include "config.h" |
33 | #endif // HAVE_CONFIG_H | ||
30 | 34 | ||
31 | #include <string> | 35 | #include <string> |
32 | 36 | ||
@@ -41,18 +45,14 @@ | |||
41 | 45 | ||
42 | class WinClient; | 46 | class WinClient; |
43 | 47 | ||
44 | class RegExp { | 48 | class RegExp:private FbTk::NotCopyable { |
45 | public: | 49 | public: |
46 | RegExp(const std::string &str, bool full_match = true); | 50 | RegExp(const std::string &str, bool full_match = true); |
47 | ~RegExp(); | 51 | ~RegExp(); |
48 | 52 | ||
49 | bool match(const std::string &str); | 53 | bool match(const std::string &str) const; |
50 | 54 | ||
51 | #ifdef USE_REGEXP | 55 | bool error() const; |
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 | 56 | ||
57 | private: | 57 | private: |
58 | #ifdef USE_REGEXP | 58 | #ifdef USE_REGEXP |