00001 // See license.txt for license information. 00002 // 00003 // generic.hpp 00004 // 00005 // 2-Nov-2005 phamilton Created 00006 // 00007 00008 #ifndef incXMLOBJ_GENERIC 00009 #define incXMLOBJ_GENERIC 00010 00011 // forwards 00012 #include "../xmlobj.hpp" 00013 #include "../xmlobj_vector.hpp" 00014 #include "boost/shared_ptr.hpp" 00015 #include <vector> 00016 #include <map> 00017 #include <string> 00018 00019 namespace ph { 00020 namespace xmlobj { 00021 namespace generic { 00022 00023 class XMLOBJ_DECL generic : public xmlobj 00024 /** 00025 A generic object. This object keeps a list of all composite 00026 and other members as strings and allows an unknown DOM to be loaded. 00027 */ 00028 { 00029 public: 00030 generic(const std::string &type, const std::string &name) : 00031 xmlobj(type, name) 00032 {}; 00033 00034 // the copy constructor. 00035 void copy(const generic &obj) 00036 { xmlobj::xmlobj::copy(obj); } 00037 00038 // xmlobj overrides 00039 virtual bool accept(ph::common::object_name_visitor *v) const; 00040 virtual bool accept(ph::common::member_visitor *v); 00041 virtual bool accept(ph::common::const_member_visitor *v) const; 00042 virtual bool accept(ph::common::object_visitor *v); 00043 virtual bool accept(ph::common::const_object_visitor *v) const; 00044 virtual ph::common::object_base *clone( 00045 const std::string &name, ph::common::cloneable_object_context *context) const; 00046 00047 // persistable_object_base overrides 00048 virtual ph::common::object_base *get_composite_object(const std::string &name); 00049 virtual bool has(const std::string &name) const; 00050 virtual void set(const std::string &name, const std::string &value); 00051 00052 // pretendable_object_base overrides. 00053 virtual bool is_any_object() 00054 { return true; } 00055 00056 private: 00057 std::vector<boost::shared_ptr<xmlobj_vector> > _composites; 00058 std::map<std::string, std::string> _members; 00059 }; 00060 00061 }; // generic 00062 }; // xmlobj 00063 }; // ph 00064 00065 #endif // incXMLOBJ_GENERIC