diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-02 23:28:10 +0100 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-02 23:28:10 +0100 |
commit | 8f24af4c28e74ef1769aef6ab00c480e09be7453 (patch) | |
tree | c73b7de11abbdd8ed2d3f3fa5b63fdd2a1409cb8 /include/countable.h | |
parent | f7dcf5d81fa1e43533c786d9443e5222398dc8b9 (diff) |
work in progress to support implementing SPL interfaces, disabled the _self variable in Php::Base because by having each object keeping a reference to itself, the refcounter never reached zero and the object was thus never destructed, checking if we can get a new implementation one way or another
Diffstat (limited to 'include/countable.h')
-rw-r--r-- | include/countable.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/include/countable.h b/include/countable.h new file mode 100644 index 0000000..12d87d5 --- /dev/null +++ b/include/countable.h @@ -0,0 +1,45 @@ +/** + * Countable.h + * + * "Interface" that can be "implemented" by your class. If you do, you + * create your class like this: + * + * class MyClass : public Php::Base, public Php::Countable { ... } + * + * You will have to implement the count() method, which should return the + * number of elements in the class + * + * @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com> + * @copyright 2014 Copernica BV + */ + +/** + * Set up namespace + */ +namespace Php { + +/** + * Class definition + */ +class Countable +{ +public: + /** + * Implementation of the countable interface + * @return zend_class_entry* + * @internal + */ + static struct _zend_class_entry *implementation(); + + /** + * Retrieve the number of items in the class + * @return Value + */ + virtual Value count() = 0; +}; + +/** + * End namespace + */ +} + |