OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Ogre::GLSL::CPreprocessor::Token Class Reference

A input token. More...

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 ()
 
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...
 
Tokenoperator= (const Token &iOther)
 Assignment operator. More...
 
bool operator== (const Token &iOther)
 Test two tokens for equality. More...
 
void SetValue (long iValue)
 Set the numeric value of the token. More...
 

Public Attributes

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

Definition at line 77 of file src/GLSL/include/OgreGLSLPreprocessor.h.

Member Enumeration Documentation

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 

Definition at line 80 of file src/GLSL/include/OgreGLSLPreprocessor.h.

Constructor & Destructor Documentation

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

Definition at line 111 of file src/GLSL/include/OgreGLSLPreprocessor.h.

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

Definition at line 114 of file src/GLSL/include/OgreGLSLPreprocessor.h.

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

Definition at line 117 of file src/GLSL/include/OgreGLSLPreprocessor.h.

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

Definition at line 121 of file src/GLSL/include/OgreGLSLPreprocessor.h.

References Allocated, Length, String, and Type.

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

Definition at line 130 of file src/GLSL/include/OgreGLSLPreprocessor.h.

References Allocated, and Buffer.

Member Function Documentation

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

Append a string to this token.

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

Append a token to this token.

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

Append given number of newlines to this token.

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

Count number of newlines in this token.

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

Get the numeric value of the token.

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

Assignment operator.

Definition at line 134 of file src/GLSL/include/OgreGLSLPreprocessor.h.

References Allocated, Buffer, Length, String, and Type.

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

Test two tokens for equality.

Definition at line 164 of file src/GLSL/include/OgreGLSLPreprocessor.h.

References Length, and String.

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

Set the numeric value of the token.

Member Data Documentation

union { ... }
size_t Ogre::GLSL::CPreprocessor::Token::Allocated
mutable

True if string was allocated (and must be freed)

Definition at line 100 of file src/GLSL/include/OgreGLSLPreprocessor.h.

Referenced by operator=(), Token(), and ~Token().

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

A memory-allocated string.

Definition at line 106 of file src/GLSL/include/OgreGLSLPreprocessor.h.

Referenced by operator=(), and ~Token().

size_t Ogre::GLSL::CPreprocessor::Token::Length

Token length in bytes.

Definition at line 109 of file src/GLSL/include/OgreGLSLPreprocessor.h.

Referenced by operator=(), operator==(), and Token().

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

A pointer somewhere into the input buffer.

Definition at line 104 of file src/GLSL/include/OgreGLSLPreprocessor.h.

Referenced by operator=(), operator==(), and Token().

Kind Ogre::GLSL::CPreprocessor::Token::Type

Token type.

Definition at line 98 of file src/GLSL/include/OgreGLSLPreprocessor.h.

Referenced by operator=(), and Token().


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