diff options
author | Mike Buland <eichlan@xagasoft.com> | 2011-03-08 21:03:43 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2011-03-08 21:03:43 +0000 |
commit | 744fe4ecbcf613ee637d00e8808f69668eac6bb2 (patch) | |
tree | a35e424f73a099d5cfc342623f56a7b2de41f02d /src/dictionary.cpp | |
parent | cd210c95a5a429293aa5c88965d3526116ba8723 (diff) | |
download | libgats-744fe4ecbcf613ee637d00e8808f69668eac6bb2.tar.gz libgats-744fe4ecbcf613ee637d00e8808f69668eac6bb2.tar.bz2 libgats-744fe4ecbcf613ee637d00e8808f69668eac6bb2.tar.xz libgats-744fe4ecbcf613ee637d00e8808f69668eac6bb2.zip |
Added a whole load of new, cool helpers for working with dictionaries and lists.
Diffstat (limited to '')
-rw-r--r-- | src/dictionary.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/dictionary.cpp b/src/dictionary.cpp index aaba7b8..9728804 100644 --- a/src/dictionary.cpp +++ b/src/dictionary.cpp | |||
@@ -168,6 +168,63 @@ void Gats::Dictionary::insert( const Bu::String &sKey, const Bu::String &s ) | |||
168 | ); | 168 | ); |
169 | } | 169 | } |
170 | 170 | ||
171 | void Gats::Dictionary::insertBool( const Bu::String &sKey, bool b ) | ||
172 | { | ||
173 | Bu::Hash<Gats::String, Gats::Object *>::insert( | ||
174 | sKey, new Gats::Boolean( b ) | ||
175 | ); | ||
176 | } | ||
177 | |||
178 | void Gats::Dictionary::insertInt( const Bu::String &sKey, int64_t i ) | ||
179 | { | ||
180 | Bu::Hash<Gats::String, Gats::Object *>::insert( | ||
181 | sKey, new Gats::Integer( i ) | ||
182 | ); | ||
183 | } | ||
184 | |||
185 | void Gats::Dictionary::insertFloat( const Bu::String &sKey, double d ) | ||
186 | { | ||
187 | Bu::Hash<Gats::String, Gats::Object *>::insert( | ||
188 | sKey, new Gats::Float( d ) | ||
189 | ); | ||
190 | } | ||
191 | |||
192 | void Gats::Dictionary::insertStr( const Bu::String &sKey, const Bu::String &s ) | ||
193 | { | ||
194 | Bu::Hash<Gats::String, Gats::Object *>::insert( | ||
195 | sKey, new Gats::String( s ) | ||
196 | ); | ||
197 | } | ||
198 | |||
199 | void Gats::Dictionary::insertList( const Bu::String &sKey, Gats::List *pL ) | ||
200 | { | ||
201 | Bu::Hash<Gats::String, Gats::Object *>::insert( | ||
202 | sKey, pL | ||
203 | ); | ||
204 | } | ||
205 | |||
206 | void Gats::Dictionary::insertDict( const Bu::String &sKey, | ||
207 | Gats::Dictionary *pD ) | ||
208 | { | ||
209 | Bu::Hash<Gats::String, Gats::Object *>::insert( | ||
210 | sKey, pD | ||
211 | ); | ||
212 | } | ||
213 | |||
214 | Gats::List *Gats::Dictionary::insertList( const Bu::String &sKey ) | ||
215 | { | ||
216 | Gats::List *pLst = new Gats::List(); | ||
217 | insertList( sKey, pLst ); | ||
218 | return pLst; | ||
219 | } | ||
220 | |||
221 | Gats::Dictionary *Gats::Dictionary::insertDict( const Bu::String &sKey ) | ||
222 | { | ||
223 | Gats::Dictionary *pDict = new Gats::Dictionary(); | ||
224 | insertDict( sKey, pDict ); | ||
225 | return pDict; | ||
226 | } | ||
227 | |||
171 | bool Gats::Dictionary::getBool( const Bu::String &sKey ) | 228 | bool Gats::Dictionary::getBool( const Bu::String &sKey ) |
172 | { | 229 | { |
173 | Gats::Boolean *pOb = dynamic_cast<Gats::Boolean *>( get( sKey ) ); | 230 | Gats::Boolean *pOb = dynamic_cast<Gats::Boolean *>( get( sKey ) ); |