intl_error.h 2.6 KB

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