VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Public Attributes
makVrv::DtGLSLToken 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

 DtGLSLToken ()
 
 DtGLSLToken (Kind iType)
 
 DtGLSLToken (Kind iType, const char *iString, size_t iLength)
 
 DtGLSLToken (const DtGLSLToken &iOther)
 
 ~DtGLSLToken ()
 
DtGLSLTokenoperator= (const DtGLSLToken &iOther)
 Assignment operator. More...
 
void Append (const char *iString, size_t iLength)
 Append a string to this token. More...
 
void Append (const DtGLSLToken &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 DtGLSLToken &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

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

makVrv::DtGLSLToken::DtGLSLToken ( )
makVrv::DtGLSLToken::DtGLSLToken ( Kind  iType)
makVrv::DtGLSLToken::DtGLSLToken ( Kind  iType,
const char iString,
size_t  iLength 
)
makVrv::DtGLSLToken::DtGLSLToken ( const DtGLSLToken iOther)
makVrv::DtGLSLToken::~DtGLSLToken ( )

Member Function Documentation

DtGLSLToken& makVrv::DtGLSLToken::operator= ( const DtGLSLToken iOther)

Assignment operator.

void makVrv::DtGLSLToken::Append ( const char iString,
size_t  iLength 
)

Append a string to this token.

void makVrv::DtGLSLToken::Append ( const DtGLSLToken iOther)

Append a token to this token.

void makVrv::DtGLSLToken::AppendNL ( int  iCount)

Append given number of newlines to this token.

int makVrv::DtGLSLToken::CountNL ( )

Count number of newlines in this token.

bool makVrv::DtGLSLToken::GetValue ( long oValue) const

Get the numeric value of the token.

void makVrv::DtGLSLToken::SetValue ( long  iValue)

Set the numeric value of the token.

bool makVrv::DtGLSLToken::operator== ( const DtGLSLToken iOther)

Test two tokens for equality.

Member Data Documentation

Kind makVrv::DtGLSLToken::Type

Token type.

size_t makVrv::DtGLSLToken::Allocated
mutable

True if string was allocated (and must be freed)

const char* makVrv::DtGLSLToken::String

A pointer somewhere into the input buffer.

char* makVrv::DtGLSLToken::Buffer

A memory-allocated string.

union { ... }
size_t makVrv::DtGLSLToken::Length

Token length in bytes.


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

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)