Back to index

php5  5.3.10
Classes | Defines | Typedefs | Enumerations | Functions | Variables
spl_iterators.c File Reference
#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "zend_exceptions.h"
#include "zend_interfaces.h"
#include "php_spl.h"
#include "spl_functions.h"
#include "spl_engine.h"
#include "spl_iterators.h"
#include "spl_directory.h"
#include "spl_array.h"
#include "spl_exceptions.h"
#include "ext/standard/php_smart_str.h"

Go to the source code of this file.

Classes

struct  _spl_sub_iterator
struct  _spl_recursive_it_object
struct  _spl_recursive_it_iterator
struct  spl_iterator_apply_info

Defines

#define RIT_CATCH_GET_CHILD   CIT_CATCH_GET_CHILD
#define SPL_FETCH_AND_CHECK_DUAL_IT(var, objzval)
#define SPL_CHECK_CTOR(intern, classname)
#define APPENDIT_CHECK_CTOR(intern)   SPL_CHECK_CTOR(intern, AppendIterator)

Typedefs

typedef struct _spl_sub_iterator spl_sub_iterator
typedef struct
_spl_recursive_it_object 
spl_recursive_it_object
typedef struct
_spl_recursive_it_iterator 
spl_recursive_it_iterator

Enumerations

enum  RecursiveIteratorMode { RIT_LEAVES_ONLY = 0, RIT_SELF_FIRST = 1, RIT_CHILD_FIRST = 2 }
enum  RecursiveTreeIteratorFlags { RTIT_BYPASS_CURRENT = 4, RTIT_BYPASS_KEY = 8 }
enum  RecursiveIteratorState {
  RS_NEXT = 0, RS_TEST = 1, RS_SELF = 2, RS_CHILD = 3,
  RS_START = 4
}

Functions

static void spl_recursive_it_dtor (zend_object_iterator *_iter TSRMLS_DC)
static int spl_recursive_it_valid_ex (spl_recursive_it_object *object, zval *zthis TSRMLS_DC)
static int spl_recursive_it_valid (zend_object_iterator *iter TSRMLS_DC)
static void spl_recursive_it_get_current_data (zend_object_iterator *iter, zval ***data TSRMLS_DC)
static int spl_recursive_it_get_current_key (zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)
static void spl_recursive_it_move_forward_ex (spl_recursive_it_object *object, zval *zthis TSRMLS_DC)
static void spl_recursive_it_rewind_ex (spl_recursive_it_object *object, zval *zthis TSRMLS_DC)
static void spl_recursive_it_move_forward (zend_object_iterator *iter TSRMLS_DC)
static void spl_recursive_it_rewind (zend_object_iterator *iter TSRMLS_DC)
static zend_object_iterator * spl_recursive_it_get_iterator (zend_class_entry *ce, zval *zobject, int by_ref TSRMLS_DC)
static void spl_recursive_it_it_construct (INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *ce_base, zend_class_entry *ce_inner, recursive_it_it_type rit_type)
 SPL_METHOD (RecursiveIteratorIterator, __construct)
 SPL_METHOD (RecursiveIteratorIterator, rewind)
 SPL_METHOD (RecursiveIteratorIterator, valid)
 SPL_METHOD (RecursiveIteratorIterator, key)
 SPL_METHOD (RecursiveIteratorIterator, current)
 SPL_METHOD (RecursiveIteratorIterator, next)
 SPL_METHOD (RecursiveIteratorIterator, getDepth)
 SPL_METHOD (RecursiveIteratorIterator, getSubIterator)
 SPL_METHOD (RecursiveIteratorIterator, getInnerIterator)
 SPL_METHOD (RecursiveIteratorIterator, beginIteration)
 SPL_METHOD (RecursiveIteratorIterator, endIteration)
 SPL_METHOD (RecursiveIteratorIterator, callHasChildren)
 SPL_METHOD (RecursiveIteratorIterator, callGetChildren)
 SPL_METHOD (RecursiveIteratorIterator, beginChildren)
 SPL_METHOD (RecursiveIteratorIterator, endChildren)
 SPL_METHOD (RecursiveIteratorIterator, nextElement)
 SPL_METHOD (RecursiveIteratorIterator, setMaxDepth)
 SPL_METHOD (RecursiveIteratorIterator, getMaxDepth)
static union _zend_functionspl_recursive_it_get_method (zval **object_ptr, char *method, int method_len TSRMLS_DC)
static void spl_RecursiveIteratorIterator_dtor (zend_object *_object, zend_object_handle handle TSRMLS_DC)
static void spl_RecursiveIteratorIterator_free_storage (void *_object TSRMLS_DC)
static zend_object_value spl_RecursiveIteratorIterator_new_ex (zend_class_entry *class_type, int init_prefix TSRMLS_DC)
static zend_object_value spl_RecursiveIteratorIterator_new (zend_class_entry *class_type TSRMLS_DC)
static zend_object_value spl_RecursiveTreeIterator_new (zend_class_entry *class_type TSRMLS_DC)
 ZEND_END_ARG_INFO ()
static void spl_recursive_tree_iterator_get_prefix (spl_recursive_it_object *object, zval *return_value TSRMLS_DC)
static void spl_recursive_tree_iterator_get_entry (spl_recursive_it_object *object, zval *return_value TSRMLS_DC)
static void spl_recursive_tree_iterator_get_postfix (spl_recursive_it_object *object, zval *return_value TSRMLS_DC)
 SPL_METHOD (RecursiveTreeIterator, __construct)
 SPL_METHOD (RecursiveTreeIterator, setPrefixPart)
 SPL_METHOD (RecursiveTreeIterator, getPrefix)
 SPL_METHOD (RecursiveTreeIterator, getEntry)
 SPL_METHOD (RecursiveTreeIterator, getPostfix)
 SPL_METHOD (RecursiveTreeIterator, current)
 SPL_METHOD (RecursiveTreeIterator, key)
static union _zend_functionspl_dual_it_get_method (zval **object_ptr, char *method, int method_len TSRMLS_DC)
static int spl_dual_it_fetch (spl_dual_it_object *intern, int check_more TSRMLS_DC)
static int spl_cit_check_flags (int flags)
static spl_dual_it_objectspl_dual_it_construct (INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *ce_base, zend_class_entry *ce_inner, dual_it_type dit_type)
 SPL_METHOD (FilterIterator, __construct)
 SPL_METHOD (dual_it, getInnerIterator)
static void spl_dual_it_require (spl_dual_it_object *intern TSRMLS_DC)
static void spl_dual_it_free (spl_dual_it_object *intern TSRMLS_DC)
static void spl_dual_it_rewind (spl_dual_it_object *intern TSRMLS_DC)
static int spl_dual_it_valid (spl_dual_it_object *intern TSRMLS_DC)
static void spl_dual_it_next (spl_dual_it_object *intern, int do_free TSRMLS_DC)
 SPL_METHOD (dual_it, rewind)
 SPL_METHOD (dual_it, valid)
 SPL_METHOD (dual_it, key)
 SPL_METHOD (dual_it, current)
 SPL_METHOD (dual_it, next)
static void spl_filter_it_fetch (zval *zthis, spl_dual_it_object *intern TSRMLS_DC)
static void spl_filter_it_rewind (zval *zthis, spl_dual_it_object *intern TSRMLS_DC)
static void spl_filter_it_next (zval *zthis, spl_dual_it_object *intern TSRMLS_DC)
 SPL_METHOD (FilterIterator, rewind)
 SPL_METHOD (FilterIterator, next)
 SPL_METHOD (RecursiveFilterIterator, __construct)
 SPL_METHOD (RecursiveFilterIterator, hasChildren)
 SPL_METHOD (RecursiveFilterIterator, getChildren)
 SPL_METHOD (ParentIterator, __construct)
static void spl_dual_it_dtor (zend_object *_object, zend_object_handle handle TSRMLS_DC)
static void spl_dual_it_free_storage (void *_object TSRMLS_DC)
static zend_object_value spl_dual_it_new (zend_class_entry *class_type TSRMLS_DC)
static int spl_limit_it_valid (spl_dual_it_object *intern TSRMLS_DC)
static void spl_limit_it_seek (spl_dual_it_object *intern, long pos TSRMLS_DC)
 SPL_METHOD (LimitIterator, __construct)
 SPL_METHOD (LimitIterator, rewind)
 SPL_METHOD (LimitIterator, valid)
 SPL_METHOD (LimitIterator, next)
 SPL_METHOD (LimitIterator, seek)
 SPL_METHOD (LimitIterator, getPosition)
static int spl_caching_it_valid (spl_dual_it_object *intern TSRMLS_DC)
static int spl_caching_it_has_next (spl_dual_it_object *intern TSRMLS_DC)
static void spl_caching_it_next (spl_dual_it_object *intern TSRMLS_DC)
static void spl_caching_it_rewind (spl_dual_it_object *intern TSRMLS_DC)
 SPL_METHOD (CachingIterator, __construct)
 SPL_METHOD (CachingIterator, rewind)
 SPL_METHOD (CachingIterator, valid)
 SPL_METHOD (CachingIterator, next)
 SPL_METHOD (CachingIterator, hasNext)
 SPL_METHOD (CachingIterator, __toString)
 SPL_METHOD (CachingIterator, offsetSet)
 SPL_METHOD (CachingIterator, offsetGet)
 SPL_METHOD (CachingIterator, offsetUnset)
 SPL_METHOD (CachingIterator, offsetExists)
 SPL_METHOD (CachingIterator, getCache)
 SPL_METHOD (CachingIterator, getFlags)
 SPL_METHOD (CachingIterator, setFlags)
 SPL_METHOD (CachingIterator, count)
 SPL_METHOD (RecursiveCachingIterator, __construct)
 SPL_METHOD (RecursiveCachingIterator, hasChildren)
 SPL_METHOD (RecursiveCachingIterator, getChildren)
 SPL_METHOD (IteratorIterator, __construct)
 SPL_METHOD (NoRewindIterator, __construct)
 SPL_METHOD (NoRewindIterator, rewind)
 SPL_METHOD (NoRewindIterator, valid)
 SPL_METHOD (NoRewindIterator, key)
 SPL_METHOD (NoRewindIterator, current)
 SPL_METHOD (NoRewindIterator, next)
 SPL_METHOD (InfiniteIterator, __construct)
 SPL_METHOD (InfiniteIterator, next)
 SPL_METHOD (EmptyIterator, rewind)
 SPL_METHOD (EmptyIterator, valid)
 SPL_METHOD (EmptyIterator, key)
 SPL_METHOD (EmptyIterator, current)
 SPL_METHOD (EmptyIterator, next)
int spl_append_it_next_iterator (spl_dual_it_object *intern TSRMLS_DC)
void spl_append_it_fetch (spl_dual_it_object *intern TSRMLS_DC)
void spl_append_it_next (spl_dual_it_object *intern TSRMLS_DC)
 SPL_METHOD (AppendIterator, __construct)
 SPL_METHOD (AppendIterator, append)
 SPL_METHOD (AppendIterator, rewind)
 SPL_METHOD (AppendIterator, valid)
 SPL_METHOD (AppendIterator, next)
 SPL_METHOD (AppendIterator, getIteratorIndex)
 SPL_METHOD (AppendIterator, getArrayIterator)
PHPAPI int spl_iterator_apply (zval *obj, spl_iterator_apply_func_t apply_func, void *puser TSRMLS_DC)
static int spl_iterator_to_array_apply (zend_object_iterator *iter, void *puser TSRMLS_DC)
static int spl_iterator_to_values_apply (zend_object_iterator *iter, void *puser TSRMLS_DC)
 PHP_FUNCTION (iterator_to_array)
static int spl_iterator_count_apply (zend_object_iterator *iter, void *puser TSRMLS_DC)
 PHP_FUNCTION (iterator_count)
static int spl_iterator_func_apply (zend_object_iterator *iter, void *puser TSRMLS_DC)
 PHP_FUNCTION (iterator_apply)
 PHP_MINIT_FUNCTION (spl_iterators)

Variables

PHPAPI zend_class_entry * spl_ce_RecursiveIterator
PHPAPI zend_class_entry * spl_ce_RecursiveIteratorIterator
PHPAPI zend_class_entry * spl_ce_FilterIterator
PHPAPI zend_class_entry * spl_ce_RecursiveFilterIterator
PHPAPI zend_class_entry * spl_ce_ParentIterator
PHPAPI zend_class_entry * spl_ce_SeekableIterator
PHPAPI zend_class_entry * spl_ce_LimitIterator
PHPAPI zend_class_entry * spl_ce_CachingIterator
PHPAPI zend_class_entry * spl_ce_RecursiveCachingIterator
PHPAPI zend_class_entry * spl_ce_OuterIterator
PHPAPI zend_class_entry * spl_ce_IteratorIterator
PHPAPI zend_class_entry * spl_ce_NoRewindIterator
PHPAPI zend_class_entry * spl_ce_InfiniteIterator
PHPAPI zend_class_entry * spl_ce_EmptyIterator
PHPAPI zend_class_entry * spl_ce_AppendIterator
PHPAPI zend_class_entry * spl_ce_RegexIterator
PHPAPI zend_class_entry * spl_ce_RecursiveRegexIterator
PHPAPI zend_class_entry * spl_ce_Countable
PHPAPI zend_class_entry * spl_ce_RecursiveTreeIterator
const zend_function_entry spl_funcs_RecursiveIterator []
static zend_object_handlers spl_handlers_rec_it_it
static zend_object_handlers spl_handlers_dual_it
zend_object_iterator_funcs spl_recursive_it_iterator_funcs
static const zend_function_entry spl_funcs_RecursiveIteratorIterator []
static const zend_function_entry spl_funcs_RecursiveTreeIterator []
static const zend_function_entry spl_funcs_FilterIterator []
static const zend_function_entry spl_funcs_RecursiveFilterIterator []
static const zend_function_entry spl_funcs_ParentIterator []
static const zend_function_entry spl_funcs_SeekableIterator []
static const zend_function_entry spl_funcs_LimitIterator []
static const zend_function_entry spl_funcs_CachingIterator []
static const zend_function_entry spl_funcs_RecursiveCachingIterator []
static const zend_function_entry spl_funcs_IteratorIterator []
static const zend_function_entry spl_funcs_NoRewindIterator []
static const zend_function_entry spl_funcs_InfiniteIterator []
static const zend_function_entry spl_funcs_EmptyIterator []
static const zend_function_entry spl_funcs_AppendIterator []
static const zend_function_entry spl_funcs_OuterIterator []
static const zend_function_entry spl_funcs_Countable []

Class Documentation

struct _spl_sub_iterator

Definition at line 94 of file spl_iterators.c.

Class Members
zend_class_entry * ce
zend_object_iterator * iterator
RecursiveIteratorState state
zval * zobject
struct _spl_recursive_it_object

Definition at line 101 of file spl_iterators.c.

Collaboration diagram for _spl_recursive_it_object:
Class Members
zend_function * beginChildren
zend_function * beginIteration
zend_function * callGetChildren
zend_function * callHasChildren
zend_class_entry * ce
zend_function * endChildren
zend_function * endIteration
int flags
zend_bool in_iteration
spl_sub_iterator * iterators
int level
int max_depth
RecursiveIteratorMode mode
zend_function * nextElement
smart_str prefix
zend_object std
struct _spl_recursive_it_iterator

Definition at line 120 of file spl_iterators.c.

Class Members
zend_object_iterator intern
zval * zobject
struct spl_iterator_apply_info

Definition at line 3447 of file spl_iterators.c.

Collaboration diagram for spl_iterator_apply_info:
Class Members
zval * args
long count
zend_fcall_info_cache fcc
zend_fcall_info fci
zval * obj

Define Documentation

#define APPENDIT_CHECK_CTOR (   intern)    SPL_CHECK_CTOR(intern, AppendIterator)

Definition at line 1347 of file spl_iterators.c.

Definition at line 79 of file spl_iterators.c.

#define SPL_CHECK_CTOR (   intern,
  classname 
)
Value:
if (intern->dit_type == DIT_Unknown) { \
              zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Classes derived from %s must call %s::__construct()", \
                            (spl_ce_##classname)->name, (spl_ce_##classname)->name); \
              return; \
       }

Definition at line 1340 of file spl_iterators.c.

#define SPL_FETCH_AND_CHECK_DUAL_IT (   var,
  objzval 
)
Value:
do { \
		spl_dual_it_object *it = zend_object_store_get_object((objzval) TSRMLS_CC); \
              if (it->dit_type == DIT_Unknown) { \
                     zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, \
                            "The object is in an invalid state as the parent constructor was not called"); \
                     return; \
              } \
              (var) = it; \
       } while (0)

Definition at line 128 of file spl_iterators.c.


Typedef Documentation


Enumeration Type Documentation

Enumerator:
RIT_LEAVES_ONLY 
RIT_SELF_FIRST 
RIT_CHILD_FIRST 

Definition at line 73 of file spl_iterators.c.

Enumerator:
RS_NEXT 
RS_TEST 
RS_SELF 
RS_CHILD 
RS_START 

Definition at line 86 of file spl_iterators.c.

Enumerator:
RTIT_BYPASS_CURRENT 
RTIT_BYPASS_KEY 

Definition at line 81 of file spl_iterators.c.


Function Documentation

Definition at line 3406 of file spl_iterators.c.

{
       zval  *obj;
       zend_bool use_keys = 1;

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|b", &obj, zend_ce_traversable, &use_keys) == FAILURE) {
              RETURN_FALSE;
       }

       array_init(return_value);

       if (spl_iterator_apply(obj, use_keys ? spl_iterator_to_array_apply : spl_iterator_to_values_apply, (void*)return_value TSRMLS_CC) != SUCCESS) {
              zval_dtor(return_value);
              RETURN_NULL();
       }
} /* }}} */

Here is the call graph for this function:

Definition at line 3432 of file spl_iterators.c.

{
       zval  *obj;
       long  count = 0;

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &obj, zend_ce_traversable) == FAILURE) {
              RETURN_FALSE;
       }
       
       if (spl_iterator_apply(obj, spl_iterator_count_apply, (void*)&count TSRMLS_CC) == SUCCESS) {
              RETURN_LONG(count);
       }
}

Here is the call graph for this function:

PHP_FUNCTION ( iterator_apply  )

Definition at line 3475 of file spl_iterators.c.

{
       spl_iterator_apply_info  apply_info;

       apply_info.args = NULL;
       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Of|a!", &apply_info.obj, zend_ce_traversable, &apply_info.fci, &apply_info.fcc, &apply_info.args) == FAILURE) {
              return;
       }

       apply_info.count = 0;
       zend_fcall_info_args(&apply_info.fci, apply_info.args TSRMLS_CC);
       if (spl_iterator_apply(apply_info.obj, spl_iterator_func_apply, (void*)&apply_info TSRMLS_CC) == SUCCESS) {
              RETVAL_LONG(apply_info.count);
       } else {
              RETVAL_FALSE;
       }
       zend_fcall_info_args(&apply_info.fci, NULL TSRMLS_CC);
}

Here is the call graph for this function:

PHP_MINIT_FUNCTION ( spl_iterators  )

Definition at line 3507 of file spl_iterators.c.

{
       REGISTER_SPL_INTERFACE(RecursiveIterator);
       REGISTER_SPL_ITERATOR(RecursiveIterator);

       REGISTER_SPL_STD_CLASS_EX(RecursiveIteratorIterator, spl_RecursiveIteratorIterator_new, spl_funcs_RecursiveIteratorIterator);
       REGISTER_SPL_ITERATOR(RecursiveIteratorIterator);

       memcpy(&spl_handlers_rec_it_it, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
       spl_handlers_rec_it_it.get_method = spl_recursive_it_get_method;
       spl_handlers_rec_it_it.clone_obj = NULL;

       memcpy(&spl_handlers_dual_it, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
       spl_handlers_dual_it.get_method = spl_dual_it_get_method;
       /*spl_handlers_dual_it.call_method = spl_dual_it_call_method;*/
       spl_handlers_dual_it.clone_obj = NULL;
       
       spl_ce_RecursiveIteratorIterator->get_iterator = spl_recursive_it_get_iterator;
       spl_ce_RecursiveIteratorIterator->iterator_funcs.funcs = &spl_recursive_it_iterator_funcs;

       REGISTER_SPL_CLASS_CONST_LONG(RecursiveIteratorIterator, "LEAVES_ONLY",     RIT_LEAVES_ONLY);
       REGISTER_SPL_CLASS_CONST_LONG(RecursiveIteratorIterator, "SELF_FIRST",      RIT_SELF_FIRST);
       REGISTER_SPL_CLASS_CONST_LONG(RecursiveIteratorIterator, "CHILD_FIRST",     RIT_CHILD_FIRST);
       REGISTER_SPL_CLASS_CONST_LONG(RecursiveIteratorIterator, "CATCH_GET_CHILD", RIT_CATCH_GET_CHILD);

       REGISTER_SPL_INTERFACE(OuterIterator);
       REGISTER_SPL_ITERATOR(OuterIterator);

       REGISTER_SPL_STD_CLASS_EX(IteratorIterator, spl_dual_it_new, spl_funcs_IteratorIterator);
       REGISTER_SPL_ITERATOR(IteratorIterator);
       REGISTER_SPL_IMPLEMENTS(IteratorIterator, OuterIterator);

       REGISTER_SPL_SUB_CLASS_EX(FilterIterator, IteratorIterator, spl_dual_it_new, spl_funcs_FilterIterator);
       spl_ce_FilterIterator->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS;

       REGISTER_SPL_SUB_CLASS_EX(RecursiveFilterIterator, FilterIterator, spl_dual_it_new, spl_funcs_RecursiveFilterIterator);
       REGISTER_SPL_IMPLEMENTS(RecursiveFilterIterator, RecursiveIterator);

       REGISTER_SPL_SUB_CLASS_EX(ParentIterator, RecursiveFilterIterator, spl_dual_it_new, spl_funcs_ParentIterator);

       REGISTER_SPL_INTERFACE(Countable);
       REGISTER_SPL_INTERFACE(SeekableIterator);
       REGISTER_SPL_ITERATOR(SeekableIterator);

       REGISTER_SPL_SUB_CLASS_EX(LimitIterator, IteratorIterator, spl_dual_it_new, spl_funcs_LimitIterator);

       REGISTER_SPL_SUB_CLASS_EX(CachingIterator, IteratorIterator, spl_dual_it_new, spl_funcs_CachingIterator);
       REGISTER_SPL_IMPLEMENTS(CachingIterator, ArrayAccess);
       REGISTER_SPL_IMPLEMENTS(CachingIterator, Countable);

       REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "CALL_TOSTRING",        CIT_CALL_TOSTRING); 
       REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "CATCH_GET_CHILD",      CIT_CATCH_GET_CHILD); 
       REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "TOSTRING_USE_KEY",     CIT_TOSTRING_USE_KEY);
       REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "TOSTRING_USE_CURRENT", CIT_TOSTRING_USE_CURRENT);
       REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "TOSTRING_USE_INNER",   CIT_TOSTRING_USE_INNER);
       REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "FULL_CACHE",           CIT_FULL_CACHE); 

       REGISTER_SPL_SUB_CLASS_EX(RecursiveCachingIterator, CachingIterator, spl_dual_it_new, spl_funcs_RecursiveCachingIterator);
       REGISTER_SPL_IMPLEMENTS(RecursiveCachingIterator, RecursiveIterator);
       
       REGISTER_SPL_SUB_CLASS_EX(NoRewindIterator, IteratorIterator, spl_dual_it_new, spl_funcs_NoRewindIterator);

       REGISTER_SPL_SUB_CLASS_EX(AppendIterator, IteratorIterator, spl_dual_it_new, spl_funcs_AppendIterator);

       REGISTER_SPL_IMPLEMENTS(RecursiveIteratorIterator, OuterIterator);

       REGISTER_SPL_SUB_CLASS_EX(InfiniteIterator, IteratorIterator, spl_dual_it_new, spl_funcs_InfiniteIterator);
#if HAVE_PCRE || HAVE_BUNDLED_PCRE
       REGISTER_SPL_SUB_CLASS_EX(RegexIterator, FilterIterator, spl_dual_it_new, spl_funcs_RegexIterator);
       REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "USE_KEY",     REGIT_USE_KEY);
       REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "MATCH",       REGIT_MODE_MATCH);
       REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "GET_MATCH",   REGIT_MODE_GET_MATCH);
       REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "ALL_MATCHES", REGIT_MODE_ALL_MATCHES);
       REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "SPLIT",       REGIT_MODE_SPLIT);
       REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "REPLACE",     REGIT_MODE_REPLACE);
       REGISTER_SPL_PROPERTY(RegexIterator, "replacement", 0);
       REGISTER_SPL_SUB_CLASS_EX(RecursiveRegexIterator, RegexIterator, spl_dual_it_new, spl_funcs_RecursiveRegexIterator);
       REGISTER_SPL_IMPLEMENTS(RecursiveRegexIterator, RecursiveIterator);
#else
       spl_ce_RegexIterator = NULL;
       spl_ce_RecursiveRegexIterator = NULL;
#endif

       REGISTER_SPL_STD_CLASS_EX(EmptyIterator, NULL, spl_funcs_EmptyIterator);
       REGISTER_SPL_ITERATOR(EmptyIterator);

       REGISTER_SPL_SUB_CLASS_EX(RecursiveTreeIterator, RecursiveIteratorIterator, spl_RecursiveTreeIterator_new, spl_funcs_RecursiveTreeIterator);
       REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "BYPASS_CURRENT",      RTIT_BYPASS_CURRENT);
       REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "BYPASS_KEY",          RTIT_BYPASS_KEY);
       REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "PREFIX_LEFT",         0);
       REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "PREFIX_MID_HAS_NEXT", 1);
       REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "PREFIX_MID_LAST",     2);
       REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "PREFIX_END_HAS_NEXT", 3);
       REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "PREFIX_END_LAST",     4);
       REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "PREFIX_RIGHT",        5);

       return SUCCESS;
}

Here is the call graph for this function:

void spl_append_it_fetch ( spl_dual_it_object *intern  TSRMLS_DC)

Definition at line 3160 of file spl_iterators.c.

{
       while (spl_dual_it_valid(intern TSRMLS_CC) != SUCCESS) {
              intern->u.append.iterator->funcs->move_forward(intern->u.append.iterator TSRMLS_CC);
              if (spl_append_it_next_iterator(intern TSRMLS_CC) != SUCCESS) {
                     return;
              }
       }
       spl_dual_it_fetch(intern, 0 TSRMLS_CC);
} /* }}} */

Here is the call graph for this function:

Here is the caller graph for this function:

void spl_append_it_next ( spl_dual_it_object *intern  TSRMLS_DC)

Definition at line 3171 of file spl_iterators.c.

{
       if (spl_dual_it_valid(intern TSRMLS_CC) == SUCCESS) {
              spl_dual_it_next(intern, 1 TSRMLS_CC);
       }
       spl_append_it_fetch(intern TSRMLS_CC);
} /* }}} */

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 3130 of file spl_iterators.c.

{
       spl_dual_it_free(intern TSRMLS_CC);

       if (intern->inner.zobject) {
              zval_ptr_dtor(&intern->inner.zobject);
              intern->inner.zobject = NULL;
              intern->inner.ce = NULL;
              intern->inner.object = NULL;
              if (intern->inner.iterator) {
                     intern->inner.iterator->funcs->dtor(intern->inner.iterator TSRMLS_CC);
                     intern->inner.iterator = NULL;
              }
       }
       if (intern->u.append.iterator->funcs->valid(intern->u.append.iterator TSRMLS_CC) == SUCCESS) {
              zval **it;

              intern->u.append.iterator->funcs->get_current_data(intern->u.append.iterator, &it TSRMLS_CC);
              Z_ADDREF_PP(it);
              intern->inner.zobject = *it;
              intern->inner.ce = Z_OBJCE_PP(it);
              intern->inner.object = zend_object_store_get_object(*it TSRMLS_CC);
              intern->inner.iterator = intern->inner.ce->get_iterator(intern->inner.ce, *it, 0 TSRMLS_CC);
              spl_dual_it_rewind(intern TSRMLS_CC);
              return SUCCESS;
       } else {
              return FAILURE;
       }
} /* }}} */

Here is the call graph for this function:

Here is the caller graph for this function:

static int spl_caching_it_has_next ( spl_dual_it_object *intern  TSRMLS_DC) [inline, static]

Definition at line 2427 of file spl_iterators.c.

{
       return spl_dual_it_valid(intern TSRMLS_CC);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void spl_caching_it_next ( spl_dual_it_object *intern  TSRMLS_DC) [inline, static]

Definition at line 2432 of file spl_iterators.c.

{
       if (spl_dual_it_fetch(intern, 1 TSRMLS_CC) == SUCCESS) {
              intern->u.caching.flags |= CIT_VALID;
              /* Full cache ? */
              if (intern->u.caching.flags & CIT_FULL_CACHE) {
                     zval *zcacheval;
                     
                     MAKE_STD_ZVAL(zcacheval);
                     ZVAL_ZVAL(zcacheval, intern->current.data, 1, 0);
                     if (intern->current.key_type == HASH_KEY_IS_LONG) {
                            add_index_zval(intern->u.caching.zcache, intern->current.int_key, zcacheval);
                     } else {
                            zend_symtable_update(HASH_OF(intern->u.caching.zcache), intern->current.str_key, intern->current.str_key_len, &zcacheval, sizeof(void*), NULL);
                     }
              }
              /* Recursion ? */
              if (intern->dit_type == DIT_RecursiveCachingIterator) {
                     zval *retval, *zchildren, zflags;
                     zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "haschildren", &retval);
                     if (EG(exception)) {
                            if (retval) {
                                   zval_ptr_dtor(&retval);
                            }
                            if (intern->u.caching.flags & CIT_CATCH_GET_CHILD) {
                                   zend_clear_exception(TSRMLS_C);
                            } else {
                                   return;
                            }
                     } else {
                            if (zend_is_true(retval)) {
                                   zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &zchildren);
                                   if (EG(exception)) {
                                          if (zchildren) {
                                                 zval_ptr_dtor(&zchildren);
                                          }
                                          if (intern->u.caching.flags & CIT_CATCH_GET_CHILD) {
                                                 zend_clear_exception(TSRMLS_C);
                                          } else {
                                                 zval_ptr_dtor(&retval);
                                                 return;
                                          }
                                   } else {
                                          INIT_PZVAL(&zflags);
                                          ZVAL_LONG(&zflags, intern->u.caching.flags & CIT_PUBLIC);
                                          spl_instantiate_arg_ex2(spl_ce_RecursiveCachingIterator, &intern->u.caching.zchildren, 1, zchildren, &zflags TSRMLS_CC);
                                          zval_ptr_dtor(&zchildren);
                                   }
                            }
                            zval_ptr_dtor(&retval);
                            if (EG(exception)) {
                                   if (intern->u.caching.flags & CIT_CATCH_GET_CHILD) {
                                          zend_clear_exception(TSRMLS_C);
                                   } else {
                                          return;
                                   }
                            }
                     }
              }
              if (intern->u.caching.flags & (CIT_TOSTRING_USE_INNER|CIT_CALL_TOSTRING)) {
                     int  use_copy;
                     zval expr_copy;
                     ALLOC_ZVAL(intern->u.caching.zstr);
                     if (intern->u.caching.flags & CIT_TOSTRING_USE_INNER) {
                            *intern->u.caching.zstr = *intern->inner.zobject;
                     } else {
                            *intern->u.caching.zstr = *intern->current.data;
                     }
                     zend_make_printable_zval(intern->u.caching.zstr, &expr_copy, &use_copy);
                     if (use_copy) {
                            *intern->u.caching.zstr = expr_copy;
                            INIT_PZVAL(intern->u.caching.zstr);
                            zval_copy_ctor(intern->u.caching.zstr);
                            zval_dtor(&expr_copy);
                     } else {
                            INIT_PZVAL(intern->u.caching.zstr);
                            zval_copy_ctor(intern->u.caching.zstr);
                     }
              }
              spl_dual_it_next(intern, 0 TSRMLS_CC);    
       } else {
              intern->u.caching.flags &= ~CIT_VALID;
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void spl_caching_it_rewind ( spl_dual_it_object *intern  TSRMLS_DC) [inline, static]

Definition at line 2517 of file spl_iterators.c.

{
       spl_dual_it_rewind(intern TSRMLS_CC);
       zend_hash_clean(HASH_OF(intern->u.caching.zcache));
       spl_caching_it_next(intern TSRMLS_CC);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int spl_caching_it_valid ( spl_dual_it_object *intern  TSRMLS_DC) [inline, static]

Definition at line 2422 of file spl_iterators.c.

{
       return intern->u.caching.flags & CIT_VALID ? SUCCESS : FAILURE;
}

Here is the caller graph for this function:

static int spl_cit_check_flags ( int  flags) [inline, static]

Definition at line 1351 of file spl_iterators.c.

{
       int cnt = 0;

       cnt += (flags & CIT_CALL_TOSTRING) ? 1 : 0;
       cnt += (flags & CIT_TOSTRING_USE_KEY) ? 1 : 0;
       cnt += (flags & CIT_TOSTRING_USE_CURRENT) ? 1 : 0;
       cnt += (flags & CIT_TOSTRING_USE_INNER) ? 1 : 0;
       
       return cnt <= 1 ? SUCCESS : FAILURE;
}

Here is the caller graph for this function:

static spl_dual_it_object* spl_dual_it_construct ( INTERNAL_FUNCTION_PARAMETERS  ,
zend_class_entry *  ce_base,
zend_class_entry *  ce_inner,
dual_it_type  dit_type 
) [static]

Definition at line 1363 of file spl_iterators.c.

{
       zval                 *zobject, *retval;
       spl_dual_it_object   *intern;
       zend_class_entry     *ce = NULL;
       int                   inc_refcount = 1;
       zend_error_handling   error_handling;

       intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
       
       if (intern->dit_type != DIT_Unknown) {
              zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%s::getIterator() must be called exactly once per instance", ce_base->name);
              return NULL;
       }

       zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling TSRMLS_CC);

       intern->dit_type = dit_type;
       switch (dit_type) {
              case DIT_LimitIterator: {
                     intern->u.limit.offset = 0; /* start at beginning */
                     intern->u.limit.count = -1; /* get all */
                     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|ll", &zobject, ce_inner, &intern->u.limit.offset, &intern->u.limit.count) == FAILURE) {
                            zend_restore_error_handling(&error_handling TSRMLS_CC);
                            return NULL;
                     }
                     if (intern->u.limit.offset < 0) {
                            zend_throw_exception(spl_ce_OutOfRangeException, "Parameter offset must be >= 0", 0 TSRMLS_CC);
                            zend_restore_error_handling(&error_handling TSRMLS_CC);
                            return NULL;
                     }
                     if (intern->u.limit.count < 0 && intern->u.limit.count != -1) {
                            zend_throw_exception(spl_ce_OutOfRangeException, "Parameter count must either be -1 or a value greater than or equal 0", 0 TSRMLS_CC);
                            zend_restore_error_handling(&error_handling TSRMLS_CC);
                            return NULL;
                     }
                     break;
              }
              case DIT_CachingIterator:
              case DIT_RecursiveCachingIterator: {
                     long flags = CIT_CALL_TOSTRING;
                     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|l", &zobject, ce_inner, &flags) == FAILURE) {
                            zend_restore_error_handling(&error_handling TSRMLS_CC);
                            return NULL;
                     }
                     if (spl_cit_check_flags(flags) != SUCCESS) {
                            zend_throw_exception(spl_ce_InvalidArgumentException, "Flags must contain only one of CALL_TOSTRING, TOSTRING_USE_KEY, TOSTRING_USE_CURRENT, TOSTRING_USE_CURRENT", 0 TSRMLS_CC);
                            zend_restore_error_handling(&error_handling TSRMLS_CC);
                            return NULL;
                     }
                     intern->u.caching.flags |= flags & CIT_PUBLIC;
                     MAKE_STD_ZVAL(intern->u.caching.zcache);
                     array_init(intern->u.caching.zcache);
                     break;
              }
              case DIT_IteratorIterator: {
                     zend_class_entry **pce_cast;
                     char * class_name = NULL;
                     int class_name_len = 0;

                     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|s", &zobject, ce_inner, &class_name, &class_name_len) == FAILURE) {
                            zend_restore_error_handling(&error_handling TSRMLS_CC);
                            return NULL;
                     }
                     ce = Z_OBJCE_P(zobject);
                     if (!instanceof_function(ce, zend_ce_iterator TSRMLS_CC)) {
                            if (ZEND_NUM_ARGS() > 1) {
                                   if (zend_lookup_class(class_name, class_name_len, &pce_cast TSRMLS_CC) == FAILURE 
                                   || !instanceof_function(ce, *pce_cast TSRMLS_CC)
                                   || !(*pce_cast)->get_iterator
                                   ) {
                                          zend_throw_exception(spl_ce_LogicException, "Class to downcast to not found or not base class or does not implement Traversable", 0 TSRMLS_CC);
                                          zend_restore_error_handling(&error_handling TSRMLS_CC);
                                          return NULL;
                                   }
                                   ce = *pce_cast;
                            }
                            if (instanceof_function(ce, zend_ce_aggregate TSRMLS_CC)) {
                                   zend_call_method_with_0_params(&zobject, ce, &ce->iterator_funcs.zf_new_iterator, "getiterator", &retval);
                                   if (EG(exception)) {
                                          if (retval) {
                                                 zval_ptr_dtor(&retval);
                                          }
                                          zend_restore_error_handling(&error_handling TSRMLS_CC);
                                          return NULL;
                                   }
                                   if (!retval || Z_TYPE_P(retval) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(retval), zend_ce_traversable TSRMLS_CC)) {
                                          zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "%s::getIterator() must return an object that implements Traversable", ce->name);
                                          zend_restore_error_handling(&error_handling TSRMLS_CC);
                                          return NULL;
                                   }
                                   zobject = retval;
                                   ce = Z_OBJCE_P(zobject);
                                   inc_refcount = 0;
                            }
                     }
                     break;
              }
              case DIT_AppendIterator:
                     spl_instantiate(spl_ce_ArrayIterator, &intern->u.append.zarrayit, 1 TSRMLS_CC);
                     zend_call_method_with_0_params(&intern->u.append.zarrayit, spl_ce_ArrayIterator, &spl_ce_ArrayIterator->constructor, "__construct", NULL);
                     intern->u.append.iterator = spl_ce_ArrayIterator->get_iterator(spl_ce_ArrayIterator, intern->u.append.zarrayit, 0 TSRMLS_CC);
                     zend_restore_error_handling(&error_handling TSRMLS_CC);
                     return intern;
#if HAVE_PCRE || HAVE_BUNDLED_PCRE
              case DIT_RegexIterator:
              case DIT_RecursiveRegexIterator: {
                     char *regex;
                     int regex_len;
                     long mode = REGIT_MODE_MATCH;

                     intern->u.regex.use_flags = ZEND_NUM_ARGS() >= 5;
                     intern->u.regex.flags = 0;
                     intern->u.regex.preg_flags = 0;
                     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os|lll", &zobject, ce_inner, &regex, &regex_len, &mode, &intern->u.regex.flags, &intern->u.regex.preg_flags) == FAILURE) {
                            zend_restore_error_handling(&error_handling TSRMLS_CC);
                            return NULL;
                     }
                     if (mode < 0 || mode >= REGIT_MODE_MAX) {
                            zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Illegal mode %ld", mode);
                            zend_restore_error_handling(&error_handling TSRMLS_CC);
                            return NULL;
                     }
                     intern->u.regex.mode = mode;
                     intern->u.regex.regex = estrndup(regex, regex_len);
                     intern->u.regex.pce = pcre_get_compiled_regex_cache(regex, regex_len TSRMLS_CC);
                     if (intern->u.regex.pce == NULL) {
                            /* pcre_get_compiled_regex_cache has already sent error */
                            zend_restore_error_handling(&error_handling TSRMLS_CC);
                            return NULL;
                     }
                     intern->u.regex.pce->refcount++;
                     break;
              }
#endif
              default:
                     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &zobject, ce_inner) == FAILURE) {
                            zend_restore_error_handling(&error_handling TSRMLS_CC);
                            return NULL;
                     }
                     break;
       }

       zend_restore_error_handling(&error_handling TSRMLS_CC);

       if (inc_refcount) {
              Z_ADDREF_P(zobject);
       }
       intern->inner.zobject = zobject;
       intern->inner.ce = dit_type == DIT_IteratorIterator ? ce : Z_OBJCE_P(zobject);
       intern->inner.object = zend_object_store_get_object(zobject TSRMLS_CC);
       intern->inner.iterator = intern->inner.ce->get_iterator(intern->inner.ce, zobject, 0 TSRMLS_CC);

       return intern;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void spl_dual_it_dtor ( zend_object _object,
zend_object_handle handle  TSRMLS_DC 
) [static]

Definition at line 2114 of file spl_iterators.c.

{
       spl_dual_it_object        *object = (spl_dual_it_object *)_object;

       /* call standard dtor */
       zend_objects_destroy_object(_object, handle TSRMLS_CC);

       spl_dual_it_free(object TSRMLS_CC);

       if (object->inner.iterator) {
              object->inner.iterator->funcs->dtor(object->inner.iterator TSRMLS_CC);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int spl_dual_it_fetch ( spl_dual_it_object intern,
int check_more  TSRMLS_DC 
) [inline, static]

Definition at line 1598 of file spl_iterators.c.

{
       zval **data;

       spl_dual_it_free(intern TSRMLS_CC);
       if (!check_more || spl_dual_it_valid(intern TSRMLS_CC) == SUCCESS) {
              intern->inner.iterator->funcs->get_current_data(intern->inner.iterator, &data TSRMLS_CC);
              if (data && *data) {
                     intern->current.data = *data;
                     Z_ADDREF_P(intern->current.data);
              }
              if (intern->inner.iterator->funcs->get_current_key) {
                     intern->current.key_type = intern->inner.iterator->funcs->get_current_key(intern->inner.iterator, &intern->current.str_key, &intern->current.str_key_len, &intern->current.int_key TSRMLS_CC);
              } else {
                     intern->current.key_type = HASH_KEY_IS_LONG;
                     intern->current.int_key = intern->current.pos;
              }
              return EG(exception) ? FAILURE : SUCCESS;
       }
       return FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void spl_dual_it_free ( spl_dual_it_object *intern  TSRMLS_DC) [inline, static]

Definition at line 1555 of file spl_iterators.c.

{
       if (intern->inner.iterator && intern->inner.iterator->funcs->invalidate_current) {
              intern->inner.iterator->funcs->invalidate_current(intern->inner.iterator TSRMLS_CC);
       }
       if (intern->current.data) {
              zval_ptr_dtor(&intern->current.data);
              intern->current.data = NULL;
       }
       if (intern->current.str_key) {
              efree(intern->current.str_key);
              intern->current.str_key = NULL;
       }
       if (intern->dit_type == DIT_CachingIterator || intern->dit_type == DIT_RecursiveCachingIterator) {
              if (intern->u.caching.zstr) {
                     zval_ptr_dtor(&intern->u.caching.zstr);
                     intern->u.caching.zstr = NULL;
              }
              if (intern->u.caching.zchildren) {
                     zval_ptr_dtor(&intern->u.caching.zchildren);
                     intern->u.caching.zchildren = NULL;
              }
       }
}

Here is the caller graph for this function:

static void spl_dual_it_free_storage ( void *_object  TSRMLS_DC) [static]

Definition at line 2130 of file spl_iterators.c.

{
       spl_dual_it_object        *object = (spl_dual_it_object *)_object;

       if (object->inner.zobject) {
              zval_ptr_dtor(&object->inner.zobject);
       }
       
       if (object->dit_type == DIT_AppendIterator) {
              object->u.append.iterator->funcs->dtor(object->u.append.iterator TSRMLS_CC);
              if (object->u.append.zarrayit) {
                     zval_ptr_dtor(&object->u.append.zarrayit);
              }
       }

       if (object->dit_type == DIT_CachingIterator || object->dit_type == DIT_RecursiveCachingIterator) {
              if (object->u.caching.zcache) {
                     zval_ptr_dtor(&object->u.caching.zcache);
                     object->u.caching.zcache = NULL;
              }
       }

#if HAVE_PCRE || HAVE_BUNDLED_PCRE
       if (object->dit_type == DIT_RegexIterator || object->dit_type == DIT_RecursiveRegexIterator) {
              if (object->u.regex.pce) {
                     object->u.regex.pce->refcount--;
              }
              if (object->u.regex.regex) {
                     efree(object->u.regex.regex);
              }
       }
#endif

       zend_object_std_dtor(&object->std TSRMLS_CC);

       efree(object);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static union _zend_function* spl_dual_it_get_method ( zval **  object_ptr,
char *  method,
int method_len  TSRMLS_DC 
) [static, write]

Definition at line 1276 of file spl_iterators.c.

{
       union _zend_function *function_handler;
       spl_dual_it_object   *intern;

       intern = (spl_dual_it_object*)zend_object_store_get_object(*object_ptr TSRMLS_CC);

       function_handler = std_object_handlers.get_method(object_ptr, method, method_len TSRMLS_CC);
       if (!function_handler && intern->inner.ce) {
              if (zend_hash_find(&intern->inner.ce->function_table, method, method_len+1, (void **) &function_handler) == FAILURE) {
                     if (Z_OBJ_HT_P(intern->inner.zobject)->get_method) {
                            *object_ptr = intern->inner.zobject;
                            function_handler = Z_OBJ_HT_P(*object_ptr)->get_method(object_ptr, method, method_len TSRMLS_CC);
                     }
              }
       }
       return function_handler;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static zend_object_value spl_dual_it_new ( zend_class_entry *class_type  TSRMLS_DC) [static]

Definition at line 2170 of file spl_iterators.c.

{
       zend_object_value retval;
       spl_dual_it_object *intern;
       zval *tmp;

       intern = emalloc(sizeof(spl_dual_it_object));
       memset(intern, 0, sizeof(spl_dual_it_object));
       intern->dit_type = DIT_Unknown;

       zend_object_std_init(&intern->std, class_type TSRMLS_CC);
       zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));

       retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)spl_dual_it_dtor, (zend_objects_free_object_storage_t) spl_dual_it_free_storage, NULL TSRMLS_CC);
       retval.handlers = &spl_handlers_dual_it;
       return retval;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void spl_dual_it_next ( spl_dual_it_object intern,
int do_free  TSRMLS_DC 
) [inline, static]

Definition at line 1620 of file spl_iterators.c.

{
       if (do_free) {
              spl_dual_it_free(intern TSRMLS_CC);
       } else {
              spl_dual_it_require(intern TSRMLS_CC);
       }
       intern->inner.iterator->funcs->move_forward(intern->inner.iterator TSRMLS_CC);
       intern->current.pos++;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void spl_dual_it_require ( spl_dual_it_object *intern  TSRMLS_DC) [inline, static]

Definition at line 1548 of file spl_iterators.c.

{
       if (!intern->inner.iterator) {
              php_error_docref(NULL TSRMLS_CC, E_ERROR, "The inner constructor wasn't initialized with an iterator instance");
       }
}

Here is the caller graph for this function:

static void spl_dual_it_rewind ( spl_dual_it_object *intern  TSRMLS_DC) [inline, static]

Definition at line 1580 of file spl_iterators.c.

{
       spl_dual_it_free(intern TSRMLS_CC);
       intern->current.pos = 0;
       if (intern->inner.iterator->funcs->rewind) {
              intern->inner.iterator->funcs->rewind(intern->inner.iterator TSRMLS_CC);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int spl_dual_it_valid ( spl_dual_it_object *intern  TSRMLS_DC) [inline, static]

Definition at line 1589 of file spl_iterators.c.

{
       if (!intern->inner.iterator) {
              return FAILURE;
       }
       /* FAILURE / SUCCESS */
       return intern->inner.iterator->funcs->valid(intern->inner.iterator TSRMLS_CC);
}

Here is the caller graph for this function:

static void spl_filter_it_fetch ( zval *  zthis,
spl_dual_it_object *intern  TSRMLS_DC 
) [inline, static]

Definition at line 1738 of file spl_iterators.c.

{
       zval *retval;

       while (spl_dual_it_fetch(intern, 1 TSRMLS_CC) == SUCCESS) {
              zend_call_method_with_0_params(&zthis, intern->std.ce, NULL, "accept", &retval);
              if (retval) {
                     if (zend_is_true(retval)) {
                            zval_ptr_dtor(&retval);
                            return;
                     }
                     zval_ptr_dtor(&retval);
              }
              if (EG(exception)) {
                     return;
              }
              intern->inner.iterator->funcs->move_forward(intern->inner.iterator TSRMLS_CC);
       }
       spl_dual_it_free(intern TSRMLS_CC);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void spl_filter_it_next ( zval *  zthis,
spl_dual_it_object *intern  TSRMLS_DC 
) [inline, static]

Definition at line 1765 of file spl_iterators.c.

{
       spl_dual_it_next(intern, 1 TSRMLS_CC);
       spl_filter_it_fetch(zthis, intern TSRMLS_CC);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void spl_filter_it_rewind ( zval *  zthis,
spl_dual_it_object *intern  TSRMLS_DC 
) [inline, static]

Definition at line 1759 of file spl_iterators.c.

Here is the call graph for this function:

Here is the caller graph for this function:

PHPAPI int spl_iterator_apply ( zval *  obj,
spl_iterator_apply_func_t  apply_func,
void *puser  TSRMLS_DC 
)

Definition at line 3308 of file spl_iterators.c.

{
       zend_object_iterator   *iter;
       zend_class_entry       *ce = Z_OBJCE_P(obj);

       iter = ce->get_iterator(ce, obj, 0 TSRMLS_CC);

       if (EG(exception)) {
              goto done;
       }

       iter->index = 0;
       if (iter->funcs->rewind) {
              iter->funcs->rewind(iter TSRMLS_CC);
              if (EG(exception)) {
                     goto done;
              }
       }

       while (iter->funcs->valid(iter TSRMLS_CC) == SUCCESS) {
              if (EG(exception)) {
                     goto done;
              }
              if (apply_func(iter, puser TSRMLS_CC) == ZEND_HASH_APPLY_STOP || EG(exception)) {
                     goto done;
              }
              iter->index++;
              iter->funcs->move_forward(iter TSRMLS_CC);
              if (EG(exception)) {
                     goto done;
              }
       }

done:
       if (iter) {
              iter->funcs->dtor(iter TSRMLS_CC);
       }
       return EG(exception) ? FAILURE : SUCCESS;
}

Here is the caller graph for this function:

static int spl_iterator_count_apply ( zend_object_iterator *  iter,
void *puser  TSRMLS_DC 
) [static]

Definition at line 3423 of file spl_iterators.c.

{
       (*(long*)puser)++;
       return ZEND_HASH_APPLY_KEEP;
}

Here is the caller graph for this function:

static int spl_iterator_func_apply ( zend_object_iterator *  iter,
void *puser  TSRMLS_DC 
) [static]

Definition at line 3455 of file spl_iterators.c.

{
       zval *retval;
       spl_iterator_apply_info  *apply_info = (spl_iterator_apply_info*)puser;
       int result;

       apply_info->count++;
       zend_fcall_info_call(&apply_info->fci, &apply_info->fcc, &retval, NULL TSRMLS_CC);
       if (retval) {
              result = zend_is_true(retval) ? ZEND_HASH_APPLY_KEEP : ZEND_HASH_APPLY_STOP;
              zval_ptr_dtor(&retval);
       } else {
              result = ZEND_HASH_APPLY_STOP;
       }
       return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int spl_iterator_to_array_apply ( zend_object_iterator *  iter,
void *puser  TSRMLS_DC 
) [static]

Definition at line 3349 of file spl_iterators.c.

{
       zval                    **data, *return_value = (zval*)puser;
       char                    *str_key;
       uint                    str_key_len;
       ulong                   int_key;
       int                     key_type;

       iter->funcs->get_current_data(iter, &data TSRMLS_CC);
       if (EG(exception)) {
              return ZEND_HASH_APPLY_STOP;
       }
       if (data == NULL || *data == NULL) {
              return ZEND_HASH_APPLY_STOP;
       }
       if (iter->funcs->get_current_key) {
              key_type = iter->funcs->get_current_key(iter, &str_key, &str_key_len, &int_key TSRMLS_CC);
              if (EG(exception)) {
                     return ZEND_HASH_APPLY_STOP;
              }
              Z_ADDREF_PP(data);
              switch(key_type) {
                     case HASH_KEY_IS_STRING:
                            add_assoc_zval_ex(return_value, str_key, str_key_len, *data);
                            efree(str_key);
                            break;
                     case HASH_KEY_IS_LONG:
                            add_index_zval(return_value, int_key, *data);
                            break;
              }
       } else {
              Z_ADDREF_PP(data);
              add_next_index_zval(return_value, *data);
       }
       return ZEND_HASH_APPLY_KEEP;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int spl_iterator_to_values_apply ( zend_object_iterator *  iter,
void *puser  TSRMLS_DC 
) [static]

Definition at line 3387 of file spl_iterators.c.

{
       zval **data, *return_value = (zval*)puser;

       iter->funcs->get_current_data(iter, &data TSRMLS_CC);
       if (EG(exception)) {
              return ZEND_HASH_APPLY_STOP;
       }
       if (data == NULL || *data == NULL) {
              return ZEND_HASH_APPLY_STOP;
       }
       Z_ADDREF_PP(data);
       add_next_index_zval(return_value, *data);
       return ZEND_HASH_APPLY_KEEP;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void spl_limit_it_seek ( spl_dual_it_object intern,
long pos  TSRMLS_DC 
) [inline, static]

Definition at line 2281 of file spl_iterators.c.

{
       zval  *zpos;

       spl_dual_it_free(intern TSRMLS_CC);
       if (pos < intern->u.limit.offset) {
              zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Cannot seek to %ld which is below the offset %ld", pos, intern->u.limit.offset);
              return;
       }
       if (pos >= intern->u.limit.offset + intern->u.limit.count && intern->u.limit.count != -1) {
              zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Cannot seek to %ld which is behind offset %ld plus count %ld", pos, intern->u.limit.offset, intern->u.limit.count);
              return;
       }
       if (pos != intern->current.pos && instanceof_function(intern->inner.ce, spl_ce_SeekableIterator TSRMLS_CC)) {
              MAKE_STD_ZVAL(zpos);
              ZVAL_LONG(zpos, pos);
              spl_dual_it_free(intern TSRMLS_CC);
              zend_call_method_with_1_params(&intern->inner.zobject, intern->inner.ce, NULL, "seek", NULL, zpos);
              zval_ptr_dtor(&zpos);
              if (!EG(exception)) {
                     intern->current.pos = pos;
                     if (spl_limit_it_valid(intern TSRMLS_CC) == SUCCESS) {
                            spl_dual_it_fetch(intern, 0 TSRMLS_CC);
                     }
              }
       } else {
              /* emulate the forward seek, by next() calls */
              /* a back ward seek is done by a previous rewind() */
              if (pos < intern->current.pos) {
                     spl_dual_it_rewind(intern TSRMLS_CC);
              }
              while (pos > intern->current.pos && spl_dual_it_valid(intern TSRMLS_CC) == SUCCESS) {
                     spl_dual_it_next(intern, 1 TSRMLS_CC);
              }
              if (spl_dual_it_valid(intern TSRMLS_CC) == SUCCESS) {
                     spl_dual_it_fetch(intern, 1 TSRMLS_CC);
              }
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int spl_limit_it_valid ( spl_dual_it_object *intern  TSRMLS_DC) [inline, static]

Definition at line 2271 of file spl_iterators.c.

{
       /* FAILURE / SUCCESS */
       if (intern->u.limit.count != -1 && intern->current.pos >= intern->u.limit.offset + intern->u.limit.count) {
              return FAILURE;
       } else {
              return spl_dual_it_valid(intern TSRMLS_CC);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

SPL_METHOD ( RecursiveIteratorIterator  ,
__construct   
)

Definition at line 581 of file spl_iterators.c.

Here is the call graph for this function:

Definition at line 594 of file spl_iterators.c.

Here is the call graph for this function:

Definition at line 607 of file spl_iterators.c.

{
       spl_recursive_it_object   *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
       zend_object_iterator      *iterator = object->iterators[object->level].iterator;
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       if (iterator->funcs->get_current_key) {
              char *str_key;
              uint str_key_len;
              ulong int_key;

              switch (iterator->funcs->get_current_key(iterator, &str_key, &str_key_len, &int_key TSRMLS_CC)) {
                     case HASH_KEY_IS_LONG:
                            RETURN_LONG(int_key);
                            break;
                     case HASH_KEY_IS_STRING:
                            RETURN_STRINGL(str_key, str_key_len-1, 0);
                            break;
                     default:
                            RETURN_NULL();
              }
       } else {
              RETURN_NULL();
       }
} /* }}} */

Here is the call graph for this function:

SPL_METHOD ( RecursiveIteratorIterator  ,
current   
)

Definition at line 638 of file spl_iterators.c.

{
       spl_recursive_it_object   *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
       zend_object_iterator      *iterator = object->iterators[object->level].iterator;
       zval                      **data;
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       iterator->funcs->get_current_data(iterator, &data TSRMLS_CC);
       if (data && *data) {
              RETURN_ZVAL(*data, 1, 0);
       }
} /* }}} */

Here is the call graph for this function:

Definition at line 656 of file spl_iterators.c.

Here is the call graph for this function:

SPL_METHOD ( RecursiveIteratorIterator  ,
getDepth   
)

Definition at line 669 of file spl_iterators.c.

Here is the call graph for this function:

SPL_METHOD ( RecursiveIteratorIterator  ,
getSubIterator   
)

Definition at line 682 of file spl_iterators.c.

{
       spl_recursive_it_object   *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
       long  level = object->level;
       
       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &level) == FAILURE) {
              return;
       }
       if (level < 0 || level > object->level) {
              RETURN_NULL();
       }
       RETURN_ZVAL(object->iterators[level].zobject, 1, 0);
} /* }}} */

Here is the call graph for this function:

SPL_METHOD ( RecursiveIteratorIterator  ,
getInnerIterator   
)

Definition at line 698 of file spl_iterators.c.

{
       spl_recursive_it_object   *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
       long  level = object->level;
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       
       RETURN_ZVAL(object->iterators[level].zobject, 1, 0);
} /* }}} */

Here is the call graph for this function:

SPL_METHOD ( RecursiveIteratorIterator  ,
beginIteration   
)

Definition at line 712 of file spl_iterators.c.

{
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       /* nothing to do */
} /* }}} */
SPL_METHOD ( RecursiveIteratorIterator  ,
endIteration   
)

Definition at line 722 of file spl_iterators.c.

{
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       /* nothing to do */
} /* }}} */
SPL_METHOD ( RecursiveIteratorIterator  ,
callHasChildren   
)

Definition at line 732 of file spl_iterators.c.

{
       spl_recursive_it_object   *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
       zend_class_entry *ce = object->iterators[object->level].ce;
       zval *retval, *zobject;
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       zobject = object->iterators[object->level].zobject;
       if (!zobject) {
              RETURN_FALSE;
       } else {
              zend_call_method_with_0_params(&zobject, ce, NULL, "haschildren", &retval);
              if (retval) {
                     RETURN_ZVAL(retval, 0, 1);
              } else {
                     RETURN_FALSE;
              }
       }
} /* }}} */

Here is the call graph for this function:

SPL_METHOD ( RecursiveIteratorIterator  ,
callGetChildren   
)

Definition at line 757 of file spl_iterators.c.

{
       spl_recursive_it_object   *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
       zend_class_entry *ce = object->iterators[object->level].ce;
       zval *retval, *zobject;
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       zobject = object->iterators[object->level].zobject;
       if (!zobject) {
              return;
       } else {
              zend_call_method_with_0_params(&zobject, ce, NULL, "getchildren", &retval);
              if (retval) {
                     RETURN_ZVAL(retval, 0, 1);
              }
       }
} /* }}} */

Here is the call graph for this function:

SPL_METHOD ( RecursiveIteratorIterator  ,
beginChildren   
)

Definition at line 780 of file spl_iterators.c.

{
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       /* nothing to do */
} /* }}} */
SPL_METHOD ( RecursiveIteratorIterator  ,
endChildren   
)

Definition at line 790 of file spl_iterators.c.

{
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       /* nothing to do */
} /* }}} */
SPL_METHOD ( RecursiveIteratorIterator  ,
nextElement   
)

Definition at line 800 of file spl_iterators.c.

{
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       /* nothing to do */
} /* }}} */
SPL_METHOD ( RecursiveIteratorIterator  ,
setMaxDepth   
)

Definition at line 810 of file spl_iterators.c.

{
       spl_recursive_it_object   *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
       long  max_depth = -1;
       
       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &max_depth) == FAILURE) {
              return;
       }
       if (max_depth < -1) {
              zend_throw_exception(spl_ce_OutOfRangeException, "Parameter max_depth must be >= -1", 0 TSRMLS_CC);
              return;
       }
       object->max_depth = max_depth;
} /* }}} */

Here is the call graph for this function:

SPL_METHOD ( RecursiveIteratorIterator  ,
getMaxDepth   
)

Definition at line 827 of file spl_iterators.c.

Here is the call graph for this function:

SPL_METHOD ( RecursiveTreeIterator  ,
__construct   
)
SPL_METHOD ( RecursiveTreeIterator  ,
setPrefixPart   
)

Definition at line 1052 of file spl_iterators.c.

{
       spl_recursive_it_object   *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
       long  part;
       char* prefix;
       int   prefix_len;
       
       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &part, &prefix, &prefix_len) == FAILURE) {
              return;
       }
       if (0 > part || part > 5) {
              zend_throw_exception_ex(spl_ce_OutOfRangeException, 0 TSRMLS_CC, "Use RecursiveTreeIterator::PREFIX_* constant");
              return;
       }
       
       smart_str_free(&object->prefix[part]);
       smart_str_appendl(&object->prefix[part], prefix, prefix_len);
} /* }}} */

Here is the call graph for this function:

SPL_METHOD ( RecursiveTreeIterator  ,
getPrefix   
)

Definition at line 1073 of file spl_iterators.c.

Here is the call graph for this function:

SPL_METHOD ( RecursiveTreeIterator  ,
getEntry   
)

Definition at line 1085 of file spl_iterators.c.

Here is the call graph for this function:

SPL_METHOD ( RecursiveTreeIterator  ,
getPostfix   
)

Definition at line 1098 of file spl_iterators.c.

Here is the call graph for this function:

SPL_METHOD ( RecursiveTreeIterator  ,
current   
)

Definition at line 1111 of file spl_iterators.c.

{
       spl_recursive_it_object   *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
       zval                       prefix, entry, postfix;
       char                      *str, *ptr;
       size_t                     str_len;
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       if (object->flags & RTIT_BYPASS_CURRENT) {
              zend_object_iterator      *iterator = object->iterators[object->level].iterator;
              zval                      **data;

              iterator->funcs->get_current_data(iterator, &data TSRMLS_CC);
              if (data && *data) {
                     RETURN_ZVAL(*data, 1, 0);
              } else {
                     RETURN_NULL();
              }
       }

       spl_recursive_tree_iterator_get_prefix(object, &prefix TSRMLS_CC);
       spl_recursive_tree_iterator_get_entry(object, &entry TSRMLS_CC);
       spl_recursive_tree_iterator_get_postfix(object, &postfix TSRMLS_CC);

       str_len = Z_STRLEN(prefix) + Z_STRLEN(entry) + Z_STRLEN(postfix);
       str = (char *) emalloc(str_len + 1U);
       ptr = str;

       memcpy(ptr, Z_STRVAL(prefix), Z_STRLEN(prefix));
       ptr += Z_STRLEN(prefix);
       memcpy(ptr, Z_STRVAL(entry), Z_STRLEN(entry));
       ptr += Z_STRLEN(entry);
       memcpy(ptr, Z_STRVAL(postfix), Z_STRLEN(postfix));
       ptr += Z_STRLEN(postfix);
       *ptr = 0;

       zval_dtor(&prefix);
       zval_dtor(&entry);
       zval_dtor(&postfix);

       RETURN_STRINGL(str, str_len, 0);
} /* }}} */

Here is the call graph for this function:

Definition at line 1159 of file spl_iterators.c.

{
       spl_recursive_it_object   *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
       zend_object_iterator      *iterator = object->iterators[object->level].iterator;
       zval                       prefix, key, postfix, key_copy;
       char                      *str, *ptr;
       size_t                     str_len;
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       if (iterator->funcs->get_current_key) {
              char *str_key;
              uint str_key_len;
              ulong int_key;

              switch (iterator->funcs->get_current_key(iterator, &str_key, &str_key_len, &int_key TSRMLS_CC)) {
                     case HASH_KEY_IS_LONG:
                            ZVAL_LONG(&key, int_key);
                            break;
                     case HASH_KEY_IS_STRING:
                            ZVAL_STRINGL(&key, str_key, str_key_len-1, 0);
                            break;
                     default:
                            ZVAL_NULL(&key);
              }
       } else {
              ZVAL_NULL(&key);
       }

       if (object->flags & RTIT_BYPASS_KEY) {
              zval *key_ptr = &key;
              RETVAL_ZVAL(key_ptr, 1, 0);
              zval_dtor(&key);
              return;
       }

       if (Z_TYPE(key) != IS_STRING) {
              int use_copy;
              zend_make_printable_zval(&key, &key_copy, &use_copy);
              if (use_copy) {
                     key = key_copy;
              }
       }

       spl_recursive_tree_iterator_get_prefix(object, &prefix TSRMLS_CC);
       spl_recursive_tree_iterator_get_postfix(object, &postfix TSRMLS_CC);

       str_len = Z_STRLEN(prefix) + Z_STRLEN(key) + Z_STRLEN(postfix);
       str = (char *) emalloc(str_len + 1U);
       ptr = str;

       memcpy(ptr, Z_STRVAL(prefix), Z_STRLEN(prefix));
       ptr += Z_STRLEN(prefix);
       memcpy(ptr, Z_STRVAL(key), Z_STRLEN(key));
       ptr += Z_STRLEN(key);
       memcpy(ptr, Z_STRVAL(postfix), Z_STRLEN(postfix));
       ptr += Z_STRLEN(postfix);
       *ptr = 0;

       zval_dtor(&prefix);
       zval_dtor(&key);
       zval_dtor(&postfix);

       RETVAL_STRINGL(str, str_len, 0);
} /* }}} */

Here is the call graph for this function:

SPL_METHOD ( FilterIterator  ,
__construct   
)

Definition at line 1521 of file spl_iterators.c.

Here is the call graph for this function:

SPL_METHOD ( dual_it  ,
getInnerIterator   
)

Definition at line 1531 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       
       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());

       if (intern->inner.zobject) {
              RETVAL_ZVAL(intern->inner.zobject, 1, 0);
       } else {
              RETURN_NULL();
       }
} /* }}} */
SPL_METHOD ( dual_it  ,
rewind   
)

Definition at line 1635 of file spl_iterators.c.

Here is the call graph for this function:

SPL_METHOD ( dual_it  ,
valid   
)

Definition at line 1654 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       
       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());

       RETURN_BOOL(intern->current.data);
} /* }}} */
SPL_METHOD ( dual_it  ,
key   
)

Definition at line 1675 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       
       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());

       if (intern->current.data) {
              if (intern->current.key_type == HASH_KEY_IS_STRING) {
                     RETURN_STRINGL(intern->current.str_key, intern->current.str_key_len-1, 1);
              } else {
                     RETURN_LONG(intern->current.int_key);
              }
       }
       RETURN_NULL();
} /* }}} */
SPL_METHOD ( dual_it  ,
current   
)

Definition at line 1703 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());

       if (intern->current.data) {
              RETVAL_ZVAL(intern->current.data, 1, 0);
       } else {
              RETURN_NULL();
       }
} /* }}} */
SPL_METHOD ( dual_it  ,
next   
)

Definition at line 1724 of file spl_iterators.c.

Here is the call graph for this function:

SPL_METHOD ( FilterIterator  ,
rewind   
)

Definition at line 1773 of file spl_iterators.c.

Here is the call graph for this function:

SPL_METHOD ( FilterIterator  ,
next   
)

Definition at line 1787 of file spl_iterators.c.

Here is the call graph for this function:

SPL_METHOD ( RecursiveFilterIterator  ,
__construct   
)
SPL_METHOD ( RecursiveFilterIterator  ,
hasChildren   
)

Definition at line 1808 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;
       zval                 *retval;
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());

       zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "haschildren", &retval);
       if (retval) {
              RETURN_ZVAL(retval, 0, 1);
       } else {
              RETURN_FALSE;
       }
} /* }}} */
SPL_METHOD ( RecursiveFilterIterator  ,
getChildren   
)

Definition at line 1829 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;
       zval                 *retval;
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());

       zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &retval);
       if (!EG(exception) && retval) {
              spl_instantiate_arg_ex1(Z_OBJCE_P(getThis()), &return_value, 0, retval TSRMLS_CC);
       }
       if (retval) {
              zval_ptr_dtor(&retval);
       }
} /* }}} */

Here is the call graph for this function:

SPL_METHOD ( ParentIterator  ,
__construct   
)

Definition at line 1851 of file spl_iterators.c.

Here is the call graph for this function:

SPL_METHOD ( LimitIterator  ,
__construct   
)

Definition at line 2323 of file spl_iterators.c.

Here is the call graph for this function:

SPL_METHOD ( LimitIterator  ,
rewind   
)

Definition at line 2330 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;

       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
       spl_dual_it_rewind(intern TSRMLS_CC);
       spl_limit_it_seek(intern, intern->u.limit.offset TSRMLS_CC);
} /* }}} */

Here is the call graph for this function:

SPL_METHOD ( LimitIterator  ,
valid   
)

Definition at line 2341 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;

       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());

/*     RETURN_BOOL(spl_limit_it_valid(intern TSRMLS_CC) == SUCCESS);*/
       RETURN_BOOL((intern->u.limit.count == -1 || intern->current.pos < intern->u.limit.offset + intern->u.limit.count) && intern->current.data);
} /* }}} */
SPL_METHOD ( LimitIterator  ,
next   
)

Definition at line 2353 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;

       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());

       spl_dual_it_next(intern, 1 TSRMLS_CC);
       if (intern->u.limit.count == -1 || intern->current.pos < intern->u.limit.offset + intern->u.limit.count) {
              spl_dual_it_fetch(intern, 1 TSRMLS_CC);
       }
} /* }}} */

Here is the call graph for this function:

SPL_METHOD ( LimitIterator  ,
seek   
)

Definition at line 2367 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;
       long                 pos;

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &pos) == FAILURE) {
              return;
       }

       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
       spl_limit_it_seek(intern, pos TSRMLS_CC);
       RETURN_LONG(intern->current.pos);
} /* }}} */

Here is the call graph for this function:

SPL_METHOD ( LimitIterator  ,
getPosition   
)

Definition at line 2383 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;
       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
       RETURN_LONG(intern->current.pos);
} /* }}} */
SPL_METHOD ( CachingIterator  ,
__construct   
)

Definition at line 2526 of file spl_iterators.c.

Here is the call graph for this function:

SPL_METHOD ( CachingIterator  ,
rewind   
)

Definition at line 2533 of file spl_iterators.c.

Here is the call graph for this function:

SPL_METHOD ( CachingIterator  ,
valid   
)

Definition at line 2548 of file spl_iterators.c.

Here is the call graph for this function:

SPL_METHOD ( CachingIterator  ,
next   
)

Definition at line 2563 of file spl_iterators.c.

Here is the call graph for this function:

SPL_METHOD ( CachingIterator  ,
hasNext   
)

Definition at line 2578 of file spl_iterators.c.

Here is the call graph for this function:

SPL_METHOD ( CachingIterator  ,
__toString   
)

Definition at line 2593 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;

       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());

       if (!(intern->u.caching.flags & (CIT_CALL_TOSTRING|CIT_TOSTRING_USE_KEY|CIT_TOSTRING_USE_CURRENT|CIT_TOSTRING_USE_INNER)))    {
              zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%s does not fetch string value (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name);
              return;
       }
       if (intern->u.caching.flags & CIT_TOSTRING_USE_KEY) {
              if (intern->current.key_type == HASH_KEY_IS_STRING) {
                     RETURN_STRINGL(intern->current.str_key, intern->current.str_key_len-1, 1);
              } else {
                     RETVAL_LONG(intern->current.int_key);
                     convert_to_string(return_value);
                     return;
              }
       } else if (intern->u.caching.flags & CIT_TOSTRING_USE_CURRENT) {
              MAKE_COPY_ZVAL(&intern->current.data, return_value);
              convert_to_string(return_value);
              return;
       }
       if (intern->u.caching.zstr) {
              RETURN_STRINGL(Z_STRVAL_P(intern->u.caching.zstr), Z_STRLEN_P(intern->u.caching.zstr), 1);
       } else {
              RETURN_NULL();
       }
} /* }}} */

Here is the call graph for this function:

SPL_METHOD ( CachingIterator  ,
offsetSet   
)

Definition at line 2625 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;
       char *arKey;
       uint nKeyLength;
       zval *value;

       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());

       if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
              zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%s does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name);
              return;
       }

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz", &arKey, &nKeyLength, &value) == FAILURE) {
              return;
       }

       Z_ADDREF_P(value);
       zend_symtable_update(HASH_OF(intern->u.caching.zcache), arKey, nKeyLength+1, &value, sizeof(value), NULL);
}

Here is the call graph for this function:

SPL_METHOD ( CachingIterator  ,
offsetGet   
)

Definition at line 2650 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;
       char *arKey;
       uint nKeyLength;
       zval **value;

       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());

       if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
              zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%s does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name);
              return;
       }

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arKey, &nKeyLength) == FAILURE) {
              return;
       }

       if (zend_symtable_find(HASH_OF(intern->u.caching.zcache), arKey, nKeyLength+1, (void**)&value) == FAILURE) {
              zend_error(E_NOTICE, "Undefined index:  %s", arKey);
              return;
       }
       
       RETURN_ZVAL(*value, 1, 0);
}

Here is the call graph for this function:

SPL_METHOD ( CachingIterator  ,
offsetUnset   
)

Definition at line 2679 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;
       char *arKey;
       uint nKeyLength;

       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());

       if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
              zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%s does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name);
              return;
       }

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arKey, &nKeyLength) == FAILURE) {
              return;
       }

       zend_symtable_del(HASH_OF(intern->u.caching.zcache), arKey, nKeyLength+1);
}

Here is the call graph for this function:

SPL_METHOD ( CachingIterator  ,
offsetExists   
)

Definition at line 2702 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;
       char *arKey;
       uint nKeyLength;
       
       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());

       if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
              zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%s does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name);
              return;
       }
       
       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arKey, &nKeyLength) == FAILURE) {
              return;
       }

       RETURN_BOOL(zend_symtable_exists(HASH_OF(intern->u.caching.zcache), arKey, nKeyLength+1));
}

Here is the call graph for this function:

SPL_METHOD ( CachingIterator  ,
getCache   
)

Definition at line 2725 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       
       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());

       if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
              zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%v does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name);
              return;
       }

       RETURN_ZVAL(intern->u.caching.zcache, 1, 0);
}

Here is the call graph for this function:

SPL_METHOD ( CachingIterator  ,
getFlags   
)

Definition at line 2746 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       
       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());

       RETURN_LONG(intern->u.caching.flags);
}
SPL_METHOD ( CachingIterator  ,
setFlags   
)

Definition at line 2762 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;
       long flags;

       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &flags) == FAILURE) {
              return;
       }

       if (spl_cit_check_flags(flags) != SUCCESS) {
              zend_throw_exception(spl_ce_InvalidArgumentException , "Flags must contain only one of CALL_TOSTRING, TOSTRING_USE_KEY, TOSTRING_USE_CURRENT, TOSTRING_USE_INNER", 0 TSRMLS_CC);
              return;
       }
       if ((intern->u.caching.flags & CIT_CALL_TOSTRING) != 0 && (flags & CIT_CALL_TOSTRING) == 0) {
              zend_throw_exception(spl_ce_InvalidArgumentException, "Unsetting flag CALL_TO_STRING is not possible", 0 TSRMLS_CC);
              return;
       }
       if ((intern->u.caching.flags & CIT_TOSTRING_USE_INNER) != 0 && (flags & CIT_TOSTRING_USE_INNER) == 0) {
              zend_throw_exception(spl_ce_InvalidArgumentException, "Unsetting flag TOSTRING_USE_INNER is not possible", 0 TSRMLS_CC);
              return;
       }
       if ((flags & CIT_FULL_CACHE) != 0 && (intern->u.caching.flags & CIT_FULL_CACHE) == 0) {
              /* clear on (re)enable */
              zend_hash_clean(HASH_OF(intern->u.caching.zcache));
       }
       intern->u.caching.flags = (intern->u.caching.flags & ~CIT_PUBLIC) | (flags & CIT_PUBLIC);
}

Here is the call graph for this function:

SPL_METHOD ( CachingIterator  ,
count   
)

Definition at line 2795 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       
       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());

       if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
              zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%v does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name);
              return;
       }

       RETURN_LONG(zend_hash_num_elements(HASH_OF(intern->u.caching.zcache)));
}

Here is the call graph for this function:

SPL_METHOD ( RecursiveCachingIterator  ,
__construct   
)
SPL_METHOD ( RecursiveCachingIterator  ,
hasChildren   
)

Definition at line 2862 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       
       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());

       RETURN_BOOL(intern->u.caching.zchildren);
} /* }}} */
SPL_METHOD ( RecursiveCachingIterator  ,
getChildren   
)

Definition at line 2877 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());

       if (intern->u.caching.zchildren) {
              RETURN_ZVAL(intern->u.caching.zchildren, 1, 0);
       } else {
              RETURN_NULL();
       }
} /* }}} */
SPL_METHOD ( IteratorIterator  ,
__construct   
)

Definition at line 2908 of file spl_iterators.c.

Here is the call graph for this function:

SPL_METHOD ( NoRewindIterator  ,
__construct   
)

Definition at line 2930 of file spl_iterators.c.

Here is the call graph for this function:

SPL_METHOD ( NoRewindIterator  ,
rewind   
)

Definition at line 2937 of file spl_iterators.c.

{
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       /* nothing to do */
} /* }}} */
SPL_METHOD ( NoRewindIterator  ,
valid   
)

Definition at line 2947 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
       RETURN_BOOL(intern->inner.iterator->funcs->valid(intern->inner.iterator TSRMLS_CC) == SUCCESS);
} /* }}} */
SPL_METHOD ( NoRewindIterator  ,
key   
)

Definition at line 2961 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());

       if (intern->inner.iterator->funcs->get_current_key) {
              char *str_key;
              uint str_key_len;
              ulong int_key;
              switch (intern->inner.iterator->funcs->get_current_key(intern->inner.iterator, &str_key, &str_key_len, &int_key TSRMLS_CC)) {
                     case HASH_KEY_IS_LONG:
                            RETURN_LONG(int_key);
                            break;
                     case HASH_KEY_IS_STRING:
                            RETURN_STRINGL(str_key, str_key_len-1, 0);
                            break;
                     default:
                            RETURN_NULL();
              }
       } else {
              RETURN_NULL();
       }
} /* }}} */
SPL_METHOD ( NoRewindIterator  ,
current   
)

Definition at line 2992 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;
       zval **data;
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
       intern->inner.iterator->funcs->get_current_data(intern->inner.iterator, &data TSRMLS_CC);
       if (data && *data) {
              RETURN_ZVAL(*data, 1, 0);
       }
} /* }}} */
SPL_METHOD ( NoRewindIterator  ,
next   
)

Definition at line 3010 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
       intern->inner.iterator->funcs->move_forward(intern->inner.iterator TSRMLS_CC);
} /* }}} */
SPL_METHOD ( InfiniteIterator  ,
__construct   
)

Definition at line 3039 of file spl_iterators.c.

Here is the call graph for this function:

SPL_METHOD ( InfiniteIterator  ,
next   
)

Definition at line 3046 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());

       spl_dual_it_next(intern, 1 TSRMLS_CC);
       if (spl_dual_it_valid(intern TSRMLS_CC) == SUCCESS) {
              spl_dual_it_fetch(intern, 0 TSRMLS_CC);
       } else {
              spl_dual_it_rewind(intern TSRMLS_CC);
              if (spl_dual_it_valid(intern TSRMLS_CC) == SUCCESS) {
                     spl_dual_it_fetch(intern, 0 TSRMLS_CC);
              }
       }
} /* }}} */

Here is the call graph for this function:

SPL_METHOD ( EmptyIterator  ,
rewind   
)

Definition at line 3075 of file spl_iterators.c.

{
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
} /* }}} */
SPL_METHOD ( EmptyIterator  ,
valid   
)

Definition at line 3084 of file spl_iterators.c.

{
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       RETURN_FALSE;
} /* }}} */
SPL_METHOD ( EmptyIterator  ,
key   
)

Definition at line 3094 of file spl_iterators.c.

{
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       zend_throw_exception(spl_ce_BadMethodCallException, "Accessing the key of an EmptyIterator", 0 TSRMLS_CC);
} /* }}} */

Here is the call graph for this function:

SPL_METHOD ( EmptyIterator  ,
current   
)

Definition at line 3104 of file spl_iterators.c.

{
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       zend_throw_exception(spl_ce_BadMethodCallException, "Accessing the value of an EmptyIterator", 0 TSRMLS_CC);
} /* }}} */

Here is the call graph for this function:

SPL_METHOD ( EmptyIterator  ,
next   
)

Definition at line 3114 of file spl_iterators.c.

{
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
} /* }}} */
SPL_METHOD ( AppendIterator  ,
__construct   
)

Definition at line 3181 of file spl_iterators.c.

Here is the call graph for this function:

SPL_METHOD ( AppendIterator  ,
append   
)

Definition at line 3188 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;
       zval *it;

       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());

       if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "O", &it, zend_ce_iterator) == FAILURE) {
              return;
       }
       spl_array_iterator_append(intern->u.append.zarrayit, it TSRMLS_CC);

       if (!intern->inner.iterator || spl_dual_it_valid(intern TSRMLS_CC) != SUCCESS) {
              if (intern->u.append.iterator->funcs->valid(intern->u.append.iterator TSRMLS_CC) != SUCCESS) {
                     intern->u.append.iterator->funcs->rewind(intern->u.append.iterator TSRMLS_CC);
              }
              do {
                     spl_append_it_next_iterator(intern TSRMLS_CC);
              } while (intern->inner.zobject != it);
              spl_append_it_fetch(intern TSRMLS_CC);
       }
} /* }}} */

Here is the call graph for this function:

SPL_METHOD ( AppendIterator  ,
rewind   
)

Definition at line 3213 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
       
       intern->u.append.iterator->funcs->rewind(intern->u.append.iterator TSRMLS_CC);
       if (spl_append_it_next_iterator(intern TSRMLS_CC) == SUCCESS) {
              spl_append_it_fetch(intern TSRMLS_CC);
       }
} /* }}} */

Here is the call graph for this function:

SPL_METHOD ( AppendIterator  ,
valid   
)

Definition at line 3231 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       
       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());

       RETURN_BOOL(intern->current.data);
} /* }}} */
SPL_METHOD ( AppendIterator  ,
next   
)

Definition at line 3246 of file spl_iterators.c.

Here is the call graph for this function:

SPL_METHOD ( AppendIterator  ,
getIteratorIndex   
)

Definition at line 3261 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());

       APPENDIT_CHECK_CTOR(intern);
       spl_array_iterator_key(intern->u.append.zarrayit, return_value TSRMLS_CC);
} /* }}} */

Here is the call graph for this function:

SPL_METHOD ( AppendIterator  ,
getArrayIterator   
)

Definition at line 3277 of file spl_iterators.c.

{
       spl_dual_it_object   *intern;
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());

       RETURN_ZVAL(intern->u.append.zarrayit, 1, 0);
} /* }}} */
static void spl_recursive_it_dtor ( zend_object_iterator *_iter  TSRMLS_DC) [static]

Definition at line 139 of file spl_iterators.c.

{
       spl_recursive_it_iterator *iter   = (spl_recursive_it_iterator*)_iter;
       spl_recursive_it_object   *object = (spl_recursive_it_object*)_iter->data;
       zend_object_iterator      *sub_iter;

       while (object->level > 0) {
              sub_iter = object->iterators[object->level].iterator;
              sub_iter->funcs->dtor(sub_iter TSRMLS_CC);
              zval_ptr_dtor(&object->iterators[object->level--].zobject);
       }
       object->iterators = erealloc(object->iterators, sizeof(spl_sub_iterator));
       object->level = 0;

       zval_ptr_dtor(&iter->zobject);
       efree(iter);
}
static void spl_recursive_it_get_current_data ( zend_object_iterator *  iter,
zval ***data  TSRMLS_DC 
) [static]

Definition at line 183 of file spl_iterators.c.

{
       spl_recursive_it_object   *object = (spl_recursive_it_object*)iter->data;
       zend_object_iterator      *sub_iter = object->iterators[object->level].iterator;
       
       sub_iter->funcs->get_current_data(sub_iter, data TSRMLS_CC);
}
static int spl_recursive_it_get_current_key ( zend_object_iterator *  iter,
char **  str_key,
uint str_key_len,
ulong *int_key  TSRMLS_DC 
) [static]

Definition at line 191 of file spl_iterators.c.

{
       spl_recursive_it_object   *object = (spl_recursive_it_object*)iter->data;
       zend_object_iterator      *sub_iter = object->iterators[object->level].iterator;

       if (sub_iter->funcs->get_current_key) {
              return sub_iter->funcs->get_current_key(sub_iter, str_key, str_key_len, int_key TSRMLS_CC);
       } else {
              *int_key = iter->index;
              return HASH_KEY_IS_LONG;
       }
}
static zend_object_iterator* spl_recursive_it_get_iterator ( zend_class_entry *  ce,
zval *  zobject,
int by_ref  TSRMLS_DC 
) [static]

Definition at line 410 of file spl_iterators.c.

{
       spl_recursive_it_iterator *iterator;
       spl_recursive_it_object   *object;

       if (by_ref) {
              zend_error(E_ERROR, "An iterator cannot be used with foreach by reference");
       }
       iterator = emalloc(sizeof(spl_recursive_it_iterator));
       object   = (spl_recursive_it_object*)zend_object_store_get_object(zobject TSRMLS_CC);
       if (object->iterators == NULL) {
              zend_error(E_ERROR, "The object to be iterated is in an invalid state: "
                            "the parent constructor has not been called");
       }

       Z_ADDREF_P(zobject);
       iterator->intern.data = (void*)object;
       iterator->intern.funcs = ce->iterator_funcs.funcs;
       iterator->zobject = zobject;
       return (zend_object_iterator*)iterator;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static union _zend_function* spl_recursive_it_get_method ( zval **  object_ptr,
char *  method,
int method_len  TSRMLS_DC 
) [static, write]

Definition at line 842 of file spl_iterators.c.

{
       union _zend_function    *function_handler;
       spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(*object_ptr TSRMLS_CC);
       long                     level = object->level;
       zval                    *zobj;

       if (!object->iterators) {
              php_error_docref(NULL TSRMLS_CC, E_ERROR, "The %s instance wasn't initialized properly", Z_OBJCE_PP(object_ptr)->name);
       }
       zobj = object->iterators[level].zobject;

       function_handler = std_object_handlers.get_method(object_ptr, method, method_len TSRMLS_CC);
       if (!function_handler) {
              if (zend_hash_find(&Z_OBJCE_P(zobj)->function_table, method, method_len+1, (void **) &function_handler) == FAILURE) {
                     if (Z_OBJ_HT_P(zobj)->get_method) {
                            *object_ptr = zobj;
                            function_handler = Z_OBJ_HT_P(*object_ptr)->get_method(object_ptr, method, method_len TSRMLS_CC);
                     }
              }
       }
       return function_handler;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void spl_recursive_it_it_construct ( INTERNAL_FUNCTION_PARAMETERS  ,
zend_class_entry *  ce_base,
zend_class_entry *  ce_inner,
recursive_it_it_type  rit_type 
) [static]

Definition at line 441 of file spl_iterators.c.

{
       zval                      *object = getThis();
       spl_recursive_it_object   *intern;
       zval                      *iterator;
       zend_class_entry          *ce_iterator;
       long                       mode, flags;
       int                        inc_refcount = 1;
       zend_error_handling        error_handling;

       zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling TSRMLS_CC);

       switch(rit_type) {
              case RIT_RecursiveTreeIterator: {

                     zval *caching_it, *caching_it_flags, *user_caching_it_flags = NULL;
                     mode = RIT_SELF_FIRST;
                     flags = RTIT_BYPASS_KEY;

                     if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "o|lzl", &iterator, &flags, &user_caching_it_flags, &mode) == SUCCESS) {
                            if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate TSRMLS_CC)) {
                                   zval *aggregate = iterator;
                                   zend_call_method_with_0_params(&aggregate, Z_OBJCE_P(aggregate), &Z_OBJCE_P(aggregate)->iterator_funcs.zf_new_iterator, "getiterator", &iterator);
                                   inc_refcount = 0;
                            }

                            MAKE_STD_ZVAL(caching_it_flags);
                            if (user_caching_it_flags) {
                                   ZVAL_ZVAL(caching_it_flags, user_caching_it_flags, 1, 0);
                            } else {
                                   ZVAL_LONG(caching_it_flags, CIT_CATCH_GET_CHILD);
                            }
                            spl_instantiate_arg_ex2(spl_ce_RecursiveCachingIterator, &caching_it, 1, iterator, caching_it_flags TSRMLS_CC);
                            zval_ptr_dtor(&caching_it_flags);
                            if (inc_refcount == 0 && iterator) {
                                   zval_ptr_dtor(&iterator);
                            }
                            iterator = caching_it;
                            inc_refcount = 0;
                     } else {
                            iterator = NULL;
                     }
                     break;
              }
              case RIT_RecursiveIteratorIterator:
              default: {
                     mode = RIT_LEAVES_ONLY;
                     flags = 0;

                     if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "o|ll", &iterator, &mode, &flags) == SUCCESS) {
                            if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate TSRMLS_CC)) {
                                   zval *aggregate = iterator;
                                   zend_call_method_with_0_params(&aggregate, Z_OBJCE_P(aggregate), &Z_OBJCE_P(aggregate)->iterator_funcs.zf_new_iterator, "getiterator", &iterator);
                                   inc_refcount = 0;
                            }
                     } else {
                            iterator = NULL;
                     }
                     break;
              }
       }
       if (!iterator || !instanceof_function(Z_OBJCE_P(iterator), spl_ce_RecursiveIterator TSRMLS_CC)) {
              if (iterator && !inc_refcount) {
                     zval_ptr_dtor(&iterator);
              }
              zend_throw_exception(spl_ce_InvalidArgumentException, "An instance of RecursiveIterator or IteratorAggregate creating it is required", 0 TSRMLS_CC);
              zend_restore_error_handling(&error_handling TSRMLS_CC);
              return;
       }

       intern = (spl_recursive_it_object*)zend_object_store_get_object(object TSRMLS_CC);
       intern->iterators = emalloc(sizeof(spl_sub_iterator));
       intern->level = 0;
       intern->mode = mode;
       intern->flags = flags;
       intern->max_depth = -1;
       intern->in_iteration = 0;
       intern->ce = Z_OBJCE_P(object);

       zend_hash_find(&intern->ce->function_table, "beginiteration", sizeof("beginiteration"), (void **) &intern->beginIteration);
       if (intern->beginIteration->common.scope == ce_base) {
              intern->beginIteration = NULL;
       }
       zend_hash_find(&intern->ce->function_table, "enditeration", sizeof("enditeration"), (void **) &intern->endIteration);
       if (intern->endIteration->common.scope == ce_base) {
              intern->endIteration = NULL;
       }
       zend_hash_find(&intern->ce->function_table, "callhaschildren", sizeof("callHasChildren"), (void **) &intern->callHasChildren);
       if (intern->callHasChildren->common.scope == ce_base) {
              intern->callHasChildren = NULL;
       }
       zend_hash_find(&intern->ce->function_table, "callgetchildren", sizeof("callGetChildren"), (void **) &intern->callGetChildren);
       if (intern->callGetChildren->common.scope == ce_base) {
              intern->callGetChildren = NULL;
       }
       zend_hash_find(&intern->ce->function_table, "beginchildren", sizeof("beginchildren"), (void **) &intern->beginChildren);
       if (intern->beginChildren->common.scope == ce_base) {
              intern->beginChildren = NULL;
       }
       zend_hash_find(&intern->ce->function_table, "endchildren", sizeof("endchildren"), (void **) &intern->endChildren);
       if (intern->endChildren->common.scope == ce_base) {
              intern->endChildren = NULL;
       }
       zend_hash_find(&intern->ce->function_table, "nextelement", sizeof("nextElement"), (void **) &intern->nextElement);
       if (intern->nextElement->common.scope == ce_base) {
              intern->nextElement = NULL;
       }
       ce_iterator = Z_OBJCE_P(iterator); /* respect inheritance, don't use spl_ce_RecursiveIterator */
       intern->iterators[0].iterator = ce_iterator->get_iterator(ce_iterator, iterator, 0 TSRMLS_CC);
       if (inc_refcount) {
              Z_ADDREF_P(iterator);
       }
       intern->iterators[0].zobject = iterator;
       intern->iterators[0].ce = ce_iterator;
       intern->iterators[0].state = RS_START;

       zend_restore_error_handling(&error_handling TSRMLS_CC);

       if (EG(exception)) {
              zend_object_iterator *sub_iter;

              while (intern->level >= 0) {
                     sub_iter = intern->iterators[intern->level].iterator;
                     sub_iter->funcs->dtor(sub_iter TSRMLS_CC);
                     zval_ptr_dtor(&intern->iterators[intern->level--].zobject);
              }
              efree(intern->iterators);
              intern->iterators = NULL;
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void spl_recursive_it_move_forward ( zend_object_iterator *iter  TSRMLS_DC) [static]

Definition at line 400 of file spl_iterators.c.

Here is the call graph for this function:

static void spl_recursive_it_move_forward_ex ( spl_recursive_it_object object,
zval *zthis  TSRMLS_DC 
) [static]

Definition at line 204 of file spl_iterators.c.

{
       zend_object_iterator      *iterator;
       zval                      *zobject;
       zend_class_entry          *ce;
       zval                      *retval, *child;
       zend_object_iterator      *sub_iter;
       int                       has_children;

       while (!EG(exception)) {
next_step:
              iterator = object->iterators[object->level].iterator;
              switch (object->iterators[object->level].state) {
                     case RS_NEXT:
                            iterator->funcs->move_forward(iterator TSRMLS_CC);
                            if (EG(exception)) {
                                   if (!(object->flags & RIT_CATCH_GET_CHILD)) {
                                          return;
                                   } else {
                                          zend_clear_exception(TSRMLS_C);
                                   }
                            }
                     case RS_START:
                            if (iterator->funcs->valid(iterator TSRMLS_CC) == FAILURE) {
                                   break;
                            }
                            object->iterators[object->level].state = RS_TEST;                                   
                            /* break; */
                     case RS_TEST:
                            ce = object->iterators[object->level].ce;
                            zobject = object->iterators[object->level].zobject;
                            if (object->callHasChildren) {
                                   zend_call_method_with_0_params(&zthis, object->ce, &object->callHasChildren, "callHasChildren", &retval);
                            } else {
                                   zend_call_method_with_0_params(&zobject, ce, NULL, "haschildren", &retval);
                            }
                            if (EG(exception)) {
                                   if (!(object->flags & RIT_CATCH_GET_CHILD)) {
                                          object->iterators[object->level].state = RS_NEXT;
                                          return;
                                   } else {
                                          zend_clear_exception(TSRMLS_C);
                                   }
                            }
                            if (retval) {
                                   has_children = zend_is_true(retval);
                                   zval_ptr_dtor(&retval);
                                   if (has_children) {
                                          if (object->max_depth == -1 || object->max_depth > object->level) {
                                                 switch (object->mode) {
                                                 case RIT_LEAVES_ONLY:
                                                 case RIT_CHILD_FIRST:
                                                        object->iterators[object->level].state = RS_CHILD;
                                                        goto next_step;
                                                 case RIT_SELF_FIRST:
                                                        object->iterators[object->level].state = RS_SELF;
                                                        goto next_step;
                                                 }
                                          } else {
                                                 /* do not recurse into */
                                                 if (object->mode == RIT_LEAVES_ONLY) {
                                                        /* this is not a leave, so skip it */
                                                        object->iterators[object->level].state = RS_NEXT;
                                                        goto next_step;
                                                 }
                                          }
                                   }
                            }
                            if (object->nextElement) {
                                   zend_call_method_with_0_params(&zthis, object->ce, &object->nextElement, "nextelement", NULL);
                            }
                            object->iterators[object->level].state = RS_NEXT;
                            if (EG(exception)) {
                                   if (!(object->flags & RIT_CATCH_GET_CHILD)) {
                                          return;
                                   } else {
                                          zend_clear_exception(TSRMLS_C);
                                   }
                            }
                            return /* self */;
                     case RS_SELF:
                            if (object->nextElement && (object->mode == RIT_SELF_FIRST || object->mode == RIT_CHILD_FIRST)) {
                                   zend_call_method_with_0_params(&zthis, object->ce, &object->nextElement, "nextelement", NULL);
                            }
                            if (object->mode == RIT_SELF_FIRST) {
                                   object->iterators[object->level].state = RS_CHILD;
                            } else {
                                   object->iterators[object->level].state = RS_NEXT;
                            }
                            return /* self */;
                     case RS_CHILD:
                            ce = object->iterators[object->level].ce;
                            zobject = object->iterators[object->level].zobject;
                            if (object->callGetChildren) {
                                   zend_call_method_with_0_params(&zthis, object->ce, &object->callGetChildren, "callGetChildren", &child);
                            } else {
                                   zend_call_method_with_0_params(&zobject, ce, NULL, "getchildren", &child);
                            }

                            if (EG(exception)) {
                                   if (!(object->flags & RIT_CATCH_GET_CHILD)) {
                                          return;
                                   } else {
                                          zend_clear_exception(TSRMLS_C);
                                          if (child) {
                                                 zval_ptr_dtor(&child);
                                          }
                                          object->iterators[object->level].state = RS_NEXT;
                                          goto next_step;
                                   }
                            }

                            ce = child && Z_TYPE_P(child) == IS_OBJECT ? Z_OBJCE_P(child) : NULL;
                            if (!ce || !instanceof_function(ce, spl_ce_RecursiveIterator TSRMLS_CC)) {
                                   if (child) {
                                          zval_ptr_dtor(&child);
                                   }
                                   zend_throw_exception(spl_ce_UnexpectedValueException, "Objects returned by RecursiveIterator::getChildren() must implement RecursiveIterator", 0 TSRMLS_CC);
                                   return;
                            }
                            if (object->mode == RIT_CHILD_FIRST) {
                                   object->iterators[object->level].state = RS_SELF;
                            } else {
                                   object->iterators[object->level].state = RS_NEXT;
                            }
                            object->iterators = erealloc(object->iterators, sizeof(spl_sub_iterator) * (++object->level+1));
                            sub_iter = ce->get_iterator(ce, child, 0 TSRMLS_CC);
                            object->iterators[object->level].iterator = sub_iter;
                            object->iterators[object->level].zobject = child;
                            object->iterators[object->level].ce = ce;
                            object->iterators[object->level].state = RS_START;
                            if (sub_iter->funcs->rewind) {
                                   sub_iter->funcs->rewind(sub_iter TSRMLS_CC);
                            }
                            if (object->beginChildren) {
                                   zend_call_method_with_0_params(&zthis, object->ce, &object->beginChildren, "beginchildren", NULL);
                                   if (EG(exception)) {
                                          if (!(object->flags & RIT_CATCH_GET_CHILD)) {
                                                 return;
                                          } else {
                                                 zend_clear_exception(TSRMLS_C);
                                          }
                                   }
                            }
                            goto next_step;
              }
              /* no more elements */
              if (object->level > 0) {
                     if (object->endChildren) {
                            zend_call_method_with_0_params(&zthis, object->ce, &object->endChildren, "endchildren", NULL);
                            if (EG(exception)) {
                                   if (!(object->flags & RIT_CATCH_GET_CHILD)) {
                                          return;
                                   } else {
                                          zend_clear_exception(TSRMLS_C);
                                   }
                            }
                     }
                     iterator->funcs->dtor(iterator TSRMLS_CC);
                     zval_ptr_dtor(&object->iterators[object->level].zobject);
                     object->level--;
              } else {
                     return; /* done completeley */
              }
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void spl_recursive_it_rewind ( zend_object_iterator *iter  TSRMLS_DC) [static]

Definition at line 405 of file spl_iterators.c.

Here is the call graph for this function:

static void spl_recursive_it_rewind_ex ( spl_recursive_it_object object,
zval *zthis  TSRMLS_DC 
) [static]

Definition at line 371 of file spl_iterators.c.

{
       zend_object_iterator      *sub_iter;
       
       if (!object->iterators) {
              php_error_docref(NULL TSRMLS_CC, E_ERROR, "The %s instance wasn't initialized properly", Z_OBJCE_P(zthis)->name);
       }

       while (object->level) {
              sub_iter = object->iterators[object->level].iterator;
              sub_iter->funcs->dtor(sub_iter TSRMLS_CC);
              zval_ptr_dtor(&object->iterators[object->level--].zobject);
              if (!EG(exception) && (!object->endChildren || object->endChildren->common.scope != spl_ce_RecursiveIteratorIterator)) {
                     zend_call_method_with_0_params(&zthis, object->ce, &object->endChildren, "endchildren", NULL);
              }
       }
       object->iterators = erealloc(object->iterators, sizeof(spl_sub_iterator));
       object->iterators[0].state = RS_START;
       sub_iter = object->iterators[0].iterator;
       if (sub_iter->funcs->rewind) {
              sub_iter->funcs->rewind(sub_iter TSRMLS_CC);
       }
       if (!EG(exception) && object->beginIteration && !object->in_iteration) {
              zend_call_method_with_0_params(&zthis, object->ce, &object->beginIteration, "beginIteration", NULL);
       }
       object->in_iteration = 1;
       spl_recursive_it_move_forward_ex(object, zthis TSRMLS_CC);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int spl_recursive_it_valid ( zend_object_iterator *iter  TSRMLS_DC) [static]

Definition at line 176 of file spl_iterators.c.

Here is the call graph for this function:

static int spl_recursive_it_valid_ex ( spl_recursive_it_object object,
zval *zthis  TSRMLS_DC 
) [static]

Definition at line 157 of file spl_iterators.c.

{
       zend_object_iterator      *sub_iter;
       int                       level = object->level;
       
       while (level >=0) {
              sub_iter = object->iterators[level].iterator;
              if (sub_iter->funcs->valid(sub_iter TSRMLS_CC) == SUCCESS) {
                     return SUCCESS;
              }
              level--;
       }
       if (object->endIteration && object->in_iteration) {
              zend_call_method_with_0_params(&zthis, object->ce, &object->endIteration, "endIteration", NULL);
       }
       object->in_iteration = 0;
       return FAILURE;
}

Here is the caller graph for this function:

static void spl_recursive_tree_iterator_get_entry ( spl_recursive_it_object object,
zval *return_value  TSRMLS_DC 
) [static]

Definition at line 1017 of file spl_iterators.c.

{
       zend_object_iterator      *iterator = object->iterators[object->level].iterator;
       zval                     **data;
       zend_error_handling        error_handling;

       iterator->funcs->get_current_data(iterator, &data TSRMLS_CC);

       zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling TSRMLS_CC);
       if (data && *data) {
              RETVAL_ZVAL(*data, 1, 0);
       }
       if (Z_TYPE_P(return_value) == IS_ARRAY) {
              zval_dtor(return_value);
              ZVAL_STRINGL(return_value, "Array", sizeof("Array")-1, 1);
       } else {
              convert_to_string(return_value);
       }
       zend_restore_error_handling(&error_handling TSRMLS_CC);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void spl_recursive_tree_iterator_get_postfix ( spl_recursive_it_object object,
zval *return_value  TSRMLS_DC 
) [static]

Definition at line 1038 of file spl_iterators.c.

{
       RETVAL_STRINGL("", 0, 1);
}

Here is the caller graph for this function:

static void spl_recursive_tree_iterator_get_prefix ( spl_recursive_it_object object,
zval *return_value  TSRMLS_DC 
) [static]

Definition at line 982 of file spl_iterators.c.

{
       smart_str  str = {0};
       zval      *has_next;
       int        level;

       smart_str_appendl(&str, object->prefix[0].c, object->prefix[0].len);
       
       for (level = 0; level < object->level; ++level) {
              zend_call_method_with_0_params(&object->iterators[level].zobject, object->iterators[level].ce, NULL, "hasnext", &has_next);
              if (has_next) {
                     if (Z_LVAL_P(has_next)) {
                            smart_str_appendl(&str, object->prefix[1].c, object->prefix[1].len);
                     } else {
                            smart_str_appendl(&str, object->prefix[2].c, object->prefix[2].len);
                     }
                     zval_ptr_dtor(&has_next);
              }
       }
       zend_call_method_with_0_params(&object->iterators[level].zobject, object->iterators[level].ce, NULL, "hasnext", &has_next);
       if (has_next) {
              if (Z_LVAL_P(has_next)) {
                     smart_str_appendl(&str, object->prefix[3].c, object->prefix[3].len);
              } else {
                     smart_str_appendl(&str, object->prefix[4].c, object->prefix[4].len);
              }
              zval_ptr_dtor(&has_next);
       }

       smart_str_appendl(&str, object->prefix[5].c, object->prefix[5].len);
       smart_str_0(&str);

       RETVAL_STRINGL(str.c, str.len, 0);
}

Here is the caller graph for this function:

static void spl_RecursiveIteratorIterator_dtor ( zend_object _object,
zend_object_handle handle  TSRMLS_DC 
) [static]

Definition at line 867 of file spl_iterators.c.

{
       spl_recursive_it_object   *object = (spl_recursive_it_object *)_object;
       zend_object_iterator      *sub_iter;

       /* call standard dtor */
       zend_objects_destroy_object(_object, handle TSRMLS_CC);

       if (object->iterators) {
              while (object->level >= 0) {
                     sub_iter = object->iterators[object->level].iterator;
                     sub_iter->funcs->dtor(sub_iter TSRMLS_CC);
                     zval_ptr_dtor(&object->iterators[object->level--].zobject);
              }
              efree(object->iterators);
              object->iterators = NULL;
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void spl_RecursiveIteratorIterator_free_storage ( void *_object  TSRMLS_DC) [static]

Definition at line 888 of file spl_iterators.c.

{
       spl_recursive_it_object   *object = (spl_recursive_it_object *)_object;

       zend_object_std_dtor(&object->std TSRMLS_CC);
       smart_str_free(&object->prefix[0]);
       smart_str_free(&object->prefix[1]);
       smart_str_free(&object->prefix[2]);
       smart_str_free(&object->prefix[3]);
       smart_str_free(&object->prefix[4]);
       smart_str_free(&object->prefix[5]);

       efree(object);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static zend_object_value spl_RecursiveIteratorIterator_new ( zend_class_entry *class_type  TSRMLS_DC) [static]

Definition at line 933 of file spl_iterators.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static zend_object_value spl_RecursiveIteratorIterator_new_ex ( zend_class_entry *  class_type,
int init_prefix  TSRMLS_DC 
) [static]

Definition at line 905 of file spl_iterators.c.

{
       zend_object_value retval;
       spl_recursive_it_object *intern;
       zval *tmp;

       intern = emalloc(sizeof(spl_recursive_it_object));
       memset(intern, 0, sizeof(spl_recursive_it_object));

       if (init_prefix) {
              smart_str_appendl(&intern->prefix[0], "",    0);
              smart_str_appendl(&intern->prefix[1], "| ",  2);
              smart_str_appendl(&intern->prefix[2], "  ",  2);
              smart_str_appendl(&intern->prefix[3], "|-",  2);
              smart_str_appendl(&intern->prefix[4], "\\-", 2);
              smart_str_appendl(&intern->prefix[5], "",    0);
       }

       zend_object_std_init(&intern->std, class_type TSRMLS_CC);
       zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));

       retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)spl_RecursiveIteratorIterator_dtor, (zend_objects_free_object_storage_t) spl_RecursiveIteratorIterator_free_storage, NULL TSRMLS_CC);
       retval.handlers = &spl_handlers_rec_it_it;
       return retval;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static zend_object_value spl_RecursiveTreeIterator_new ( zend_class_entry *class_type  TSRMLS_DC) [static]

Definition at line 940 of file spl_iterators.c.

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

PHPAPI zend_class_entry* spl_ce_AppendIterator

Definition at line 58 of file spl_iterators.c.

PHPAPI zend_class_entry* spl_ce_CachingIterator

Definition at line 51 of file spl_iterators.c.

PHPAPI zend_class_entry* spl_ce_Countable

Definition at line 61 of file spl_iterators.c.

PHPAPI zend_class_entry* spl_ce_EmptyIterator

Definition at line 57 of file spl_iterators.c.

PHPAPI zend_class_entry* spl_ce_FilterIterator

Definition at line 46 of file spl_iterators.c.

PHPAPI zend_class_entry* spl_ce_InfiniteIterator

Definition at line 56 of file spl_iterators.c.

PHPAPI zend_class_entry* spl_ce_IteratorIterator

Definition at line 54 of file spl_iterators.c.

PHPAPI zend_class_entry* spl_ce_LimitIterator

Definition at line 50 of file spl_iterators.c.

PHPAPI zend_class_entry* spl_ce_NoRewindIterator

Definition at line 55 of file spl_iterators.c.

PHPAPI zend_class_entry* spl_ce_OuterIterator

Definition at line 53 of file spl_iterators.c.

PHPAPI zend_class_entry* spl_ce_ParentIterator

Definition at line 48 of file spl_iterators.c.

Definition at line 52 of file spl_iterators.c.

Definition at line 47 of file spl_iterators.c.

PHPAPI zend_class_entry* spl_ce_RecursiveIterator

Definition at line 44 of file spl_iterators.c.

Definition at line 45 of file spl_iterators.c.

Definition at line 60 of file spl_iterators.c.

Definition at line 62 of file spl_iterators.c.

PHPAPI zend_class_entry* spl_ce_RegexIterator

Definition at line 59 of file spl_iterators.c.

PHPAPI zend_class_entry* spl_ce_SeekableIterator

Definition at line 49 of file spl_iterators.c.

Initial value:

Definition at line 3294 of file spl_iterators.c.

Initial value:

Definition at line 2832 of file spl_iterators.c.

Initial value:

Definition at line 3500 of file spl_iterators.c.

Initial value:

Definition at line 3121 of file spl_iterators.c.

Initial value:

Definition at line 2193 of file spl_iterators.c.

Initial value:

Definition at line 3067 of file spl_iterators.c.

Initial value:

Definition at line 2917 of file spl_iterators.c.

Initial value:

Definition at line 2409 of file spl_iterators.c.

Initial value:

Definition at line 3026 of file spl_iterators.c.

Initial value:

Definition at line 3495 of file spl_iterators.c.

Initial value:

Definition at line 2216 of file spl_iterators.c.

Initial value:

Definition at line 2899 of file spl_iterators.c.

Initial value:

Definition at line 2209 of file spl_iterators.c.

Initial value:

Definition at line 67 of file spl_iterators.c.

Initial value:

Definition at line 960 of file spl_iterators.c.

Initial value:

Definition at line 1239 of file spl_iterators.c.

Initial value:

Definition at line 2394 of file spl_iterators.c.

zend_object_handlers spl_handlers_dual_it [static]

Definition at line 126 of file spl_iterators.c.

zend_object_handlers spl_handlers_rec_it_it [static]

Definition at line 125 of file spl_iterators.c.