Skip to content
Snippets Groups Projects
Commit e708cb1f authored by Tobias Schmidt's avatar Tobias Schmidt
Browse files

return list of all generic properties

parent 658ed2bb
No related branches found
No related tags found
No related merge requests found
...@@ -156,6 +156,7 @@ void const_generic_prop_def(O& bp_class) ...@@ -156,6 +156,7 @@ void const_generic_prop_def(O& bp_class)
.def("GetIntProp", get_int2) .def("GetIntProp", get_int2)
.def("GetStringProp", get_str1) .def("GetStringProp", get_str1)
.def("GetStringProp", get_str2) .def("GetStringProp", get_str2)
.def("GetPropList",&C::GetPropList)
.def("GetGenericBoolProperty", &depr_get_bool_a<C>) .def("GetGenericBoolProperty", &depr_get_bool_a<C>)
.def("GetGenericBoolProperty", &depr_get_bool_b<C>) .def("GetGenericBoolProperty", &depr_get_bool_b<C>)
.def("GetGenericFloatProperty", &depr_get_float_a<C>) .def("GetGenericFloatProperty", &depr_get_float_a<C>)
...@@ -180,6 +181,7 @@ void generic_prop_def(O& bp_class) ...@@ -180,6 +181,7 @@ void generic_prop_def(O& bp_class)
.def("SetFloatProp", &C::SetFloatProp) .def("SetFloatProp", &C::SetFloatProp)
.def("SetIntProp", &C::SetIntProp) .def("SetIntProp", &C::SetIntProp)
.def("SetStringProp", &C::SetStringProp) .def("SetStringProp", &C::SetStringProp)
.def("GetPropList",&C::GetPropList)
.def("ClearGenericProperties", &depr_clear_props<C>) .def("ClearGenericProperties", &depr_clear_props<C>)
.def("SetGenericIntProperty", &depr_set_int<C>) .def("SetGenericIntProperty", &depr_set_int<C>)
.def("SetGenericFloatProperty", &depr_set_float<C>) .def("SetGenericFloatProperty", &depr_set_float<C>)
...@@ -189,4 +191,4 @@ void generic_prop_def(O& bp_class) ...@@ -189,4 +191,4 @@ void generic_prop_def(O& bp_class)
; ;
} }
#endif #endif
\ No newline at end of file
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <exception> #include <exception>
#include <sstream> #include <sstream>
#include <map> #include <map>
#include <vector>
#include <boost/variant.hpp> #include <boost/variant.hpp>
#include <ost/module_config.hh> #include <ost/module_config.hh>
...@@ -109,6 +110,7 @@ public: ...@@ -109,6 +110,7 @@ public:
map_->erase(key); map_->erase(key);
} }
} }
void Assign(const GenericPropContainerImpl& impl) void Assign(const GenericPropContainerImpl& impl)
{ {
if (impl.map_) { if (impl.map_) {
...@@ -130,6 +132,17 @@ public: ...@@ -130,6 +132,17 @@ public:
return *map_; return *map_;
} }
std::vector<String> GetPropList() const
{
std::vector<String> prop_list;
if (map_) {
PropertyMap::const_iterator i;
for (i=map_->begin(); i!=map_->end(); ++i) {
prop_list.push_back(i->first);
}
}
return prop_list;
}
private: private:
mutable PropertyMap* map_; mutable PropertyMap* map_;
...@@ -189,12 +202,13 @@ public: ...@@ -189,12 +202,13 @@ public:
rep << this->GetImpl()->GenericProp(key); rep << this->GetImpl()->GenericProp(key);
return rep.str(); return rep.str();
} }
/// \brief returns String property, raises an exception if it does not exist
String GetStringProp(const String& key) const /// \brief returns String property, raises an exception if it does not exist
{ String GetStringProp(const String& key) const
CheckHandleValidity(*static_cast<const H*>(this)); {
return this->gp_get<String>(key); CheckHandleValidity(*static_cast<const H*>(this));
} return this->gp_get<String>(key);
}
/// \brief returns floating point property, raises an exception if it does /// \brief returns floating point property, raises an exception if it does
/// not exist /// not exist
...@@ -279,6 +293,12 @@ public: ...@@ -279,6 +293,12 @@ public:
CheckHandleValidity(*static_cast<const H*>(this)); CheckHandleValidity(*static_cast<const H*>(this));
return this->GetImpl()->GetPropMap(); return this->GetImpl()->GetPropMap();
} }
std::vector<String> GetPropList() const
{
CheckHandleValidity(*static_cast<const H*>(this));
return this->GetImpl()->GetPropList();
}
}; };
/// \brief base class for the handler classes /// \brief base class for the handler classes
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment