Public Types | Public Member Functions | Public Attributes | List of all members
Ogre::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, 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
}
 
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, 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 ()
 
 Token (const Token &iOther)
 
 Token (const Token &iOther)
 
 Token (Kind iType)
 
 Token (Kind iType)
 
 Token (Kind iType, const char *iString, size_t iLength)
 
 Token (Kind iType, const char *iString, size_t iLength)
 
 ~Token ()
 
 ~Token ()
 
void Append (const char *iString, size_t iLength)
 Append a string to this token. 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 Append (const Token &iOther)
 Append a token to this token. More...
 
void AppendNL (int iCount)
 Append given number of newlines 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...
 
int CountNL ()
 Count number of newlines in this token. More...
 
bool GetValue (long &oValue) const
 Get the numeric value of the token. More...
 
bool GetValue (long &oValue) const
 Get the numeric value of the token. More...
 
Tokenoperator= (const Token &iOther)
 Assignment operator. More...
 
Tokenoperator= (const Token &iOther)
 Assignment operator. More...
 
bool operator== (const Token &iOther)
 Test two tokens for equality. More...
 
bool operator== (const Token &iOther)
 Test two tokens for equality. More...
 
void SetValue (long iValue)
 Set the numeric value of the token. 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...
 
}; 
 
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 76 of file Plus/src/GLSL/include/OgreGLSLPreprocessor.h.

Member Enumeration Documentation

◆ Kind [1/2]

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 
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 79 of file Plus/src/GLSL/include/OgreGLSLPreprocessor.h.

◆ Kind [2/2]

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 
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 79 of file OgreGLSLESPreprocessor.h.

Constructor & Destructor Documentation

◆ Token() [1/8]

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

◆ Token() [2/8]

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

◆ Token() [3/8]

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

◆ Token() [4/8]

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

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

References Allocated, Length, String, and Type.

◆ ~Token() [1/2]

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

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

References Allocated, and Buffer.

◆ Token() [5/8]

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

Definition at line 110 of file OgreGLSLESPreprocessor.h.

◆ Token() [6/8]

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

Definition at line 113 of file OgreGLSLESPreprocessor.h.

◆ Token() [7/8]

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

Definition at line 116 of file OgreGLSLESPreprocessor.h.

◆ Token() [8/8]

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

Definition at line 120 of file OgreGLSLESPreprocessor.h.

References Allocated, Length, and Type.

◆ ~Token() [2/2]

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

Definition at line 129 of file OgreGLSLESPreprocessor.h.

References Allocated, and Buffer.

Member Function Documentation

◆ Append() [1/4]

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

Append a string to this token.

◆ Append() [2/4]

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

Append a string to this token.

◆ Append() [3/4]

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

Append a token to this token.

◆ Append() [4/4]

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

Append a token to this token.

◆ AppendNL() [1/2]

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

Append given number of newlines to this token.

◆ AppendNL() [2/2]

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

Append given number of newlines to this token.

◆ CountNL() [1/2]

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

Count number of newlines in this token.

◆ CountNL() [2/2]

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

Count number of newlines in this token.

◆ GetValue() [1/2]

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

Get the numeric value of the token.

◆ GetValue() [2/2]

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

Get the numeric value of the token.

◆ operator=() [1/2]

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

Assignment operator.

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

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

◆ operator=() [2/2]

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

Assignment operator.

Definition at line 133 of file OgreGLSLESPreprocessor.h.

References Allocated, Buffer, Length, and Type.

◆ operator==() [1/2]

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

Test two tokens for equality.

Definition at line 163 of file OgreGLSLESPreprocessor.h.

References Length.

◆ operator==() [2/2]

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

Test two tokens for equality.

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

References Length, and String.

◆ SetValue() [1/2]

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

Set the numeric value of the token.

◆ SetValue() [2/2]

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

Set the numeric value of the token.

Member Data Documentation

◆ @18

union { ... }

◆ @21

union { ... }

◆ Allocated

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

True if string was allocated (and must be freed)

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

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

◆ Buffer

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

A memory-allocated string.

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

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

◆ Length

size_t Ogre::CPreprocessor::Token::Length

Token length in bytes.

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

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

◆ String

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

A pointer somewhere into the input buffer.

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

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

◆ Type

Kind Ogre::CPreprocessor::Token::Type

Token type.

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

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


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

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Tue Apr 13 2021 08:53:15