diff options
Diffstat (limited to 'src/RegExp.cc')
-rw-r--r-- | src/RegExp.cc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/RegExp.cc b/src/RegExp.cc index c716b73..895cc7b 100644 --- a/src/RegExp.cc +++ b/src/RegExp.cc | |||
@@ -33,7 +33,12 @@ | |||
33 | #include <string> | 33 | #include <string> |
34 | #include <iostream> | 34 | #include <iostream> |
35 | 35 | ||
36 | using namespace std; | 36 | using std::string; |
37 | |||
38 | #ifdef USE_REGEXP | ||
39 | using std::cerr; | ||
40 | using std::endl; | ||
41 | #endif // USE_REGEXP | ||
37 | 42 | ||
38 | 43 | ||
39 | /******************************************************** | 44 | /******************************************************** |
@@ -42,7 +47,7 @@ using namespace std; | |||
42 | 47 | ||
43 | // full_match is to say if we match on this regexp using the full string | 48 | // full_match is to say if we match on this regexp using the full string |
44 | // or just a substring. Substrings aren't supported if not HAVE_REGEXP | 49 | // or just a substring. Substrings aren't supported if not HAVE_REGEXP |
45 | RegExp::RegExp(const std::string &str, bool full_match): | 50 | RegExp::RegExp(const string &str, bool full_match): |
46 | #ifdef USE_REGEXP | 51 | #ifdef USE_REGEXP |
47 | m_regex(0) { | 52 | m_regex(0) { |
48 | string match; | 53 | string match; |
@@ -83,7 +88,7 @@ RegExp::~RegExp() { | |||
83 | #endif // USE_REGEXP | 88 | #endif // USE_REGEXP |
84 | } | 89 | } |
85 | 90 | ||
86 | bool RegExp::match(const std::string &str) const { | 91 | bool RegExp::match(const string &str) const { |
87 | #ifdef USE_REGEXP | 92 | #ifdef USE_REGEXP |
88 | if (m_regex) | 93 | if (m_regex) |
89 | return regexec(m_regex, str.c_str(), 0, 0, 0) == 0; | 94 | return regexec(m_regex, str.c_str(), 0, 0, 0) == 0; |
@@ -97,7 +102,7 @@ bool RegExp::match(const std::string &str) const { | |||
97 | 102 | ||
98 | bool RegExp::error() const { | 103 | bool RegExp::error() const { |
99 | #ifdef USE_REGEXP | 104 | #ifdef USE_REGEXP |
100 | return m_regex == 0; | 105 | return m_regex == 0; |
101 | #else | 106 | #else |
102 | return m_str == ""; | 107 | return m_str == ""; |
103 | #endif // USE_REGEXP | 108 | #endif // USE_REGEXP |