diff options
author | Mike Buland <eichlan@xagasoft.com> | 2012-11-08 22:58:28 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2012-11-08 22:58:28 +0000 |
commit | 52be1ef0d126f09ba943c7afcf367e7d9347f2fd (patch) | |
tree | fd4b0dd148751c3c6c1b95296c3b82cb86051b83 /src/variable.h | |
parent | 795d0737fed40d88a7801b451b7750ba90802345 (diff) | |
download | build-52be1ef0d126f09ba943c7afcf367e7d9347f2fd.tar.gz build-52be1ef0d126f09ba943c7afcf367e7d9347f2fd.tar.bz2 build-52be1ef0d126f09ba943c7afcf367e7d9347f2fd.tar.xz build-52be1ef0d126f09ba943c7afcf367e7d9347f2fd.zip |
tabconv: it's all spaces now.
Diffstat (limited to '')
-rw-r--r-- | src/variable.h | 190 |
1 files changed, 95 insertions, 95 deletions
diff --git a/src/variable.h b/src/variable.h index 890552a..f6c2044 100644 --- a/src/variable.h +++ b/src/variable.h | |||
@@ -12,109 +12,109 @@ class Variable | |||
12 | friend Bu::ArchiveBase &operator<<( Bu::ArchiveBase &ar, const Variable &v ); | 12 | friend Bu::ArchiveBase &operator<<( Bu::ArchiveBase &ar, const Variable &v ); |
13 | friend Bu::ArchiveBase &operator>>( Bu::ArchiveBase &ar, Variable &v ); | 13 | friend Bu::ArchiveBase &operator>>( Bu::ArchiveBase &ar, Variable &v ); |
14 | public: | 14 | public: |
15 | enum Type | 15 | enum Type |
16 | { | 16 | { |
17 | typeNone, | 17 | typeNone, |
18 | typeBool, | 18 | typeBool, |
19 | typeInt, | 19 | typeInt, |
20 | typeFloat, | 20 | typeFloat, |
21 | typeVersion, | 21 | typeVersion, |
22 | typeString, | 22 | typeString, |
23 | typeList, | 23 | typeList, |
24 | typeRef, /**< Reference by name, it's just a string. */ | 24 | typeRef, /**< Reference by name, it's just a string. */ |
25 | typeOpaque /**< Only useful to functions. */ | 25 | typeOpaque /**< Only useful to functions. */ |
26 | }; | 26 | }; |
27 | 27 | ||
28 | public: | 28 | public: |
29 | Variable(); | 29 | Variable(); |
30 | Variable( Type t ); | 30 | Variable( Type t ); |
31 | Variable( int iVal ); | 31 | Variable( int iVal ); |
32 | Variable( double fVal ); | 32 | Variable( double fVal ); |
33 | Variable( bool bVal ); | 33 | Variable( bool bVal ); |
34 | Variable( const Bu::String &sVal ); | 34 | Variable( const Bu::String &sVal ); |
35 | Variable( const char *sVal ); | 35 | Variable( const char *sVal ); |
36 | Variable( const Variable &v ); | 36 | Variable( const Variable &v ); |
37 | Variable( const class AstLeaf &l ); | 37 | Variable( const class AstLeaf &l ); |
38 | /** | 38 | /** |
39 | * This special case function turns the variable into a string if there is | 39 | * This special case function turns the variable into a string if there is |
40 | * only one string in the list, or a list of strings if there is more or | 40 | * only one string in the list, or a list of strings if there is more or |
41 | * less than one. | 41 | * less than one. |
42 | */ | 42 | */ |
43 | Variable( const StrList &lst ); | 43 | Variable( const StrList &lst ); |
44 | Variable( const VarList &lst ); | 44 | Variable( const VarList &lst ); |
45 | Variable( void *oVal ); | 45 | Variable( void *oVal ); |
46 | virtual ~Variable(); | 46 | virtual ~Variable(); |
47 | 47 | ||
48 | static Variable mkRef( const Bu::String &sVal ); | 48 | static Variable mkRef( const Bu::String &sVal ); |
49 | 49 | ||
50 | Type getType() const; | 50 | Type getType() const; |
51 | 51 | ||
52 | // Raw aquisition functions, if the type isn't right, | 52 | // Raw aquisition functions, if the type isn't right, |
53 | // they throw an exception | 53 | // they throw an exception |
54 | int getInt() const; | 54 | int getInt() const; |
55 | double getFloat() const; | 55 | double getFloat() const; |
56 | bool getBool() const; | 56 | bool getBool() const; |
57 | const Bu::String &getString() const; | 57 | const Bu::String &getString() const; |
58 | const VarList &getList() const; | 58 | const VarList &getList() const; |
59 | const void *getOpaque() const; | 59 | const void *getOpaque() const; |
60 | 60 | ||
61 | // Conversion functions, they'll return the requested type, maybe an error | 61 | // Conversion functions, they'll return the requested type, maybe an error |
62 | // if the source data is really bad | 62 | // if the source data is really bad |
63 | int toInt() const; | 63 | int toInt() const; |
64 | double toFloat() const; | 64 | double toFloat() const; |
65 | bool toBool() const; | 65 | bool toBool() const; |
66 | Bu::String toString() const; | 66 | Bu::String toString() const; |
67 | VarList toList() const; | 67 | VarList toList() const; |
68 | 68 | ||
69 | Variable toType( Type eNewType ) const; | 69 | Variable toType( Type eNewType ) const; |
70 | 70 | ||
71 | void append( const Variable &v ); | 71 | void append( const Variable &v ); |
72 | VarList::iterator begin(); | 72 | VarList::iterator begin(); |
73 | VarList::const_iterator begin() const; | 73 | VarList::const_iterator begin() const; |
74 | 74 | ||
75 | void doNegate(); | 75 | void doNegate(); |
76 | void doNot(); | 76 | void doNot(); |
77 | 77 | ||
78 | const Variable &operator=( const Variable &rhs ); | 78 | const Variable &operator=( const Variable &rhs ); |
79 | const Variable &operator=( const int &rhs ); | 79 | const Variable &operator=( const int &rhs ); |
80 | const Variable &operator=( const double &rhs ); | 80 | const Variable &operator=( const double &rhs ); |
81 | const Variable &operator=( const bool &rhs ); | 81 | const Variable &operator=( const bool &rhs ); |
82 | const Variable &operator=( const Bu::String &rhs ); | 82 | const Variable &operator=( const Bu::String &rhs ); |
83 | const Variable &operator=( void *rhs ); | 83 | const Variable &operator=( void *rhs ); |
84 | 84 | ||
85 | const Variable &operator+=( const Variable &rhs ); | 85 | const Variable &operator+=( const Variable &rhs ); |
86 | const Variable &operator<<( const Variable &rhs ); | 86 | const Variable &operator<<( const Variable &rhs ); |
87 | 87 | ||
88 | bool operator==( const Variable &rhs ) const; | 88 | bool operator==( const Variable &rhs ) const; |
89 | bool operator!=( const Variable &rhs ) const; | 89 | bool operator!=( const Variable &rhs ) const; |
90 | bool operator<( const Variable &rhs ) const; | 90 | bool operator<( const Variable &rhs ) const; |
91 | bool operator>( const Variable &rhs ) const; | 91 | bool operator>( const Variable &rhs ) const; |
92 | bool operator<=( const Variable &rhs ) const; | 92 | bool operator<=( const Variable &rhs ) const; |
93 | bool operator>=( const Variable &rhs ) const; | 93 | bool operator>=( const Variable &rhs ) const; |
94 | 94 | ||
95 | Variable operator+( const Variable &rhs ) const; | 95 | Variable operator+( const Variable &rhs ) const; |
96 | Variable operator-( const Variable &rhs ) const; | 96 | Variable operator-( const Variable &rhs ) const; |
97 | Variable operator*( const Variable &rhs ) const; | 97 | Variable operator*( const Variable &rhs ) const; |
98 | Variable operator/( const Variable &rhs ) const; | 98 | Variable operator/( const Variable &rhs ) const; |
99 | 99 | ||
100 | private: | 100 | private: |
101 | Type eType; | 101 | Type eType; |
102 | union | 102 | union |
103 | { | 103 | { |
104 | int iVal; | 104 | int iVal; |
105 | double fVal; | 105 | double fVal; |
106 | bool bVal; | 106 | bool bVal; |
107 | Bu::String *sVal; | 107 | Bu::String *sVal; |
108 | VarList *lVal; | 108 | VarList *lVal; |
109 | void *oVal; | 109 | void *oVal; |
110 | } uVal; | 110 | } uVal; |
111 | 111 | ||
112 | void reset( Type eType ); | 112 | void reset( Type eType ); |
113 | }; | 113 | }; |
114 | 114 | ||
115 | namespace Bu | 115 | namespace Bu |
116 | { | 116 | { |
117 | class Formatter; | 117 | class Formatter; |
118 | } | 118 | } |
119 | 119 | ||
120 | Bu::Formatter &operator<<( Bu::Formatter &f, const Variable::Type &t ); | 120 | Bu::Formatter &operator<<( Bu::Formatter &f, const Variable::Type &t ); |