1 /* 2 +----------------------------------------------------------------------+ 3 | PHP Version 5 | 4 +----------------------------------------------------------------------+ 5 | This source file is subject to version 3.01 of the PHP license, | 6 | that is bundled with this package in the file LICENSE, and is | 7 | available through the world-wide-web at the following url: | 8 | http://www.php.net/license/3_01.txt | 9 | If you did not receive a copy of the PHP license and are unable to | 10 | obtain it through the world-wide-web, please send a note to | 11 | license@php.net so we can mail you a copy immediately. | 12 +----------------------------------------------------------------------+ 13 | Authors: Vadim Savchuk <vsavchuk@productengine.com> | 14 | Dmitry Lakhtyuk <dlakhtyuk@productengine.com> | 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 // INTL_COMMON_ENUM_H 78