1 /* 2 +----------------------------------------------------------------------+ 3 | PHP Version 7 | 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: Kirti Velankar <kirtig@yahoo-inc.com> | 14 +----------------------------------------------------------------------+ 15 */ 16 #ifndef DATE_FORMAT_CLASS_H 17 #define DATE_FORMAT_CLASS_H 18 19 #include <php.h> 20 21 #include "intl_common.h" 22 #include "intl_error.h" 23 #include "intl_data.h" 24 #include "dateformat_data.h" 25 26 typedef struct { 27 dateformat_data datef_data; 28 int date_type; 29 int time_type; 30 int calendar; 31 char *requested_locale; 32 zend_object zo; 33 } IntlDateFormatter_object; 34 php_intl_dateformatter_fetch_object(zend_object * obj)35static inline IntlDateFormatter_object *php_intl_dateformatter_fetch_object(zend_object *obj) { 36 return (IntlDateFormatter_object *)((char*)(obj) - XtOffsetOf(IntlDateFormatter_object, zo)); 37 } 38 #define Z_INTL_DATEFORMATTER_P(zv) php_intl_dateformatter_fetch_object(Z_OBJ_P(zv)) 39 40 void dateformat_register_IntlDateFormatter_class( void ); 41 extern zend_class_entry *IntlDateFormatter_ce_ptr; 42 43 /* Auxiliary macros */ 44 45 #define DATE_FORMAT_METHOD_INIT_VARS INTL_METHOD_INIT_VARS(IntlDateFormatter, dfo) 46 #define DATE_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(INTL_DATEFORMATTER, dfo) 47 #define DATE_FORMAT_METHOD_FETCH_OBJECT \ 48 DATE_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; \ 49 if (dfo->datef_data.udatf == NULL) \ 50 { \ 51 intl_errors_set(&dfo->datef_data.error, U_ILLEGAL_ARGUMENT_ERROR, "Found unconstructed IntlDateFormatter", 0); \ 52 RETURN_FALSE; \ 53 } 54 55 #define DATE_FORMAT_OBJECT(dfo) (dfo)->datef_data.udatf 56 57 #endif // #ifndef DATE_FORMAT_CLASS_H 58