php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
collator_class.c
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#include "collator.h"
17#include "collator_class.h"
18#include "php_intl.h"
19#include "collator_sort.h"
20#include "collator_convert.h"
21#include "intl_error.h"
22
23#include <unicode/ucol.h>
24
25#include "collator_arginfo.h"
26
28static zend_object_handlers Collator_handlers;
29
30/*
31 * Auxiliary functions needed by objects of 'Collator' class
32 */
33
34/* {{{ Collator_objects_free */
36{
37 Collator_object* co = php_intl_collator_fetch_object(object);
38
40
42}
43/* }}} */
44
45/* {{{ Collator_object_create */
47{
48 Collator_object *intern = zend_object_alloc(sizeof(Collator_object), ce);
50 zend_object_std_init(&intern->zo, ce );
51 object_properties_init(&intern->zo, ce);
52
53 return &intern->zo;
54}
55/* }}} */
56
57/*
58 * 'Collator' class registration structures & functions
59 */
60
61/* {{{ collator_register_Collator_symbols
62 * Initialize 'Collator' class
63 */
65{
66 register_collator_symbols(module_number);
67
68 /* Create and register 'Collator' class. */
69 Collator_ce_ptr = register_class_Collator();
71 Collator_ce_ptr->default_object_handlers = &Collator_handlers;
72
73 memcpy(&Collator_handlers, &std_object_handlers,
74 sizeof Collator_handlers);
75 /* Collator has no usable clone semantics - ucol_cloneBinary/ucol_openBinary require binary buffer
76 for which we don't have the place to keep */
77 Collator_handlers.offset = XtOffsetOf(Collator_object, zo);
78 Collator_handlers.clone_obj = NULL;
79 Collator_handlers.free_obj = Collator_objects_free;
80}
81/* }}} */
82
83/* {{{ void collator_object_init( Collator_object* co )
84 * Initialize internals of Collator_object.
85 * Must be called before any other call to 'collator_object_...' functions.
86 */
88{
89 if( !co )
90 return;
91
93}
94/* }}} */
95
96/* {{{ void collator_object_destroy( Collator_object* co )
97 * Clean up mem allocted by internals of Collator_object
98 */
100{
101 if( !co )
102 return;
103
104 if( co->ucoll )
105 {
106 ucol_close( co->ucoll );
107 co->ucoll = NULL;
108 }
109
111}
112/* }}} */
void collator_object_init(Collator_object *co)
void collator_register_Collator_symbols(int module_number)
void Collator_objects_free(zend_object *object)
zend_object * Collator_object_create(zend_class_entry *ce)
void collator_object_destroy(Collator_object *co)
zend_class_entry * Collator_ce_ptr
#define COLLATOR_ERROR_P(co)
memcpy(ptr1, ptr2, size)
#define NULL
Definition gdcache.h:45
void intl_error_init(intl_error *err)
Definition intl_error.c:66
void intl_error_reset(intl_error *err)
Definition intl_error.c:78
UCollator * ucoll
ZEND_API void object_properties_init(zend_object *object, zend_class_entry *class_type)
Definition zend_API.c:1688
ZEND_API const zend_object_handlers std_object_handlers
ZEND_API void ZEND_FASTCALL zend_object_std_init(zend_object *object, zend_class_entry *ce)
ZEND_API void zend_object_std_dtor(zend_object *object)
#define XtOffsetOf(s_type, field)
struct _zend_class_entry zend_class_entry
struct _zend_object zend_object
struct _zend_object_handlers zend_object_handlers
Definition zend_types.h:88