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 | Stanislav Malyshev <stas@zend.com> | 16 +----------------------------------------------------------------------+ 17 */ 18 19 #ifndef INTL_ERROR_H 20 #define INTL_ERROR_H 21 22 #include <unicode/utypes.h> 23 #include <unicode/parseerr.h> 24 #include <ext/standard/php_smart_str.h> 25 26 #define INTL_ERROR_CODE(e) (e).code 27 28 typedef struct _intl_error { 29 UErrorCode code; 30 char* custom_error_message; 31 int free_custom_error_message; 32 } intl_error; 33 34 intl_error* intl_error_create( TSRMLS_D ); 35 void intl_error_init( intl_error* err TSRMLS_DC ); 36 void intl_error_reset( intl_error* err TSRMLS_DC ); 37 void intl_error_set_code( intl_error* err, UErrorCode err_code TSRMLS_DC ); 38 void intl_error_set_custom_msg( intl_error* err, char* msg, int copyMsg TSRMLS_DC ); 39 void intl_error_set( intl_error* err, UErrorCode code, char* msg, int copyMsg TSRMLS_DC ); 40 UErrorCode intl_error_get_code( intl_error* err TSRMLS_DC ); 41 char* intl_error_get_message( intl_error* err TSRMLS_DC ); 42 43 // Wrappers to synchonize object's and global error structures. 44 void intl_errors_reset( intl_error* err TSRMLS_DC ); 45 void intl_errors_set_custom_msg( intl_error* err, char* msg, int copyMsg TSRMLS_DC ); 46 void intl_errors_set_code( intl_error* err, UErrorCode err_code TSRMLS_DC ); 47 void intl_errors_set( intl_error* err, UErrorCode code, char* msg, int copyMsg TSRMLS_DC ); 48 49 // Other error helpers 50 smart_str intl_parse_error_to_string( UParseError* pe ); 51 52 // exported to be called on extension MINIT 53 void intl_register_IntlException_class( TSRMLS_D ); 54 55 #endif // INTL_ERROR_H 56