php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
collator_locale.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#ifdef HAVE_CONFIG_H
17#include <config.h>
18#endif
19
20#include "php_intl.h"
21#include "collator_class.h"
22#include "intl_convert.h"
23
24#include <zend_API.h>
25
26/* {{{ Gets the locale name of the collator. */
28{
29 zend_long type = 0;
30 char* locale_name = NULL;
31
33
34 /* Parse parameters. */
36 &object, Collator_ce_ptr, &type ) == FAILURE )
37 {
39 }
40
41 /* Fetch the object. */
43
44 if (!co || !co->ucoll) {
47 "Object not initialized", 0 );
48 zend_throw_error(NULL, "Object not initialized");
49
51 }
52
53 /* Get locale by specified type. */
54 locale_name = (char*) ucol_getLocaleByType(
55 co->ucoll, type, COLLATOR_ERROR_CODE_P( co ) );
56 COLLATOR_CHECK_STATUS( co, "Error getting locale by type" );
57
58 /* Return it. */
59 RETVAL_STRINGL( locale_name, strlen(locale_name) );
60}
61/* }}} */
zend_class_entry * Collator_ce_ptr
#define COLLATOR_ERROR_CODE_P(co)
#define COLLATOR_CHECK_STATUS(co, msg)
#define COLLATOR_ERROR_P(co)
#define COLLATOR_METHOD_FETCH_OBJECT
#define COLLATOR_ERROR_CODE(co)
#define COLLATOR_METHOD_INIT_VARS
zend_ffi_type * type
Definition ffi.c:3812
#define NULL
Definition gdcache.h:45
void intl_errors_set_custom_msg(intl_error *err, const char *msg, int copyMsg)
Definition intl_error.c:187
void intl_error_set_code(intl_error *err, UErrorCode err_code)
Definition intl_error.c:141
#define PHP_FUNCTION
Definition php.h:364
collator_get_locale(Collator $object, int $type)
ZEND_API ZEND_COLD void zend_throw_error(zend_class_entry *exception_ce, const char *format,...)
Definition zend.c:1772
ZEND_API zend_result zend_parse_method_parameters(uint32_t num_args, zval *this_ptr, const char *type_spec,...)
Definition zend_API.c:1314
#define ZEND_NUM_ARGS()
Definition zend_API.h:530
#define RETURN_THROWS()
Definition zend_API.h:1060
#define getThis()
Definition zend_API.h:526
#define RETVAL_STRINGL(s, l)
Definition zend_API.h:1018
strlen(string $string)
int32_t zend_long
Definition zend_long.h:42
@ FAILURE
Definition zend_types.h:61