Back to index

php5  5.3.10
Functions | Variables
zend_iterators.c File Reference
#include "zend.h"
#include "zend_API.h"

Go to the source code of this file.

Functions

ZEND_API void zend_register_iterator_wrapper (TSRMLS_D)
static void iter_wrapper_dtor (void *object, zend_object_handle handle TSRMLS_DC)
ZEND_API zval * zend_iterator_wrap (zend_object_iterator *iter TSRMLS_DC)
ZEND_API enum
zend_object_iterator_kind 
zend_iterator_unwrap (zval *array_ptr, zend_object_iterator **iter TSRMLS_DC)

Variables

static zend_class_entry zend_iterator_class_entry
static zend_object_handlers iterator_object_handlers

Function Documentation

static void iter_wrapper_dtor ( void *  object,
zend_object_handle handle  TSRMLS_DC 
) [static]

Definition at line 58 of file zend_iterators.c.

{
       zend_object_iterator *iter = (zend_object_iterator*)object;
       iter->funcs->dtor(iter TSRMLS_CC);
}

Here is the caller graph for this function:

ZEND_API enum zend_object_iterator_kind zend_iterator_unwrap ( zval *  array_ptr,
zend_object_iterator **iter  TSRMLS_DC 
)

Definition at line 76 of file zend_iterators.c.

{
       switch (Z_TYPE_P(array_ptr)) {
              case IS_OBJECT:
                     if (Z_OBJ_HT_P(array_ptr) == &iterator_object_handlers) {
                            *iter = (zend_object_iterator *)zend_object_store_get_object(array_ptr TSRMLS_CC);
                            return ZEND_ITER_OBJECT;
                     }
                     if (HASH_OF(array_ptr)) {
                            return ZEND_ITER_PLAIN_OBJECT;
                     }
                     return ZEND_ITER_INVALID;

              case IS_ARRAY:
                     if (HASH_OF(array_ptr)) {
                            return ZEND_ITER_PLAIN_ARRAY;
                     }
                     return ZEND_ITER_INVALID;

              default:
                     return ZEND_ITER_INVALID;
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

ZEND_API zval* zend_iterator_wrap ( zend_object_iterator *iter  TSRMLS_DC)

Definition at line 64 of file zend_iterators.c.

{
       zval *wrapped;

       MAKE_STD_ZVAL(wrapped);
       Z_TYPE_P(wrapped) = IS_OBJECT;
       Z_OBJ_HANDLE_P(wrapped) = zend_objects_store_put(iter, iter_wrapper_dtor, NULL, NULL TSRMLS_CC);
       Z_OBJ_HT_P(wrapped) = &iterator_object_handlers;

       return wrapped;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 51 of file zend_iterators.c.

{
       INIT_CLASS_ENTRY(zend_iterator_class_entry, "__iterator_wrapper", NULL);
       free(zend_iterator_class_entry.name);
       zend_iterator_class_entry.name = "__iterator_wrapper";
}

Here is the caller graph for this function:


Variable Documentation

zend_object_handlers iterator_object_handlers [static]
Initial value:

Definition at line 27 of file zend_iterators.c.

zend_class_entry zend_iterator_class_entry [static]

Definition at line 25 of file zend_iterators.c.