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
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>incron: strtok.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">incron
 <span id="projectnumber">0.5.10</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.7.5.1 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>File Members</span></a></li>
</ul>
</div>
<div class="header">
<div class="headertitle">
<div class="title">strtok.h</div> </div>
</div>
<div class="contents">
<a href="strtok_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001
<a name="l00003"></a>00003
<a name="l00023"></a>00023 <span class="preprocessor">#ifndef _STRTOK_H_</span>
<a name="l00024"></a>00024 <span class="preprocessor"></span><span class="preprocessor">#define _STRTOK_H_</span>
<a name="l00025"></a>00025 <span class="preprocessor"></span>
<a name="l00026"></a>00026
<a name="l00027"></a>00027 <span class="preprocessor">#include <string></span>
<a name="l00028"></a>00028
<a name="l00029"></a><a class="code" href="strtok_8h.html#ad7b52e937ae64097e49f3f82f423f237">00029</a> <span class="keyword">typedef</span> std::string::size_type <a class="code" href="strtok_8h.html#ad7b52e937ae64097e49f3f82f423f237">SIZE</a>;
<a name="l00030"></a>00030
<a name="l00032"></a>00032
<a name="l00054"></a><a class="code" href="classStringTokenizer.html">00054</a> <span class="keyword">class </span><a class="code" href="classStringTokenizer.html" title="Simple string tokenizer class.">StringTokenizer</a>
<a name="l00055"></a>00055 {
<a name="l00056"></a>00056 <span class="keyword">public</span>:
<a name="l00058"></a>00058
<a name="l00066"></a>00066 <a class="code" href="classStringTokenizer.html#aabacf484c3ed4e8d9f00801ecbe4881b" title="Constructor.">StringTokenizer</a>(<span class="keyword">const</span> std::string& rStr, <span class="keywordtype">char</span> cDelim = <span class="charliteral">','</span>, <span class="keywordtype">char</span> cPrefix = <span class="charliteral">'\0'</span>);
<a name="l00067"></a>00067
<a name="l00069"></a><a class="code" href="classStringTokenizer.html#a26a59cd69f871ace17ec831e1508b377">00069</a> <a class="code" href="classStringTokenizer.html#a26a59cd69f871ace17ec831e1508b377" title="Destructor.">~StringTokenizer</a>() {}
<a name="l00070"></a>00070
<a name="l00072"></a>00072
<a name="l00075"></a><a class="code" href="classStringTokenizer.html#af6f1497f3a3f18ff8c8c664782c4d6e2">00075</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classStringTokenizer.html#af6f1497f3a3f18ff8c8c664782c4d6e2" title="Checks whether the tokenizer can provide more tokens.">HasMoreTokens</a>()<span class="keyword"> const</span>
<a name="l00076"></a>00076 <span class="keyword"> </span>{
<a name="l00077"></a>00077 <span class="keywordflow">return</span> m_pos < m_len;
<a name="l00078"></a>00078 }
<a name="l00079"></a>00079
<a name="l00081"></a>00081
<a name="l00091"></a>00091 std::string <a class="code" href="classStringTokenizer.html#a62da00196f41b154dfb4c0969fd13f30" title="Returns the next token.">GetNextToken</a>(<span class="keywordtype">bool</span> fSkipEmpty = <span class="keyword">false</span>);
<a name="l00092"></a>00092
<a name="l00094"></a>00094
<a name="l00103"></a>00103 std::string <a class="code" href="classStringTokenizer.html#a4a089402dd2c2e486221f331bf2b77b6" title="Returns the next token.">GetNextTokenRaw</a>(<span class="keywordtype">bool</span> fSkipEmpty = <span class="keyword">false</span>);
<a name="l00104"></a>00104
<a name="l00106"></a>00106
<a name="l00116"></a>00116 std::string <a class="code" href="classStringTokenizer.html#a8f2379a3dd119a1e00aac7a710ac1e72" title="Returns the remainder of the source string.">GetRemainder</a>();
<a name="l00117"></a>00117
<a name="l00119"></a>00119
<a name="l00128"></a><a class="code" href="classStringTokenizer.html#a62764b5e11edee9ae256725bcc81b397">00128</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classStringTokenizer.html#a62764b5e11edee9ae256725bcc81b397" title="Sets a delimiter (separator) character.">SetDelimiter</a>(<span class="keywordtype">char</span> cDelim)
<a name="l00129"></a>00129 {
<a name="l00130"></a>00130 m_cDelim = cDelim;
<a name="l00131"></a>00131 }
<a name="l00132"></a>00132
<a name="l00134"></a>00134
<a name="l00137"></a><a class="code" href="classStringTokenizer.html#a2a553eebdd4848f0dcdfd63d3bd70ab3">00137</a> <span class="keyword">inline</span> <span class="keywordtype">char</span> <a class="code" href="classStringTokenizer.html#a2a553eebdd4848f0dcdfd63d3bd70ab3" title="Returns the delimiter (separator) character.">GetDelimiter</a>()<span class="keyword"> const</span>
<a name="l00138"></a>00138 <span class="keyword"> </span>{
<a name="l00139"></a>00139 <span class="keywordflow">return</span> m_cDelim;
<a name="l00140"></a>00140 }
<a name="l00141"></a>00141
<a name="l00143"></a>00143
<a name="l00151"></a><a class="code" href="classStringTokenizer.html#ab448703764e979812c857a1616411e79">00151</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classStringTokenizer.html#ab448703764e979812c857a1616411e79" title="Sets a prefix character.">SetPrefix</a>(<span class="keywordtype">char</span> cPrefix)
<a name="l00152"></a>00152 {
<a name="l00153"></a>00153 m_cPrefix = cPrefix;
<a name="l00154"></a>00154 }
<a name="l00155"></a>00155
<a name="l00157"></a>00157
<a name="l00160"></a><a class="code" href="classStringTokenizer.html#a74f70c56d6fac1eb0006b18f5ad82dcb">00160</a> <span class="keyword">inline</span> <span class="keywordtype">char</span> <a class="code" href="classStringTokenizer.html#a74f70c56d6fac1eb0006b18f5ad82dcb" title="Returns the prefix character.">GetPrefix</a>()<span class="keyword"> const</span>
<a name="l00161"></a>00161 <span class="keyword"> </span>{
<a name="l00162"></a>00162 <span class="keywordflow">return</span> m_cPrefix;
<a name="l00163"></a>00163 }
<a name="l00164"></a>00164
<a name="l00166"></a>00166
<a name="l00171"></a><a class="code" href="classStringTokenizer.html#a627a26cfed1b3159802a7f0cb54b40f5">00171</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classStringTokenizer.html#a627a26cfed1b3159802a7f0cb54b40f5" title="Sets the prefix to 'no prefix'.">SetNoPrefix</a>()
<a name="l00172"></a>00172 {
<a name="l00173"></a>00173 <a class="code" href="classStringTokenizer.html#ab448703764e979812c857a1616411e79" title="Sets a prefix character.">SetPrefix</a>(<span class="charliteral">'\0'</span>);
<a name="l00174"></a>00174 }
<a name="l00175"></a>00175
<a name="l00177"></a>00177
<a name="l00180"></a><a class="code" href="classStringTokenizer.html#a8084d41ec9c314128c01b6a361e62591">00180</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classStringTokenizer.html#a8084d41ec9c314128c01b6a361e62591" title="Resets the tokenizer.">Reset</a>()
<a name="l00181"></a>00181 {
<a name="l00182"></a>00182 m_pos = 0;
<a name="l00183"></a>00183 }
<a name="l00184"></a>00184
<a name="l00185"></a>00185 <span class="keyword">private</span>:
<a name="l00186"></a>00186 std::string m_str;
<a name="l00187"></a>00187 <span class="keywordtype">char</span> m_cDelim;
<a name="l00188"></a>00188 <span class="keywordtype">char</span> m_cPrefix;
<a name="l00189"></a>00189 std::string::size_type m_pos;
<a name="l00190"></a>00190 std::string::size_type m_len;
<a name="l00191"></a>00191
<a name="l00193"></a>00193
<a name="l00198"></a>00198 std::string StripPrefix(<span class="keyword">const</span> <span class="keywordtype">char</span>* s, <a class="code" href="strtok_8h.html#ad7b52e937ae64097e49f3f82f423f237">SIZE</a> cnt);
<a name="l00199"></a>00199
<a name="l00201"></a>00201
<a name="l00207"></a>00207 <span class="keywordtype">void</span> _GetNextToken(std::string& rToken, <span class="keywordtype">bool</span> fStripPrefix);
<a name="l00208"></a>00208
<a name="l00210"></a>00210
<a name="l00217"></a>00217 <span class="keywordtype">void</span> _GetNextTokenNoPrefix(std::string& rToken);
<a name="l00218"></a>00218
<a name="l00220"></a>00220
<a name="l00227"></a>00227 <span class="keywordtype">void</span> _GetNextTokenWithPrefix(std::string& rToken);
<a name="l00228"></a>00228 };
<a name="l00229"></a>00229
<a name="l00230"></a>00230
<a name="l00231"></a>00231 <span class="preprocessor">#endif //_STRTOK_H_</span>
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>
</body>
</html>
|