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 #include <regex.h> 00018 00019 #include <string> 00020 00021 namespace ASSA { 00022 00033 class Regexp { 00034 public: 00038 Regexp (const std::string& pattern_); 00039 00043 ~Regexp (); 00044 00050 int match (const char* text_); 00051 00054 const char* get_error () const { return m_error_msg; } 00055 00058 const char* get_pattern () const { return m_pattern; } 00059 00060 private: 00061 char* m_pattern; 00062 char* m_error_msg; 00063 regex_t* m_compiled_pattern; 00064 }; 00065 } // @end namespace 00066 00067 #endif /* REGEXP_H */ 00068 00069 00070