From 0b1399479a09c25e52f12ed8f37971830aa55d29 Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Wed, 27 May 2015 20:18:22 +0200 Subject: [PATCH] PropertyObject: enable creation of property add a create-flag to the node() method of a PropertyObject, defaulting to false to maintain existing behaviour. This could be used to add a listener to a non-existing property without having to write a dummy-value beforehand. Usage: myPropertyObject->node() returns the corresponding node or NULL if does not exist or has not been accessed before. myPropertyObject->node(true) returns the corresponding node, never NULL. If the property does not exist, it will gets created. --- simgear/props/propertyObject.hxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/simgear/props/propertyObject.hxx b/simgear/props/propertyObject.hxx index 9e658659..d97f9d11 100644 --- a/simgear/props/propertyObject.hxx +++ b/simgear/props/propertyObject.hxx @@ -144,9 +144,9 @@ public: #undef SG_DEF_ASSIGN_OP - SGPropertyNode* node() const + SGPropertyNode* node(bool aCreate = false) const { - return PropertyObjectBase::node(false); + return PropertyObjectBase::node(aCreate); } }; // of template PropertyObject -- 2.39.5