00001 // See ../../license.txt for license information. 00002 // 00003 // c_base.cpp 00004 // 00005 // 7-Aug-2003 phamilton Created 00006 // 00007 00008 #include "c_base.hpp" 00009 00010 using namespace persist_test; 00011 00012 ph::common::object_base *c_base::create( 00013 const std::string &type, 00014 const std::string &name, 00015 ph::common::persistable_object_context *context) 00016 { 00017 if (outer() && outer()->persistable()) 00018 return outer()->persistable()->create(type, name, context); 00019 return 0; 00020 } 00021 00022 bool c_base::has(const std::string &name) const 00023 { 00024 return name == "name" || name == "type"; 00025 } 00026 00027 void c_base::set(const std::string &name, const std::string &value) 00028 { 00029 if (name == "name") 00030 _name = value; 00031 else if (name == "type") 00032 ; // TBD: Should check this error. 00033 } 00034 00035 std::string c_base::get(const std::string &name) const 00036 { 00037 if (name == "name") 00038 return _name; 00039 else if (name == "type") 00040 return "composite"; 00041 else 00042 return "unknown: " + name; 00043 }