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
|
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<title>Boost Token Iterator</title>
<!--
-- Copyright John Bandela 2001
--
-- Permission to use, copy, modify, distribute and sell this software
-- and its documentation for any purpose is hereby granted without fee,
-- provided that the above copyright notice appears in all copies and
-- that both that copyright notice and this permission notice appear
-- in supporting documentation. Jeremy Siek makes no
-- representations about the suitability of this software for any
-- purpose. It is provided "as is" without express or implied warranty.
-->
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#0000EE"
vlink="#551A8B" alink="#FF0000">
<p><img src="../../c++boost.gif" alt="C++ Boost" width="277"
height="86"> <br>
</p>
<h1 align="center">Token Iterator</h1>
<pre>
template <
class TokenizerFunc = char_delimiters_separator<char>,
class Iterator = std::string::const_iterator,
class Type = std::string
>
class token_iterator_generator </pre>
<pre>template<class Type, class Iterator, class TokenizerFunc>
typename token_iterator_generator<TokenizerFunc,Iterator,Type>::type
make_token_iterator(Iterator begin, Iterator end,const TokenizerFunc& fun)
</pre>
<p>The token iterator serves to provide an iterator view of the
tokens in a parsed sequence.</p>
<h2>Example</h2>
<pre>
/// simple_example_5.cpp
#include<iostream>
#include<boost/token_iterator.hpp>
#include<string>
int main(){
using namespace std;
using namespace boost;
string s = "12252001";
int offsets[] = {2,2,4};
offset_separator f(offsets, offsets+3);
typedef token_iterator_generator<offset_separator>::type Iter;
Iter beg = make_token_iterator<string>(s.begin(),s.end(),f);
Iter end = make_token_iterator<string>(s.end(),s.end(),f);
// The above statement could also have been what is below
// Iter end;
for(;beg!=end;++beg){
cout << *beg << "\n";
}
}
</pre>
<pre>
</pre>
<p> </p>
<h3>Template Parameters</h3>
<table border="1">
<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>
<h2>Model of</h2>
<p>The category of Iterator, up to and including Forward Iterator.
Anything higher will get scaled down to Forward Iterator.</p>
<h2>Related Types</h2>
<table border="1">
<tr>
<td><p align="center"><strong>Type</strong></p>
</td>
<td><p align="center"><strong>Remarks</strong></p>
</td>
</tr>
<tr>
<td>token_iterator_generator::type</td>
<td>The type of the token iterator.</td>
</tr>
</table>
<h2>Creation</h2>
<pre>template<class Type, class Iterator, class TokenizerFunc>
typename token_iterator_generator<TokenizerFunc,Iterator,Type>::type
make_token_iterator(Iterator begin, Iterator end,const TokenizerFunc& fun)</pre>
<table border="1">
<tr>
<td><p align="center"><strong>Parameter</strong></p>
</td>
<td><p align="center"><strong>Description</strong></p>
</td>
</tr>
<tr>
<td>begin</td>
<td>The beginning of the sequence to be parsed.</td>
</tr>
<tr>
<td>end</td>
<td>Past the end of the sequence to be parsed.</td>
</tr>
<tr>
<td>fun</td>
<td>A functor that is a model of TokenizerFunction</td>
</tr>
</table>
<p> </p>
<hr>
<p> Copyright John R. Bandela 2001. Permission to copy, use,
modify, sell and distribute this document is granted provided
this copyright notice appears in all copies. This document is
provided "as is" without express or implied warranty,
and with no claim as to its suitability for any purpose.</p>
</body>
</html>
|