diff options
author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-01-14 22:04:55 +0100 |
---|---|---|
committer | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-01-14 22:04:55 +0100 |
commit | 2ed3e09b30357cbab2137056d51caf6bac3f48c6 (patch) | |
tree | 88cc939075dc62d2daca14ffb2d307b88fb19d53 | |
parent | 682250084fdd162b86427e0c29af24696ad10eb1 (diff) |
Added RttiType::hasProperty and RttiType::hasMethod function
-rw-r--r-- | src/core/common/Rtti.cpp | 10 | ||||
-rw-r--r-- | src/core/common/Rtti.hpp | 17 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/core/common/Rtti.cpp b/src/core/common/Rtti.cpp index 239f2b4..6809911 100644 --- a/src/core/common/Rtti.cpp +++ b/src/core/common/Rtti.cpp @@ -161,6 +161,16 @@ std::shared_ptr<PropertyDescriptor> RttiType::getProperty(const std::string &nam return it->second; } +bool RttiType::hasMethod(const std::string &name) const +{ + return methods.count(name) > 0; +} + +bool RttiType::hasProperty(const std::string &name) const +{ + return properties.count(name) > 0; +} + /* Constant initialization */ namespace RttiTypes { diff --git a/src/core/common/Rtti.hpp b/src/core/common/Rtti.hpp index 6449c75..3549474 100644 --- a/src/core/common/Rtti.hpp +++ b/src/core/common/Rtti.hpp @@ -435,6 +435,23 @@ public: */ std::shared_ptr<PropertyDescriptor> getProperty(const std::string &name) const; + /** + * Returns true if a method with the given name is registered for this type. + * + * @param name is the name of the method that should be looked up. + * @return true if a method with this name exists, false otherwise. + */ + bool hasMethod(const std::string &name) const; + + /** + * Returns true if a property with the given name is registered for this + * type. + * + * @param name is the name of the property that should be looked up. + * @return true if a property with this name exists, false otherwise. + */ + bool hasProperty(const std::string &name) const; + }; /** |