OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

token Class Reference

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

Collaboration diagram for token:

List of all members.


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 wordwordToken () 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 ()
label lineNumber () const
labellineNumber ()
void setBad ()
 Set bad.
InfoProxy< tokeninfo () 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

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 63 of file token.H.


Member Enumeration Documentation

enum tokenType

Enumeration defining the types of token.

Enumerator:
UNDEFINED 
PUNCTUATION 
WORD 
STRING 
LABEL 
FLOAT_SCALAR 
DOUBLE_SCALAR 
COMPOUND 
ERROR 

Definition at line 69 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 
BEGIN_STRING 
END_STRING 
ASSIGN 
ADD 
SUBTRACT 
MULTIPLY 
DIVIDE 

Definition at line 86 of file token.H.


Constructor & Destructor Documentation

token (  )  [inline]

Construct null.

Definition at line 57 of file tokenI.H.

token ( const token t  )  [inline]

Construct as copy.

Definition at line 64 of file tokenI.H.

token ( punctuationToken  p,
label  lineNumber = 0 
) [inline]

Construct punctuation character token.

Definition at line 109 of file tokenI.H.

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

Construct word token.

Definition at line 117 of file tokenI.H.

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

Construct string token.

Definition at line 125 of file tokenI.H.

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

Construct label token.

Definition at line 133 of file tokenI.H.

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

Construct floatScalar token.

Definition at line 141 of file tokenI.H.

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

Construct doubleScalar token.

Definition at line 149 of file tokenI.H.

token ( Istream is  ) 

Construct from Istream.

Definition at line 30 of file tokenIO.C.

~token (  )  [inline]

Definition at line 160 of file tokenI.H.


Member Function Documentation

token::tokenType type (  )  const [inline]

Definition at line 168 of file tokenI.H.

Referenced by Foam::operator<<().

Here is the caller graph for this function:

bool good (  )  const [inline]

Definition at line 173 of file tokenI.H.

bool undefined (  )  const [inline]

Definition at line 178 of file tokenI.H.

bool error (  )  const [inline]

Definition at line 183 of file tokenI.H.

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

bool isPunctuation (  )  const [inline]

Definition at line 188 of file tokenI.H.

References token::UNDEFINED.

Referenced by Foam::operator>>(), and PtrList< T >::read().

Here is the caller graph for this function:

token::punctuationToken pToken (  )  const [inline]

Definition at line 193 of file tokenI.H.

References token::ERROR.

Referenced by Foam::operator<<(), Foam::operator>>(), and PtrList< T >::read().

Here is the caller graph for this function:

bool isWord (  )  const [inline]

Definition at line 206 of file tokenI.H.

Referenced by Foam::operator>>(), and IOobject::readHeader().

Here is the caller graph for this function:

const word & wordToken (  )  const [inline]

Definition at line 211 of file tokenI.H.

Referenced by Foam::operator<<(), token::operator==(), Foam::operator>>(), and IOobject::readHeader().

Here is the caller graph for this function:

bool isString (  )  const [inline]

Definition at line 224 of file tokenI.H.

const string & stringToken (  )  const [inline]

Definition at line 229 of file tokenI.H.

Referenced by Foam::operator<<(), and token::operator==().

Here is the caller graph for this function:

bool isLabel (  )  const [inline]

Definition at line 242 of file tokenI.H.

Referenced by Foam::operator>>(), and PtrList< T >::read().

Here is the caller graph for this function:

label labelToken (  )  const [inline]

Definition at line 247 of file tokenI.H.

Referenced by Foam::operator<<(), Foam::operator>>(), and PtrList< T >::read().

Here is the caller graph for this function:

bool isFloatScalar (  )  const [inline]

Definition at line 260 of file tokenI.H.

floatScalar floatScalarToken (  )  const [inline]

Definition at line 265 of file tokenI.H.

Referenced by Foam::operator<<().

Here is the caller graph for this function:

bool isDoubleScalar (  )  const [inline]

Definition at line 279 of file tokenI.H.

doubleScalar doubleScalarToken (  )  const [inline]

Definition at line 284 of file tokenI.H.

Referenced by Foam::operator<<().

Here is the caller graph for this function:

bool isScalar (  )  const [inline]

Definition at line 298 of file tokenI.H.

scalar scalarToken (  )  const [inline]

Definition at line 303 of file tokenI.H.

bool isNumber (  )  const [inline]

Definition at line 320 of file tokenI.H.

Referenced by Time::findTimes().

Here is the caller graph for this function:

scalar number (  )  const [inline]

Definition at line 325 of file tokenI.H.

Referenced by Time::findTimes().

Here is the caller graph for this function:

bool isCompound (  )  const [inline]

Definition at line 342 of file tokenI.H.

const token::compound & compoundToken (  )  const [inline]

Definition at line 347 of file tokenI.H.

Referenced by Foam::operator<<().

Here is the caller graph for this function:

Foam::token::compound & transferCompoundToken (  ) 

Definition at line 81 of file token.C.

label lineNumber (  )  const [inline]

Definition at line 361 of file tokenI.H.

Referenced by Foam::operator<<().

Here is the caller graph for this function:

label & lineNumber (  )  [inline]

Definition at line 366 of file tokenI.H.

void setBad (  )  [inline]

Set bad.

Definition at line 372 of file tokenI.H.

InfoProxy<token> info (  )  const [inline]

Return info proxy.

Used to print token information to a stream

Definition at line 366 of file token.H.

Referenced by Foam::operator>>(), PtrList< T >::read(), and compound::~compound().

Here is the caller graph for this function:

void operator= ( const token t  )  [inline]

Definition at line 381 of file tokenI.H.

References token::ERROR.

void operator= ( const punctuationToken  p  )  [inline]

Definition at line 427 of file tokenI.H.

void operator= ( word wPtr  )  [inline]

Definition at line 434 of file tokenI.H.

void operator= ( const word w  )  [inline]

Definition at line 441 of file tokenI.H.

void operator= ( string sPtr  )  [inline]

Definition at line 446 of file tokenI.H.

void operator= ( const string s  )  [inline]

Definition at line 453 of file tokenI.H.

void operator= ( const label  l  )  [inline]

Definition at line 458 of file tokenI.H.

void operator= ( const floatScalar  s  )  [inline]

Definition at line 465 of file tokenI.H.

void operator= ( const doubleScalar  s  )  [inline]

Definition at line 472 of file tokenI.H.

void operator= ( token::compound cPtr  )  [inline]

Definition at line 479 of file tokenI.H.

bool operator== ( const token t  )  const [inline]

Definition at line 487 of file tokenI.H.

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

Referenced by token::operator!=().

Here is the caller graph for this function:

bool operator== ( const punctuationToken  p  )  const [inline]

Definition at line 527 of file tokenI.H.

bool operator== ( const word w  )  const [inline]

Definition at line 532 of file tokenI.H.

bool operator== ( const string s  )  const [inline]

Definition at line 537 of file tokenI.H.

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

bool operator== ( const label  l  )  const [inline]

Definition at line 542 of file tokenI.H.

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

Here is the call graph for this function:

bool operator== ( const floatScalar  s  )  const [inline]

Definition at line 547 of file tokenI.H.

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

Here is the call graph for this function:

bool operator== ( const doubleScalar  s  )  const [inline]

Definition at line 552 of file tokenI.H.

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

bool operator!= ( const token t  )  const [inline]

Definition at line 557 of file tokenI.H.

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

Here is the call graph for this function:

bool operator!= ( const punctuationToken  p  )  const [inline]

Definition at line 562 of file tokenI.H.

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

Here is the call graph for this function:

bool operator!= ( const word w  )  const [inline]

Definition at line 567 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 572 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 587 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 577 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 582 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

Static undefined token.

Definition at line 235 of file token.H.

Definition at line 248 of file token.H.

Referenced by token::operator==().

Definition at line 249 of file token.H.

Definition at line 250 of file token.H.

Definition at line 251 of file token.H.

Referenced by token::operator==().

Definition at line 252 of file token.H.

Referenced by token::operator!=().

Definition at line 253 of file token.H.

Referenced by token::operator!=().

Definition at line 254 of file token.H.

Referenced by token::operator==().

const char *const typeName = "token" [static]

Definition at line 274 of file token.H.


The documentation for this class was generated from the following files:
  • src/OpenFOAM/db/IOstreams/token/token.H
  • src/OpenFOAM/db/IOstreams/token/token.C
  • src/OpenFOAM/db/IOstreams/token/tokenI.H
  • src/OpenFOAM/db/IOstreams/token/tokenIO.C
Copyright © 2000-2009 OpenCFD Ltd