Add method to get fully qualified id to Propertys

This commit is contained in:
Alexander Bock
2014-12-06 17:19:25 +01:00
parent 9a9c0c0237
commit 4e65aaafe2
2 changed files with 25 additions and 3 deletions

View File

@@ -167,6 +167,15 @@ public:
* \return The unique identifier of this Property
*/
const std::string& identifier() const;
/**
* Returns the fully qualified name for this Property that uniquely identifies this
* Property within OpenSpace. It consists of the <code>identifier</code> preceded by
* all levels of PropertyOwner%s separated with <code>.</code>; for example:
* <code>owner1.owner2.identifier</code>.
* \return The fully qualified identifier for this Property
*/
std::string fullyQualifiedIdentifier() const;
/**
* Returns the PropertyOwner of this Property or <code>nullptr</code>, if it does not
@@ -189,7 +198,7 @@ public:
* key.
* \return The human-readable GUI name for this Property
*/
const std::string& guiName() const;
std::string guiName() const;
/**
* Sets the identifier of the group that this Property belongs to. Property groups can

View File

@@ -22,7 +22,9 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include "openspace/properties/property.h"
#include <openspace/properties/property.h>
#include <openspace/properties/propertyowner.h>
#include <ghoul/lua/ghoul_lua.h>
@@ -63,6 +65,17 @@ const std::string& Property::identifier() const {
return _identifier;
}
std::string Property::fullyQualifiedIdentifier() const {
std::string identifier = _identifier;
PropertyOwner* currentOwner = owner();
while (currentOwner) {
std::string ownerId = currentOwner->name();
identifier = ownerId + "." + identifier;
currentOwner = currentOwner->owner();
}
return identifier;
}
boost::any Property::get() const {
return boost::any();
}
@@ -85,7 +98,7 @@ int Property::typeLua() const {
return LUA_TNONE;
}
const std::string& Property::guiName() const {
std::string Property::guiName() const {
std::string result;
_metaData.getValue(_metaDataKeyGuiName, result);
return std::move(result);