More helper methods for Canvas and PropertyBasedElement.

This commit is contained in:
Thomas Geymayer
2013-06-02 21:19:37 +02:00
parent 7a8d796ac1
commit 2a6c50c893
6 changed files with 42 additions and 0 deletions
+11
View File
@@ -55,6 +55,17 @@ namespace simgear
setValue(_node->getNode(name, true), val);
}
template<class T>
T get( const std::string& name,
typename boost::call_traits<T>::param_type def = T() )
{
SGPropertyNode const* child = _node->getNode(name);
if( !child )
return def;
return getValue<T>(child);
}
virtual void setSelf(const PropertyBasedElementPtr& self);
protected:
+6
View File
@@ -1796,6 +1796,12 @@ inline const char * getValue<const char*>(const SGPropertyNode* node)
return node->getStringValue ();
}
template<>
inline std::string getValue<std::string>(const SGPropertyNode* node)
{
return node->getStringValue();
}
inline bool setValue(SGPropertyNode* node, bool value)
{
return node->setBoolValue(value);