Inheritance diagram for ReaderToken:
Public Member Functions | |
this (ITokenizer tk) | |
void | read (IReader r) |
Private Member Functions | |
ITokenizer | getTokenizer () |
bool | next (IBuffer buf) |
Here's a contrived example of how to use ReaderToken:
// create a small buffer on the heap Buffer buf = new Buffer (256); // write items with a comma between each TextWriter write = new TextWriter (buf, ","); // write some stuff to the buffer write ("now is the time for all good men") (3.14159); // bind a couple of tokens to a comma tokenizer ReaderToken text = new ReaderToken (Tokenizers.comma); ReaderToken number = new ReaderToken (Tokenizers.comma); // create any old reader since we only use it for handling tokens Reader read = new Reader (buf); // populate both tokens via reader read (text) (number); // print them to the console Stdout (text) (':') (number) (CR);
Definition at line 376 of file io/Token.d.
|
Construct a ReaderToken using the provided Tokenizer. Reimplemented from BoundToken. Definition at line 384 of file io/Token.d. |
|
Read the next delimited element into this token. Reimplemented from IReadable. Definition at line 395 of file io/Token.d. References IReader::getBuffer(), and ITokenizer::next(). |
|
Return the associated tokenizer Definition at line 309 of file io/Token.d. References BoundToken::tk. |
|
Extract the next token from the provided buffer. Returns true if a token was isolated, false if no more tokens were found. Note that one last token may still be present when this return false; this may happen if (for example) the last delimiter is missing before an EOF condition is seen. Check token.getLength() when this method returns false. For example:
while (token.next() || token.getLength()) // do something Definition at line 335 of file io/Token.d. References ITokenizer::next(), and BoundToken::tk. Referenced by StartLine::VersionUseTokenizer::parse(), HttpParams::parse(), HttpHeaders::parse(), and ResponseLine::parse(). |