]> granicus.if.org Git - php/commitdiff
Add count_elements handler for overloaded objects.
authorWez Furlong <wez@php.net>
Tue, 4 May 2004 15:03:28 +0000 (15:03 +0000)
committerWez Furlong <wez@php.net>
Tue, 4 May 2004 15:03:28 +0000 (15:03 +0000)
Zend/zend_iterators.c
Zend/zend_object_handlers.c
Zend/zend_object_handlers.h
Zend/zend_objects_API.c

index 17d37da814eaa8dcbaa2055779cf31f17624df08..022839cb66968755b122c2391cf83738e5867180 100755 (executable)
@@ -44,7 +44,8 @@ static zend_object_handlers iterator_object_handlers = {
        NULL, /* get_ce */
        NULL, /* get class name */
        NULL, /* compare */
-       NULL  /* cast */
+       NULL, /* cast */
+       NULL  /* count */
 };
 
 ZEND_API void zend_register_iterator_wrapper(TSRMLS_D)
index 7c078ca666bbcde30ae7cd44a3e1a28da9c5187c..7d2a1036ce2ec5864049a5f3e0df9d2ccd14c144 100644 (file)
@@ -972,6 +972,7 @@ ZEND_API zend_object_handlers std_object_handlers = {
        zend_std_object_get_class_name,                 /* get_class_name */
        zend_std_compare_objects,                               /* compare_objects */
        NULL,                                                                   /* cast_object */
+       NULL,                                                                   /* count_elements */
 };
 
 /*
index a0c2cfa8e4072bcf5a133204fa96843c4e5b020c..4c8d12eda38023ad2af30f92c23777709d14e339 100644 (file)
@@ -93,6 +93,9 @@ typedef int (*zend_object_get_class_name_t)(zval *object, char **class_name, zen
 typedef int (*zend_object_compare_t)(zval *object1, zval *object2 TSRMLS_DC);
 typedef int (*zend_object_cast_t)(zval *readobj, zval *writeobj, int type, int should_free TSRMLS_DC);
 
+/* updates *count to hold the number of elements present and returns SUCCESS.
+ * Returns FAILURE if the object does not have any sense of overloaded dimensions */
+typedef int (*zend_object_count_elements_t)(zval *object, long *count TSRMLS_DC);
 
 typedef struct _zend_object_handlers {
        /* general object functions */
@@ -119,6 +122,7 @@ typedef struct _zend_object_handlers {
        zend_object_get_class_name_t                    get_class_name;
        zend_object_compare_t                                   compare_objects;
        zend_object_cast_t                                              cast_object;
+       zend_object_count_elements_t                    count_elements;
 } zend_object_handlers;
 
 extern ZEND_API zend_object_handlers std_object_handlers;
index a46b8622c7c9724820b3fa0722bd95b88540083a..95a36a178184a7aed9b2698bee3b1574e97b59cb 100644 (file)
@@ -284,6 +284,7 @@ static zend_object_handlers zend_object_proxy_handlers = {
        NULL,                                           /* get_class_name */
        NULL,                                           /* compare_objects */
        NULL,                                           /* cast_object */
+       NULL,                                           /* count_elements */
 };