libUTL++
Token.h
1 #pragma once
2 
4 
5 #include <libutl/String.h>
6 
8 
9 UTL_NS_BEGIN;
10 
12 
20 
22 class Token : public String
23 {
25 
26 public:
34  Token(uint_t id, const String& token, size_t lineNo, size_t colNo)
35  : String(token)
36  {
37  _id = id;
38  _lineNo = lineNo;
39  _colNo = colNo;
40  }
41 
42  virtual int compare(const Object& rhs) const;
43 
44  virtual void copy(const Object& rhs);
45 
46  virtual void steal(Object& rhs);
47 
49 
50  uint_t
51  id() const
52  {
53  return _id;
54  }
55 
56  size_t
57  colNo() const
58  {
59  return _colNo;
60  }
61 
62  size_t
63  lineNo() const
64  {
65  return _lineNo;
66  }
68 private:
69  void
70  init()
71  {
72  _id = 0;
73  }
74  void
75  deInit()
76  {
77  }
78 
79 private:
80  uint_t _id;
81  size_t _lineNo, _colNo;
82 };
83 
85 
86 UTL_NS_END;
void deInit()
De-initialize UTL++.
#define UTL_CLASS_DECL(DC, BC)
Declaration of standard UTL++ functionality for a non-template class.
Definition: macros.h:688
Character string.
Definition: String.h:31
void copy(T *dest, const T *src, size_t len)
Copy one array of objects to another.
Definition: util_inl.h:690
Token(uint_t id, const String &token, size_t lineNo, size_t colNo)
Constructor.
Definition: Token.h:34
unsigned int uint_t
Unsigned integer.
Definition: types.h:59
Scanned token.
Definition: Token.h:22
Root of UTL++ class hierarchy.
Definition: Object.h:52
int compare(bool lhs, bool rhs)
Compare two boolean values.
void init()
Initialize UTL++.