<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>Crystal Space 1.2.1: csutil/regexp.h Source File (Crystal Space 1.2.1 Public API Reference)</title> <link href="tabs.css" rel="stylesheet" type="text/css"> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="head"> <tr height="59"> <td class="head" width="202" valign="bottom" style="padding-left:0;"><a href="http://www.crystalspace3d.org/"><img src="csblur.png" width="236" height="59" alt="CrystalSpace" border="0"></a></td> <td class="head"><h2>Public API Reference</h2></td> </tr> <tr height="11"> <td colspan="2" class="headshadow" valign="top" style="padding-left:0;"><img src="csblurb.png" width="236" height="11" alt="" border="0"></td> </tr> </table> <div class="content"> <!-- Generated by Doxygen 1.5.3 --> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="classes.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> </ul> </div> <h1>csutil/regexp.h</h1><a href="regexp_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> <a name="l00002"></a>00002 <span class="comment"> Copyright (C) 2004 by Frank Richter</span> <a name="l00003"></a>00003 <span class="comment"></span> <a name="l00004"></a>00004 <span class="comment"> This library is free software; you can redistribute it and/or</span> <a name="l00005"></a>00005 <span class="comment"> modify it under the terms of the GNU Library General Public</span> <a name="l00006"></a>00006 <span class="comment"> License as published by the Free Software Foundation; either</span> <a name="l00007"></a>00007 <span class="comment"> version 2 of the License, or (at your option) any later version.</span> <a name="l00008"></a>00008 <span class="comment"></span> <a name="l00009"></a>00009 <span class="comment"> This library is distributed in the hope that it will be useful,</span> <a name="l00010"></a>00010 <span class="comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00011"></a>00011 <span class="comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span> <a name="l00012"></a>00012 <span class="comment"> Library General Public License for more details.</span> <a name="l00013"></a>00013 <span class="comment"></span> <a name="l00014"></a>00014 <span class="comment"> You should have received a copy of the GNU Library General Public</span> <a name="l00015"></a>00015 <span class="comment"> License along with this library; if not, write to the Free</span> <a name="l00016"></a>00016 <span class="comment"> Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.</span> <a name="l00017"></a>00017 <span class="comment">*/</span> <a name="l00018"></a>00018 <a name="l00019"></a>00019 <span class="preprocessor">#ifndef __CS_UTIL_REGEXP_H__</span> <a name="l00020"></a>00020 <span class="preprocessor"></span><span class="preprocessor">#define __CS_UTIL_REGEXP_H__</span> <a name="l00021"></a>00021 <span class="preprocessor"></span> <a name="l00026"></a>00026 <span class="preprocessor">#include "csextern.h"</span> <a name="l00027"></a>00027 <span class="preprocessor">#include "<a class="code" href="csutil_2array_8h.html" title="Generic Array Template.">csutil/array.h</a>"</span> <a name="l00028"></a>00028 <a name="l00032"></a><a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13f">00032</a> <span class="keyword">enum</span> <a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13f" title="Possible errors that can occur during matching.">csRegExpMatchError</a> <a name="l00033"></a>00033 { <a name="l00035"></a><a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13f23218b27ac9cb13d1314dd2fe5d7fdf3">00035</a> <a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13f23218b27ac9cb13d1314dd2fe5d7fdf3" title="No problems during matching.">csrxNoError</a>, <a name="l00037"></a><a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13f7ced38ce226cf9947ba369eb53058d26">00037</a> <a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13f7ced38ce226cf9947ba369eb53058d26" title="The pattern didn&#39;t match the string.">csrxNoMatch</a>, <a name="l00043"></a><a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13fc4fcb5be2054406bc68c80efd0d1b36c">00043</a> <a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13fc4fcb5be2054406bc68c80efd0d1b36c" title="There was an invalid \{.">csrxBadBraces</a>, <a name="l00047"></a><a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13f868c78ca88806aea0c4077de232bf035">00047</a> <a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13f868c78ca88806aea0c4077de232bf035" title="There was a syntax error in the regular expression.">csrxBadPattern</a>, <a name="l00052"></a><a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13f43413ebc3c5ce3b9caefd70fcd9c5ba1">00052</a> <a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13f43413ebc3c5ce3b9caefd70fcd9c5ba1" title="A repetition operator such as ? or * appeared in a bad position (with no preceding...">csrxBadRepetition</a>, <a name="l00057"></a><a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13fefb5755d7da42e1092b4534228169965">00057</a> <a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13fefb5755d7da42e1092b4534228169965" title="The regular expression referred to an invalid collating element (one not defined...">csrxErrCollate</a>, <a name="l00061"></a><a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13f07822db12dd009219b1f65b26abb621a">00061</a> <a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13f07822db12dd009219b1f65b26abb621a" title="The regular expression referred to an invalid character class name.">csrxErrCharType</a>, <a name="l00065"></a><a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13f96f87ca6761f38a3d8fbd0c1f95232f8">00065</a> <a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13f96f87ca6761f38a3d8fbd0c1f95232f8" title="The regular expression ended with \.">csrxErrEscape</a>, <a name="l00069"></a><a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13f1533648b3060849f6e798388566f70af">00069</a> <a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13f1533648b3060849f6e798388566f70af" title="There was an invalid number in the \digit construct.">csrxErrSubReg</a>, <a name="l00073"></a><a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13f58360089a02e3adb7ddca92d9f20a3f3">00073</a> <a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13f58360089a02e3adb7ddca92d9f20a3f3" title="There were unbalanced square brackets in the regular expression.">csrxErrBrackets</a>, <a name="l00078"></a><a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13fd0f7a753221185b6da3b4cdd37e7b4ba">00078</a> <a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13fd0f7a753221185b6da3b4cdd37e7b4ba" title="An extended regular expression had unbalanced parentheses, or a basic regular expression...">csrxErrParentheses</a>, <a name="l00082"></a><a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13f60a78fac958ffbd5edfdaa684a396565">00082</a> <a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13f60a78fac958ffbd5edfdaa684a396565" title="The regular expression had unbalanced \{ and \}.">csrxErrBraces</a>, <a name="l00086"></a><a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13f582ed2fa4a40538d978ce9b76f1b8d80">00086</a> <a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13f582ed2fa4a40538d978ce9b76f1b8d80" title="One of the endpoints in a range expression was invalid.">csrxErrRange</a>, <a name="l00090"></a><a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13ff39cfb12b33fa439b3aa8bfbda6cfa02">00090</a> <a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13ff39cfb12b33fa439b3aa8bfbda6cfa02" title="Out of memory.">csrxErrSpace</a>, <a name="l00094"></a><a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13faae87077933d20e4abb1711fde7cd9ab">00094</a> <a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13faae87077933d20e4abb1711fde7cd9ab" title="Unknown error.">csrxErrUnknown</a> <a name="l00095"></a>00095 }; <a name="l00096"></a>00096 <a name="l00100"></a><a class="code" href="regexp_8h.html#d938c33b723e05f5d5a73ec768a317e4">00100</a> <span class="keyword">enum</span> <a class="code" href="regexp_8h.html#d938c33b723e05f5d5a73ec768a317e4" title="Flags for regular expression matching.">csRegExpMatchFlags</a> <a name="l00101"></a>00101 { <a name="l00105"></a><a class="code" href="regexp_8h.html#d938c33b723e05f5d5a73ec768a317e40cc39899830cc8740438b2b1272c1b5b">00105</a> <a class="code" href="regexp_8h.html#d938c33b723e05f5d5a73ec768a317e40cc39899830cc8740438b2b1272c1b5b" title="Ignore case when matching letters.">csrxIgnoreCase</a> = 1, <a name="l00114"></a><a class="code" href="regexp_8h.html#d938c33b723e05f5d5a73ec768a317e41820d801b9422fd3cb1bcbabdf3a2fc7">00114</a> <a class="code" href="regexp_8h.html#d938c33b723e05f5d5a73ec768a317e41820d801b9422fd3cb1bcbabdf3a2fc7" title="Treat a newline in string as dividing string into multiple lines, so that $ can match...">csrxNewLine</a> = 2, <a name="l00120"></a><a class="code" href="regexp_8h.html#d938c33b723e05f5d5a73ec768a317e4ba8707b3b4913da6f22442eae454b271">00120</a> <a class="code" href="regexp_8h.html#d938c33b723e05f5d5a73ec768a317e4ba8707b3b4913da6f22442eae454b271" title="Do not regard the beginning of the specified string as the beginning of a line; more...">csrxNotBOL</a> = 4, <a name="l00125"></a><a class="code" href="regexp_8h.html#d938c33b723e05f5d5a73ec768a317e492d05c63cb9e7b473f21804a381e3bef">00125</a> <a class="code" href="regexp_8h.html#d938c33b723e05f5d5a73ec768a317e492d05c63cb9e7b473f21804a381e3bef" title="Do not regard the end of the specified string as the end of a line; more generally...">csrxNotEOL</a> = 8 <a name="l00126"></a>00126 }; <a name="l00127"></a>00127 <a name="l00131"></a><a class="code" href="structcsRegExpMatch.html">00131</a> <span class="keyword">struct </span>CS_CRYSTALSPACE_EXPORT <a class="code" href="structcsRegExpMatch.html" title="Information about (sub)expression matches.">csRegExpMatch</a> <a name="l00132"></a>00132 { <a name="l00134"></a><a class="code" href="structcsRegExpMatch.html#ef8b424895ffc927787074737ce79b9d">00134</a> <span class="keywordtype">size_t</span> startOffset; <a name="l00139"></a><a class="code" href="structcsRegExpMatch.html#79b7b8c3fa4a0db9cb7e879b0e1222d2">00139</a> <span class="keywordtype">size_t</span> endOffset; <a name="l00140"></a>00140 }; <a name="l00141"></a>00141 <a name="l00153"></a><a class="code" href="classcsRegExpMatcher.html">00153</a> <span class="keyword">class </span>CS_CRYSTALSPACE_EXPORT <a class="code" href="classcsRegExpMatcher.html" title="Matcher for regular expressions.">csRegExpMatcher</a> <a name="l00154"></a>00154 { <a name="l00155"></a>00155 <span class="keywordtype">void</span>* regex; <a name="l00156"></a>00156 <span class="keywordtype">char</span>* pattern; <a name="l00157"></a>00157 <span class="keywordtype">int</span> compiledFlags; <a name="l00158"></a>00158 <a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13f" title="Possible errors that can occur during matching.">csRegExpMatchError</a> compileError; <a name="l00159"></a>00159 <span class="keywordtype">bool</span> extendedRE; <a name="l00160"></a>00160 <a name="l00161"></a>00161 <span class="keywordtype">bool</span> Compile (<span class="keywordtype">int</span> flags, <span class="keywordtype">bool</span> nosub); <a name="l00162"></a>00162 <a name="l00163"></a>00163 <span class="keyword">public</span>: <a name="l00170"></a>00170 <a class="code" href="classcsRegExpMatcher.html" title="Matcher for regular expressions.">csRegExpMatcher</a> (<span class="keyword">const</span> <span class="keywordtype">char</span>* pattern, <span class="keywordtype">bool</span> extendedRE = <span class="keyword">false</span>); <a name="l00171"></a>00171 <a name="l00173"></a>00173 <a class="code" href="classcsRegExpMatcher.html" title="Matcher for regular expressions.">csRegExpMatcher</a> (<span class="keyword">const</span> <a class="code" href="classcsRegExpMatcher.html" title="Matcher for regular expressions.">csRegExpMatcher</a>& other); <a name="l00174"></a>00174 <a name="l00176"></a>00176 ~<a class="code" href="classcsRegExpMatcher.html" title="Matcher for regular expressions.">csRegExpMatcher</a> (); <a name="l00177"></a>00177 <a name="l00179"></a>00179 <a class="code" href="classcsRegExpMatcher.html" title="Matcher for regular expressions.">csRegExpMatcher</a>& operator= (<span class="keyword">const</span> <a class="code" href="classcsRegExpMatcher.html" title="Matcher for regular expressions.">csRegExpMatcher</a> &other); <a name="l00180"></a>00180 <a name="l00190"></a>00190 <a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13f" title="Possible errors that can occur during matching.">csRegExpMatchError</a> Match (<span class="keyword">const</span> <span class="keywordtype">char</span>* <span class="keywordtype">string</span>, <span class="keywordtype">int</span> flags = 0); <a name="l00191"></a>00191 <a name="l00203"></a>00203 <a class="code" href="regexp_8h.html#89f80052ddcd1fa25c12f5d0578ed13f" title="Possible errors that can occur during matching.">csRegExpMatchError</a> Match (<span class="keyword">const</span> <span class="keywordtype">char</span>* <span class="keywordtype">string</span>, <a name="l00204"></a>00204 <a class="code" href="classcsArray.html" title="A templated array class.">csArray<csRegExpMatch></a>& matches, <span class="keywordtype">int</span> flags = 0); <a name="l00205"></a>00205 }; <a name="l00206"></a>00206 <a name="l00207"></a>00207 <span class="preprocessor">#endif // __CS_UTIL_REGEXP_H__</span> </pre></div><hr size="1"><address><small>Generated for Crystal Space 1.2.1 by <a href="http://www.doxygen.org/index.html">doxygen</a> 1.5.3 </small></address> </div></body> </html>