php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
zend_iterators.h
Go to the documentation of this file.
1/*
2 +----------------------------------------------------------------------+
3 | Zend Engine |
4 +----------------------------------------------------------------------+
5 | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 2.00 of the Zend license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.zend.com/license/2_00.txt. |
11 | If you did not receive a copy of the Zend license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@zend.com so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
15 | Author: Wez Furlong <wez@thebrainroom.com> |
16 | Marcus Boerger <helly@php.net> |
17 +----------------------------------------------------------------------+
18*/
19
20#ifndef ZEND_ITERATORS_H
21#define ZEND_ITERATORS_H
22
23#include "zend_types.h"
24
25/* These iterators were designed to operate within the foreach()
26 * structures provided by the engine, but could be extended for use
27 * with other iterative engine opcodes.
28 * These methods have similar semantics to the zend_hash API functions
29 * with similar names.
30 * */
31
33
35 /* release all resources associated with this iterator instance */
37
38 /* check for end of iteration (FAILURE or SUCCESS if data is valid) */
40
41 /* fetch the item data for the current element */
42 zval *(*get_current_data)(zend_object_iterator *iter);
43
44 /* fetch the key for the current element (optional, may be NULL). The key
45 * should be written into the provided zval* using the ZVAL_* macros. If
46 * this handler is not provided auto-incrementing integer keys will be
47 * used. */
49
50 /* step forwards to next element */
52
53 /* rewind to start of data (optional, may be NULL) */
55
56 /* invalidate current value/key (optional, may be NULL) */
58
59 /* Expose owned values to GC.
60 * This has the same semantics as the corresponding object handler. */
61 HashTable *(*get_gc)(zend_object_iterator *iter, zval **table, int *n);
63
68 zend_ulong index; /* private to fe_reset/fe_fetch opcodes */
69};
70
79
86
88/* given a zval, returns stuff that can be used to iterate it. */
90
91/* given an iterator, wrap it up as a zval for use by the engine opcodes */
94
97
98#endif /* ZEND_ITERATORS_H */
zend_long n
Definition ffi.c:4979
unsigned char key[REFLECTION_KEY_LEN]
zend_function * zf_new_iterator
void(* get_current_key)(zend_object_iterator *iter, zval *key)
void(* invalidate_current)(zend_object_iterator *iter)
void(* rewind)(zend_object_iterator *iter)
void(* move_forward)(zend_object_iterator *iter)
void(* dtor)(zend_object_iterator *iter)
zend_result(* valid)(zend_object_iterator *iter)
const zend_object_iterator_funcs * funcs
struct _zval_struct zval
#define ZEND_API
ZEND_API void(ZEND_FASTCALL *zend_touch_vm_stack_data)(void *vm_stack_data)
union _zend_function zend_function
ZEND_API void zend_register_iterator_wrapper(void)
ZEND_API zend_object_iterator * zend_iterator_unwrap(zval *array_ptr)
ZEND_API void zend_iterator_init(zend_object_iterator *iter)
ZEND_API void zend_iterator_dtor(zend_object_iterator *iter)
struct _zend_class_arrayaccess_funcs zend_class_arrayaccess_funcs
struct _zend_class_iterator_funcs zend_class_iterator_funcs
struct _zend_object_iterator zend_object_iterator
struct _zend_object_iterator_funcs zend_object_iterator_funcs
uint32_t zend_ulong
Definition zend_long.h:43
#define END_EXTERN_C()
#define BEGIN_EXTERN_C()
struct _zend_object zend_object
struct _zend_array HashTable
Definition zend_types.h:386
ZEND_RESULT_CODE zend_result
Definition zend_types.h:64