00001 /* 00002 * $Id: Regex.h 571 2007-12-02 08:34:30Z mindstorm2600 $ 00003 */ 00004 /* 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 */ 00019 #ifndef __XVR2_TEXT_REGEX_H__ 00020 #define __XVR2_TEXT_REGEX_H__ 00021 #include<xvr2/xvr2config.h> 00022 #include<xvr2/String.h> 00023 #include<xvr2/CoreExceptions.h> 00024 #include<xvr2/Text/RegexException.h> 00025 00026 namespace xvr2{ 00027 namespace Text { 00048 class Regex:public xvr2::Object{ 00049 private: 00050 void *handle; 00053 bool compiled; 00054 String *_pattern; 00055 protected: 00057 int cflags; 00068 virtual void compile(); 00069 public: 00074 Regex(); 00084 Regex(const char *pat); 00094 Regex(const String &pat); 00095 ~Regex(); 00108 const char *pattern(const char *pat = 0); 00115 void useExtended(bool u = true); 00123 void ignoreCase(bool u = true); 00140 static bool match(const String &pattern, const String &str, bool case_sensitive = true); 00147 bool matches(const char *str); 00154 bool matches(const String &str); 00155 }; 00156 }; 00157 }; 00158 00159 #endif