1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 #ifndef INTL_COMMON_ENUM_H
19 #define INTL_COMMON_ENUM_H
20
21 #include <unicode/umachine.h>
22 #ifdef __cplusplus
23 #include <unicode/strenum.h>
24 extern "C" {
25 #include <math.h>
26 #endif
27 #include <php.h>
28 #include "../intl_error.h"
29 #include "../intl_data.h"
30 #ifdef __cplusplus
31 }
32 #endif
33
34 #define INTLITERATOR_ERROR(ii) (ii)->err
35 #define INTLITERATOR_ERROR_P(ii) &(INTLITERATOR_ERROR(ii))
36
37 #define INTLITERATOR_ERROR_CODE(ii) INTL_ERROR_CODE(INTLITERATOR_ERROR(ii))
38 #define INTLITERATOR_ERROR_CODE_P(ii) &(INTL_ERROR_CODE(INTLITERATOR_ERROR(ii)))
39
40 #define INTLITERATOR_METHOD_INIT_VARS INTL_METHOD_INIT_VARS(IntlIterator, ii)
41 #define INTLITERATOR_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(IntlIterator, ii)
42 #define INTLITERATOR_METHOD_FETCH_OBJECT\
43 object = getThis(); \
44 INTLITERATOR_METHOD_FETCH_OBJECT_NO_CHECK; \
45 if (ii->iterator == NULL) { \
46 intl_errors_set(&ii->err, U_ILLEGAL_ARGUMENT_ERROR, "Found unconstructed IntlIterator", 0 TSRMLS_CC); \
47 RETURN_FALSE; \
48 }
49
50 typedef struct {
51 zend_object zo;
52 intl_error err;
53 zend_object_iterator *iterator;
54 } IntlIterator_object;
55
56 typedef struct {
57 zend_object_iterator zoi;
58 zval *current;
59 zval *wrapping_obj;
60 void (*destroy_it)(zend_object_iterator *iterator TSRMLS_DC);
61 } zoi_with_current;
62
63 extern zend_class_entry *IntlIterator_ce_ptr;
64 extern zend_object_handlers IntlIterator_handlers;
65
66 U_CFUNC void zoi_with_current_dtor(zend_object_iterator *iter TSRMLS_DC);
67 U_CFUNC int zoi_with_current_valid(zend_object_iterator *iter TSRMLS_DC);
68 U_CFUNC void zoi_with_current_get_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC);
69 U_CFUNC void zoi_with_current_invalidate_current(zend_object_iterator *iter TSRMLS_DC);
70
71 #ifdef __cplusplus
72 U_CFUNC void IntlIterator_from_StringEnumeration(StringEnumeration *se, zval *object TSRMLS_DC);
73 #endif
74
75 U_CFUNC void intl_register_IntlIterator_class(TSRMLS_D);
76
77 #endif