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: Gustavo Lopes <cataphract@netcabo.pt> | 14 +----------------------------------------------------------------------+ 15 */ 16 17 #ifndef TRANSLITERATOR_CLASS_H 18 #define TRANSLITERATOR_CLASS_H 19 20 #include <php.h> 21 22 #include "intl_common.h" 23 #include "intl_error.h" 24 25 #include <unicode/utrans.h> 26 27 typedef struct { 28 zend_object zo; 29 30 // error handling 31 intl_error err; 32 33 // ICU transliterator 34 UTransliterator* utrans; 35 } Transliterator_object; 36 37 #define TRANSLITERATOR_FORWARD UTRANS_FORWARD 38 #define TRANSLITERATOR_REVERSE UTRANS_REVERSE 39 40 #define TRANSLITERATOR_ERROR( co ) (co)->err 41 #define TRANSLITERATOR_ERROR_P( co ) &(TRANSLITERATOR_ERROR( co )) 42 43 #define TRANSLITERATOR_ERROR_CODE( co ) INTL_ERROR_CODE(TRANSLITERATOR_ERROR( co )) 44 #define TRANSLITERATOR_ERROR_CODE_P( co ) &(INTL_ERROR_CODE(TRANSLITERATOR_ERROR( co ))) 45 46 #define TRANSLITERATOR_METHOD_INIT_VARS INTL_METHOD_INIT_VARS( Transliterator, to ) 47 #define TRANSLITERATOR_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT( Transliterator, to ) 48 #define TRANSLITERATOR_METHOD_FETCH_OBJECT\ 49 TRANSLITERATOR_METHOD_FETCH_OBJECT_NO_CHECK; \ 50 if( to->utrans == NULL ) \ 51 { \ 52 intl_errors_set( &to->err, U_ILLEGAL_ARGUMENT_ERROR, "Found unconstructed transliterator", 0 TSRMLS_CC ); \ 53 RETURN_FALSE; \ 54 } 55 56 int transliterator_object_construct( zval *object, 57 UTransliterator *utrans, 58 UErrorCode *status TSRMLS_DC ); 59 60 void transliterator_register_Transliterator_class( TSRMLS_D ); 61 62 extern zend_class_entry *Transliterator_ce_ptr; 63 extern zend_object_handlers Transliterator_handlers; 64 65 #endif /* #ifndef TRANSLITERATOR_CLASS_H */ 66