php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
collator_class.h
Go to the documentation of this file.
1/*
2 +----------------------------------------------------------------------+
3 | This source file is subject to version 3.01 of the PHP license, |
4 | that is bundled with this package in the file LICENSE, and is |
5 | available through the world-wide-web at the following url: |
6 | https://www.php.net/license/3_01.txt |
7 | If you did not receive a copy of the PHP license and are unable to |
8 | obtain it through the world-wide-web, please send a note to |
9 | license@php.net so we can mail you a copy immediately. |
10 +----------------------------------------------------------------------+
11 | Authors: Vadim Savchuk <vsavchuk@productengine.com> |
12 | Dmitry Lakhtyuk <dlakhtyuk@productengine.com> |
13 +----------------------------------------------------------------------+
14 */
15
16#ifndef COLLATOR_CLASS_H
17#define COLLATOR_CLASS_H
18
19#include <php.h>
20
21#include "../intl_common.h"
22#include "../intl_error.h"
23#include "../intl_data.h"
24
25#include <unicode/ucol.h>
26
27typedef struct {
28 // error handling
30
31 // ICU collator
32 UCollator* ucoll;
33
35
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
44static inline Collator_object *php_intl_collator_fetch_object(zend_object *obj) {
45 return (Collator_object *)((char*)(obj) - XtOffsetOf(Collator_object, zo));
46}
47#define Z_INTL_COLLATOR_P(zv) php_intl_collator_fetch_object(Z_OBJ_P(zv))
48
49void collator_register_Collator_symbols(int module_number);
52
54
55/* Auxiliary macros */
56
57#define COLLATOR_METHOD_INIT_VARS \
58 zval* object = NULL; \
59 Collator_object* co = NULL; \
60 intl_error_reset( NULL ); \
61
62#define COLLATOR_METHOD_FETCH_OBJECT INTL_METHOD_FETCH_OBJECT(INTL_COLLATOR, co)
63
64// Macro to check return value of a ucol_* function call.
65#define COLLATOR_CHECK_STATUS( co, msg ) \
66 intl_error_set_code( NULL, COLLATOR_ERROR_CODE( co ) ); \
67 if( U_FAILURE( COLLATOR_ERROR_CODE( co ) ) ) \
68 { \
69 intl_errors_set_custom_msg( COLLATOR_ERROR_P( co ), msg, 0 ); \
70 RETURN_FALSE; \
71 } \
72
73#endif // #ifndef COLLATOR_CLASS_H
zend_class_entry * Collator_ce_ptr
void collator_object_init(Collator_object *co)
void collator_register_Collator_symbols(int module_number)
void collator_object_destroy(Collator_object *co)
struct _intl_error intl_error
UCollator * ucoll
#define XtOffsetOf(s_type, field)
struct _zend_class_entry zend_class_entry
struct _zend_object zend_object