00001 #ifndef PROPERTYBAG_H 00002 #define PROPERTYBAG_H 00003 00004 #include <exception> 00005 #include <memory> 00006 #include <map> 00007 #include <string> 00008 #include "Property.h" 00009 class Property; 00010 00011 00012 class PropertyBag 00013 { 00014 public: 00015 PropertyBag(const std::string& name); 00016 PropertyBag(const PropertyBag& other); 00017 virtual ~PropertyBag()=0; 00018 virtual void save(); 00019 Property& operator[](const std::string idx)throw(std::exception); 00020 const Property& operator[](const std::string idx)const throw(std::exception); 00021 Property& addProperty(Property* newProp); 00022 void operator=(const PropertyBag& other); 00023 void merge(const PropertyBag& other); 00024 protected: 00025 virtual Property* store(Property& prop)=0; 00026 virtual Property* load(Property& prop)throw(std::exception)=0; 00027 void destroy(); 00028 typedef std::map<std::string,Property*> PropMap; 00029 PropMap m_props; 00030 std::string m_name; 00031 }; 00032 00033 #endif //PROPERTYBAG_H