aboutsummaryrefslogtreecommitdiffhomepage
path: root/php/ext/google/protobuf/protobuf.h
diff options
context:
space:
mode:
authorGravatar Paul Yang <TeBoring@users.noreply.github.com>2017-03-10 13:42:59 -0800
committerGravatar GitHub <noreply@github.com>2017-03-10 13:42:59 -0800
commit616e68ecc1c997c8b4c22a708cc9f6605a329bef (patch)
tree423b87d463238652d667bedd4791314d869045e0 /php/ext/google/protobuf/protobuf.h
parenta1bb147e96b6f74db6cdf3c3fcb00492472dbbfa (diff)
Repeated/Map field setter should accept a regular PHP array (#2817)
Accept regular PHP array for repeated/map setter. Existing map/repeated field will be swapped by a clean map/repeated field. Then, elements in the array will be added to the map/repeated field. All elements will be type checked before adding. See #2686 for detail.
Diffstat (limited to 'php/ext/google/protobuf/protobuf.h')
-rw-r--r--php/ext/google/protobuf/protobuf.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h
index 28cea95c..2287f7e6 100644
--- a/php/ext/google/protobuf/protobuf.h
+++ b/php/ext/google/protobuf/protobuf.h
@@ -296,6 +296,7 @@ PHP_METHOD(Util, checkBool);
PHP_METHOD(Util, checkString);
PHP_METHOD(Util, checkBytes);
PHP_METHOD(Util, checkMessage);
+PHP_METHOD(Util, checkMapField);
PHP_METHOD(Util, checkRepeatedField);
// -----------------------------------------------------------------------------
@@ -349,7 +350,11 @@ const upb_fielddef* map_entry_key(const upb_msgdef* msgdef);
const upb_fielddef* map_entry_value(const upb_msgdef* msgdef);
zend_object_value map_field_create(zend_class_entry *ce TSRMLS_DC);
-void map_field_create_with_type(zend_class_entry *ce, const upb_fielddef *field,
+void map_field_create_with_field(zend_class_entry *ce, const upb_fielddef *field,
+ zval **map_field TSRMLS_DC);
+void map_field_create_with_type(zend_class_entry *ce, upb_fieldtype_t key_type,
+ upb_fieldtype_t value_type,
+ const zend_class_entry *msg_ce,
zval **map_field TSRMLS_DC);
void map_field_free(void* object TSRMLS_DC);
void* upb_value_memory(upb_value* v);
@@ -392,9 +397,12 @@ struct RepeatedFieldIter {
long position;
};
-void repeated_field_create_with_type(zend_class_entry* ce,
+void repeated_field_create_with_field(zend_class_entry* ce,
const upb_fielddef* field,
zval** repeated_field TSRMLS_DC);
+void repeated_field_create_with_type(zend_class_entry* ce, upb_fieldtype_t type,
+ const zend_class_entry* msg_ce,
+ zval** repeated_field TSRMLS_DC);
// Return the element at the index position from the repeated field. There is
// not restriction on the type of stored elements.
void *repeated_field_index_native(RepeatedField *intern, int index TSRMLS_DC);