File: tokenizer.htm

package info (click to toggle)
boost1.35 1.35.0-5
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 203,856 kB
  • ctags: 337,867
  • sloc: cpp: 938,683; xml: 56,847; ansic: 41,589; python: 18,999; sh: 11,566; makefile: 664; perl: 494; yacc: 456; asm: 353; csh: 6
file content (238 lines) | stat: -rw-r--r-- 5,562 bytes parent folder | download | duplicates (2)
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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
  <meta http-equiv="Content-Language" content="en-us">
  <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
  <meta name="GENERATOR" content="Microsoft FrontPage 6.0">
  <meta name="ProgId" content="FrontPage.Editor.Document">

  <title>Boost Tokenizer Class</title>
</head>

<body bgcolor="#FFFFFF" text="#000000" link="#0000EE" vlink="#551A8B" alink=
"#FF0000">
  <p><img src="../../boost.png" alt="C++ Boost" width="277" height=
  "86"><br></p>

  <h1 align="center">Tokenizer Class</h1>
  <pre>
  template &lt;
        class TokenizerFunc = char_delimiters_separator&lt;char&gt;, 
        class Iterator = std::string::const_iterator,
        class Type = std::string
  &gt;
  class tokenizer
</pre>

  <p>The tokenizer class provides a container view of a series of tokens
  contained in a sequence. You set the sequence to parse and the
  TokenizerFunction to use to parse the sequence either upon construction or
  using the assign member function. Note: No parsing is actually done upon
  construction. Parsing is done on demand as the tokens are accessed via the
  iterator provided by begin.</p>

  <h2>Example</h2>
  <pre>
// simple_example_1.cpp
#include&lt;iostream&gt;
#include&lt;boost/tokenizer.hpp&gt;
#include&lt;string&gt;

int main(){
   using namespace std;
   using namespace boost;
   string s = "This is,  a test";
   tokenizer&lt;&gt; tok(s);
   for(tokenizer&lt;&gt;::iterator beg=tok.begin(); beg!=tok.end();++beg){
       cout &lt;&lt; *beg &lt;&lt; "\n";
   }
}
</pre>

  <p>&nbsp;</p>

  <h3>Template Parameters</h3>

  <table border="1" summary="">
    <tr>
      <th>Parameter</th>

      <th>Description</th>
    </tr>

    <tr>
      <td><tt>TokenizerFunc</tt></td>

      <td>The TokenizerFunction used to parse the sequence.</td>
    </tr>

    <tr>
      <td><tt>Iterator</tt></td>

      <td>The type of the iterator the specifies the sequence.</td>
    </tr>

    <tr>
      <td><tt>Type</tt></td>

      <td>The type of the token, typically string.</td>
    </tr>
  </table>

  <p>&nbsp;</p>

  <h2>Related Types</h2>

  <table border="1" summary="">
    <tr>
      <td>
        <p align="center"><strong>Type</strong></p>
      </td>

      <td>
        <p align="center"><strong>Remarks</strong></p>
      </td>
    </tr>

    <tr>
      <td>iterator</td>

      <td>The type returned by begin and end. Note: the category of iterator
      will be at most ForwardIterator. It will be InputIterator if the
      Iterator template parameter is an InputIterator. For any other
      category, it will be ForwardIterator.</td>
    </tr>

    <tr>
      <td>const_iterator</td>

      <td>Same type as iterator.</td>
    </tr>

    <tr>
      <td>value_type</td>

      <td>Same type as the template parameter Type</td>
    </tr>

    <tr>
      <td>reference</td>

      <td>Same type as value_type&amp;</td>
    </tr>

    <tr>
      <td>const_reference</td>

      <td>Same type as const reference</td>
    </tr>

    <tr>
      <td>pointer</td>

      <td>Same type as value_type*</td>
    </tr>

    <tr>
      <td>const_pointer</td>

      <td>Same type as const pointer</td>
    </tr>

    <tr>
      <td>size_type</td>

      <td>void</td>
    </tr>

    <tr>
      <td>difference_type</td>

      <td>void</td>
    </tr>
  </table>

  <p>&nbsp;</p>

  <h2>Construction and Member Functions</h2>
  <pre>
tokenizer(Iterator first, Iterator last,const TokenizerFunc&amp; f = TokenizerFunc()) 

template&lt;class Container&gt;
tokenizer(const Container&amp; c,const TokenizerFunc&amp; f = TokenizerFunc())

void assign(Iterator first, Iterator last)

void assign(Iterator first, Iterator last, const TokenizerFunc&amp; f)

template&lt;class Container&gt;
void assign(const Container&amp; c)

template&lt;class Container&gt;
void assign(const Container&amp; c, const TokenizerFunc&amp; f)

iterator begin() const 

iterator end() const
</pre>

  <table border="1" summary="">
    <tr>
      <td>
        <p align="center"><strong>Parameter</strong></p>
      </td>

      <td>
        <p align="center"><strong>Description</strong></p>
      </td>
    </tr>

    <tr>
      <td>c</td>

      <td>A container that contains the sequence to parse. Note: c.begin()
      and c.end() must be convertible to the template parameter
      Iterator.</td>
    </tr>

    <tr>
      <td>f</td>

      <td>A functor that is a model of TokenizerFunction that will be used to
      parse the sequence.</td>
    </tr>

    <tr>
      <td>first</td>

      <td>The iterator that represents the beginning position in the sequence
      to be parsed.</td>
    </tr>

    <tr>
      <td>last</td>

      <td>The iterator that represents the past the end position in the
      sequence to be parsed.</td>
    </tr>
  </table>

  <p>&nbsp;</p>
  <hr>

  <p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
  "http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional"
  height="31" width="88"></a></p>

  <p>Revised 
  <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->25 December, 2006<!--webbot bot="Timestamp" endspan i-checksum="38518" --></p>

  <p><i>Copyright &copy; 2001 John R. Bandela</i></p>

  <p><i>Distributed under the Boost Software License, Version 1.0. (See
  accompanying file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
  copy at <a href=
  "http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</i></p>
</body>
</html>