Go to the documentation of this file.
31 #include <ext/spl/spl_iterators.h>
32 #include <Zend/zend_API.h>
33 #include <Zend/zend_interfaces.h>
38 ZEND_BEGIN_ARG_INFO_EX(arginfo_offsetGet, 0, 0, 1)
39 ZEND_ARG_INFO(0,
index)
42 ZEND_BEGIN_ARG_INFO_EX(arginfo_offsetSet, 0, 0, 2)
43 ZEND_ARG_INFO(0,
index)
44 ZEND_ARG_INFO(0, newval)
47 ZEND_BEGIN_ARG_INFO(arginfo_void, 0)
53 return (
void*)(&
v->val);
88 #define TABLE_KEY_BUF_LENGTH 8 // sizeof(uint64_t)
92 size_t* out_length TSRMLS_DC) {
93 switch (
self->key_type) {
99 zend_error(E_USER_ERROR,
"Given key is not UTF8 encoded.");
102 *out_key = Z_STRVAL_P(
key);
103 *out_length = Z_STRLEN_P(
key);
106 #define CASE_TYPE(upb_type, type, c_type, php_type) \
107 case UPB_TYPE_##upb_type: { \
108 c_type type##_value; \
109 if (!protobuf_convert_to_##type(key, &type##_value)) { \
112 native_slot_set_by_array(self->key_type, NULL, buf, key TSRMLS_CC); \
114 *out_length = native_slot_size(self->key_type); \
140 PHP_ME(MapField, __construct,
NULL, ZEND_ACC_PUBLIC)
141 PHP_ME(MapField, offsetExists, arginfo_offsetGet, ZEND_ACC_PUBLIC)
142 PHP_ME(MapField, offsetGet, arginfo_offsetGet, ZEND_ACC_PUBLIC)
143 PHP_ME(MapField, offsetSet, arginfo_offsetSet, ZEND_ACC_PUBLIC)
144 PHP_ME(MapField, offsetUnset, arginfo_offsetGet, ZEND_ACC_PUBLIC)
145 PHP_ME(MapField,
count, arginfo_void, ZEND_ACC_PUBLIC)
146 PHP_ME(MapField, getIterator, arginfo_void, ZEND_ACC_PUBLIC)
153 zval *
value TSRMLS_DC);
181 #if PHP_MAJOR_VERSION < 7
183 zval_ptr_dtor(
value);
187 zval_ptr_dtor(
value);
191 zend_string*
object = *(zend_string**)
value;
192 zend_string_release(
object);
195 zend_object*
object = *(zend_object**)
value;
197 if(GC_REFCOUNT(
object) == 0) {
198 zend_objects_store_del(
object);
210 switch (
intern->value_type) {
233 zend_error(E_USER_ERROR,
"Could not allocate table.");
240 zend_class_implements(
map_field_type TSRMLS_CC, 3, spl_ce_ArrayAccess,
241 zend_ce_aggregate, spl_ce_Countable);
259 const zend_class_entry *
msg_ce,
278 const char* keyval =
NULL;
293 zend_error(E_USER_ERROR,
"Given key doesn't exist.");
301 switch (
intern->value_type) {
303 #if PHP_MAJOR_VERSION < 7
308 if(GC_REFCOUNT(
object) == 0) {
309 zend_objects_store_del(
object);
316 #if PHP_MAJOR_VERSION < 7
320 zend_string_release(
object);
335 zend_error(E_USER_ERROR,
"Could not insert into table");
343 zval *
value TSRMLS_DC) {
347 const char* keyval =
NULL;
372 const char* keyval =
NULL;
395 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
"ll|C", &
key_type,
406 switch (
intern->key_type) {
417 zend_error(E_USER_ERROR,
"Invalid key type for map.");
423 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
"z", &
key) ==
431 const char* keyval =
NULL;
446 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
"z", &
index) ==
456 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
"zz", &
index, &
value) ==
465 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
"z", &
index) ==
475 if (zend_parse_parameters_none() == FAILURE) {
522 PHP_ME(MapFieldIter, rewind, arginfo_void, ZEND_ACC_PUBLIC)
523 PHP_ME(MapFieldIter, current, arginfo_void, ZEND_ACC_PUBLIC)
524 PHP_ME(MapFieldIter,
key, arginfo_void, ZEND_ACC_PUBLIC)
525 PHP_ME(MapFieldIter,
next, arginfo_void, ZEND_ACC_PUBLIC)
526 PHP_ME(MapFieldIter, valid, arginfo_void, ZEND_ACC_PUBLIC)
565 int value_length = 0;
void * upb_value_memory(upb_value *v)
upb_fieldtype_t to_fieldtype(upb_descriptortype_t type)
#define PHP_PROTO_TSRMLS_DC
#define CASE_TYPE(upb_type, type, c_type, php_type)
zend_object_handlers * map_field_handlers
#define PHP_PROTO_TSRMLS_CC
#define CACHED_PTR_TO_ZVAL_PTR(VALUE)
void map_field_create_with_type(const zend_class_entry *ce, upb_fieldtype_t key_type, upb_fieldtype_t value_type, const zend_class_entry *msg_ce, CACHED_VALUE *map_field PHP_PROTO_TSRMLS_DC)
size_t upb_strtable_iter_keylength(const upb_strtable_iter *i)
const char * map_iter_key(MapIter *iter, int *len)
GLenum GLuint GLenum GLsizei length
#define PHP_PROTO_INIT_CLASS_END
static void php_proto_map_object_release(void *value)
void map_field_create_with_field(const zend_class_entry *ce, const upb_fielddef *field, CACHED_VALUE *map_field PHP_PROTO_TSRMLS_DC)
bool map_index_set(Map *intern, const char *keyval, int length, upb_value v)
PHP_PROTO_OBJECT_FREE_END PHP_PROTO_OBJECT_DTOR_END intern self
static bool map_field_unset_dimension(zval *object, zval *key TSRMLS_DC)
bool native_slot_set_by_map(upb_fieldtype_t type, const zend_class_entry *klass, void *memory, zval *value TSRMLS_DC)
void native_slot_get_by_map_key(upb_fieldtype_t type, const void *memory, int length, CACHED_VALUE *cache TSRMLS_DC)
zend_class_entry * map_field_iter_type
UPB_INLINE bool upb_strtable_init(upb_strtable *table, upb_ctype_t ctype)
static HashTable * map_field_get_gc(zval *object, CACHED_VALUE **table, int *n TSRMLS_DC)
#define PHP_PROTO_OBJECT_DTOR_START(classname, lowername)
PHP_PROTO_OBJECT_FREE_END PHP_PROTO_OBJECT_DTOR_END if(!upb_strtable_init(&intern->table, UPB_CTYPE_UINT64))
static zend_function_entry map_field_methods[]
upb_value map_iter_value(MapIter *iter, int *len)
bool map_done(MapIter *iter)
const upb_fielddef * map_field_value(const upb_fielddef *field)
size_t native_slot_size(upb_fieldtype_t type)
static bool table_key(Map *self, zval *key, char *buf, const char **out_key, size_t *out_length TSRMLS_DC)
#define UNBOX(class_name, val)
void upb_strtable_next(upb_strtable_iter *i)
bool upb_strtable_done(const upb_strtable_iter *i)
#define PHP_PROTO_OBJECT_DTOR_END
const char * upb_strtable_iter_key(const upb_strtable_iter *i)
static void map_index_unset(Map *intern, const char *keyval, int length)
PHP_PROTO_INIT_CLASS_START("Google\\Protobuf\\Internal\\MapField", Map, map_field)
const zend_class_entry * field_type_class(const upb_fielddef *field PHP_PROTO_TSRMLS_DC)
upb_value upb_strtable_iter_value(const upb_strtable_iter *i)
UPB_INLINE void upb_strtable_uninit(upb_strtable *table)
#define CACHED_TO_ZVAL_PTR(VALUE)
#define PHP_PROTO_OBJECT_CREATE_START(NAME, LOWWERNAME)
zend_object_handlers * map_field_iter_handlers
const FieldDescriptor * field
GLenum GLuint GLenum GLsizei const GLchar * buf
const SETUP_TEARDOWN_TESTCONTEXT char * key
#define PHP_PROTO_OBJECT_FREE_END
upb_fieldtype_t upb_fielddef_type(const upb_fielddef *f)
void map_next(MapIter *iter)
const upb_fielddef * map_field_key(const upb_fielddef *field)
static zend_function_entry map_field_iter_methods[]
UPB_INLINE bool upb_strtable_insert2(upb_strtable *t, const char *key, size_t len, upb_value val)
bool is_structurally_valid_utf8(const char *buf, int len)
#define TABLE_KEY_BUF_LENGTH
PHP_METHOD(MapField, __construct)
static void map_field_write_dimension(zval *object, zval *key, zval *value TSRMLS_DC)
zend_class_entry * value_type
void map_begin(zval *map_php, MapIter *iter TSRMLS_DC)
void upb_strtable_begin(upb_strtable_iter *i, const upb_strtable *t)
#define PHP_PROTO_OBJECT_CREATE_END(NAME, LOWWERNAME)
#define CREATE_OBJ_ON_ALLOCATED_ZVAL_PTR(zval_ptr, class_type)
static void php_proto_map_string_release(void *value)
static bool map_field_read_dimension(zval *object, zval *key, int type, CACHED_VALUE *retval TSRMLS_DC)
static size_t next(const upb_table *t, size_t i)
GLsizei const GLfloat * value
static void map_begin_internal(Map *map, MapIter *iter)
upb_strtable_uninit & intern
bool upb_strtable_lookup2(const upb_strtable *t, const char *key, size_t len, upb_value *v)
upb_fieldtype_t value_type
#define ZVAL_PTR_TO_CACHED_PTR(VALUE)
UPB_INLINE size_t upb_strtable_count(const upb_strtable *t)
bool protobuf_convert_to_string(zval *from)
UPB_INLINE bool upb_strtable_remove2(upb_strtable *t, const char *key, size_t len, upb_value *val)
zend_class_entry * map_field_type
void native_slot_get_by_map_value(upb_fieldtype_t type, const void *memory, CACHED_VALUE *cache TSRMLS_DC)
#define PHP_PROTO_OBJECT_FREE_START(classname, lowername)
for(map_begin_internal(intern, &it);!map_done(&it);map_next(&it))
libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:55