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 24 #define INTL_ERROR_CODE(e) (e).code 25 26 typedef struct _intl_error { 27 UErrorCode code; 28 char* custom_error_message; 29 int free_custom_error_message; 30 } intl_error; 31 32 intl_error* intl_error_create( TSRMLS_D ); 33 void intl_error_init( intl_error* err TSRMLS_DC ); 34 void intl_error_reset( intl_error* err TSRMLS_DC ); 35 void intl_error_set_code( intl_error* err, UErrorCode err_code TSRMLS_DC ); 36 void intl_error_set_custom_msg( intl_error* err, char* msg, int copyMsg TSRMLS_DC ); 37 void intl_error_set( intl_error* err, UErrorCode code, char* msg, int copyMsg TSRMLS_DC ); 38 UErrorCode intl_error_get_code( intl_error* err TSRMLS_DC ); 39 char* intl_error_get_message( intl_error* err TSRMLS_DC ); 40 41 // Wrappers to synchonize object's and global error structures. 42 void intl_errors_reset( intl_error* err TSRMLS_DC ); 43 void intl_errors_set_custom_msg( intl_error* err, char* msg, int copyMsg TSRMLS_DC ); 44 void intl_errors_set_code( intl_error* err, UErrorCode err_code TSRMLS_DC ); 45 void intl_errors_set( intl_error* err, UErrorCode code, char* msg, int copyMsg TSRMLS_DC ); 46 47 #endif // INTL_ERROR_H 48