More helper methods for Canvas and PropertyBasedElement.
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user