php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
resourcebundle.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: Hans-Peter Oeri (University of St.Gallen) <hp@oeri.ch> |
12 +----------------------------------------------------------------------+
13 */
14
15#include <unicode/ures.h>
16
17#include <zend.h>
18#include <zend_API.h>
19
20#include "intl_convert.h"
21#include "intl_data.h"
23
24/* {{{ ResourceBundle_extract_value */
26{
27 UResType restype;
28 const UChar* ufield;
29 const uint8_t* bfield;
30 const int32_t* vfield;
31 int32_t ilen;
32 int i;
33 zend_long lfield;
35
36 restype = ures_getType( source->child );
37 switch (restype)
38 {
39 case URES_STRING:
40 ufield = ures_getString( source->child, &ilen, &INTL_DATA_ERROR_CODE(source) );
41 INTL_METHOD_CHECK_STATUS(source, "Failed to retrieve string value");
42 INTL_METHOD_RETVAL_UTF8(source, (UChar *)ufield, ilen, 0);
43 break;
44
45 case URES_BINARY:
46 bfield = ures_getBinary( source->child, &ilen, &INTL_DATA_ERROR_CODE(source) );
47 INTL_METHOD_CHECK_STATUS(source, "Failed to retrieve binary value");
48 ZVAL_STRINGL( return_value, (char *) bfield, ilen );
49 break;
50
51 case URES_INT:
52 lfield = ures_getInt( source->child, &INTL_DATA_ERROR_CODE(source) );
53 INTL_METHOD_CHECK_STATUS(source, "Failed to retrieve integer value");
54 ZVAL_LONG( return_value, lfield );
55 break;
56
57 case URES_INT_VECTOR:
58 vfield = ures_getIntVector( source->child, &ilen, &INTL_DATA_ERROR_CODE(source) );
59 INTL_METHOD_CHECK_STATUS(source, "Failed to retrieve vector value");
61 for (i=0; i<ilen; i++) {
63 }
64 break;
65
66 case URES_ARRAY:
67 case URES_TABLE:
70 newrb->me = source->child;
71 source->child = NULL;
73 break;
75 }
76}
77/* }}} */
#define NULL
Definition gdcache.h:45
#define INTL_DATA_ERROR_P(obj)
Definition intl_data.h:39
#define INTL_DATA_ERROR_CODE(obj)
Definition intl_data.h:40
#define INTL_METHOD_CHECK_STATUS(obj, msg)
Definition intl_data.h:66
#define INTL_METHOD_RETVAL_UTF8(obj, ustring, ulen, free_it)
Definition intl_data.h:103
void intl_errors_reset(intl_error *err)
Definition intl_error.c:177
void resourcebundle_extract_value(zval *return_value, ResourceBundle_object *source)
zend_class_entry * ResourceBundle_ce_ptr
#define Z_INTL_RESOURCEBUNDLE_P(zv)
ZEND_API zend_result add_next_index_long(zval *arg, zend_long n)
Definition zend_API.c:2132
ZEND_API zend_result object_init_ex(zval *arg, zend_class_entry *class_type)
Definition zend_API.c:1849
#define ZVAL_STRINGL(z, s, l)
Definition zend_API.h:952
#define array_init(arg)
Definition zend_API.h:537
struct _zval_struct zval
int32_t zend_long
Definition zend_long.h:42
#define EMPTY_SWITCH_DEFAULT_CASE()
#define ZVAL_LONG(z, l)
zval * return_value