minor fixes
This commit is contained in:
parent
6add92330b
commit
cb14466431
2 changed files with 19 additions and 11 deletions
|
@ -20,7 +20,7 @@
|
|||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// $Id: RegExp.cc,v 1.1 2003/06/12 15:12:19 rathnor Exp $
|
||||
// $Id: RegExp.cc,v 1.2 2003/06/13 11:43:46 fluxgen Exp $
|
||||
|
||||
#include "RegExp.hh"
|
||||
|
||||
|
@ -81,10 +81,10 @@ RegExp::~RegExp() {
|
|||
#endif // USE_REGEXP
|
||||
}
|
||||
|
||||
bool RegExp::match(const std::string &str) {
|
||||
bool RegExp::match(const std::string &str) const {
|
||||
#ifdef USE_REGEXP
|
||||
if (m_regex)
|
||||
return (regexec(m_regex, str.c_str(), 0, 0, 0) == 0);
|
||||
return regexec(m_regex, str.c_str(), 0, 0, 0) == 0;
|
||||
else
|
||||
return false;
|
||||
#else // notdef USE_REGEXP
|
||||
|
@ -92,3 +92,11 @@ bool RegExp::match(const std::string &str) {
|
|||
#endif // USE_REGEXP
|
||||
}
|
||||
|
||||
|
||||
bool RegExp::error() const {
|
||||
#ifdef USE_REGEXP
|
||||
return m_regex == 0;
|
||||
#else
|
||||
return return m_str == "";
|
||||
#endif // USE_REGEXP
|
||||
}
|
||||
|
|
|
@ -21,12 +21,16 @@
|
|||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// $Id: RegExp.hh,v 1.1 2003/06/12 15:12:19 rathnor Exp $
|
||||
// $Id: RegExp.hh,v 1.2 2003/06/13 11:43:46 fluxgen Exp $
|
||||
|
||||
#ifndef REGEXP_HH
|
||||
#define REGEXP_HH
|
||||
|
||||
#include "NotCopyable.hh"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif // HAVE_CONFIG_H
|
||||
|
||||
#include <string>
|
||||
|
||||
|
@ -41,18 +45,14 @@
|
|||
|
||||
class WinClient;
|
||||
|
||||
class RegExp {
|
||||
class RegExp:private FbTk::NotCopyable {
|
||||
public:
|
||||
RegExp(const std::string &str, bool full_match = true);
|
||||
~RegExp();
|
||||
|
||||
bool match(const std::string &str);
|
||||
bool match(const std::string &str) const;
|
||||
|
||||
#ifdef USE_REGEXP
|
||||
inline bool error() { return m_regex == 0; }
|
||||
#else // notdef USE_REGEXP
|
||||
inline bool error() { return m_str == ""; }
|
||||
#endif // USE_REGEXP
|
||||
bool error() const;
|
||||
|
||||
private:
|
||||
#ifdef USE_REGEXP
|
||||
|
|
Loading…
Reference in a new issue