Annotation of embedaddon/php/ext/intl/collator/collator_class.h, revision 1.1
1.1 ! misho 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: +----------------------------------------------------------------------+
! 16: */
! 17:
! 18: #ifndef COLLATOR_CLASS_H
! 19: #define COLLATOR_CLASS_H
! 20:
! 21: #include <php.h>
! 22:
! 23: #include "intl_common.h"
! 24: #include "intl_error.h"
! 25:
! 26: #include <unicode/ucol.h>
! 27:
! 28: typedef struct {
! 29: zend_object zo;
! 30:
! 31: // error handling
! 32: intl_error err;
! 33:
! 34: // ICU collator
! 35: UCollator* ucoll;
! 36: } Collator_object;
! 37:
! 38: #define COLLATOR_ERROR(co) (co)->err
! 39: #define COLLATOR_ERROR_P(co) &(COLLATOR_ERROR(co))
! 40:
! 41: #define COLLATOR_ERROR_CODE(co) INTL_ERROR_CODE(COLLATOR_ERROR(co))
! 42: #define COLLATOR_ERROR_CODE_P(co) &(INTL_ERROR_CODE(COLLATOR_ERROR(co)))
! 43:
! 44: void collator_register_Collator_class( TSRMLS_D );
! 45: void collator_object_init( Collator_object* co TSRMLS_DC );
! 46: void collator_object_destroy( Collator_object* co TSRMLS_DC );
! 47:
! 48: extern zend_class_entry *Collator_ce_ptr;
! 49:
! 50: /* Auxiliary macros */
! 51:
! 52: #define COLLATOR_METHOD_INIT_VARS \
! 53: zval* object = NULL; \
! 54: Collator_object* co = NULL; \
! 55: intl_error_reset( NULL TSRMLS_CC ); \
! 56:
! 57: #define COLLATOR_METHOD_FETCH_OBJECT \
! 58: co = (Collator_object *) zend_object_store_get_object( object TSRMLS_CC ); \
! 59: intl_error_reset( COLLATOR_ERROR_P( co ) TSRMLS_CC ); \
! 60:
! 61: // Macro to check return value of a ucol_* function call.
! 62: #define COLLATOR_CHECK_STATUS( co, msg ) \
! 63: intl_error_set_code( NULL, COLLATOR_ERROR_CODE( co ) TSRMLS_CC ); \
! 64: if( U_FAILURE( COLLATOR_ERROR_CODE( co ) ) ) \
! 65: { \
! 66: intl_errors_set_custom_msg( COLLATOR_ERROR_P( co ), msg, 0 TSRMLS_CC ); \
! 67: RETURN_FALSE; \
! 68: } \
! 69:
! 70: #endif // #ifndef COLLATOR_CLASS_H
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>