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 239 240 241 242 243 244 245 246 247
|
.TH ACE_Tokenizer 3 "1 Dec 2001" "ACE" \" -*- nroff -*-
.ad l
.nh
.SH NAME
ACE_Tokenizer \- Tokenizer.
.SH SYNOPSIS
.br
.PP
\fC#include <SString.h>\fR
.PP
.SS Public Types
.in +1c
.ti -1c
.RI "enum { \fBMAX_DELIMITERS\fR = 16, \fBMAX_PRESERVES\fR = 16 }"
.br
.in -1c
.SS Public Methods
.in +1c
.ti -1c
.RI "\fBACE_Tokenizer\fR (\fBACE_TCHAR\fR *buffer)"
.br
.ti -1c
.RI "int \fBdelimiter\fR (\fBACE_TCHAR\fR d)"
.br
.ti -1c
.RI "int \fBdelimiter_replace\fR (\fBACE_TCHAR\fR d, \fBACE_TCHAR\fR replacement)"
.br
.ti -1c
.RI "int \fBpreserve_designators\fR (\fBACE_TCHAR\fR start, \fBACE_TCHAR\fR stop, int strip=1)"
.br
.ti -1c
.RI "\fBACE_TCHAR\fR* \fBnext\fR (void)"
.br
.RI "\fIReturns the next token.\fR"
.in -1c
.SS Protected Methods
.in +1c
.ti -1c
.RI "int \fBis_delimiter\fR (\fBACE_TCHAR\fR d, int &replace, \fBACE_TCHAR\fR &r)"
.br
.RI "\fIReturns 1 if <d> is a delimiter, 0 otherwise. If <d> should be replaced with <r>, <replace> is set to 1, otherwise 0.\fR"
.ti -1c
.RI "int \fBis_preserve_designator\fR (\fBACE_TCHAR\fR start, \fBACE_TCHAR\fR &stop, int &strip)"
.br
.in -1c
.SS Protected Attributes
.in +1c
.ti -1c
.RI "\fBACE_TCHAR\fR* \fBbuffer_\fR"
.br
.ti -1c
.RI "int \fBindex_\fR"
.br
.ti -1c
.RI "\fBPreserve_Entry\fR \fBpreserves_\fR [MAX_PRESERVES]"
.br
.RI "\fIThe application can specify MAX_PRESERVES preserve designators.\fR"
.ti -1c
.RI "int \fBpreserves_index_\fR"
.br
.RI "\fIPointer to the next free spot in preserves_.\fR"
.ti -1c
.RI "\fBDelimiter_Entry\fR \fBdelimiters_\fR [MAX_DELIMITERS]"
.br
.RI "\fIThe tokenizer allows MAX_DELIMITERS number of delimiters.\fR"
.ti -1c
.RI "int \fBdelimiter_index_\fR"
.br
.RI "\fIPointer to the next free space in delimiters_.\fR"
.in -1c
.SH DETAILED DESCRIPTION
.PP
Tokenizer.
.PP
.PP
Tokenizes a buffer. Allows application to set delimiters and preserve designators. Does not allow special characters, yet (e.g., printf ("\\"like a quoted string\\"")).
.PP
.SH MEMBER ENUMERATION DOCUMENTATION
.PP
.SS anonymous enum
.PP
\fBEnumeration values:\fR
.in +1c
.TP
\fB\fIMAX_DELIMITERS\fR \fR
.TP
\fB\fIMAX_PRESERVES\fR \fR
.SH CONSTRUCTOR & DESTRUCTOR DOCUMENTATION
.PP
.SS ACE_Tokenizer::ACE_Tokenizer (\fBACE_TCHAR\fR * buffer)
.PP
\fIbuffer\fR will be parsed. Notice that ACE_Tokenizer will modify \fIbuffer\fR if you use \fC delimiter_replace \fR or \fC preserve_designators \fR to do character substitution. NOTE: You should NOT pass a constant string or string literal to this constructor, since ACE_Tokenizer will try to modify the string.
.PP
\fBSee also: \fR
.in +1c
\fBpreserve_designators\fR , \fBpreserve_designators\fR
.SH MEMBER FUNCTION DOCUMENTATION
.PP
.SS int ACE_Tokenizer::delimiter (\fBACE_TCHAR\fR d)
.PP
\fId\fR is a delimiter.
.PP
\fBReturns: \fR
.in +1c
Returns 0 on success, -1 if there is no memory left.
.PP
\fBExample:\fR
.PP
.nf
char buf[30];
ACE_OS::strcpy(buf, "William/Joseph/Hagins");
ACE_Tokenizer tok (buf);
tok.delimiter ('/');
for (char *p = tok.next (); p; p = tok.next ())
cout << p << endl;
.fi
.PP
This will print out:
.PP
.nf
William/Joseph/Hagins
Joseph/Hagins
Hagins
.fi
.SS int ACE_Tokenizer::delimiter_replace (\fBACE_TCHAR\fR d, \fBACE_TCHAR\fR replacement)
.PP
\fId\fR is a delimiter and, when found, will be replaced by \fIreplacement\fR.
.PP
\fBReturns: \fR
.in +1c
0 on success, -1 if there is no memory left.
.PP
\fBExample:\fR
.PP
.nf
ACE_Tokenizer tok ("William/Joseph/Hagins");
tok.delimiter_replace ('/', 0);
for (char *p = tok.next (); p; p = tok.next ())
cout << p << endl;
.fi
.PP
This will print out:
.PP
.nf
William
Joseph
Hagins
.fi
.SS int ACE_Tokenizer::is_delimiter (\fBACE_TCHAR\fR d, int & replace, \fBACE_TCHAR\fR & r)\fC [protected]\fR
.PP
Returns 1 if <d> is a delimiter, 0 otherwise. If <d> should be replaced with <r>, <replace> is set to 1, otherwise 0.
.PP
.SS int ACE_Tokenizer::is_preserve_designator (\fBACE_TCHAR\fR start, \fBACE_TCHAR\fR & stop, int & strip)\fC [protected]\fR
.PP
If <start> is a start preserve designator, returns 1 and sets <stop> to the stop designator. Returns 0 if <start> is not a preserve designator.
.SS \fBACE_TCHAR\fR * ACE_Tokenizer::next (void)
.PP
Returns the next token.
.PP
.SS int ACE_Tokenizer::preserve_designators (\fBACE_TCHAR\fR start, \fBACE_TCHAR\fR stop, int strip = 1)
.PP
Extract string between a pair of designator characters. For instance, quotes, or '(' and ')'. \fIstart\fR specifies the begin designator. \fIstop\fR specifies the end designator. \fIstrip\fR If \fIstrip\fR == 1, then the preserve designators will be stripped from the tokens returned by next.
.PP
\fBReturns: \fR
.in +1c
0 on success, -1 if there is no memory left.
.PP
\fBExample with strip = 0:\fR
.PP
.nf
ACE_Tokenizer tok ("William(Joseph)Hagins");
tok.preserve_designators ('(', ')', 0);
for (char *p = tok.next (); p; p = tok.next ())
cout << p << endl;
.fi
.PP
This will print out:
.PP
.nf
William(Joseph)Hagins
(Joseph)Hagins
)Hagins
.fi
.PP
\fBExample with strip = 1:\fR
.PP
.nf
ACE_Tokenizer tok ("William(Joseph)Hagins");
tok.preserve_designators ('(', ')', 1);
for (char *p = tok.next (); p; p = tok.next ())
cout << p << endl;
.fi
.PP
This will print out:
.PP
.nf
William
Joseph
Hagins
.fi
.SH MEMBER DATA DOCUMENTATION
.PP
.SS \fBACE_TCHAR\fR * ACE_Tokenizer::buffer_\fC [protected]\fR
.PP
.SS int ACE_Tokenizer::delimiter_index_\fC [protected]\fR
.PP
Pointer to the next free space in delimiters_.
.PP
.SS \fBDelimiter_Entry\fR ACE_Tokenizer::delimiters_[MAX_DELIMITERS]\fC [protected]\fR
.PP
The tokenizer allows MAX_DELIMITERS number of delimiters.
.PP
.SS int ACE_Tokenizer::index_\fC [protected]\fR
.PP
.SS \fBPreserve_Entry\fR ACE_Tokenizer::preserves_[MAX_PRESERVES]\fC [protected]\fR
.PP
The application can specify MAX_PRESERVES preserve designators.
.PP
.SS int ACE_Tokenizer::preserves_index_\fC [protected]\fR
.PP
Pointer to the next free spot in preserves_.
.PP
.SH AUTHOR
.PP
Generated automatically by Doxygen for ACE from the source code.
|