Poco

class Token

File Information

Library: Foundation
Package: Streams
Header: Poco/Token.h

Description

The base class for all token classes that can be registered with the StreamTokenizer.

Inheritance

Known Derived Classes: Poco::OSP::QLToken, Poco::OSP::OperatorToken, Poco::OSP::IdentifierToken, Poco::OSP::StringLiteralToken, Poco::OSP::RegExpToken, Poco::OSP::NumberLiteralToken, InvalidToken, EOFToken, WhitespaceToken, Poco::CppParser::CppToken, Poco::CppParser::OperatorToken, Poco::CppParser::IdentifierToken, Poco::CppParser::StringLiteralToken, Poco::CppParser::CharLiteralToken, Poco::CppParser::NumberLiteralToken, Poco::CppParser::CommentToken, Poco::CppParser::PreprocessorToken

Member Summary

Member Functions: asChar, asFloat, asInteger, asInteger64, asString, asUnsignedInteger, asUnsignedInteger64, finish, is, start, tokenClass, tokenString

Enumerations

Class

IDENTIFIER_TOKEN

KEYWORD_TOKEN

SEPARATOR_TOKEN

OPERATOR_TOKEN

STRING_LITERAL_TOKEN

CHAR_LITERAL_TOKEN

INTEGER_LITERAL_TOKEN

LONG_INTEGER_LITERAL_TOKEN

FLOAT_LITERAL_TOKEN

DOUBLE_LITERAL_TOKEN

COMMENT_TOKEN

SPECIAL_COMMENT_TOKEN

PREPROCESSOR_TOKEN

WHITESPACE_TOKEN

EOF_TOKEN

INVALID_TOKEN

USER_TOKEN

Constructors

Token

Token();

Creates the Token.

Destructor

~Token virtual

virtual ~Token();

Destroys the Token.

Member Functions

asChar virtual

virtual char asChar() const;

Returns a char representation of the token.

asFloat virtual

virtual double asFloat() const;

Returns a floating-point representation of the token.

asInteger virtual

virtual int asInteger() const;

Returns an integer representation of the token.

asInteger64 virtual

virtual Int64 asInteger64() const;

Returns a 64-bit integer representation of the token.

asString virtual

virtual std::string asString() const;

Returns a string representation of the token.

asUnsignedInteger virtual

virtual unsigned asUnsignedInteger() const;

Returns an unsigned integer representation of the token.

asUnsignedInteger64 virtual

virtual UInt64 asUnsignedInteger64() const;

Returns an unsigned 64-bit integer representation of the token.

finish virtual

virtual void finish(
    std::istream & istr
);

Builds the token by reading and appending the remaining characters from istr.

is inline

bool is(
    Class tokenClass
) const;

Returns true iff the token has the given class.

start virtual

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.

tokenClass virtual

virtual Class tokenClass() const;

Returns the kind of the token.

tokenString inline

const std::string & tokenString() const;

Returns the token's raw string.

Variables

_value protected

std::string _value;

Securely control IoT edge devices from anywhere   Connect a Device