diff options
Diffstat (limited to 'src/variable.h')
-rw-r--r-- | src/variable.h | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/src/variable.h b/src/variable.h index 3df9255..c9665f5 100644 --- a/src/variable.h +++ b/src/variable.h | |||
@@ -4,26 +4,51 @@ | |||
4 | #include <stdint.h> | 4 | #include <stdint.h> |
5 | 5 | ||
6 | #include <bu/string.h> | 6 | #include <bu/string.h> |
7 | #include <bu/hash.h> | ||
7 | 8 | ||
8 | class Variable | 9 | class Variable |
9 | { | 10 | { |
10 | public: | 11 | public: |
11 | enum Type | 12 | enum Type |
12 | { | 13 | { |
13 | Undef, | 14 | Null, |
14 | Int, | 15 | Int, |
15 | Float, | 16 | Float, |
16 | Bool, | 17 | Bool, |
17 | String | 18 | String, |
19 | List, | ||
20 | Dictionary | ||
18 | }; | 21 | }; |
19 | 22 | ||
20 | public: | 23 | public: |
21 | Variable(); | 24 | Variable(); |
25 | Variable( Type eType ); | ||
26 | Variable( int64_t iValue ); | ||
27 | Variable( double fValue ); | ||
28 | Variable( bool bValue ); | ||
29 | Variable( const Bu::String &sValue ); | ||
22 | virtual ~Variable(); | 30 | virtual ~Variable(); |
23 | 31 | ||
32 | Variable &operator=( const Variable &rhs ); | ||
33 | Variable &operator+=( const Variable &rhs ); | ||
34 | Variable &operator-=( const Variable &rhs ); | ||
35 | Variable &operator*=( const Variable &rhs ); | ||
36 | Variable &operator/=( const Variable &rhs ); | ||
37 | Variable &operator+( const Variable &rhs ); | ||
38 | Variable &operator-( const Variable &rhs ); | ||
39 | Variable &operator*( const Variable &rhs ); | ||
40 | Variable &operator/( const Variable &rhs ); | ||
41 | Variable &operator!=( const Variable &rhs ); | ||
42 | Variable &operator>( const Variable &rhs ); | ||
43 | Variable &operator<( const Variable &rhs ); | ||
44 | Variable &operator>=( const Variable &rhs ); | ||
45 | Variable &operator<=( const Variable &rhs ); | ||
46 | |||
24 | private: | 47 | private: |
25 | Type eType; | 48 | Type eType; |
26 | bool bNull; | 49 | |
50 | typedef Bu::List<Variable> VList; | ||
51 | typedef Bu::Hash<Variable, Variable> VHash; | ||
27 | 52 | ||
28 | union | 53 | union |
29 | { | 54 | { |
@@ -31,6 +56,8 @@ private: | |||
31 | double fValue; | 56 | double fValue; |
32 | bool bValue; | 57 | bool bValue; |
33 | Bu::String *sValue; | 58 | Bu::String *sValue; |
59 | VList *lValue; | ||
60 | VHash *hValue; | ||
34 | }; | 61 | }; |
35 | }; | 62 | }; |
36 | 63 | ||