TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
G3D::Token Class Reference

#include <TextInput.h>

Public Types

enum  ExtendedType {
  DOUBLE_QUOTED_TYPE, SINGLE_QUOTED_TYPE, SYMBOL_TYPE, FLOATING_POINT_TYPE,
  INTEGER_TYPE, BOOLEAN_TYPE, LINE_COMMENT_TYPE, BLOCK_COMMENT_TYPE,
  NEWLINE_TYPE, END_TYPE
}
 
enum  Type {
  STRING = DOUBLE_QUOTED_TYPE, SYMBOL = SYMBOL_TYPE, NUMBER = FLOATING_POINT_TYPE, BOOLEAN = BOOLEAN_TYPE,
  COMMENT = LINE_COMMENT_TYPE, NEWLINE = NEWLINE_TYPE, END = END_TYPE
}
 

Public Member Functions

 Token ()
 
 Token (Type t, ExtendedType e, const std::string &s, int L, int c, uint64 byte)
 
 Token (Type t, ExtendedType e, const std::string &s, bool b, int L, int c, uint64 byte)
 
Type type () const
 
ExtendedType extendedType () const
 
const std::string & string () const
 
bool boolean () const
 
int line () const
 
int character () const
 
uint64 bytePosition () const
 
double number () const
 

Private Attributes

std::string _string
 
bool _bool
 
int _line
 
int _character
 
uint64 _bytePosition
 
Type _type
 
ExtendedType _extendedType
 

Friends

class TextInput
 

Detailed Description

For use with TextInput.

Member Enumeration Documentation

More detailed type information than Type.

Enumerator
DOUBLE_QUOTED_TYPE 
SINGLE_QUOTED_TYPE 
SYMBOL_TYPE 
FLOATING_POINT_TYPE 
INTEGER_TYPE 
BOOLEAN_TYPE 
LINE_COMMENT_TYPE 
BLOCK_COMMENT_TYPE 
NEWLINE_TYPE 
END_TYPE 
40  {
50  END_TYPE
51  };
Definition: TextInput.h:46
Definition: TextInput.h:45
Definition: TextInput.h:50
Definition: TextInput.h:43
Definition: TextInput.h:48
Definition: TextInput.h:47
Definition: TextInput.h:41
Definition: TextInput.h:42
Definition: TextInput.h:49
Definition: TextInput.h:44

Strings are enclosed in quotes, symbols are not.

Enumerator
STRING 
SYMBOL 
NUMBER 
BOOLEAN 
COMMENT 
NEWLINE 
END 
56  {
63  END = END_TYPE
64  };
Definition: TextInput.h:61
Definition: TextInput.h:46
Definition: TextInput.h:62
Definition: TextInput.h:57
Definition: TextInput.h:58
Definition: TextInput.h:50
Definition: TextInput.h:63
Definition: TextInput.h:43
Definition: TextInput.h:60
Definition: TextInput.h:47
Definition: TextInput.h:59
Definition: TextInput.h:41
Definition: TextInput.h:49
Definition: TextInput.h:44

Constructor & Destructor Documentation

G3D::Token::Token ( )
inline
85  :
86  _string(""),
87  _bool(false),
88  _line(0),
89  _character(0),
90  _bytePosition(0),
91  _type(END),
Definition: TextInput.h:50
int _character
Definition: TextInput.h:78
Definition: TextInput.h:63
ExtendedType _extendedType
Definition: TextInput.h:81
uint64 _bytePosition
Definition: TextInput.h:79
int _line
Definition: TextInput.h:77
bool _bool
Definition: TextInput.h:76
std::string _string
Definition: TextInput.h:74
Type _type
Definition: TextInput.h:80
G3D::Token::Token ( Type  t,
ExtendedType  e,
const std::string &  s,
int  L,
int  c,
uint64  byte 
)
inline
95  : _string(s), _bool(false), _line(L), _character(c), _bytePosition(byte), _type(t), _extendedType(e) {}
int _character
Definition: TextInput.h:78
ExtendedType _extendedType
Definition: TextInput.h:81
uint64 _bytePosition
Definition: TextInput.h:79
#define byte(x, n)
Definition: tomcrypt_macros.h:419
int _line
Definition: TextInput.h:77
bool _bool
Definition: TextInput.h:76
std::string _string
Definition: TextInput.h:74
Type _type
Definition: TextInput.h:80
G3D::Token::Token ( Type  t,
ExtendedType  e,
const std::string &  s,
bool  b,
int  L,
int  c,
uint64  byte 
)
inline
98  : _string(s), _bool(b), _line(L), _character(c), _bytePosition(byte), _type(t), _extendedType(e) {}
int _character
Definition: TextInput.h:78
ExtendedType _extendedType
Definition: TextInput.h:81
uint64 _bytePosition
Definition: TextInput.h:79
#define byte(x, n)
Definition: tomcrypt_macros.h:419
int _line
Definition: TextInput.h:77
bool _bool
Definition: TextInput.h:76
std::string _string
Definition: TextInput.h:74
Type _type
Definition: TextInput.h:80

Member Function Documentation

bool G3D::Token::boolean ( ) const
inline
117  {
118  return _bool;
119  }
bool _bool
Definition: TextInput.h:76

+ Here is the caller graph for this function:

uint64 G3D::Token::bytePosition ( ) const
inline

Number of bytes from the beginning of the buffer that this token was parsed from. Begins at 0

139  {
140  return _bytePosition;
141  }
uint64 _bytePosition
Definition: TextInput.h:79

+ Here is the caller graph for this function:

int G3D::Token::character ( ) const
inline

Starting character position in the input line from which this token was parsed. Starts at 1.

133  {
134  return _character;
135  }
int _character
Definition: TextInput.h:78

+ Here is the caller graph for this function:

ExtendedType G3D::Token::extendedType ( ) const
inline
104  {
105  return _extendedType;
106  }
ExtendedType _extendedType
Definition: TextInput.h:81
int G3D::Token::line ( ) const
inline

Starting line of the input from which this token was parsed. Starts at 1.

125  {
126  return _line;
127  }
int _line
Definition: TextInput.h:77

+ Here is the caller graph for this function:

double G3D::Token::number ( ) const

Return the numeric value for a number type, or zero if this is not a number type.

33  {
34  if (_type == NUMBER) {
36  } else {
37  return 0.0;
38  }
39 }
Definition: TextInput.h:59
std::string _string
Definition: TextInput.h:74
static double parseNumber(const std::string &_string)
Definition: TextInput.cpp:46
Type _type
Definition: TextInput.h:80

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const std::string& G3D::Token::string ( ) const
inline

The value of a single or double quote string (not including the quotes), the name of a symbol, or the exact textual representation of a number as parsed from the input.

113  {
114  return _string;
115  }
std::string _string
Definition: TextInput.h:74

+ Here is the caller graph for this function:

Type G3D::Token::type ( ) const
inline
100  {
101  return _type;
102  }
Type _type
Definition: TextInput.h:80

+ Here is the caller graph for this function:

Friends And Related Function Documentation

friend class TextInput
friend

Member Data Documentation

bool G3D::Token::_bool
private
uint64 G3D::Token::_bytePosition
private
int G3D::Token::_character
private
ExtendedType G3D::Token::_extendedType
private
int G3D::Token::_line
private
std::string G3D::Token::_string
private

Holds the actual value, which might be any type. If a number, it will be parsed at runtime.

Type G3D::Token::_type
private

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