1 /* 2 +----------------------------------------------------------------------+ 3 | This source file is subject to version 3.01 of the PHP license, | 4 | that is bundled with this package in the file LICENSE, and is | 5 | available through the world-wide-web at the following url: | 6 | https://www.php.net/license/3_01.txt | 7 | If you did not receive a copy of the PHP license and are unable to | 8 | obtain it through the world-wide-web, please send a note to | 9 | license@php.net so we can mail you a copy immediately. | 10 +----------------------------------------------------------------------+ 11 | Authors: Stanislav Malyshev <stas@zend.com> | 12 +----------------------------------------------------------------------+ 13 */ 14 15 #ifndef FORMATTER_CLASS_H 16 #define FORMATTER_CLASS_H 17 18 #include <php.h> 19 20 #include "intl_common.h" 21 #include "intl_error.h" 22 #include "intl_data.h" 23 #include "formatter_data.h" 24 25 typedef struct { 26 formatter_data nf_data; 27 zend_object zo; 28 } NumberFormatter_object; 29 php_intl_number_format_fetch_object(zend_object * obj)30static inline NumberFormatter_object *php_intl_number_format_fetch_object(zend_object *obj) { 31 return (NumberFormatter_object *)((char*)(obj) - XtOffsetOf(NumberFormatter_object, zo)); 32 } 33 #define Z_INTL_NUMBERFORMATTER_P(zv) php_intl_number_format_fetch_object(Z_OBJ_P(zv)) 34 35 void formatter_register_class( void ); 36 extern zend_class_entry *NumberFormatter_ce_ptr; 37 38 /* Auxiliary macros */ 39 40 #define FORMATTER_METHOD_INIT_VARS INTL_METHOD_INIT_VARS(NumberFormatter, nfo) 41 #define FORMATTER_OBJECT(nfo) (nfo)->nf_data.unum 42 #define FORMATTER_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(INTL_NUMBERFORMATTER, nfo) 43 #define FORMATTER_METHOD_FETCH_OBJECT \ 44 FORMATTER_METHOD_FETCH_OBJECT_NO_CHECK; \ 45 if (FORMATTER_OBJECT(nfo) == NULL) \ 46 { \ 47 zend_throw_error(NULL, "Found unconstructed NumberFormatter"); \ 48 RETURN_THROWS(); \ 49 } 50 51 52 #endif // #ifndef FORMATTER_CLASS_H 53