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