csutil/regexp.h
Go to the documentation of this file.00001 /* 00002 Copyright (C) 2004 by Frank Richter 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public 00015 License along with this library; if not, write to the Free 00016 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00017 */ 00018 00019 #ifndef __CS_UTIL_REGEXP_H__ 00020 #define __CS_UTIL_REGEXP_H__ 00021 00026 #include "csextern.h" 00027 #include "csutil/array.h" 00028 00032 enum csRegExpMatchError 00033 { 00035 NoError, 00037 NoMatch, 00043 BadBraces, 00047 BadPattern, 00052 BadRepetition, 00057 ErrCollate, 00061 ErrCharType, 00065 ErrEscape, 00069 ErrSubReg, 00073 ErrBrackets, 00078 ErrParentheses, 00082 ErrBraces, 00086 ErrRange, 00090 ErrSpace, 00094 ErrUnknown 00095 }; 00096 00100 enum csRegExpMatchFlags 00101 { 00105 IgnoreCase = 1, 00114 NewLine = 2, 00120 NotBOL = 4, 00125 NotEOL = 8 00126 }; 00127 00131 struct CS_CSUTIL_EXPORT csRegExpMatch 00132 { 00134 size_t startOffset; 00139 size_t endOffset; 00140 }; 00141 00153 class CS_CSUTIL_EXPORT csRegExpMatcher 00154 { 00155 void* regex; 00156 char* pattern; 00157 int compiledFlags; 00158 csRegExpMatchError compileError; 00159 bool extendedRE; 00160 00161 bool Compile (int flags, bool nosub); 00162 00163 public: 00170 csRegExpMatcher (const char* pattern, bool extendedRE = false); 00171 00173 ~csRegExpMatcher (); 00174 00184 csRegExpMatchError Match (const char* string, int flags = 0); 00185 00191 csRegExpMatchError Match (const char* string, 00192 csArray<csRegExpMatch>& matches, int flags = 0); 00193 }; 00194 00195 #endif // __CS_UTIL_REGEXP_H__
Generated for Crystal Space by doxygen 1.2.18