diff options
author | Mike Buland <eichlan@xagasoft.com> | 2011-12-19 09:42:16 -0700 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2011-12-19 09:42:16 -0700 |
commit | c33bfc4ede827d3335e353fd35815c1613257942 (patch) | |
tree | b7cc27b6205bd571b3d56162f2f9b9dd47b69254 /src/variable.h | |
parent | 16a5fdbed6f57d62f2ac44f37988c35319222d79 (diff) | |
download | stage-c33bfc4ede827d3335e353fd35815c1613257942.tar.gz stage-c33bfc4ede827d3335e353fd35815c1613257942.tar.bz2 stage-c33bfc4ede827d3335e353fd35815c1613257942.tar.xz stage-c33bfc4ede827d3335e353fd35815c1613257942.zip |
Variables are assignable and comperable now.
Not >, <. >=, <=, but those should be really easy.
Diffstat (limited to 'src/variable.h')
-rw-r--r-- | src/variable.h | 48 |
1 files changed, 32 insertions, 16 deletions
diff --git a/src/variable.h b/src/variable.h index c9665f5..0236951 100644 --- a/src/variable.h +++ b/src/variable.h | |||
@@ -8,20 +8,22 @@ | |||
8 | 8 | ||
9 | class Variable | 9 | class Variable |
10 | { | 10 | { |
11 | friend uint32_t Bu::__calcHashCode<Variable>( const Variable &k ); | ||
11 | public: | 12 | public: |
12 | enum Type | 13 | enum Type |
13 | { | 14 | { |
14 | Null, | 15 | tNull, |
15 | Int, | 16 | tBool, |
16 | Float, | 17 | tInt, |
17 | Bool, | 18 | tFloat, |
18 | String, | 19 | tString, |
19 | List, | 20 | tList, |
20 | Dictionary | 21 | tDictionary |
21 | }; | 22 | }; |
22 | 23 | ||
23 | public: | 24 | public: |
24 | Variable(); | 25 | Variable(); |
26 | Variable( const Variable &src ); | ||
25 | Variable( Type eType ); | 27 | Variable( Type eType ); |
26 | Variable( int64_t iValue ); | 28 | Variable( int64_t iValue ); |
27 | Variable( double fValue ); | 29 | Variable( double fValue ); |
@@ -29,20 +31,27 @@ public: | |||
29 | Variable( const Bu::String &sValue ); | 31 | Variable( const Bu::String &sValue ); |
30 | virtual ~Variable(); | 32 | virtual ~Variable(); |
31 | 33 | ||
34 | Type getType() const { return eType; } | ||
35 | |||
32 | Variable &operator=( const Variable &rhs ); | 36 | Variable &operator=( const Variable &rhs ); |
33 | Variable &operator+=( const Variable &rhs ); | 37 | Variable &operator+=( const Variable &rhs ); |
34 | Variable &operator-=( const Variable &rhs ); | 38 | Variable &operator-=( const Variable &rhs ); |
35 | Variable &operator*=( const Variable &rhs ); | 39 | Variable &operator*=( const Variable &rhs ); |
36 | Variable &operator/=( const Variable &rhs ); | 40 | Variable &operator/=( const Variable &rhs ); |
37 | Variable &operator+( const Variable &rhs ); | 41 | Variable &operator+( const Variable &rhs ) const; |
38 | Variable &operator-( const Variable &rhs ); | 42 | Variable &operator-( const Variable &rhs ) const; |
39 | Variable &operator*( const Variable &rhs ); | 43 | Variable &operator*( const Variable &rhs ) const; |
40 | Variable &operator/( const Variable &rhs ); | 44 | Variable &operator/( const Variable &rhs ) const; |
41 | Variable &operator!=( const Variable &rhs ); | 45 | bool operator==( const Variable &rhs ) const; |
42 | Variable &operator>( const Variable &rhs ); | 46 | bool operator!=( const Variable &rhs ) const; |
43 | Variable &operator<( const Variable &rhs ); | 47 | bool operator>( const Variable &rhs ) const; |
44 | Variable &operator>=( const Variable &rhs ); | 48 | bool operator<( const Variable &rhs ) const; |
45 | Variable &operator<=( const Variable &rhs ); | 49 | bool operator>=( const Variable &rhs ) const; |
50 | bool operator<=( const Variable &rhs ) const; | ||
51 | |||
52 | private: | ||
53 | void initType(); | ||
54 | void deinitType(); | ||
46 | 55 | ||
47 | private: | 56 | private: |
48 | Type eType; | 57 | Type eType; |
@@ -61,4 +70,11 @@ private: | |||
61 | }; | 70 | }; |
62 | }; | 71 | }; |
63 | 72 | ||
73 | namespace Bu | ||
74 | { | ||
75 | template<> uint32_t __calcHashCode<Variable>( const Variable &k ); | ||
76 | template<> bool __cmpHashKeys<Variable>( const Variable &a, const Variable &b ); | ||
77 | } | ||
78 | |||
79 | |||
64 | #endif | 80 | #endif |