diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-08 10:54:44 +0100 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-08 10:54:44 +0100 |
commit | 8b94e46c8f044a21c18435525da84bee28594d1a (patch) | |
tree | 4eb1165b907939d9fafc55ccf1215134debcfb84 /include/class.h | |
parent | 7c32658df2fe777ba3ac20030cfce9d2f424caef (diff) |
implemented the Countable spl without using the actual spl
Diffstat (limited to 'include/class.h')
-rw-r--r-- | include/class.h | 44 |
1 files changed, 12 insertions, 32 deletions
diff --git a/include/class.h b/include/class.h index 3326507..ab4a3e0 100644 --- a/include/class.h +++ b/include/class.h @@ -18,8 +18,11 @@ /** * Zend/SPL interfaces that we support */ -extern struct _zend_class_entry *spl_ce_Countable; -extern struct _zend_class_entry *spl_ce_ArrayAccess; +//extern struct _zend_class_entry *zend_ce_traversable; +//extern struct _zend_class_entry *zend_ce_aggregate; +//extern struct _zend_class_entry *zend_ce_iterator; +extern struct _zend_class_entry *zend_ce_arrayaccess; +//extern struct _zend_class_entry *zend_ce_serializable; /** * Set up namespace @@ -43,36 +46,13 @@ public: */ Class(const char *name) : ClassBase(name) { - // check for special classes - if (std::is_base_of<Countable, T>::value) - { - // register the interface (we register a pointer-to-a-pointer here, - // because when this code runs (during the get_module() call), the - // interfaces are not yet initialized by the zend engine, this - // happens later when the all classes are registered (after the - // get_module() call) - interface(&spl_ce_Countable); - - // add the count method - method("count", &T::count, {}); - } - - // check for special classes - if (std::is_base_of<ArrayAccess, T>::value) - { - // register the interface (we register a pointer-to-a-pointer here, - // because when this code runs (during the get_module() call), the - // interfaces are not yet initialized by the zend engine, this - // happens later when the all classes are registered (after the - // get_module() call) - interface(&spl_ce_ArrayAccess); - - // add the count method - method("count", &T::offsetSet); - method("count", &T::offsetGet); - method("count", &T::offsetUnset); - method("count", &T::offsetExists); - } + // check for special classes, and register the interface if it does + // register the interface (we register a pointer-to-a-pointer here, + // because when this code runs (during the get_module() call), the + // interfaces are not yet initialized by the zend engine, this only + // happens later when the all classes are registered (after the + // get_module() call) + if (std::is_base_of<ArrayAccess, T>::value) interface(&zend_ce_arrayaccess); } /** |