From a9e52e201f401860e394a87ec3634206aedc440b Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 8 Sep 2015 19:44:43 +0000 Subject: Added a getType helper to the dictionary. This allows you to get the type of a child object without having to unpack it. --- c++-libbu++/src/dictionary.cpp | 5 +++++ c++-libbu++/src/dictionary.h | 1 + 2 files changed, 6 insertions(+) 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() } } +Gats::Type Gats::Dictionary::getType( const Bu::String &sKey ) const +{ + return get( sKey )->getType(); +} + Gats::Object *Gats::Dictionary::clone() const { 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 virtual ~Dictionary(); virtual Type getType() const { return typeDictionary; } + Type getType( const Bu::String &sKey ) const; virtual Object *clone() const; virtual void write( Bu::Stream &rOut ) const; virtual void read( Bu::Stream &rIn, char cType ); -- cgit v1.2.3