/usr/share/doc/libpcre++-dev/pcre++_8h-source.html is in libpcre++-dev 0.9.5-5.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | <!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>pcre++.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3-rc3 -->
<center>
<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center>
<hr><h1>pcre++.h</h1><a href="pcre++_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span>
00002 <span class="comment"> *</span>
00003 <span class="comment"> * This file is part of the PCRE++ Class Library.</span>
00004 <span class="comment"> *</span>
00005 <span class="comment"> * By accessing this software, PCRE++, you are duly informed</span>
00006 <span class="comment"> * of and agree to be bound by the conditions described below</span>
00007 <span class="comment"> * in this notice:</span>
00008 <span class="comment"> *</span>
00009 <span class="comment"> * This software product, PCRE++, is developed by Thomas Linden</span>
00010 <span class="comment"> * and copyrighted (C) 2002-2003 by Thomas Linden,with all rights </span>
00011 <span class="comment"> * reserved.</span>
00012 <span class="comment"> *</span>
00013 <span class="comment"> * There is no charge for PCRE++ software. You can redistribute</span>
00014 <span class="comment"> * it and/or modify it under the terms of the GNU Lesser General</span>
00015 <span class="comment"> * Public License, which is incorporated by reference herein.</span>
00016 <span class="comment"> *</span>
00017 <span class="comment"> * PCRE++ is distributed WITHOUT ANY WARRANTY, IMPLIED OR EXPRESS,</span>
00018 <span class="comment"> * OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE or that</span>
00019 <span class="comment"> * the use of it will not infringe on any third party's intellec-</span>
00020 <span class="comment"> * tual property rights.</span>
00021 <span class="comment"> *</span>
00022 <span class="comment"> * You should have received a copy of the GNU Lesser General Public</span>
00023 <span class="comment"> * License along with PCRE++. Copies can also be obtained from:</span>
00024 <span class="comment"> *</span>
00025 <span class="comment"> * http://www.gnu.org/licenses/lgpl.txt</span>
00026 <span class="comment"> *</span>
00027 <span class="comment"> * or by writing to:</span>
00028 <span class="comment"> *</span>
00029 <span class="comment"> * Free Software Foundation, Inc.</span>
00030 <span class="comment"> * 59 Temple Place, Suite 330</span>
00031 <span class="comment"> * Boston, MA 02111-1307</span>
00032 <span class="comment"> * USA</span>
00033 <span class="comment"> *</span>
00034 <span class="comment"> * Or contact:</span>
00035 <span class="comment"> *</span>
00036 <span class="comment"> * "Thomas Linden" <tom@daemon.de></span>
00037 <span class="comment"> *</span>
00038 <span class="comment"> *</span>
00039 <span class="comment"> */</span>
00040
00041 <span class="preprocessor">#ifndef HAVE_PCRE_PP_H</span>
00042 <span class="preprocessor"></span><span class="preprocessor">#define HAVE_PCRE_PP_H</span>
00043 <span class="preprocessor"></span>
00044 <span class="preprocessor">#include <string></span>
00045 <span class="preprocessor">#include <sstream></span>
00046 <span class="preprocessor">#include <vector></span>
00047 <span class="preprocessor">#include <map></span>
00048 <span class="preprocessor">#include <stdexcept></span>
00049 <span class="preprocessor">#include <iostream></span>
00050
00051
00052 <span class="keyword">extern</span> <span class="stringliteral">"C"</span> {
00053 <span class="preprocessor"> #include <pcre.h></span>
00054 <span class="preprocessor"> #include <locale.h></span>
00055 }
00056
<a name="l00057"></a><a class="code" href="namespacepcrepp.html">00057</a> <span class="keyword">namespace </span>pcrepp {
00058
00059 <span class="preprocessor">#ifdef DEBUG</span>
00060 <span class="preprocessor"></span><span class="preprocessor">#define __pcredebug cerr << "(pcre++ DEBUG) " << __LINE__ << ": " </span>
00061 <span class="preprocessor"></span><span class="preprocessor">#else</span>
<a name="l00062"></a><a class="code" href="pcre++_8h.html#a0">00062</a> <span class="preprocessor"></span><span class="preprocessor">#define __pcredebug if(0) cerr </span>
00063 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00064 <span class="preprocessor"></span>
<a name="l00068"></a><a class="code" href="pcre++_8h.html#a1">00068</a> <span class="preprocessor">#define PCRE_GLOBAL 0x10000</span>
00069 <span class="preprocessor"></span>
00070
<a name="l00099"></a><a class="code" href="classpcrepp_1_1Pcre.html">00099</a> <span class="keyword">class </span><a class="code" href="classpcrepp_1_1Pcre.html">Pcre</a> {
00100 <span class="keyword">private</span>:
00101 std::string _expression; <span class="comment">/* the given regular expression */</span>
00102 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> _flags; <span class="comment">/* the given flags, 0 if not defined */</span>
00103 <span class="keywordtype">bool</span> case_t, global_t; <span class="comment">/* internal compile flags, used by replace() and split() */</span>
00104 pcre *p_pcre; <span class="comment">/* pcre object pointer */</span>
00105 pcre_extra *p_pcre_extra; <span class="comment">/* stuff required by pcre lib */</span>
00106 <span class="keywordtype">int</span> sub_len;
00107 <span class="keywordtype">int</span> *sub_vec;
00108 <span class="keywordtype">int</span> erroffset;
00109 <span class="keywordtype">char</span> *err_str;
00110 std::vector<std::string> *resultset; <span class="comment">/* store substrings, if any */</span>
00111 <span class="keywordtype">bool</span> _have_paren; <span class="comment">/* indicate wether we have already parentesis applied in replace */</span>
00112
00113 <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *tables; <span class="comment">/* locale tables */</span>
00114
00115 <span class="keywordtype">bool</span> did_match;
00116 <span class="keywordtype">int</span> num_matches;
00118 <span class="comment">/* reset all counters and free objects, prepare for another search */</span>
00119 <span class="keywordtype">void</span> reset();
00120
00121 <span class="comment">/* compile the pattern */</span>
00122 <span class="keywordtype">void</span> Compile(<span class="keywordtype">int</span> flags);
00123
00124 <span class="comment">/* do the actual search, will be called by the public ::search(..) methods */</span>
00125 <span class="keywordtype">bool</span> dosearch(<span class="keyword">const</span> std::string& stuff, <span class="keywordtype">int</span> OffSet);
00126
00127 <span class="comment">/* do the actual split() job, called by the various wrapper split() methods */</span>
00128 std::vector<std::string> _split(<span class="keyword">const</span> std::string& piece, <span class="keywordtype">int</span> limit, <span class="keywordtype">int</span> start_offset, <span class="keywordtype">int</span> end_offset);
00129
00130 <span class="comment">/* replace $1 .. $n with the corresponding substring, used by replace() */</span>
00131 std::string _replace_vars(<span class="keyword">const</span> std::string& piece);
00132
00133 <span class="comment">/* init pointers with NULL */</span>
00134 <span class="keywordtype">void</span> zero();
00135
00136 std::map<std::string,std::string> info();
00137 std::string info(<span class="keywordtype">int</span> what);
00138
00139 <span class="keyword">public</span>:
00140
<a name="l00158"></a><a class="code" href="classpcrepp_1_1Pcre_1_1exception.html">00158</a> <span class="keyword">class </span><a class="code" href="classpcrepp_1_1Pcre_1_1exception.html">exception</a> : <span class="keyword">public</span> std::runtime_error {
00159 <span class="keyword">private</span>:
00160 std::string translate(<span class="keywordtype">int</span> num) {
00161 std::string msg;
00162 <span class="keywordflow">switch</span>(num) {
00163 <span class="keywordflow">case</span> -1: msg = <span class="stringliteral">"PCRE_ERROR_NOMATCH"</span>; <span class="keywordflow">break</span>;
00164 <span class="keywordflow">case</span> -2: msg = <span class="stringliteral">"PCRE_ERROR_NULL"</span>; <span class="keywordflow">break</span>;
00165 <span class="keywordflow">case</span> -3: msg = <span class="stringliteral">"PCRE_ERROR_BADOPTION"</span>; <span class="keywordflow">break</span>;
00166 <span class="keywordflow">case</span> -4: msg = <span class="stringliteral">"PCRE_ERROR_BADMAGIC"</span>; <span class="keywordflow">break</span>;
00167 <span class="keywordflow">case</span> -5: msg = <span class="stringliteral">"PCRE_ERROR_UNKNOWN_NODE"</span>; <span class="keywordflow">break</span>;
00168 <span class="keywordflow">case</span> -6: msg = <span class="stringliteral">"PCRE_ERROR_NOMEMORY"</span>; <span class="keywordflow">break</span>;
00169 <span class="keywordflow">case</span> -7: msg = <span class="stringliteral">"PCRE_ERROR_NOSUBSTRING"</span>; <span class="keywordflow">break</span>;
00170 <span class="comment">// pcre4-HINT: add PCRE_ERROR_MATCHLIMIT support</span>
00171 }
00172 <span class="keywordflow">return</span> msg;
00173 }
00174 <span class="keyword">public</span>:
<a name="l00175"></a><a class="code" href="classpcrepp_1_1Pcre_1_1exception.html#a0">00175</a> <a class="code" href="classpcrepp_1_1Pcre_1_1exception.html#a0">exception</a>(<span class="keyword">const</span> std::string & msg) : runtime_error(msg) { }
<a name="l00176"></a><a class="code" href="classpcrepp_1_1Pcre_1_1exception.html#a1">00176</a> <a class="code" href="classpcrepp_1_1Pcre_1_1exception.html#a0">exception</a>(<span class="keywordtype">int</span> num) : runtime_error(translate(num)) { }
00177 };
00178
00179
00191 <a class="code" href="classpcrepp_1_1Pcre.html#a0">Pcre</a>();
00192
00202 <a class="code" href="classpcrepp_1_1Pcre.html#a0">Pcre</a>(<span class="keyword">const</span> std::string& expression);
00203
00230 <a class="code" href="classpcrepp_1_1Pcre.html#a0">Pcre</a>(<span class="keyword">const</span> std::string& expression, <span class="keyword">const</span> std::string& flags);
00231
00257 <a class="code" href="classpcrepp_1_1Pcre.html#a0">Pcre</a>(<span class="keyword">const</span> std::string& expression, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> flags);
00258
00266 <a class="code" href="classpcrepp_1_1Pcre.html#a0">Pcre</a>(<span class="keyword">const</span> Pcre &P);
00267
00278 <span class="keyword">const</span> <a class="code" href="classpcrepp_1_1Pcre.html#a0">Pcre</a>& <a class="code" href="classpcrepp_1_1Pcre.html#a5">operator = </a>(<span class="keyword">const</span> std::string& expression);
00279
00292 <span class="keyword">const</span> <a class="code" href="classpcrepp_1_1Pcre.html#a0">Pcre</a>& <a class="code" href="classpcrepp_1_1Pcre.html#a5">operator = </a>(<span class="keyword">const</span> Pcre &P);
00293
00299 <a class="code" href="classpcrepp_1_1Pcre.html#a7">~Pcre</a>();
00300
00307 <span class="keywordtype">bool</span> <a class="code" href="classpcrepp_1_1Pcre.html#a8">search</a>(<span class="keyword">const</span> std::string& stuff);
00308
00316 <span class="keywordtype">bool</span> <a class="code" href="classpcrepp_1_1Pcre.html#a8">search</a>(<span class="keyword">const</span> std::string& stuff, <span class="keywordtype">int</span> OffSet);
00317
00322 std::vector<std::string>* <a class="code" href="classpcrepp_1_1Pcre.html#a10">get_sub_strings</a>() <span class="keyword">const</span>;
00323
00338 std::string <a class="code" href="classpcrepp_1_1Pcre.html#a11">get_match</a>(<span class="keywordtype">int</span> pos) <span class="keyword">const</span>;
00339
00360 <span class="keywordtype">int</span> <a class="code" href="classpcrepp_1_1Pcre.html#a14">get_match_start</a>(<span class="keywordtype">int</span> pos) <span class="keyword">const</span>;
00361
00382 <span class="keywordtype">int</span> <a class="code" href="classpcrepp_1_1Pcre.html#a15">get_match_end</a>(<span class="keywordtype">int</span> pos) <span class="keyword">const</span>;
00383
00384
00385
00386
00405 <span class="keywordtype">int</span> <a class="code" href="classpcrepp_1_1Pcre.html#a14">get_match_start</a>() <span class="keyword">const</span>;
00406
00426 <span class="keywordtype">int</span> <a class="code" href="classpcrepp_1_1Pcre.html#a15">get_match_end</a>() <span class="keyword">const</span>;
00427
00428
00429
00430
00438 size_t <a class="code" href="classpcrepp_1_1Pcre.html#a16">get_match_length</a>(<span class="keywordtype">int</span> pos) <span class="keyword">const</span>;
00439
<a name="l00444"></a><a class="code" href="classpcrepp_1_1Pcre.html#a17">00444</a> <span class="keywordtype">bool</span> <a class="code" href="classpcrepp_1_1Pcre.html#a17">matched</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> did_match; };
00445
<a name="l00449"></a><a class="code" href="classpcrepp_1_1Pcre.html#a18">00449</a> <span class="keywordtype">int</span> <a class="code" href="classpcrepp_1_1Pcre.html#a18">matches</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> num_matches; }
00450
00451
00464 std::vector<std::string> <a class="code" href="classpcrepp_1_1Pcre.html#a19">split</a>(<span class="keyword">const</span> std::string& piece);
00465
00479 std::vector<std::string> <a class="code" href="classpcrepp_1_1Pcre.html#a19">split</a>(<span class="keyword">const</span> std::string& piece, <span class="keywordtype">int</span> limit);
00480
00495 std::vector<std::string> <a class="code" href="classpcrepp_1_1Pcre.html#a19">split</a>(<span class="keyword">const</span> std::string& piece, <span class="keywordtype">int</span> limit, <span class="keywordtype">int</span> start_offset);
00496
00512 std::vector<std::string> <a class="code" href="classpcrepp_1_1Pcre.html#a19">split</a>(<span class="keyword">const</span> std::string& piece, <span class="keywordtype">int</span> limit, <span class="keywordtype">int</span> start_offset, <span class="keywordtype">int</span> end_offset);
00513
00527 std::vector<std::string> <a class="code" href="classpcrepp_1_1Pcre.html#a19">split</a>(<span class="keyword">const</span> std::string& piece, std::vector<int> positions);
00528
00537 std::string <a class="code" href="classpcrepp_1_1Pcre.html#a24">replace</a>(<span class="keyword">const</span> std::string& piece, <span class="keyword">const</span> std::string& with);
00538
00550 pcre* <a class="code" href="classpcrepp_1_1Pcre.html#a25">get_pcre</a>();
00551
00559 pcre_extra* <a class="code" href="classpcrepp_1_1Pcre.html#a26">get_pcre_extra</a>();
00560
00567 <span class="keywordtype">void</span> <a class="code" href="classpcrepp_1_1Pcre.html#a27">study</a>();
00568
00576 <span class="keywordtype">bool</span> <a class="code" href="classpcrepp_1_1Pcre.html#a28">setlocale</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* locale);
00577
<a name="l00594"></a><a class="code" href="classpcrepp_1_1Pcre.html#a29">00594</a> std::string <a class="code" href="classpcrepp_1_1Pcre.html#a29">operator[]</a>(<span class="keywordtype">int</span> index) {
00595 <span class="keywordflow">return</span> <a class="code" href="classpcrepp_1_1Pcre.html#a11">get_match</a>(index);
00596 }
00597 };
00598
00599 } <span class="comment">// end namespace pcre</span>
00600
00601 <span class="preprocessor">#endif // HAVE_PCRE_PP_H</span>
</pre></div><hr><address style="align: right;"><small>Generated on Wed Aug 25 01:38:04 2004 for PCRE++ by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0
width=110 height=53></a>1.3-rc3 </small></address>
</body>
</html>
|