Annotation of embedaddon/php/ext/spl/spl_iterators.h, revision 1.1.1.1
1.1 misho 1: /*
2: +----------------------------------------------------------------------+
3: | PHP Version 5 |
4: +----------------------------------------------------------------------+
5: | Copyright (c) 1997-2012 The PHP Group |
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:
19: /* $Id: spl_iterators.h 321634 2012-01-01 13:15:04Z felipe $ */
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;
55:
56: PHP_MINIT_FUNCTION(spl_iterators);
57:
58: PHP_FUNCTION(iterator_to_array);
59: PHP_FUNCTION(iterator_count);
60: PHP_FUNCTION(iterator_apply);
61:
62: typedef enum {
63: DIT_Default = 0,
64: DIT_FilterIterator = DIT_Default,
65: DIT_RecursiveFilterIterator = DIT_Default,
66: DIT_ParentIterator = DIT_Default,
67: DIT_LimitIterator,
68: DIT_CachingIterator,
69: DIT_RecursiveCachingIterator,
70: DIT_IteratorIterator,
71: DIT_NoRewindIterator,
72: DIT_InfiniteIterator,
73: DIT_AppendIterator,
74: #if HAVE_PCRE || HAVE_BUNDLED_PCRE
75: DIT_RegexIterator,
76: DIT_RecursiveRegexIterator,
77: #endif
78: DIT_Unknown = ~0
79: } dual_it_type;
80:
81: typedef enum {
82: RIT_Default = 0,
83: RIT_RecursiveIteratorIterator = RIT_Default,
84: RIT_RecursiveTreeIterator,
85: RIT_Unknow = ~0
86: } recursive_it_it_type;
87:
88: enum {
89: /* public */
90: CIT_CALL_TOSTRING = 0x00000001,
91: CIT_TOSTRING_USE_KEY = 0x00000002,
92: CIT_TOSTRING_USE_CURRENT = 0x00000004,
93: CIT_TOSTRING_USE_INNER = 0x00000008,
94: CIT_CATCH_GET_CHILD = 0x00000010,
95: CIT_FULL_CACHE = 0x00000100,
96: CIT_PUBLIC = 0x0000FFFF,
97: /* private */
98: CIT_VALID = 0x00010000,
99: CIT_HAS_CHILDREN = 0x00020000
100: };
101:
102: enum {
103: /* public */
104: REGIT_USE_KEY = 0x00000001,
105: REGIT_INVERTED = 0x00000002
106: };
107:
108: typedef enum {
109: REGIT_MODE_MATCH,
110: REGIT_MODE_GET_MATCH,
111: REGIT_MODE_ALL_MATCHES,
112: REGIT_MODE_SPLIT,
113: REGIT_MODE_REPLACE,
114: REGIT_MODE_MAX
115: } regex_mode;
116:
117: typedef struct _spl_dual_it_object {
118: zend_object std;
119: struct {
120: zval *zobject;
121: zend_class_entry *ce;
122: zend_object *object;
123: zend_object_iterator *iterator;
124: } inner;
125: struct {
126: zval *data;
127: char *str_key;
128: uint str_key_len;
129: ulong int_key;
130: int key_type; /* HASH_KEY_IS_STRING or HASH_KEY_IS_LONG */
131: int pos;
132: } current;
133: dual_it_type dit_type;
134: union {
135: struct {
136: long offset;
137: long count;
138: } limit;
139: struct {
140: long flags; /* CIT_* */
141: zval *zstr;
142: zval *zchildren;
143: zval *zcache;
144: } caching;
145: struct {
146: zval *zarrayit;
147: zend_object_iterator *iterator;
148: } append;
149: #if HAVE_PCRE || HAVE_BUNDLED_PCRE
150: struct {
151: int use_flags;
152: long flags;
153: regex_mode mode;
154: long preg_flags;
155: pcre_cache_entry *pce;
156: char *regex;
157: } regex;
158: #endif
159: } u;
160: } spl_dual_it_object;
161:
162: typedef int (*spl_iterator_apply_func_t)(zend_object_iterator *iter, void *puser TSRMLS_DC);
163:
164: PHPAPI int spl_iterator_apply(zval *obj, spl_iterator_apply_func_t apply_func, void *puser TSRMLS_DC);
165:
166: #endif /* SPL_ITERATORS_H */
167:
168: /*
169: * Local Variables:
170: * c-basic-offset: 4
171: * tab-width: 4
172: * End:
173: * vim600: fdm=marker
174: * vim: noet sw=4 ts=4
175: */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>