libassa 3.5.0
|
00001 // -*- c++ -*- 00002 //------------------------------------------------------------------------------ 00003 // Regexp.h 00004 //------------------------------------------------------------------------------ 00005 // Copyright (C) 1997-2003 Vladislav Grinchenko <vlg@users.sourceforge.net> 00006 // 00007 // This library is free software; you can redistribute it and/or 00008 // modify it under the terms of the GNU Library General Public 00009 // License as published by the Free Software Foundation; either 00010 // version 2 of the License, or (at your option) any later version. 00011 //------------------------------------------------------------------------------ 00012 #ifndef REGEXP_H 00013 #define REGEXP_H 00014 00015 #include "assa/Assure.h" 00016 #include <sys/types.h> 00017 00018 #ifdef __cplusplus 00019 extern "C" { 00020 #endif 00021 00022 #include <regex.h> 00023 00024 #ifdef __cplusplus 00025 } 00026 #endif /* C++ */ 00027 00028 00029 #include <string> 00030 00031 namespace ASSA { 00032 00043 class Regexp { 00044 public: 00048 Regexp (const std::string& pattern_); 00049 00053 ~Regexp (); 00054 00060 int match (const char* text_); 00061 00064 const char* get_error () const { return m_error_msg; } 00065 00068 const char* get_pattern () const { return m_pattern; } 00069 00070 private: 00071 char* m_pattern; 00072 char* m_error_msg; 00073 regex_t* m_compiled_pattern; 00074 }; 00075 } // @end namespace 00076 00077 #endif /* REGEXP_H */ 00078 00079 00080