VR-Forces 5.0.3 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtGLSLToken.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2018 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <cstring>
13 
14 namespace makVrv
15 {
30  {
31  public:
32  enum Kind
33  {
34  TK_EOS, // End of input stream
35  TK_ERROR, // An error has been encountered
36  TK_WHITESPACE, // A whitespace span (but not newline)
37  TK_NEWLINE, // A single newline (CR & LF)
38  TK_LINECONT, // Line continuation ('\' followed by LF)
39  TK_NUMBER, // A number
40  TK_KEYWORD, // A keyword
41  TK_PUNCTUATION, // A punctuation character
42  TK_DIRECTIVE, // A preprocessor directive
43  TK_STRING, // A string
44  TK_COMMENT, // A block comment
45  TK_LINECOMMENT, // A line comment
46  TK_TEXT // An unparsed text (cannot be returned from GetToken())
47  };
48 
52  mutable size_t Allocated;
53  union
54  {
56  const char *String;
58  char *Buffer;
59  };
61  size_t Length;
62 
63  DtGLSLToken();
64 
65  DtGLSLToken(Kind iType);
66 
67  DtGLSLToken(Kind iType, const char *iString, size_t iLength);
68 
69  DtGLSLToken(const DtGLSLToken &iOther);
70 
71  ~DtGLSLToken();
72 
74  DtGLSLToken &operator = (const DtGLSLToken &iOther);
75 
77  void Append(const char *iString, size_t iLength);
78 
80  void Append(const DtGLSLToken &iOther);
81 
83  void AppendNL(int iCount);
84 
86  int CountNL();
87 
89  bool GetValue(long &oValue) const;
90 
92  void SetValue(long iValue);
93 
95  bool operator == (const DtGLSLToken &iOther);
96  };
97 }
Kind
Definition: DtGLSLToken.h:32
Definition: DtGLSLToken.h:34
bool operator==(const DtGLSLToken &iOther)
Test two tokens for equality.
Definition: DtGLSLToken.h:35
int CountNL()
Count number of newlines in this token.
Definition: DtGLSLToken.h:37
Kind Type
Token type.
Definition: DtGLSLToken.h:50
char * Buffer
A memory-allocated string.
Definition: DtGLSLToken.h:58
Definition: DtGLSLToken.h:45
Definition: DtGLSLToken.h:42
void Append(const char *iString, size_t iLength)
Append a string to this token.
Definition: DtGLSLToken.h:44
size_t Length
Token length in bytes.
Definition: DtGLSLToken.h:61
const char * String
A pointer somewhere into the input buffer.
Definition: DtGLSLToken.h:56
A input token.
Definition: DtGLSLToken.h:29
Definition: DtGLSLToken.h:40
Definition: DtGLSLToken.h:46
bool GetValue(long &oValue) const
Get the numeric value of the token.
void AppendNL(int iCount)
Append given number of newlines to this token.
Definition: DtGLSLToken.h:41
size_t Allocated
True if string was allocated (and must be freed)
Definition: DtGLSLToken.h:52
DtGLSLToken & operator=(const DtGLSLToken &iOther)
Assignment operator.
Definition: DtGLSLToken.h:36
Definition: DtGLSLToken.h:43
Definition: DtGLSLToken.h:38
Definition: DtGLSLToken.h:39
void SetValue(long iValue)
Set the numeric value of the token.

Document ID: Generated on Thu Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)