class PropertyObject : PropertyObjectBase
{
public:
- PropertyObject();
+ PropertyObject()
+ {}
/**
* Create from path relative to the default root, and option default value
*/
- PropertyObject(const char* aChild) :
+ explicit PropertyObject(const char* aChild) :
PropertyObjectBase(aChild)
{ }
/**
* Create from a node, with optional relative path
*/
- PropertyObject(SGPropertyNode* aNode, const char* aChild = NULL) :
+ explicit PropertyObject(SGPropertyNode* aNode, const char* aChild = NULL) :
PropertyObjectBase(aNode, aChild)
{
// conversion operators
operator T () const
{
- return getOrThrow()->getValue<T>();
+ return getOrThrow()->template getValue<T>();
}
T operator=(const T& aValue)
{
SGPropertyNode* n = PropertyObjectBase::node(true);
- if (!n) {
+ if( !n )
return aValue;
- }
-
+
n->setValue<T>(aValue);
return aValue;
}
+#define SG_DEF_ASSIGN_OP(op)\
+ T operator op##=(const T rhs)\
+ {\
+ SGPropertyNode* n = getOrThrow();\
+ T new_val = n->getValue<T>() op rhs;\
+ n->setValue<T>(new_val);\
+ return new_val;\
+ }
+
+ SG_DEF_ASSIGN_OP(+)
+ SG_DEF_ASSIGN_OP(-)
+ SG_DEF_ASSIGN_OP(*)
+ SG_DEF_ASSIGN_OP(/)
+ SG_DEF_ASSIGN_OP(%)
+ SG_DEF_ASSIGN_OP(>>)
+ SG_DEF_ASSIGN_OP(<<)
+ SG_DEF_ASSIGN_OP(&)
+ SG_DEF_ASSIGN_OP(^)
+ SG_DEF_ASSIGN_OP(|)
+
+#undef SG_DEF_ASSIGN_OP
+
SGPropertyNode* node() const
{
return PropertyObjectBase::node(false);
class PropertyObject<std::string> : PropertyObjectBase
{
public:
- PropertyObject(const char* aChild) :
+ explicit PropertyObject(const char* aChild) :
PropertyObjectBase(aChild)
{ }
- PropertyObject(SGPropertyNode* aNode, const char* aChild = NULL) :
+ explicit PropertyObject(SGPropertyNode* aNode, const char* aChild = NULL) :
PropertyObjectBase(aNode, aChild)
{