]> git.mxchange.org Git - simgear.git/blobdiff - simgear/props/propertyObject.hxx
cppbind: automatic conversion of SGReferenced derived pointers.
[simgear.git] / simgear / props / propertyObject.hxx
index 6a5e1ae7345d1a91fceff2f2bb02bb378d17c846..9e6586594e379473d50dd3a3dd1fc66b52ad315a 100644 (file)
@@ -59,19 +59,20 @@ template <typename T>
 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)
   {
   
@@ -114,10 +115,9 @@ public:
   T operator=(const T& aValue)
   {
     SGPropertyNode* n = PropertyObjectBase::node(true);
-    if (!n) {
+    if( !n )
       return aValue;
-    }
-    
+
     n->setValue<T>(aValue);
     return aValue;
   }
@@ -126,8 +126,9 @@ public:
   T operator op##=(const T rhs)\
   {\
     SGPropertyNode* n = getOrThrow();\
-    n->setValue<T>(n->getValue<T>() op rhs);\
-    return *this;\
+    T new_val = n->getValue<T>() op rhs;\
+    n->setValue<T>(new_val);\
+    return new_val;\
   }
 
   SG_DEF_ASSIGN_OP(+)
@@ -156,13 +157,13 @@ template <>
 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)
   {