Annotation of embedaddon/php/ext/spl/spl_iterators.h, revision 1.1.1.4
1.1 misho 1: /*
2: +----------------------------------------------------------------------+
3: | PHP Version 5 |
4: +----------------------------------------------------------------------+
1.1.1.4 ! misho 5: | Copyright (c) 1997-2014 The PHP Group |
1.1 misho 6: +----------------------------------------------------------------------+
7: | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
11: | If you did not receive a copy of the PHP license and are unable to |
12: | obtain it through the world-wide-web, please send a note to |
13: | license@php.net so we can mail you a copy immediately. |
14: +----------------------------------------------------------------------+
15: | Authors: Marcus Boerger <helly@php.net> |
16: +----------------------------------------------------------------------+
17: */
18:
1.1.1.2 misho 19: /* $Id$ */
1.1 misho 20:
21: #ifndef SPL_ITERATORS_H
22: #define SPL_ITERATORS_H
23:
24: #include "php.h"
25: #include "php_spl.h"
26: #if HAVE_PCRE || HAVE_BUNDLED_PCRE
27: #include "ext/pcre/php_pcre.h"
28: #endif
29:
30: #define spl_ce_Traversable zend_ce_traversable
31: #define spl_ce_Iterator zend_ce_iterator
32: #define spl_ce_Aggregate zend_ce_aggregate
33: #define spl_ce_ArrayAccess zend_ce_arrayaccess
34: #define spl_ce_Serializable zend_ce_serializable
35:
36: extern PHPAPI zend_class_entry *spl_ce_RecursiveIterator;
37: extern PHPAPI zend_class_entry *spl_ce_RecursiveIteratorIterator;
38: extern PHPAPI zend_class_entry *spl_ce_RecursiveTreeIterator;
39: extern PHPAPI zend_class_entry *spl_ce_FilterIterator;
40: extern PHPAPI zend_class_entry *spl_ce_RecursiveFilterIterator;
41: extern PHPAPI zend_class_entry *spl_ce_ParentIterator;
42: extern PHPAPI zend_class_entry *spl_ce_SeekableIterator;
43: extern PHPAPI zend_class_entry *spl_ce_LimitIterator;
44: extern PHPAPI zend_class_entry *spl_ce_CachingIterator;
45: extern PHPAPI zend_class_entry *spl_ce_RecursiveCachingIterator;
46: extern PHPAPI zend_class_entry *spl_ce_OuterIterator;
47: extern PHPAPI zend_class_entry *spl_ce_IteratorIterator;
48: extern PHPAPI zend_class_entry *spl_ce_NoRewindIterator;
49: extern PHPAPI zend_class_entry *spl_ce_InfiniteIterator;
50: extern PHPAPI zend_class_entry *spl_ce_EmptyIterator;
51: extern PHPAPI zend_class_entry *spl_ce_AppendIterator;
52: extern PHPAPI zend_class_entry *spl_ce_RegexIterator;
53: extern PHPAPI zend_class_entry *spl_ce_RecursiveRegexIterator;
54: extern PHPAPI zend_class_entry *spl_ce_Countable;
1.1.1.2 misho 55: extern PHPAPI zend_class_entry *spl_ce_CallbackFilterIterator;
56: extern PHPAPI zend_class_entry *spl_ce_RecursiveCallbackFilterIterator;
1.1 misho 57:
58: PHP_MINIT_FUNCTION(spl_iterators);
59:
60: PHP_FUNCTION(iterator_to_array);
61: PHP_FUNCTION(iterator_count);
62: PHP_FUNCTION(iterator_apply);
63:
64: typedef enum {
65: DIT_Default = 0,
66: DIT_FilterIterator = DIT_Default,
67: DIT_RecursiveFilterIterator = DIT_Default,
68: DIT_ParentIterator = DIT_Default,
69: DIT_LimitIterator,
70: DIT_CachingIterator,
71: DIT_RecursiveCachingIterator,
72: DIT_IteratorIterator,
73: DIT_NoRewindIterator,
74: DIT_InfiniteIterator,
75: DIT_AppendIterator,
76: #if HAVE_PCRE || HAVE_BUNDLED_PCRE
77: DIT_RegexIterator,
78: DIT_RecursiveRegexIterator,
79: #endif
1.1.1.2 misho 80: DIT_CallbackFilterIterator,
81: DIT_RecursiveCallbackFilterIterator,
1.1 misho 82: DIT_Unknown = ~0
83: } dual_it_type;
84:
85: typedef enum {
86: RIT_Default = 0,
87: RIT_RecursiveIteratorIterator = RIT_Default,
88: RIT_RecursiveTreeIterator,
89: RIT_Unknow = ~0
90: } recursive_it_it_type;
91:
92: enum {
93: /* public */
94: CIT_CALL_TOSTRING = 0x00000001,
95: CIT_TOSTRING_USE_KEY = 0x00000002,
96: CIT_TOSTRING_USE_CURRENT = 0x00000004,
97: CIT_TOSTRING_USE_INNER = 0x00000008,
98: CIT_CATCH_GET_CHILD = 0x00000010,
99: CIT_FULL_CACHE = 0x00000100,
100: CIT_PUBLIC = 0x0000FFFF,
101: /* private */
102: CIT_VALID = 0x00010000,
103: CIT_HAS_CHILDREN = 0x00020000
104: };
105:
106: enum {
107: /* public */
108: REGIT_USE_KEY = 0x00000001,
109: REGIT_INVERTED = 0x00000002
110: };
111:
112: typedef enum {
113: REGIT_MODE_MATCH,
114: REGIT_MODE_GET_MATCH,
115: REGIT_MODE_ALL_MATCHES,
116: REGIT_MODE_SPLIT,
117: REGIT_MODE_REPLACE,
118: REGIT_MODE_MAX
119: } regex_mode;
120:
1.1.1.2 misho 121: typedef struct _spl_cbfilter_it_intern {
122: zend_fcall_info fci;
123: zend_fcall_info_cache fcc;
124: } _spl_cbfilter_it_intern;
125:
1.1 misho 126: typedef struct _spl_dual_it_object {
127: zend_object std;
128: struct {
129: zval *zobject;
130: zend_class_entry *ce;
131: zend_object *object;
132: zend_object_iterator *iterator;
133: } inner;
134: struct {
135: zval *data;
136: char *str_key;
137: uint str_key_len;
138: ulong int_key;
139: int key_type; /* HASH_KEY_IS_STRING or HASH_KEY_IS_LONG */
140: int pos;
141: } current;
142: dual_it_type dit_type;
143: union {
144: struct {
145: long offset;
146: long count;
147: } limit;
148: struct {
149: long flags; /* CIT_* */
150: zval *zstr;
151: zval *zchildren;
152: zval *zcache;
153: } caching;
154: struct {
155: zval *zarrayit;
156: zend_object_iterator *iterator;
157: } append;
158: #if HAVE_PCRE || HAVE_BUNDLED_PCRE
159: struct {
160: int use_flags;
161: long flags;
162: regex_mode mode;
163: long preg_flags;
164: pcre_cache_entry *pce;
165: char *regex;
1.1.1.2 misho 166: uint regex_len;
1.1 misho 167: } regex;
168: #endif
1.1.1.2 misho 169: _spl_cbfilter_it_intern *cbfilter;
1.1 misho 170: } u;
171: } spl_dual_it_object;
172:
173: typedef int (*spl_iterator_apply_func_t)(zend_object_iterator *iter, void *puser TSRMLS_DC);
174:
175: PHPAPI int spl_iterator_apply(zval *obj, spl_iterator_apply_func_t apply_func, void *puser TSRMLS_DC);
176:
177: #endif /* SPL_ITERATORS_H */
178:
179: /*
180: * Local Variables:
181: * c-basic-offset: 4
182: * tab-width: 4
183: * End:
184: * vim600: fdm=marker
185: * vim: noet sw=4 ts=4
186: */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>