Inheritance diagram for ReaderToken:
Public Member Functions | |
this (ITokenizer tk) | |
void | read (IReader r) |
Private Member Functions | |
ITokenizer | getTokenizer () |
bool | next (IBuffer buf) |
Static Private Member Functions | |
this () |
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 tw = new TextWriter (buf, ","); // write some stuff to the buffer tw << "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 r = new Reader (buf); // populate both tokens via reader r >> text >> number; // print them to the console Stdout << text << ':' << number << Stdout.newline;
Definition at line 159 of file TokenEx.d.
|
Construct a ReaderToken using the provided Tokenizer. Reimplemented from BoundToken. |
|
Read the next delimited element into this token. Reimplemented from IReadable. Definition at line 178 of file TokenEx.d. References IReader::getBuffer(). |
|
Construct a static exception instance. Definition at line 141 of file Token.d. References Token::Error. |
|
Return the associated tokenizer Definition at line 92 of file TokenEx.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:
Definition at line 118 of file TokenEx.d. References ITokenizer::next(), and BoundToken::tk. Referenced by StartLine::VersionUseTokenizer::parse(), HttpParams::parse(), HttpHeaders::parse(), ResponseLine::parse(), testFile2(), and testToken1(). |