Pyrogenesis trunk
Public Types | Public Member Functions | Public Attributes | List of all members
Ogre::CPreprocessor::Token Class Reference

A input token. More...

#include <OgreGLSLPreprocessor.h>

Public Types

enum  Kind {
  TK_EOS , TK_ERROR , TK_WHITESPACE , TK_NEWLINE ,
  TK_LINECONT , TK_NUMBER , TK_KEYWORD , TK_PUNCTUATION ,
  TK_DIRECTIVE , TK_STRING , TK_COMMENT , TK_LINECOMMENT ,
  TK_TEXT
}
 

Public Member Functions

 Token ()
 
 Token (Kind iType)
 
 Token (Kind iType, const char *iString, size_t iLength)
 
 Token (const Token &iOther)
 
 ~Token ()
 
Tokenoperator= (const Token &iOther)
 Assignment operator. More...
 
void Append (const char *iString, size_t iLength)
 Append a string to this token. More...
 
void Append (const Token &iOther)
 Append a token to this token. More...
 
void AppendNL (int iCount)
 Append given number of newlines to this token. More...
 
int CountNL ()
 Count number of newlines in this token. More...
 
bool GetValue (long &oValue) const
 Get the numeric value of the token. More...
 
void SetValue (long iValue)
 Set the numeric value of the token. More...
 
bool operator== (const Token &iOther)
 Test two tokens for equality. More...
 

Public Attributes

Kind Type
 Token type. More...
 
size_t Allocated
 True if string was allocated (and must be freed) More...
 
union {
   const char *   String
 A pointer somewhere into the input buffer. More...
 
   char *   Buffer
 A memory-allocated string. More...
 
}; 
 
size_t Length
 Token length in bytes. More...
 

Detailed Description

A input token.

For performance reasons most tokens will point to portions of the input stream, so no unneeded memory allocation is done. However, in some cases we must allocate different memory for token storage, in this case this is signalled by setting the Allocated member to non-zero in which case the destructor will know that it must free memory on object destruction.

Again for performance reasons we use malloc/realloc/free here because C++-style new[] lacks the realloc() counterpart.

Member Enumeration Documentation

◆ Kind

Enumerator
TK_EOS 
TK_ERROR 
TK_WHITESPACE 
TK_NEWLINE 
TK_LINECONT 
TK_NUMBER 
TK_KEYWORD 
TK_PUNCTUATION 
TK_DIRECTIVE 
TK_STRING 
TK_COMMENT 
TK_LINECOMMENT 
TK_TEXT 

Constructor & Destructor Documentation

◆ Token() [1/4]

Ogre::CPreprocessor::Token::Token ( )
inline

◆ Token() [2/4]

Ogre::CPreprocessor::Token::Token ( Kind  iType)
inline

◆ Token() [3/4]

Ogre::CPreprocessor::Token::Token ( Kind  iType,
const char *  iString,
size_t  iLength 
)
inline

◆ Token() [4/4]

Ogre::CPreprocessor::Token::Token ( const Token iOther)
inline

◆ ~Token()

Ogre::CPreprocessor::Token::~Token ( )
inline

Member Function Documentation

◆ Append() [1/2]

void Ogre::CPreprocessor::Token::Append ( const char *  iString,
size_t  iLength 
)

Append a string to this token.

◆ Append() [2/2]

void Ogre::CPreprocessor::Token::Append ( const Token iOther)

Append a token to this token.

◆ AppendNL()

void Ogre::CPreprocessor::Token::AppendNL ( int  iCount)

Append given number of newlines to this token.

◆ CountNL()

int Ogre::CPreprocessor::Token::CountNL ( )

Count number of newlines in this token.

◆ GetValue()

bool Ogre::CPreprocessor::Token::GetValue ( long &  oValue) const

Get the numeric value of the token.

◆ operator=()

Token & Ogre::CPreprocessor::Token::operator= ( const Token iOther)
inline

Assignment operator.

◆ operator==()

bool Ogre::CPreprocessor::Token::operator== ( const Token iOther)
inline

Test two tokens for equality.

◆ SetValue()

void Ogre::CPreprocessor::Token::SetValue ( long  iValue)

Set the numeric value of the token.

Member Data Documentation

◆ 

union { ... } Ogre::CPreprocessor::Token::@54

◆ Allocated

size_t Ogre::CPreprocessor::Token::Allocated
mutable

True if string was allocated (and must be freed)

◆ Buffer

char* Ogre::CPreprocessor::Token::Buffer

A memory-allocated string.

◆ Length

size_t Ogre::CPreprocessor::Token::Length

Token length in bytes.

◆ String

const char* Ogre::CPreprocessor::Token::String

A pointer somewhere into the input buffer.

◆ Type

Kind Ogre::CPreprocessor::Token::Type

Token type.


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