![]() |
VR-Forces Developer's Guide
|
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.
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 () | |
| DtGLSLToken & | operator= (const DtGLSLToken &iOther) |
| void | Append (const char *iString, size_t iLength) |
| void | Append (const DtGLSLToken &iOther) |
| void | AppendNL (int iCount) |
| int | CountNL () |
| bool | GetValue (long &oValue) const |
| void | SetValue (long iValue) |
| bool | operator== (const DtGLSLToken &iOther) |
Public Attributes | |
| Kind | Type |
| size_t | Allocated |
| union { | |
| const char * String | |
| char * Buffer | |
| }; | |
| size_t | Length |
| makVrv::DtGLSLToken::DtGLSLToken | ( | ) |
| makVrv::DtGLSLToken::DtGLSLToken | ( | Kind | iType | ) |
| makVrv::DtGLSLToken::DtGLSLToken | ( | const DtGLSLToken & | iOther | ) |
| makVrv::DtGLSLToken::~DtGLSLToken | ( | ) |
| 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.
| 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.
| Kind makVrv::DtGLSLToken::Type |
Token type.
|
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.