summaryrefslogtreecommitdiff
path: root/src/variable.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/variable.h')
-rw-r--r--src/variable.h48
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
9class Variable 9class Variable
10{ 10{
11friend uint32_t Bu::__calcHashCode<Variable>( const Variable &k );
11public: 12public:
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
23public: 24public:
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
52private:
53 void initType();
54 void deinitType();
46 55
47private: 56private:
48 Type eType; 57 Type eType;
@@ -61,4 +70,11 @@ private:
61 }; 70 };
62}; 71};
63 72
73namespace 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