Library: Foundation
Package: Streams
Header: Poco/Token.h
The base class for all token classes that can be registered with the StreamTokenizer.
Known Derived Classes: Poco::CppParser::OperatorToken, Poco::CppParser::CppToken, Poco::CppParser::IdentifierToken, Poco::CppParser::StringLiteralToken, Poco::CppParser::CharLiteralToken, Poco::CppParser::NumberLiteralToken, Poco::CppParser::CommentToken, Poco::CppParser::PreprocessorToken, InvalidToken, EOFToken, WhitespaceToken, Poco::OSP::QLToken, Poco::OSP::IdentifierToken, Poco::OSP::OperatorToken, Poco::OSP::StringLiteralToken, Poco::OSP::RegExpToken, Poco::OSP::NumberLiteralToken
Member Functions: asChar, asFloat, asInteger, asString, finish, is, start, tokenClass, tokenString
Token();
Creates the Token.
virtual ~Token();
Destroys the Token.
virtual char asChar() const;
Returns a char representation of the token.
virtual double asFloat() const;
Returns a floating-point representation of the token.
virtual int asInteger() const;
Returns an integer representation of the token.
virtual std::string asString() const;
Returns a string representation of the token.
virtual void finish(
std::istream & istr
);
Builds the token by reading and appending the remaining characters from istr.
bool is(
Class tokenClass
) const;
Returns true if and only if the token has the given class.
virtual bool start(
char c,
std::istream & istr
);
Checks if the given character (and, optionally, the next character in the input stream) start a valid token. Returns true if so, false otherwise.
The current read position in istr must not be changed. In other words, only the peek() method of istream may be used.
If the character starts the token, it should be set as the token's value.
virtual Class tokenClass() const;
Returns the kind of the token.
const std::string & tokenString() const;
Returns the token's raw string.
std::string _value;