#include #include #include #include using namespace std; /* DictObject * Used to store different types of values. * either a string value or * a map (dictionary/collection) of key/value pairs (strings). * Note: i used the term Dict and Dictionary since * it will eventually map to the Python object directly. */ #ifndef _DATAOBJECT_ #define _DATAOBJECT_ class DictObject { public: enum DictObjectType {Scalar, Dict}; private: DictObjectType type; string value; map entry; public: DictObject(DictObjectType type); DictObject(void); DictObject(string); ~DictObject(); bool isDict(void); bool isScalar(void); // dictionary operations bool hasKey(string key); void setValue(string key, DictObject *value); DictObject *getValue(string key); map& getDict(void); vector* getKeys(void); // value operations void setValue(string value); string getValue(void); // returns a 'python' formatted string. string format(string indent = ""); }; #endif