aboutsummaryrefslogtreecommitdiff
path: root/src/RegExp.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/RegExp.cc')
-rw-r--r--src/RegExp.cc14
1 files changed, 11 insertions, 3 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
84bool RegExp::match(const std::string &str) { 84bool 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
96bool RegExp::error() const {
97#ifdef USE_REGEXP
98 return m_regex == 0;
99#else
100 return return m_str == "";
101#endif // USE_REGEXP
102}