Loading...
Searching...
No Matches
Regexp.h
Go to the documentation of this file.
// -*- c++ -*-
//------------------------------------------------------------------------------
// Regexp.h
//------------------------------------------------------------------------------
// Copyright (C) 1997-2003 Vladislav Grinchenko <vlg@users.sourceforge.net>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//------------------------------------------------------------------------------
#ifndef REGEXP_H
#define REGEXP_H
#include "assa/Assure.h"
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <regex.h>
#ifdef __cplusplus
}
#endif /* C++ */
#include <string>
namespace ASSA {
class Regexp {
public:
Regexp (const std::string& pattern_);
~Regexp ();
int match (const char* text_);
const char* get_error () const { return m_error_msg; }
const char* get_pattern () const { return m_pattern; }
private:
char* m_pattern;
char* m_error_msg;
regex_t* m_compiled_pattern;
};
} // @end namespace
#endif /* REGEXP_H */
Assure.h
A collection of assert function wrappers.
ASSA::Regexp::get_pattern
const char * get_pattern() const
Return the original pattern (uncompiled).
Definition Regexp.h:68
ASSA::Regexp::m_error_msg
char * m_error_msg
Definition Regexp.h:72
ASSA::Regexp::m_pattern
char * m_pattern
Definition Regexp.h:71
ASSA::Regexp::Regexp
Regexp(const std::string &pattern_)
Constructor.
Definition Regexp.cpp:17
ASSA::Regexp::get_error
const char * get_error() const
Return error message.
Definition Regexp.h:64
ASSA::Regexp::m_compiled_pattern
regex_t * m_compiled_pattern
Definition Regexp.h:73
ASSA::Regexp::~Regexp
~Regexp()
Destructor.
Definition Regexp.cpp:42
ASSA::Regexp::match
int match(const char *text_)
Match an ASCII character string agains the pattern this class wraps.
Definition Regexp.cpp:58
ASSA
Definition Acceptor.h:40