diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/classbase.cpp | 5 | ||||
-rw-r--r-- | src/countable.cpp | 32 | ||||
-rw-r--r-- | src/includes.h | 1 |
3 files changed, 37 insertions, 1 deletions
diff --git a/src/classbase.cpp b/src/classbase.cpp index 87a1cd2..c7ade6c 100644 --- a/src/classbase.cpp +++ b/src/classbase.cpp @@ -101,7 +101,7 @@ static zend_object_value create_object(zend_class_entry *type TSRMLS_DC) result.handle = zend_objects_store_put(object, NULL, deallocate_object, clone_object TSRMLS_CC); // finally, construct the cpp object - object->cpp = info->construct(Value(result)); + object->cpp = info->construct(result); // done return result; @@ -215,6 +215,9 @@ void ClassBase::initialize(const std::string &prefix) // set access types flags for class _entry->ce_flags = (int)_type; + // mark the interfaces as being implemented + for (auto &interface : _interfaces) zend_do_implement_interface(_entry, interface); + // declare all member variables for (auto &member : _members) member->initialize(_entry); } diff --git a/src/countable.cpp b/src/countable.cpp new file mode 100644 index 0000000..6182afd --- /dev/null +++ b/src/countable.cpp @@ -0,0 +1,32 @@ +/** + * Countable.cpp + * + * Implementation of the Countable interface + * + * @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com> + * @copyright 2014 Copernica BV + */ +#include "includes.h" + +#include "spl/spl_iterators.h" + +/** + * Set up namespace + */ +namespace Php { + +/** + * Implementation of the countable interface + * @return zend_class_entry* + * @internal + */ +struct _zend_class_entry *Countable::implementation() +{ + return spl_ce_Countable; +} + +/** + * End namespace + */ +} + diff --git a/src/includes.h b/src/includes.h index 81370bc..59ee8b3 100644 --- a/src/includes.h +++ b/src/includes.h @@ -57,6 +57,7 @@ #include "../include/parameters.h" #include "../include/modifiers.h" #include "../include/base.h" +#include "../include/countable.h" #include "../include/classtype.h" #include "../include/classbase.h" #include "../include/class.h" |