Classes | Public Types | Public Member Functions | Static Public Attributes | Friends | List of all members
token Class Reference

A token holds items read from Istream. More...

Collaboration diagram for token:
Collaboration graph
[legend]

Classes

class  compound
 Abstract base class for complex tokens. More...
 
class  Compound
 A templated class for holding compound tokens. More...
 

Public Types

enum  tokenType {
  UNDEFINED, PUNCTUATION, WORD, VARIABLE,
  STRING, VERBATIMSTRING, 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 = ',', HASH = '#', BEGIN_STRING = '"', END_STRING = BEGIN_STRING,
  ASSIGN = '=', ADD = '+', SUBTRACT = '-', MULTIPLY = '*',
  DIVIDE = '/'
}
 Standard punctuation tokens. More...
 

Public Member Functions

 token ()
 Construct null. More...
 
 token (const token &)
 Construct as copy. More...
 
 token (punctuationToken, label lineNumber=0)
 Construct punctuation character token. More...
 
 token (const word &, label lineNumber=0)
 Construct word token. More...
 
 token (const string &, label lineNumber=0)
 Construct string token. More...
 
 token (const label, label lineNumber=0)
 Construct label token. More...
 
 token (const floatScalar, label lineNumber=0)
 Construct floatScalar token. More...
 
 token (const doubleScalar, label lineNumber=0)
 Construct doubleScalar token. More...
 
 token (Istream &)
 Construct from Istream. More...
 
 ~token ()
 Destructor. More...
 
tokenType type () const
 
tokenTypetype ()
 
bool good () const
 
bool undefined () const
 
bool error () const
 
bool isPunctuation () const
 
punctuationToken pToken () const
 
bool isWord () const
 
const wordwordToken () const
 
bool isVariable () const
 
bool isString () const
 
const stringstringToken () 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 compoundcompoundToken () const
 
compoundtransferCompoundToken (const Istream &is)
 
label lineNumber () const
 
labellineNumber ()
 
void setBad ()
 Set bad. More...
 
InfoProxy< tokeninfo () const
 Return info proxy. More...
 
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. More...
 
static const char *const typeName = "token"
 

Friends

Istreamoperator>> (Istream &, token &)
 
Ostreamoperator<< (Ostream &, const token &)
 
Ostreamoperator<< (Ostream &, const punctuationToken &)
 
ostream & operator<< (ostream &, const punctuationToken &)
 
ostream & operator<< (ostream &, const InfoProxy< token > &)
 

Detailed Description

A token holds items read from Istream.

Source files

Definition at line 69 of file token.H.

Member Enumeration Documentation

enum tokenType

Enumeration defining the types of token.

Enumerator
UNDEFINED 
PUNCTUATION 
WORD 
VARIABLE 
STRING 
VERBATIMSTRING 
LABEL 
FLOAT_SCALAR 
DOUBLE_SCALAR 
COMPOUND 
ERROR 

Definition at line 75 of file token.H.

Standard punctuation tokens.

Enumerator
NULL_TOKEN 
SPACE 
TAB 
NL 
END_STATEMENT 
BEGIN_LIST 
END_LIST 
BEGIN_SQR 
END_SQR 
BEGIN_BLOCK 
END_BLOCK 
COLON 
COMMA 
HASH 
BEGIN_STRING 
END_STRING 
ASSIGN 
ADD 
SUBTRACT 
MULTIPLY 
DIVIDE 

Definition at line 94 of file token.H.

Constructor & Destructor Documentation

token ( )
inline

Construct null.

Definition at line 58 of file tokenI.H.

token ( const token t)
inline
token ( punctuationToken  p,
label  lineNumber = 0 
)
inline

Construct punctuation character token.

Definition at line 112 of file tokenI.H.

token ( const word w,
label  lineNumber = 0 
)
inline

Construct word token.

Definition at line 120 of file tokenI.H.

token ( const string s,
label  lineNumber = 0 
)
inline

Construct string token.

Definition at line 128 of file tokenI.H.

token ( const label  l,
label  lineNumber = 0 
)
inline

Construct label token.

Definition at line 136 of file tokenI.H.

token ( const floatScalar  s,
label  lineNumber = 0 
)
inline

Construct floatScalar token.

Definition at line 144 of file tokenI.H.

token ( const doubleScalar  s,
label  lineNumber = 0 
)
inline

Construct doubleScalar token.

Definition at line 152 of file tokenI.H.

token ( Istream is)

Construct from Istream.

Definition at line 34 of file tokenIO.C.

References Istream::read().

Here is the call graph for this function:

~token ( )
inline

Destructor.

Definition at line 162 of file tokenI.H.

Member Function Documentation

Foam::token::tokenType type ( ) const
inline
Foam::token::tokenType & type ( )
inline

Definition at line 175 of file tokenI.H.

bool good ( ) const
inline

Definition at line 180 of file tokenI.H.

References token::ERROR, and token::UNDEFINED.

Referenced by dimensionSet::dimensionSet(), Foam::operator>>(), and primitiveEntry::read().

Here is the caller graph for this function:

bool undefined ( ) const
inline

Definition at line 185 of file tokenI.H.

References token::UNDEFINED.

bool error ( ) const
inline

Definition at line 190 of file tokenI.H.

References token::ERROR.

bool isPunctuation ( ) const
inline
Foam::token::punctuationToken pToken ( ) const
inline
bool isWord ( ) const
inline
const Foam::word & wordToken ( ) const
inline
bool isVariable ( ) const
inline

Definition at line 231 of file tokenI.H.

References token::VARIABLE.

bool isString ( ) const
inline

Definition at line 236 of file tokenI.H.

References token::STRING, token::VARIABLE, and token::VERBATIMSTRING.

Referenced by Foam::operator>>().

Here is the caller graph for this function:

const Foam::string & stringToken ( ) const
inline
bool isLabel ( ) const
inline
Foam::label labelToken ( ) const
inline
bool isFloatScalar ( ) const
inline

Definition at line 272 of file tokenI.H.

References token::FLOAT_SCALAR.

Foam::floatScalar floatScalarToken ( ) const
inline

Definition at line 277 of file tokenI.H.

References token::FLOAT_SCALAR, and token::floatScalarToken_.

Referenced by Foam::operator<<().

Here is the caller graph for this function:

bool isDoubleScalar ( ) const
inline

Definition at line 291 of file tokenI.H.

References token::DOUBLE_SCALAR.

Foam::doubleScalar doubleScalarToken ( ) const
inline

Definition at line 296 of file tokenI.H.

References token::DOUBLE_SCALAR, and token::doubleScalarToken_.

Referenced by Foam::operator<<().

Here is the caller graph for this function:

bool isScalar ( ) const
inline

Definition at line 310 of file tokenI.H.

References token::DOUBLE_SCALAR, and token::FLOAT_SCALAR.

Referenced by token::isNumber(), and token::number().

Here is the caller graph for this function:

Foam::scalar scalarToken ( ) const
inline

Definition at line 315 of file tokenI.H.

References token::DOUBLE_SCALAR, token::doubleScalarToken_, token::FLOAT_SCALAR, and token::floatScalarToken_.

Referenced by token::number().

Here is the caller graph for this function:

bool isNumber ( ) const
inline

Definition at line 332 of file tokenI.H.

References token::isScalar(), and token::LABEL.

Referenced by Time::findTimes(), Foam::operator>>(), dimensionSet::read(), and Reaction< ReactionThermo >::specieCoeffs::specieCoeffs().

Here is the call graph for this function:

Here is the caller graph for this function:

Foam::scalar number ( ) const
inline

Definition at line 337 of file tokenI.H.

References token::isScalar(), token::LABEL, token::labelToken_, and token::scalarToken().

Referenced by Time::findTimes(), genericFvPatchField< Type >::genericFvPatchField(), Foam::operator>>(), dimensionSet::read(), and Reaction< ReactionThermo >::specieCoeffs::specieCoeffs().

Here is the call graph for this function:

Here is the caller graph for this function:

bool isCompound ( ) const
inline
const Foam::token::compound & compoundToken ( ) const
inline

Definition at line 359 of file tokenI.H.

References token::COMPOUND, and token::compoundTokenPtr_.

Referenced by genericFvPatchField< Type >::genericFvPatchField(), genericPointPatchField< Type >::genericPointPatchField(), and Foam::operator<<().

Here is the caller graph for this function:

Foam::token::compound & transferCompoundToken ( const Istream is)

Definition at line 93 of file token.C.

References Foam::abort(), Foam::FatalIOError, and FatalIOErrorInFunction.

Referenced by FixedList< T, Size >::FixedList(), genericFvPatchField< Type >::genericFvPatchField(), genericPointPatchField< Type >::genericPointPatchField(), List< T >::List(), and UList< T >::writeEntry().

Here is the call graph for this function:

Here is the caller graph for this function:

Foam::label lineNumber ( ) const
inline

Definition at line 373 of file tokenI.H.

Referenced by Foam::operator<<(), ISstream::read(), UIPstream::read(), and ITstream::read().

Here is the caller graph for this function:

Foam::label & lineNumber ( )
inline

Definition at line 378 of file tokenI.H.

void setBad ( )
inline

Set bad.

Definition at line 384 of file tokenI.H.

References token::ERROR.

Referenced by ISstream::read(), and UIPstream::read().

Here is the caller graph for this function:

InfoProxy<token> info ( ) const
inline
void operator= ( const token t)
inline
void operator= ( const punctuationToken  p)
inline

Definition at line 441 of file tokenI.H.

References p, token::PUNCTUATION, and token::punctuationToken_.

void operator= ( word wPtr)
inline

Definition at line 448 of file tokenI.H.

References token::WORD, and token::wordTokenPtr_.

void operator= ( const word w)
inline

Definition at line 455 of file tokenI.H.

References token::operator=().

Here is the call graph for this function:

void operator= ( string sPtr)
inline

Definition at line 460 of file tokenI.H.

References token::STRING, and token::stringTokenPtr_.

void operator= ( const string s)
inline

Definition at line 467 of file tokenI.H.

References token::operator=().

Here is the call graph for this function:

void operator= ( const label  l)
inline

Definition at line 472 of file tokenI.H.

References token::LABEL, and token::labelToken_.

void operator= ( const floatScalar  s)
inline

Definition at line 479 of file tokenI.H.

References token::FLOAT_SCALAR, token::floatScalarToken_, and s().

Here is the call graph for this function:

void operator= ( const doubleScalar  s)
inline

Definition at line 486 of file tokenI.H.

References token::DOUBLE_SCALAR, token::doubleScalarToken_, and s().

Here is the call graph for this function:

void operator= ( compound cPtr)
inline

Definition at line 493 of file tokenI.H.

References token::COMPOUND, and token::compoundTokenPtr_.

bool operator== ( const token t) const
inline
bool operator== ( const punctuationToken  p) const
inline

Definition at line 543 of file tokenI.H.

References token::PUNCTUATION, and token::punctuationToken_.

bool operator== ( const word w) const
inline

Definition at line 548 of file tokenI.H.

References token::WORD, and token::wordToken().

Here is the call graph for this function:

bool operator== ( const string s) const
inline

Definition at line 553 of file tokenI.H.

References token::STRING, token::stringToken(), token::VARIABLE, and token::VERBATIMSTRING.

Here is the call graph for this function:

bool operator== ( const label  l) const
inline

Definition at line 562 of file tokenI.H.

References token::LABEL, and token::labelToken_.

bool operator== ( const floatScalar  s) const
inline

Definition at line 567 of file tokenI.H.

References Foam::equal(), token::FLOAT_SCALAR, and token::floatScalarToken_.

Here is the call graph for this function:

bool operator== ( const doubleScalar  s) const
inline

Definition at line 572 of file tokenI.H.

References token::DOUBLE_SCALAR, token::doubleScalarToken_, and Foam::equal().

Here is the call graph for this function:

bool operator!= ( const token t) const
inline

Definition at line 577 of file tokenI.H.

References token::operator==().

Here is the call graph for this function:

bool operator!= ( const punctuationToken  p) const
inline

Definition at line 582 of file tokenI.H.

References token::operator==().

Here is the call graph for this function:

bool operator!= ( const word w) const
inline

Definition at line 587 of file tokenI.H.

References token::operator==().

Here is the call graph for this function:

bool operator!= ( const string s) const
inline

Definition at line 592 of file tokenI.H.

References token::operator==().

Here is the call graph for this function:

bool operator!= ( const label  l) const
inline

Definition at line 607 of file tokenI.H.

References token::operator==().

Here is the call graph for this function:

bool operator!= ( const floatScalar  s) const
inline

Definition at line 597 of file tokenI.H.

References token::operator==().

Here is the call graph for this function:

bool operator!= ( const doubleScalar  s) const
inline

Definition at line 602 of file tokenI.H.

References token::operator==().

Here is the call graph for this function:

Friends And Related Function Documentation

Istream& operator>> ( Istream ,
token  
)
friend
Ostream& operator<< ( Ostream ,
const token  
)
friend
Ostream& operator<< ( Ostream ,
const punctuationToken  
)
friend
ostream& operator<< ( ostream &  ,
const punctuationToken  
)
friend
ostream& operator<< ( ostream &  ,
const InfoProxy< token > &   
)
friend

Member Data Documentation

token undefinedToken
static

Static undefined token.

Definition at line 243 of file token.H.

Referenced by Istream::peekBack(), and ITstream::read().

punctuationToken punctuationToken_
word* wordTokenPtr_
string* stringTokenPtr_
label labelToken_
floatScalar floatScalarToken_
doubleScalar doubleScalarToken_
compound* compoundTokenPtr_
mutable
const char *const typeName = "token"
static

Definition at line 282 of file token.H.


The documentation for this class was generated from the following files: