A token holds items read from Istream. More...
#include <OpenFOAM/token.H>
A token holds items read from Istream.
Classes | |
class | Compound |
A templated class for holding compound tokens. More... | |
class | compound |
Abstract base class for complex tokens. More... |
Public Types | |
enum | tokenType { UNDEFINED, PUNCTUATION, WORD, STRING, LABEL, FLOAT_SCALAR, DOUBLE_SCALAR, COMPOUND, ERROR } |
Enumeration defining the types of token. More... | |
enum | punctuationToken { NULL_TOKEN = '\0', SPACE = ' ', TAB = '\t', NL = '\n', END_STATEMENT = ';', BEGIN_LIST = '(', END_LIST = ')', BEGIN_SQR = '[', END_SQR = ']', BEGIN_BLOCK = '{', END_BLOCK = '}', COLON = ':', COMMA = ',', BEGIN_STRING = '"', END_STRING = BEGIN_STRING, ASSIGN = '=', ADD = '+', SUBTRACT = '-', MULTIPLY = '*', DIVIDE = '/' } |
Standard punctuation tokens. More... |
Public Member Functions | |
token () | |
Construct null. | |
token (const token &) | |
Construct as copy. | |
token (punctuationToken, label lineNumber=0) | |
Construct punctuation character token. | |
token (const word &, label lineNumber=0) | |
Construct word token. | |
token (const string &, label lineNumber=0) | |
Construct string token. | |
token (const label, label lineNumber=0) | |
Construct label token. | |
token (const floatScalar, label lineNumber=0) | |
Construct floatScalar token. | |
token (const doubleScalar, label lineNumber=0) | |
Construct doubleScalar token. | |
token (Istream &) | |
Construct from Istream. | |
~token () | |
tokenType | type () const |
bool | good () const |
bool | undefined () const |
bool | error () const |
bool | isPunctuation () const |
punctuationToken | pToken () const |
bool | isWord () const |
const word & | wordToken () const |
bool | isString () const |
const string & | stringToken () const |
bool | isLabel () const |
label | labelToken () const |
bool | isFloatScalar () const |
floatScalar | floatScalarToken () const |
bool | isDoubleScalar () const |
doubleScalar | doubleScalarToken () const |
bool | isScalar () const |
scalar | scalarToken () const |
bool | isNumber () const |
scalar | number () const |
bool | isCompound () const |
const compound & | compoundToken () const |
compound & | transferCompoundToken () |
label | lineNumber () const |
label & | lineNumber () |
void | setBad () |
Set bad. | |
InfoProxy< token > | info () const |
Return info proxy. | |
void | operator= (const token &) |
void | operator= (const punctuationToken) |
void | operator= (word *) |
void | operator= (const word &) |
void | operator= (string *) |
void | operator= (const string &) |
void | operator= (const label) |
void | operator= (const floatScalar) |
void | operator= (const doubleScalar) |
void | operator= (compound *) |
bool | operator== (const token &) const |
bool | operator== (const punctuationToken) const |
bool | operator== (const word &) const |
bool | operator== (const string &) const |
bool | operator== (const label) const |
bool | operator== (const floatScalar) const |
bool | operator== (const doubleScalar) const |
bool | operator!= (const token &) const |
bool | operator!= (const punctuationToken) const |
bool | operator!= (const word &) const |
bool | operator!= (const string &) const |
bool | operator!= (const label) const |
bool | operator!= (const floatScalar) const |
bool | operator!= (const doubleScalar) const |
Static Public Attributes | |
static token | undefinedToken |
Static undefined token. | |
static const char *const | typeName = "token" |
Friends | |
Istream & | operator>> (Istream &, token &) |
Ostream & | operator<< (Ostream &, const token &) |
Ostream & | operator<< (Ostream &, const punctuationToken &) |
ostream & | operator<< (ostream &, const punctuationToken &) |
ostream & | operator<< (ostream &, const InfoProxy< token > &) |
enum tokenType |
enum punctuationToken |
Construct as copy.
Definition at line 72 of file tokenI.H.
References token::COMPOUND, token::compoundTokenPtr_, token::DOUBLE_SCALAR, token::doubleScalarToken_, token::ERROR, token::FLOAT_SCALAR, token::floatScalarToken_, token::LABEL, token::labelToken_, token::PUNCTUATION, token::punctuationToken_, token::STRING, token::stringTokenPtr_, token::UNDEFINED, token::WORD, and token::wordTokenPtr_.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 176 of file tokenI.H.
Referenced by Foam::operator<<().
|
inline |
Definition at line 181 of file tokenI.H.
References token::ERROR, and token::UNDEFINED.
Referenced by Foam::operator>>(), and primitiveEntry::read().
|
inline |
Definition at line 186 of file tokenI.H.
References token::UNDEFINED.
|
inline |
Definition at line 191 of file tokenI.H.
References token::ERROR.
|
inline |
Definition at line 196 of file tokenI.H.
References token::PUNCTUATION.
Referenced by genericFvPatchField< Type >::genericFvPatchField(), Foam::operator>>(), PtrList< T >::read(), IOPosition< ParticleType >::readData(), Foam::readList(), and thirdBodyEfficiencies::thirdBodyEfficiencies().
|
inline |
Definition at line 201 of file tokenI.H.
References token::NULL_TOKEN, token::PUNCTUATION, and token::punctuationToken_.
Referenced by Foam::operator<<(), Foam::operator>>(), PtrList< T >::read(), Istream::readBeginList(), IOPosition< ParticleType >::readData(), Istream::readEndList(), Foam::readList(), and thirdBodyEfficiencies::thirdBodyEfficiencies().
|
inline |
Definition at line 214 of file tokenI.H.
References token::WORD.
Referenced by Field< Type >::Field(), genericFvPatchField< Type >::genericFvPatchField(), genericPointPatchField< Type >::genericPointPatchField(), Foam::operator>>(), IOobject::readHeader(), Reaction< ReactionThermo >::specieCoeffs::specieCoeffs(), and thirdBodyEfficiencies::thirdBodyEfficiencies().
|
inline |
Definition at line 219 of file tokenI.H.
References word::null, token::WORD, and token::wordTokenPtr_.
Referenced by Field< Type >::Field(), genericFvPatchField< Type >::genericFvPatchField(), genericPointPatchField< Type >::genericPointPatchField(), Foam::operator<<(), token::operator==(), Foam::operator>>(), IOobject::readHeader(), Reaction< ReactionThermo >::specieCoeffs::specieCoeffs(), and thirdBodyEfficiencies::thirdBodyEfficiencies().
|
inline |
Definition at line 232 of file tokenI.H.
References token::STRING.
Referenced by Foam::operator>>().
|
inline |
Definition at line 237 of file tokenI.H.
References string::null, token::STRING, and token::stringTokenPtr_.
Referenced by Foam::operator<<(), token::operator==(), and Foam::operator>>().
|
inline |
Definition at line 250 of file tokenI.H.
References token::LABEL.
Referenced by genericFvPatchField< Type >::genericFvPatchField(), genericPointPatchField< Type >::genericPointPatchField(), Foam::operator>>(), PtrList< T >::read(), and IOPosition< ParticleType >::readData().
|
inline |
Definition at line 255 of file tokenI.H.
References token::LABEL, and token::labelToken_.
Referenced by genericFvPatchField< Type >::genericFvPatchField(), genericPointPatchField< Type >::genericPointPatchField(), Foam::operator<<(), Foam::operator>>(), PtrList< T >::read(), ISstream::read(), and IOPosition< ParticleType >::readData().
|
inline |
Definition at line 268 of file tokenI.H.
References token::FLOAT_SCALAR.
|
inline |
Definition at line 273 of file tokenI.H.
References token::FLOAT_SCALAR, and token::floatScalarToken_.
Referenced by Foam::operator<<().
|
inline |
Definition at line 287 of file tokenI.H.
References token::DOUBLE_SCALAR.
|
inline |
Definition at line 292 of file tokenI.H.
References token::DOUBLE_SCALAR, and token::doubleScalarToken_.
Referenced by Foam::operator<<().
|
inline |
Definition at line 306 of file tokenI.H.
References token::DOUBLE_SCALAR, and token::FLOAT_SCALAR.
Referenced by token::isNumber(), and token::number().
|
inline |
Definition at line 311 of file tokenI.H.
References token::DOUBLE_SCALAR, token::doubleScalarToken_, token::FLOAT_SCALAR, and token::floatScalarToken_.
Referenced by token::number().
|
inline |
Definition at line 328 of file tokenI.H.
References token::isScalar(), and token::LABEL.
Referenced by Time::findTimes(), Foam::operator>>(), and Reaction< ReactionThermo >::specieCoeffs::specieCoeffs().
|
inline |
Definition at line 333 of file tokenI.H.
References token::isScalar(), token::LABEL, token::labelToken_, and token::scalarToken().
Referenced by Time::findTimes(), genericFvPatchField< Type >::genericFvPatchField(), Foam::operator>>(), and Reaction< ReactionThermo >::specieCoeffs::specieCoeffs().
|
inline |
Definition at line 350 of file tokenI.H.
References token::COMPOUND.
Referenced by genericFvPatchField< Type >::genericFvPatchField(), genericPointPatchField< Type >::genericPointPatchField(), and Foam::operator>>().
|
inline |
Definition at line 355 of file tokenI.H.
References token::COMPOUND, and token::compoundTokenPtr_.
Referenced by genericFvPatchField< Type >::genericFvPatchField(), genericPointPatchField< Type >::genericPointPatchField(), and Foam::operator<<().
Foam::token::compound & transferCompoundToken | ( | ) |
Definition at line 89 of file token.C.
References Foam::abort(), Foam::FatalError, and FatalErrorIn.
Referenced by genericFvPatchField< Type >::genericFvPatchField(), genericPointPatchField< Type >::genericPointPatchField(), and Foam::operator>>().
|
inline |
Definition at line 369 of file tokenI.H.
Referenced by Foam::operator<<(), ISstream::read(), IPstream::read(), and ITstream::read().
|
inline |
Set bad.
Definition at line 380 of file tokenI.H.
References token::ERROR.
Referenced by ISstream::read(), and IPstream::read().
Return info proxy.
Used to print token information to a stream
Definition at line 369 of file token.H.
Referenced by Field< Type >::Field(), Foam::operator>>(), PtrList< T >::read(), Istream::readBegin(), Istream::readBeginList(), IOPosition< ParticleType >::readData(), Istream::readEnd(), Istream::readEndList(), Foam::readList(), Reaction< ReactionThermo >::specieCoeffs::specieCoeffs(), and thirdBodyEfficiencies::thirdBodyEfficiencies().
|
inline |
Definition at line 389 of file tokenI.H.
References token::COMPOUND, token::compoundTokenPtr_, token::DOUBLE_SCALAR, token::doubleScalarToken_, token::ERROR, token::FLOAT_SCALAR, token::floatScalarToken_, token::LABEL, token::labelToken_, token::PUNCTUATION, token::punctuationToken_, token::STRING, token::stringTokenPtr_, token::UNDEFINED, token::WORD, and token::wordTokenPtr_.
Referenced by token::operator=().
|
inline |
Definition at line 435 of file tokenI.H.
References p, token::PUNCTUATION, and token::punctuationToken_.
|
inline |
Definition at line 442 of file tokenI.H.
References token::WORD, and token::wordTokenPtr_.
|
inline |
Definition at line 449 of file tokenI.H.
References token::operator=().
|
inline |
Definition at line 454 of file tokenI.H.
References token::STRING, and token::stringTokenPtr_.
|
inline |
Definition at line 461 of file tokenI.H.
References token::operator=().
|
inline |
Definition at line 466 of file tokenI.H.
References token::LABEL, and token::labelToken_.
|
inline |
Definition at line 473 of file tokenI.H.
References token::FLOAT_SCALAR, and token::floatScalarToken_.
|
inline |
Definition at line 480 of file tokenI.H.
References token::DOUBLE_SCALAR, and token::doubleScalarToken_.
|
inline |
Definition at line 487 of file tokenI.H.
References token::COMPOUND, and token::compoundTokenPtr_.
|
inline |
Definition at line 495 of file tokenI.H.
References token::COMPOUND, token::compoundTokenPtr_, token::DOUBLE_SCALAR, token::doubleScalarToken_, Foam::equal(), token::ERROR, token::FLOAT_SCALAR, token::floatScalarToken_, token::LABEL, token::labelToken_, token::PUNCTUATION, token::punctuationToken_, token::STRING, token::stringTokenPtr_, token::UNDEFINED, token::WORD, and token::wordTokenPtr_.
Referenced by token::operator!=().
|
inline |
Definition at line 535 of file tokenI.H.
References token::PUNCTUATION, and token::punctuationToken_.
|
inline |
Definition at line 540 of file tokenI.H.
References token::WORD, and token::wordToken().
|
inline |
Definition at line 545 of file tokenI.H.
References token::STRING, and token::stringToken().
|
inline |
Definition at line 550 of file tokenI.H.
References token::LABEL, and token::labelToken_.
|
inline |
Definition at line 555 of file tokenI.H.
References Foam::equal(), token::FLOAT_SCALAR, and token::floatScalarToken_.
|
inline |
Definition at line 560 of file tokenI.H.
References token::DOUBLE_SCALAR, token::doubleScalarToken_, and Foam::equal().
|
inline |
Definition at line 565 of file tokenI.H.
References token::operator==().
|
inline |
Definition at line 570 of file tokenI.H.
References token::operator==().
|
inline |
Definition at line 575 of file tokenI.H.
References token::operator==().
|
inline |
Definition at line 580 of file tokenI.H.
References token::operator==().
|
inline |
Definition at line 595 of file tokenI.H.
References token::operator==().
|
inline |
Definition at line 585 of file tokenI.H.
References token::operator==().
|
inline |
Definition at line 590 of file tokenI.H.
References token::operator==().
|
friend |
|
friend |
|
static |
punctuationToken punctuationToken_ |
Definition at line 253 of file token.H.
Referenced by Foam::operator<<(), token::operator=(), token::operator==(), token::pToken(), and token::token().
word* wordTokenPtr_ |
Definition at line 254 of file token.H.
Referenced by Foam::operator<<(), token::operator=(), token::operator==(), token::token(), and token::wordToken().
string* stringTokenPtr_ |
Definition at line 255 of file token.H.
Referenced by Foam::operator<<(), token::operator=(), token::operator==(), token::stringToken(), and token::token().
label labelToken_ |
Definition at line 256 of file token.H.
Referenced by token::labelToken(), token::number(), Foam::operator<<(), token::operator=(), token::operator==(), and token::token().
floatScalar floatScalarToken_ |
Definition at line 257 of file token.H.
Referenced by token::floatScalarToken(), Foam::operator<<(), token::operator=(), token::operator==(), token::scalarToken(), and token::token().
doubleScalar doubleScalarToken_ |
Definition at line 258 of file token.H.
Referenced by token::doubleScalarToken(), Foam::operator<<(), token::operator=(), token::operator==(), token::scalarToken(), and token::token().
|
mutable |
Definition at line 259 of file token.H.
Referenced by token::compoundToken(), Foam::operator<<(), token::operator=(), token::operator==(), and token::token().