summaryrefslogtreecommitdiff
path: root/src/classimpl.h
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-04-02 23:12:31 +0200
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-04-02 23:12:31 +0200
commita3bd6dc04d5210ddeffdda5884f51c0e5b37ec27 (patch)
tree41ec4059d1c713e117126e1e131564946e0b27ad /src/classimpl.h
parentbbdcdae98979e002476fc1e8296effd0b270928b (diff)
added Class::implements() method to allow classes that implement interfaces (request from issue #52)
Diffstat (limited to 'src/classimpl.h')
-rw-r--r--src/classimpl.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/classimpl.h b/src/classimpl.h
index bfb4532..03dc548 100644
--- a/src/classimpl.h
+++ b/src/classimpl.h
@@ -73,6 +73,12 @@ private:
*/
std::map<std::string,std::shared_ptr<Property>> _properties;
+ /**
+ * Interfaces that are implemented
+ * @var std::list
+ */
+ std::list<std::shared_ptr<ClassImpl>> _interfaces;
+
/**
* Retrieve an array of zend_function_entry objects that hold the
@@ -395,7 +401,11 @@ public:
void property(const char *name, const getter_callback_0 &getter, const setter_callback_1 &setter) { _properties[name] = std::make_shared<Property>(getter,setter); }
void property(const char *name, const getter_callback_1 &getter, const setter_callback_1 &setter) { _properties[name] = std::make_shared<Property>(getter,setter); }
-
+ /**
+ * Add an interface that is implemented
+ * @param interface The interface that is implemented
+ */
+ void implements(const std::shared_ptr<ClassImpl> &interface) { _interfaces.push_back(interface); }
};