Crystal Space: csutil/regexp.h Source File (Crystal Space Public API Reference)

| ## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# 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   csrxNoError,
    00037   csrxNoMatch,
    00043   csrxBadBraces,
    00047   csrxBadPattern,
    00052   csrxBadRepetition,
    00057   csrxErrCollate,
    00061   csrxErrCharType,
    00065   csrxErrEscape,
    00069   csrxErrSubReg,
    00073   csrxErrBrackets,
    00078   csrxErrParentheses,
    00082   csrxErrBraces,
    00086   csrxErrRange,
    00090   csrxErrSpace,
    00094   csrxErrUnknown
    00095 };
    00096
    00100 enum csRegExpMatchFlags
    00101 {
    00105   csrxIgnoreCase = 1,
    00114   csrxNewLine = 2,
    00120   csrxNotBOL = 4,
    00125   csrxNotEOL = 8
    00126 };
    00127
    00131 struct CS_CRYSTALSPACE_EXPORT csRegExpMatch
    00132 {
    00134   size_t startOffset;
    00139   size_t endOffset;
    00140 };
    00141
    00153 class CS_CRYSTALSPACE_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 (const csRegExpMatcher& other);
    00174
    00176   ~csRegExpMatcher ();
    00177
    00179   csRegExpMatcher& operator= (const csRegExpMatcher &other);
    00180
    00190   csRegExpMatchError Match (const char* string, int flags = 0);
    00191
    00203   csRegExpMatchError Match (const char* string,
    00204     csArray<csRegExpMatch>& matches, int flags = 0);
    00205 };
    00206
    00207 #endif // __CS_UTIL_REGEXP_H__