aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2015-09-08 19:44:43 +0000
committerMike Buland <eichlan@xagasoft.com>2015-09-08 19:44:43 +0000
commita9e52e201f401860e394a87ec3634206aedc440b (patch)
tree84ca8355004158e00f7097b2bdc2f1f754d8f2da
parent86eb61d18b97230bb47f6651e44597cef7e4c24b (diff)
downloadlibgats-a9e52e201f401860e394a87ec3634206aedc440b.tar.gz
libgats-a9e52e201f401860e394a87ec3634206aedc440b.tar.bz2
libgats-a9e52e201f401860e394a87ec3634206aedc440b.tar.xz
libgats-a9e52e201f401860e394a87ec3634206aedc440b.zip
Added a getType helper to the dictionary. This allows you to get the type of a
child object without having to unpack it.
-rw-r--r--c++-libbu++/src/dictionary.cpp5
-rw-r--r--c++-libbu++/src/dictionary.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/c++-libbu++/src/dictionary.cpp b/c++-libbu++/src/dictionary.cpp
index 876bab2..5ed3834 100644
--- a/c++-libbu++/src/dictionary.cpp
+++ b/c++-libbu++/src/dictionary.cpp
@@ -33,6 +33,11 @@ Gats::Dictionary::~Dictionary()
33 } 33 }
34} 34}
35 35
36Gats::Type Gats::Dictionary::getType( const Bu::String &sKey ) const
37{
38 return get( sKey )->getType();
39}
40
36Gats::Object *Gats::Dictionary::clone() const 41Gats::Object *Gats::Dictionary::clone() const
37{ 42{
38 Gats::Dictionary *pClone = new Gats::Dictionary; 43 Gats::Dictionary *pClone = new Gats::Dictionary;
diff --git a/c++-libbu++/src/dictionary.h b/c++-libbu++/src/dictionary.h
index 9ea8a2e..d2cdec0 100644
--- a/c++-libbu++/src/dictionary.h
+++ b/c++-libbu++/src/dictionary.h
@@ -24,6 +24,7 @@ namespace Gats
24 virtual ~Dictionary(); 24 virtual ~Dictionary();
25 25
26 virtual Type getType() const { return typeDictionary; } 26 virtual Type getType() const { return typeDictionary; }
27 Type getType( const Bu::String &sKey ) const;
27 virtual Object *clone() const; 28 virtual Object *clone() const;
28 virtual void write( Bu::Stream &rOut ) const; 29 virtual void write( Bu::Stream &rOut ) const;
29 virtual void read( Bu::Stream &rIn, char cType ); 30 virtual void read( Bu::Stream &rIn, char cType );