diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-01 22:39:31 +0100 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-01 22:39:31 +0100 |
commit | 6abc8b4c062c7333a98830004da894ff81613d5b (patch) | |
tree | 7b11179ef6775130fce0c4ef537fb3656f716852 /include/namespace.h | |
parent | abc3b4fbf996a647bcefb02e4ecf643b659577c9 (diff) |
added possibility to define interfaces, the class::add() method has been renamed to class::method() and class::property() to prevent ambiguity in defining properties and methods
Diffstat (limited to 'include/namespace.h')
-rw-r--r-- | include/namespace.h | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/include/namespace.h b/include/namespace.h index ef625fc..4cbf43e 100644 --- a/include/namespace.h +++ b/include/namespace.h @@ -78,7 +78,6 @@ public: /** * Add a native class to the extension by moving it - * @param name Name of the class * @param type The class implementation */ template<typename T> @@ -93,7 +92,6 @@ public: /** * Add a native class to the extension by copying it - * @param name Name of the class * @param type The class implementation */ template<typename T> @@ -105,6 +103,32 @@ public: // and add it to the list of classes _classes.push_back(std::unique_ptr<ClassBase>(copy)); } + + /** + * Add an interface to the extension by moving it + * @param interface The interface properties + */ + void add(Interface &&interface) + { + // make a copy of the object + auto *copy = new Interface(std::move(interface)); + + // and add it to the list of classes + _classes.push_back(std::unique_ptr<ClassBase>(copy)); + } + + /** + * Add an interface to the extension by copying it + * @param interface The interface properties + */ + void add(const Interface &interface) + { + // make a copy of the object + auto *copy = new Interface(interface); + + // and add it to the list of classes + _classes.push_back(std::unique_ptr<ClassBase>(copy)); + } /** * Add a namespace to the extension by moving it |