From 46ae90dc5e145b12fffa7e053a908a9f3e066286 Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Thu, 8 Dec 2016 11:16:49 -0800 Subject: Make php generated code conform to PSR-4. (#2435) 1. Generate single file for each message. 2. Lazily initiate metadata. --- .gitignore | 3 +- Makefile.am | 134 +- composer.json | 6 +- jenkins/docker/Dockerfile | 2 +- jenkins/docker32/Dockerfile | 2 +- php/composer.json | 27 + php/ext/google/protobuf/message.c | 12 + php/ext/google/protobuf/protobuf.h | 5 +- php/ext/google/protobuf/storage.c | 8 +- php/phpunit.xml | 14 + .../Google/Protobuf/Internal/Descriptor.php | 260 ++ .../Google/Protobuf/Internal/DescriptorProto.php | 325 +++ .../Internal/DescriptorProto_ExtensionRange.php | 82 + .../Internal/DescriptorProto_ReservedRange.php | 112 + .../Protobuf/Internal/EnumDescriptorProto.php | 114 + php/src/Google/Protobuf/Internal/EnumOptions.php | 158 ++ .../Protobuf/Internal/EnumValueDescriptorProto.php | 114 + .../Google/Protobuf/Internal/EnumValueOptions.php | 115 + .../Protobuf/Internal/FieldDescriptorProto.php | 424 ++++ .../Internal/FieldDescriptorProto_Label.php | 29 + .../Internal/FieldDescriptorProto_Type.php | 120 + php/src/Google/Protobuf/Internal/FieldOptions.php | 429 ++++ .../Protobuf/Internal/FieldOptions_CType.php | 29 + .../Protobuf/Internal/FieldOptions_JSType.php | 37 + .../Protobuf/Internal/FileDescriptorProto.php | 477 ++++ .../Google/Protobuf/Internal/FileDescriptorSet.php | 59 + php/src/Google/Protobuf/Internal/FileOptions.php | 741 ++++++ .../Protobuf/Internal/FileOptions_OptimizeMode.php | 41 + .../Google/Protobuf/Internal/GeneratedCodeInfo.php | 75 + .../Internal/GeneratedCodeInfo_Annotation.php | 198 ++ .../Google/Protobuf/Internal/MessageOptions.php | 334 +++ .../Protobuf/Internal/MethodDescriptorProto.php | 237 ++ php/src/Google/Protobuf/Internal/MethodOptions.php | 143 ++ .../Internal/MethodOptions_IdempotencyLevel.php | 39 + .../Protobuf/Internal/OneofDescriptorProto.php | 86 + php/src/Google/Protobuf/Internal/OneofOptions.php | 66 + .../Protobuf/Internal/ServiceDescriptorProto.php | 114 + .../Google/Protobuf/Internal/ServiceOptions.php | 115 + .../Google/Protobuf/Internal/SourceCodeInfo.php | 191 ++ .../Protobuf/Internal/SourceCodeInfo_Location.php | 379 +++ .../Protobuf/Internal/UninterpretedOption.php | 246 ++ .../Internal/UninterpretedOption_NamePart.php | 90 + php/src/Google/Protobuf/descriptor_internal.pb.php | 2532 -------------------- php/tests/array_test.php | 1 - php/tests/autoload.php | 25 + php/tests/encode_decode_test.php | 1 - php/tests/gdb_test.sh | 12 + php/tests/generated_class_test.php | 3 +- php/tests/google/protobuf/empty.pb.php | 28 - php/tests/map_field_test.php | 1 - php/tests/memory_leak_test.php | 10 +- php/tests/php_implementation_test.php | 1 - php/tests/proto/test.proto | 141 ++ php/tests/proto/test_include.proto | 7 + php/tests/proto/test_no_namespace.proto | 5 + php/tests/test.pb.php | 2325 ------------------ php/tests/test.proto | 141 -- php/tests/test.sh | 7 +- php/tests/test_include.pb.php | 48 - php/tests/test_include.proto | 7 - php/tests/test_no_namespace.pb.php | 34 - php/tests/test_no_namespace.proto | 5 - php/tests/well_known_test.php | 2 - phpunit.xml | 14 - src/google/protobuf/compiler/php/php_generator.cc | 479 ++-- tests.sh | 23 +- 66 files changed, 6661 insertions(+), 5383 deletions(-) create mode 100644 php/composer.json create mode 100644 php/phpunit.xml create mode 100644 php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php create mode 100644 php/src/Google/Protobuf/Internal/DescriptorProto.php create mode 100644 php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php create mode 100644 php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php create mode 100644 php/src/Google/Protobuf/Internal/EnumDescriptorProto.php create mode 100644 php/src/Google/Protobuf/Internal/EnumOptions.php create mode 100644 php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php create mode 100644 php/src/Google/Protobuf/Internal/EnumValueOptions.php create mode 100644 php/src/Google/Protobuf/Internal/FieldDescriptorProto.php create mode 100644 php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php create mode 100644 php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php create mode 100644 php/src/Google/Protobuf/Internal/FieldOptions.php create mode 100644 php/src/Google/Protobuf/Internal/FieldOptions_CType.php create mode 100644 php/src/Google/Protobuf/Internal/FieldOptions_JSType.php create mode 100644 php/src/Google/Protobuf/Internal/FileDescriptorProto.php create mode 100644 php/src/Google/Protobuf/Internal/FileDescriptorSet.php create mode 100644 php/src/Google/Protobuf/Internal/FileOptions.php create mode 100644 php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php create mode 100644 php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php create mode 100644 php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php create mode 100644 php/src/Google/Protobuf/Internal/MessageOptions.php create mode 100644 php/src/Google/Protobuf/Internal/MethodDescriptorProto.php create mode 100644 php/src/Google/Protobuf/Internal/MethodOptions.php create mode 100644 php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php create mode 100644 php/src/Google/Protobuf/Internal/OneofDescriptorProto.php create mode 100644 php/src/Google/Protobuf/Internal/OneofOptions.php create mode 100644 php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php create mode 100644 php/src/Google/Protobuf/Internal/ServiceOptions.php create mode 100644 php/src/Google/Protobuf/Internal/SourceCodeInfo.php create mode 100644 php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php create mode 100644 php/src/Google/Protobuf/Internal/UninterpretedOption.php create mode 100644 php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php delete mode 100644 php/src/Google/Protobuf/descriptor_internal.pb.php create mode 100755 php/tests/autoload.php create mode 100755 php/tests/gdb_test.sh delete mode 100644 php/tests/google/protobuf/empty.pb.php create mode 100644 php/tests/proto/test.proto create mode 100644 php/tests/proto/test_include.proto create mode 100644 php/tests/proto/test_no_namespace.proto delete mode 100644 php/tests/test.pb.php delete mode 100644 php/tests/test.proto delete mode 100644 php/tests/test_include.pb.php delete mode 100644 php/tests/test_include.proto delete mode 100644 php/tests/test_no_namespace.pb.php delete mode 100644 php/tests/test_no_namespace.proto delete mode 100644 phpunit.xml diff --git a/.gitignore b/.gitignore index ea865f4e..4383c623 100644 --- a/.gitignore +++ b/.gitignore @@ -122,8 +122,7 @@ conformance/succeeding_tests.txt # php test output composer.lock -php/tests/test.pb.php -php/tests/test_include.pb.php +php/tests/generated/ php/ext/google/protobuf/.libs/ php/ext/google/protobuf/Makefile.fragments php/ext/google/protobuf/Makefile.global diff --git a/Makefile.am b/Makefile.am index bea48ca3..4ece5217 100644 --- a/Makefile.am +++ b/Makefile.am @@ -575,58 +575,88 @@ objectivec_EXTRA_DIST= \ objectivec/Tests/UnitTests-Info.plist \ Protobuf.podspec -php_EXTRA_DIST= \ - php/src/phpdoc.dist.xml \ - php/src/Google/Protobuf/Internal/DescriptorPool.php \ - php/src/Google/Protobuf/Internal/OneofField.php \ - php/src/Google/Protobuf/Internal/MapEntry.php \ - php/src/Google/Protobuf/Internal/InputStream.php \ - php/src/Google/Protobuf/Internal/OutputStream.php \ - php/src/Google/Protobuf/Internal/MessageBuilderContext.php \ - php/src/Google/Protobuf/Internal/MapField.php \ - php/src/Google/Protobuf/Internal/RepeatedField.php \ - php/src/Google/Protobuf/Internal/Message.php \ - php/src/Google/Protobuf/Internal/GPBWire.php \ - php/src/Google/Protobuf/Internal/GPBType.php \ - php/src/Google/Protobuf/Internal/GPBLabel.php \ - php/src/Google/Protobuf/Internal/EnumBuilderContext.php \ - php/src/Google/Protobuf/Internal/GPBUtil.php \ - php/src/Google/Protobuf/descriptor_internal.pb.php \ - php/src/Google/Protobuf/descriptor.php \ - php/tests/encode_decode_test.php \ - php/tests/test.sh \ - php/tests/generated_class_test.php \ - php/tests/array_test.php \ - php/tests/php_implementation_test.php \ - php/tests/test_include.proto \ - php/tests/test_include.pb.php \ - php/tests/map_field_test.php \ - php/tests/test_base.php \ - php/tests/test_no_namespace.proto \ - php/tests/test_no_namespace.pb.php \ - php/tests/test_util.php \ - php/tests/test.proto \ - php/tests/test.pb.php \ - php/tests/memory_leak_test.php \ - php/tests/google/protobuf/empty.pb.php \ - php/tests/well_known_test.php \ - php/README.md \ - php/ext/google/protobuf/utf8.h \ - php/ext/google/protobuf/message.c \ - php/ext/google/protobuf/utf8.c \ - php/ext/google/protobuf/package.xml \ - php/ext/google/protobuf/upb.h \ - php/ext/google/protobuf/array.c \ - php/ext/google/protobuf/encode_decode.c \ - php/ext/google/protobuf/protobuf.h \ - php/ext/google/protobuf/type_check.c \ - php/ext/google/protobuf/def.c \ - php/ext/google/protobuf/storage.c \ - php/ext/google/protobuf/map.c \ - php/ext/google/protobuf/config.m4 \ - php/ext/google/protobuf/upb.c \ - php/ext/google/protobuf/protobuf.c \ - phpunit.xml \ +php_EXTRA_DIST= \ + php/src/phpdoc.dist.xml \ + php/src/Google/Protobuf/Internal/DescriptorPool.php \ + php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php \ + php/src/Google/Protobuf/Internal/OneofField.php \ + php/src/Google/Protobuf/Internal/MessageOptions.php \ + php/src/Google/Protobuf/Internal/FileDescriptorProto.php \ + php/src/Google/Protobuf/Internal/MapEntry.php \ + php/src/Google/Protobuf/Internal/FieldDescriptorProto.php \ + php/src/Google/Protobuf/Internal/InputStream.php \ + php/src/Google/Protobuf/Internal/UninterpretedOption.php \ + php/src/Google/Protobuf/Internal/ServiceOptions.php \ + php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php \ + php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php \ + php/src/Google/Protobuf/Internal/OneofDescriptorProto.php \ + php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php \ + php/src/Google/Protobuf/Internal/OutputStream.php \ + php/src/Google/Protobuf/Internal/MessageBuilderContext.php \ + php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php \ + php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php \ + php/src/Google/Protobuf/Internal/DescriptorProto.php \ + php/src/Google/Protobuf/Internal/MapField.php \ + php/src/Google/Protobuf/Internal/MethodDescriptorProto.php \ + php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php \ + php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php \ + php/src/Google/Protobuf/Internal/RepeatedField.php \ + php/src/Google/Protobuf/Internal/EnumValueOptions.php \ + php/src/Google/Protobuf/Internal/MethodOptions.php \ + php/src/Google/Protobuf/Internal/OneofOptions.php \ + php/src/Google/Protobuf/Internal/Message.php \ + php/src/Google/Protobuf/Internal/FileOptions.php \ + php/src/Google/Protobuf/Internal/FileDescriptorSet.php \ + php/src/Google/Protobuf/Internal/EnumDescriptorProto.php \ + php/src/Google/Protobuf/Internal/GPBWire.php \ + php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php \ + php/src/Google/Protobuf/Internal/FieldOptions.php \ + php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php \ + php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php \ + php/src/Google/Protobuf/Internal/GPBType.php \ + php/src/Google/Protobuf/Internal/FieldOptions_JSType.php \ + php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php \ + php/src/Google/Protobuf/Internal/SourceCodeInfo.php \ + php/src/Google/Protobuf/Internal/EnumOptions.php \ + php/src/Google/Protobuf/Internal/GPBLabel.php \ + php/src/Google/Protobuf/Internal/EnumBuilderContext.php \ + php/src/Google/Protobuf/Internal/GPBUtil.php \ + php/src/Google/Protobuf/Internal/FieldOptions_CType.php \ + php/src/Google/Protobuf/descriptor.php \ + php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php \ + php/tests/autoload.php \ + php/tests/encode_decode_test.php \ + php/tests/test.sh \ + php/tests/gdb_test.sh \ + php/tests/generated_class_test.php \ + php/tests/array_test.php \ + php/tests/php_implementation_test.php \ + php/tests/proto/test_include.proto \ + php/tests/map_field_test.php \ + php/tests/test_base.php \ + php/tests/proto/test_no_namespace.proto \ + php/tests/test_util.php \ + php/tests/proto/test.proto \ + php/tests/memory_leak_test.php \ + php/tests/well_known_test.php \ + php/README.md \ + php/ext/google/protobuf/utf8.h \ + php/ext/google/protobuf/message.c \ + php/ext/google/protobuf/utf8.c \ + php/ext/google/protobuf/package.xml \ + php/ext/google/protobuf/upb.h \ + php/ext/google/protobuf/array.c \ + php/ext/google/protobuf/encode_decode.c \ + php/ext/google/protobuf/protobuf.h \ + php/ext/google/protobuf/type_check.c \ + php/ext/google/protobuf/def.c \ + php/ext/google/protobuf/storage.c \ + php/ext/google/protobuf/map.c \ + php/ext/google/protobuf/config.m4 \ + php/ext/google/protobuf/upb.c \ + php/ext/google/protobuf/protobuf.c \ + php/phpunit.xml \ + php/composer.json \ composer.json python_EXTRA_DIST= \ diff --git a/composer.json b/composer.json index 6afe71ce..2833f0a2 100644 --- a/composer.json +++ b/composer.json @@ -13,11 +13,11 @@ }, "autoload": { "psr-4": { - "Google\\": "php/src/Google" + "Google\\Protobuf\\Internal\\": "src/Google/Protobuf/Internal", + "GPBMetadata\\Google\\Protobuf\\Internal\\": "src/GPBMetadata/Google/Protobuf/Internal" }, "files": [ - "php/src/Google/Protobuf/descriptor.php", - "php/src/Google/Protobuf/descriptor_internal.pb.php" + "src/Google/Protobuf/descriptor.php" ] } } diff --git a/jenkins/docker/Dockerfile b/jenkins/docker/Dockerfile index 3f4725b2..ca56a7c0 100644 --- a/jenkins/docker/Dockerfile +++ b/jenkins/docker/Dockerfile @@ -148,7 +148,7 @@ RUN php composer-setup.php RUN mv composer.phar /usr/bin/composer RUN php -r "unlink('composer-setup.php');" RUN cd /tmp && \ - cd protobuf && \ + cd protobuf/php && \ ln -sfn /usr/bin/php5.5 /usr/bin/php && \ ln -sfn /usr/bin/php-config5.5 /usr/bin/php-config && \ ln -sfn /usr/bin/phpize5.5 /usr/bin/phpize && \ diff --git a/jenkins/docker32/Dockerfile b/jenkins/docker32/Dockerfile index a36338b4..bf59503f 100644 --- a/jenkins/docker32/Dockerfile +++ b/jenkins/docker32/Dockerfile @@ -63,7 +63,7 @@ RUN mv composer.phar /usr/bin/composer RUN php -r "unlink('composer-setup.php');" RUN cd /tmp && \ git clone https://github.com/google/protobuf.git && \ - cd protobuf && \ + cd protobuf/php && \ git reset 734930f9197b7bc97c3c794c7a949fee2a08c280 && \ ln -sfn /usr/bin/php5.5 /usr/bin/php && \ ln -sfn /usr/bin/php-config5.5 /usr/bin/php-config && \ diff --git a/php/composer.json b/php/composer.json new file mode 100644 index 00000000..3dae2865 --- /dev/null +++ b/php/composer.json @@ -0,0 +1,27 @@ +{ + "name": "google/protobuf", + "type": "library", + "description": "proto library for PHP", + "keywords": ["proto"], + "homepage": "https://developers.google.com/protocol-buffers/", + "license": "BSD-3-Clause", + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": ">=4.8.0" + }, + "autoload": { + "psr-4": { + "Foo\\": "tests/generated/Foo", + "Bar\\": "tests/generated/Bar", + "Google\\Protobuf\\": "tests/generated/Google/Protobuf", + "Google\\Protobuf\\Internal\\": "src/Google/Protobuf/Internal", + "GPBMetadata\\": "tests/generated/GPBMetadata", + "GPBMetadata\\Google\\Protobuf\\Internal\\": "src/GPBMetadata/Google/Protobuf/Internal" + }, + "files": [ + "src/Google/Protobuf/descriptor.php" + ] + } +} diff --git a/php/ext/google/protobuf/message.c b/php/ext/google/protobuf/message.c index d8fbbe11..16e397f5 100644 --- a/php/ext/google/protobuf/message.c +++ b/php/ext/google/protobuf/message.c @@ -41,6 +41,7 @@ static zend_function_entry message_methods[] = { PHP_ME(Message, decode, NULL, ZEND_ACC_PUBLIC) PHP_ME(Message, readOneof, NULL, ZEND_ACC_PROTECTED) PHP_ME(Message, writeOneof, NULL, ZEND_ACC_PROTECTED) + PHP_ME(Message, __construct, NULL, ZEND_ACC_PROTECTED) {NULL, NULL, NULL} }; @@ -210,6 +211,17 @@ void build_class_from_descriptor(zval* php_descriptor TSRMLS_DC) { // PHP Methods // ----------------------------------------------------------------------------- +// At the first time the message is created, the class entry hasn't been +// modified. As a result, the first created instance will be a normal zend +// object. Here, we manually modify it to our message in such a case. +PHP_METHOD(Message, __construct) { + if (Z_OBJVAL_P(getThis()).handlers != message_handlers) { + zend_class_entry* ce = Z_OBJCE_P(getThis()); + zval_dtor(getThis()); + Z_OBJVAL_P(getThis()) = message_create(ce TSRMLS_CC); + } +} + PHP_METHOD(Message, readOneof) { long index; diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h index fb5879dc..8022a9aa 100644 --- a/php/ext/google/protobuf/protobuf.h +++ b/php/ext/google/protobuf/protobuf.h @@ -231,8 +231,8 @@ struct MessageHeader { }; MessageLayout* create_layout(const upb_msgdef* msgdef); -void layout_init(MessageLayout* layout, void* storage, zval** properties_table - TSRMLS_DC); +void layout_init(MessageLayout* layout, void* storage, + zval** properties_table TSRMLS_DC); zval* layout_get(MessageLayout* layout, const void* storage, const upb_fielddef* field, zval** cache TSRMLS_DC); void layout_set(MessageLayout* layout, MessageHeader* header, @@ -241,6 +241,7 @@ void free_layout(MessageLayout* layout); PHP_METHOD(Message, readOneof); PHP_METHOD(Message, writeOneof); +PHP_METHOD(Message, __construct); // ----------------------------------------------------------------------------- // Encode / Decode. diff --git a/php/ext/google/protobuf/storage.c b/php/ext/google/protobuf/storage.c index 1d25a91b..8a2b3a22 100644 --- a/php/ext/google/protobuf/storage.c +++ b/php/ext/google/protobuf/storage.c @@ -458,8 +458,8 @@ void free_layout(MessageLayout* layout) { FREE(layout); } -void layout_init(MessageLayout* layout, void* storage, zval** properties_table - TSRMLS_DC) { +void layout_init(MessageLayout* layout, void* storage, + zval** properties_table TSRMLS_DC) { int i; upb_msg_field_iter it; for (upb_msg_field_begin(&it, layout->msgdef), i = 0; !upb_msg_field_done(&it); @@ -479,8 +479,8 @@ void layout_init(MessageLayout* layout, void* storage, zval** properties_table DEREF(memory, zval**) = property_ptr; } else if (upb_fielddef_label(field) == UPB_LABEL_REPEATED) { zval_ptr_dtor(property_ptr); - repeated_field_create_with_type(repeated_field_type, field, property_ptr - TSRMLS_CC); + repeated_field_create_with_type(repeated_field_type, field, + property_ptr TSRMLS_CC); DEREF(memory, zval**) = property_ptr; } else { native_slot_init(upb_fielddef_type(field), memory, property_ptr); diff --git a/php/phpunit.xml b/php/phpunit.xml new file mode 100644 index 00000000..0191a601 --- /dev/null +++ b/php/phpunit.xml @@ -0,0 +1,14 @@ + + + + + tests/php_implementation_test.php + tests/array_test.php + tests/encode_decode_test.php + tests/generated_class_test.php + tests/map_field_test.php + tests/well_known_test.php + + + diff --git a/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php b/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php new file mode 100644 index 00000000..7c5c8df4 --- /dev/null +++ b/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php @@ -0,0 +1,260 @@ +addMessage('google.protobuf.internal.FileDescriptorSet', \Google\Protobuf\Internal\FileDescriptorSet::class) + ->repeated('file', \Google\Protobuf\Internal\GPBType::MESSAGE, 1, 'google.protobuf.internal.FileDescriptorProto') + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.FileDescriptorProto', \Google\Protobuf\Internal\FileDescriptorProto::class) + ->optional('name', \Google\Protobuf\Internal\GPBType::STRING, 1) + ->optional('package', \Google\Protobuf\Internal\GPBType::STRING, 2) + ->repeated('dependency', \Google\Protobuf\Internal\GPBType::STRING, 3) + ->repeated('public_dependency', \Google\Protobuf\Internal\GPBType::INT32, 10) + ->repeated('weak_dependency', \Google\Protobuf\Internal\GPBType::INT32, 11) + ->repeated('message_type', \Google\Protobuf\Internal\GPBType::MESSAGE, 4, 'google.protobuf.internal.DescriptorProto') + ->repeated('enum_type', \Google\Protobuf\Internal\GPBType::MESSAGE, 5, 'google.protobuf.internal.EnumDescriptorProto') + ->repeated('service', \Google\Protobuf\Internal\GPBType::MESSAGE, 6, 'google.protobuf.internal.ServiceDescriptorProto') + ->repeated('extension', \Google\Protobuf\Internal\GPBType::MESSAGE, 7, 'google.protobuf.internal.FieldDescriptorProto') + ->optional('options', \Google\Protobuf\Internal\GPBType::MESSAGE, 8, 'google.protobuf.internal.FileOptions') + ->optional('source_code_info', \Google\Protobuf\Internal\GPBType::MESSAGE, 9, 'google.protobuf.internal.SourceCodeInfo') + ->optional('syntax', \Google\Protobuf\Internal\GPBType::STRING, 12) + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.DescriptorProto', \Google\Protobuf\Internal\DescriptorProto::class) + ->optional('name', \Google\Protobuf\Internal\GPBType::STRING, 1) + ->repeated('field', \Google\Protobuf\Internal\GPBType::MESSAGE, 2, 'google.protobuf.internal.FieldDescriptorProto') + ->repeated('extension', \Google\Protobuf\Internal\GPBType::MESSAGE, 6, 'google.protobuf.internal.FieldDescriptorProto') + ->repeated('nested_type', \Google\Protobuf\Internal\GPBType::MESSAGE, 3, 'google.protobuf.internal.DescriptorProto') + ->repeated('enum_type', \Google\Protobuf\Internal\GPBType::MESSAGE, 4, 'google.protobuf.internal.EnumDescriptorProto') + ->repeated('extension_range', \Google\Protobuf\Internal\GPBType::MESSAGE, 5, 'google.protobuf.internal.DescriptorProto.ExtensionRange') + ->repeated('oneof_decl', \Google\Protobuf\Internal\GPBType::MESSAGE, 8, 'google.protobuf.internal.OneofDescriptorProto') + ->optional('options', \Google\Protobuf\Internal\GPBType::MESSAGE, 7, 'google.protobuf.internal.MessageOptions') + ->repeated('reserved_range', \Google\Protobuf\Internal\GPBType::MESSAGE, 9, 'google.protobuf.internal.DescriptorProto.ReservedRange') + ->repeated('reserved_name', \Google\Protobuf\Internal\GPBType::STRING, 10) + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.DescriptorProto.ExtensionRange', \Google\Protobuf\Internal\DescriptorProto_ExtensionRange::class) + ->optional('start', \Google\Protobuf\Internal\GPBType::INT32, 1) + ->optional('end', \Google\Protobuf\Internal\GPBType::INT32, 2) + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.DescriptorProto.ReservedRange', \Google\Protobuf\Internal\DescriptorProto_ReservedRange::class) + ->optional('start', \Google\Protobuf\Internal\GPBType::INT32, 1) + ->optional('end', \Google\Protobuf\Internal\GPBType::INT32, 2) + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.FieldDescriptorProto', \Google\Protobuf\Internal\FieldDescriptorProto::class) + ->optional('name', \Google\Protobuf\Internal\GPBType::STRING, 1) + ->optional('number', \Google\Protobuf\Internal\GPBType::INT32, 3) + ->optional('label', \Google\Protobuf\Internal\GPBType::ENUM, 4, 'google.protobuf.internal.FieldDescriptorProto.Label') + ->optional('type', \Google\Protobuf\Internal\GPBType::ENUM, 5, 'google.protobuf.internal.FieldDescriptorProto.Type') + ->optional('type_name', \Google\Protobuf\Internal\GPBType::STRING, 6) + ->optional('extendee', \Google\Protobuf\Internal\GPBType::STRING, 2) + ->optional('default_value', \Google\Protobuf\Internal\GPBType::STRING, 7) + ->optional('oneof_index', \Google\Protobuf\Internal\GPBType::INT32, 9) + ->optional('json_name', \Google\Protobuf\Internal\GPBType::STRING, 10) + ->optional('options', \Google\Protobuf\Internal\GPBType::MESSAGE, 8, 'google.protobuf.internal.FieldOptions') + ->finalizeToPool(); + + $pool->addEnum('google.protobuf.internal.FieldDescriptorProto.Type', \Google\Protobuf\Internal\Type::class) + ->value("TYPE_DOUBLE", 1) + ->value("TYPE_FLOAT", 2) + ->value("TYPE_INT64", 3) + ->value("TYPE_UINT64", 4) + ->value("TYPE_INT32", 5) + ->value("TYPE_FIXED64", 6) + ->value("TYPE_FIXED32", 7) + ->value("TYPE_BOOL", 8) + ->value("TYPE_STRING", 9) + ->value("TYPE_GROUP", 10) + ->value("TYPE_MESSAGE", 11) + ->value("TYPE_BYTES", 12) + ->value("TYPE_UINT32", 13) + ->value("TYPE_ENUM", 14) + ->value("TYPE_SFIXED32", 15) + ->value("TYPE_SFIXED64", 16) + ->value("TYPE_SINT32", 17) + ->value("TYPE_SINT64", 18) + ->finalizeToPool(); + + $pool->addEnum('google.protobuf.internal.FieldDescriptorProto.Label', \Google\Protobuf\Internal\Label::class) + ->value("LABEL_OPTIONAL", 1) + ->value("LABEL_REQUIRED", 2) + ->value("LABEL_REPEATED", 3) + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.OneofDescriptorProto', \Google\Protobuf\Internal\OneofDescriptorProto::class) + ->optional('name', \Google\Protobuf\Internal\GPBType::STRING, 1) + ->optional('options', \Google\Protobuf\Internal\GPBType::MESSAGE, 2, 'google.protobuf.internal.OneofOptions') + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.EnumDescriptorProto', \Google\Protobuf\Internal\EnumDescriptorProto::class) + ->optional('name', \Google\Protobuf\Internal\GPBType::STRING, 1) + ->repeated('value', \Google\Protobuf\Internal\GPBType::MESSAGE, 2, 'google.protobuf.internal.EnumValueDescriptorProto') + ->optional('options', \Google\Protobuf\Internal\GPBType::MESSAGE, 3, 'google.protobuf.internal.EnumOptions') + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.EnumValueDescriptorProto', \Google\Protobuf\Internal\EnumValueDescriptorProto::class) + ->optional('name', \Google\Protobuf\Internal\GPBType::STRING, 1) + ->optional('number', \Google\Protobuf\Internal\GPBType::INT32, 2) + ->optional('options', \Google\Protobuf\Internal\GPBType::MESSAGE, 3, 'google.protobuf.internal.EnumValueOptions') + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.ServiceDescriptorProto', \Google\Protobuf\Internal\ServiceDescriptorProto::class) + ->optional('name', \Google\Protobuf\Internal\GPBType::STRING, 1) + ->repeated('method', \Google\Protobuf\Internal\GPBType::MESSAGE, 2, 'google.protobuf.internal.MethodDescriptorProto') + ->optional('options', \Google\Protobuf\Internal\GPBType::MESSAGE, 3, 'google.protobuf.internal.ServiceOptions') + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.MethodDescriptorProto', \Google\Protobuf\Internal\MethodDescriptorProto::class) + ->optional('name', \Google\Protobuf\Internal\GPBType::STRING, 1) + ->optional('input_type', \Google\Protobuf\Internal\GPBType::STRING, 2) + ->optional('output_type', \Google\Protobuf\Internal\GPBType::STRING, 3) + ->optional('options', \Google\Protobuf\Internal\GPBType::MESSAGE, 4, 'google.protobuf.internal.MethodOptions') + ->optional('client_streaming', \Google\Protobuf\Internal\GPBType::BOOL, 5) + ->optional('server_streaming', \Google\Protobuf\Internal\GPBType::BOOL, 6) + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.FileOptions', \Google\Protobuf\Internal\FileOptions::class) + ->optional('java_package', \Google\Protobuf\Internal\GPBType::STRING, 1) + ->optional('java_outer_classname', \Google\Protobuf\Internal\GPBType::STRING, 8) + ->optional('java_multiple_files', \Google\Protobuf\Internal\GPBType::BOOL, 10) + ->optional('java_generate_equals_and_hash', \Google\Protobuf\Internal\GPBType::BOOL, 20) + ->optional('java_string_check_utf8', \Google\Protobuf\Internal\GPBType::BOOL, 27) + ->optional('optimize_for', \Google\Protobuf\Internal\GPBType::ENUM, 9, 'google.protobuf.internal.FileOptions.OptimizeMode') + ->optional('go_package', \Google\Protobuf\Internal\GPBType::STRING, 11) + ->optional('cc_generic_services', \Google\Protobuf\Internal\GPBType::BOOL, 16) + ->optional('java_generic_services', \Google\Protobuf\Internal\GPBType::BOOL, 17) + ->optional('py_generic_services', \Google\Protobuf\Internal\GPBType::BOOL, 18) + ->optional('deprecated', \Google\Protobuf\Internal\GPBType::BOOL, 23) + ->optional('cc_enable_arenas', \Google\Protobuf\Internal\GPBType::BOOL, 31) + ->optional('objc_class_prefix', \Google\Protobuf\Internal\GPBType::STRING, 36) + ->optional('csharp_namespace', \Google\Protobuf\Internal\GPBType::STRING, 37) + ->optional('swift_prefix', \Google\Protobuf\Internal\GPBType::STRING, 39) + ->repeated('uninterpreted_option', \Google\Protobuf\Internal\GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') + ->finalizeToPool(); + + $pool->addEnum('google.protobuf.internal.FileOptions.OptimizeMode', \Google\Protobuf\Internal\OptimizeMode::class) + ->value("SPEED", 1) + ->value("CODE_SIZE", 2) + ->value("LITE_RUNTIME", 3) + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.MessageOptions', \Google\Protobuf\Internal\MessageOptions::class) + ->optional('message_set_wire_format', \Google\Protobuf\Internal\GPBType::BOOL, 1) + ->optional('no_standard_descriptor_accessor', \Google\Protobuf\Internal\GPBType::BOOL, 2) + ->optional('deprecated', \Google\Protobuf\Internal\GPBType::BOOL, 3) + ->optional('map_entry', \Google\Protobuf\Internal\GPBType::BOOL, 7) + ->repeated('uninterpreted_option', \Google\Protobuf\Internal\GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.FieldOptions', \Google\Protobuf\Internal\FieldOptions::class) + ->optional('ctype', \Google\Protobuf\Internal\GPBType::ENUM, 1, 'google.protobuf.internal.FieldOptions.CType') + ->optional('packed', \Google\Protobuf\Internal\GPBType::BOOL, 2) + ->optional('jstype', \Google\Protobuf\Internal\GPBType::ENUM, 6, 'google.protobuf.internal.FieldOptions.JSType') + ->optional('lazy', \Google\Protobuf\Internal\GPBType::BOOL, 5) + ->optional('deprecated', \Google\Protobuf\Internal\GPBType::BOOL, 3) + ->optional('weak', \Google\Protobuf\Internal\GPBType::BOOL, 10) + ->repeated('uninterpreted_option', \Google\Protobuf\Internal\GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') + ->finalizeToPool(); + + $pool->addEnum('google.protobuf.internal.FieldOptions.CType', \Google\Protobuf\Internal\CType::class) + ->value("STRING", 0) + ->value("CORD", 1) + ->value("STRING_PIECE", 2) + ->finalizeToPool(); + + $pool->addEnum('google.protobuf.internal.FieldOptions.JSType', \Google\Protobuf\Internal\JSType::class) + ->value("JS_NORMAL", 0) + ->value("JS_STRING", 1) + ->value("JS_NUMBER", 2) + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.OneofOptions', \Google\Protobuf\Internal\OneofOptions::class) + ->repeated('uninterpreted_option', \Google\Protobuf\Internal\GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.EnumOptions', \Google\Protobuf\Internal\EnumOptions::class) + ->optional('allow_alias', \Google\Protobuf\Internal\GPBType::BOOL, 2) + ->optional('deprecated', \Google\Protobuf\Internal\GPBType::BOOL, 3) + ->repeated('uninterpreted_option', \Google\Protobuf\Internal\GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.EnumValueOptions', \Google\Protobuf\Internal\EnumValueOptions::class) + ->optional('deprecated', \Google\Protobuf\Internal\GPBType::BOOL, 1) + ->repeated('uninterpreted_option', \Google\Protobuf\Internal\GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.ServiceOptions', \Google\Protobuf\Internal\ServiceOptions::class) + ->optional('deprecated', \Google\Protobuf\Internal\GPBType::BOOL, 33) + ->repeated('uninterpreted_option', \Google\Protobuf\Internal\GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.MethodOptions', \Google\Protobuf\Internal\MethodOptions::class) + ->optional('deprecated', \Google\Protobuf\Internal\GPBType::BOOL, 33) + ->optional('idempotency_level', \Google\Protobuf\Internal\GPBType::ENUM, 34, 'google.protobuf.internal.MethodOptions.IdempotencyLevel') + ->repeated('uninterpreted_option', \Google\Protobuf\Internal\GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') + ->finalizeToPool(); + + $pool->addEnum('google.protobuf.internal.MethodOptions.IdempotencyLevel', \Google\Protobuf\Internal\IdempotencyLevel::class) + ->value("IDEMPOTENCY_UNKNOWN", 0) + ->value("NO_SIDE_EFFECTS", 1) + ->value("IDEMPOTENT", 2) + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.UninterpretedOption', \Google\Protobuf\Internal\UninterpretedOption::class) + ->repeated('name', \Google\Protobuf\Internal\GPBType::MESSAGE, 2, 'google.protobuf.internal.UninterpretedOption.NamePart') + ->optional('identifier_value', \Google\Protobuf\Internal\GPBType::STRING, 3) + ->optional('positive_int_value', \Google\Protobuf\Internal\GPBType::UINT64, 4) + ->optional('negative_int_value', \Google\Protobuf\Internal\GPBType::INT64, 5) + ->optional('double_value', \Google\Protobuf\Internal\GPBType::DOUBLE, 6) + ->optional('string_value', \Google\Protobuf\Internal\GPBType::BYTES, 7) + ->optional('aggregate_value', \Google\Protobuf\Internal\GPBType::STRING, 8) + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.UninterpretedOption.NamePart', \Google\Protobuf\Internal\UninterpretedOption_NamePart::class) + ->required('name_part', \Google\Protobuf\Internal\GPBType::STRING, 1) + ->required('is_extension', \Google\Protobuf\Internal\GPBType::BOOL, 2) + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.SourceCodeInfo', \Google\Protobuf\Internal\SourceCodeInfo::class) + ->repeated('location', \Google\Protobuf\Internal\GPBType::MESSAGE, 1, 'google.protobuf.internal.SourceCodeInfo.Location') + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.SourceCodeInfo.Location', \Google\Protobuf\Internal\SourceCodeInfo_Location::class) + ->repeated('path', \Google\Protobuf\Internal\GPBType::INT32, 1) + ->repeated('span', \Google\Protobuf\Internal\GPBType::INT32, 2) + ->optional('leading_comments', \Google\Protobuf\Internal\GPBType::STRING, 3) + ->optional('trailing_comments', \Google\Protobuf\Internal\GPBType::STRING, 4) + ->repeated('leading_detached_comments', \Google\Protobuf\Internal\GPBType::STRING, 6) + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.GeneratedCodeInfo', \Google\Protobuf\Internal\GeneratedCodeInfo::class) + ->repeated('annotation', \Google\Protobuf\Internal\GPBType::MESSAGE, 1, 'google.protobuf.internal.GeneratedCodeInfo.Annotation') + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.GeneratedCodeInfo.Annotation', \Google\Protobuf\Internal\GeneratedCodeInfo_Annotation::class) + ->repeated('path', \Google\Protobuf\Internal\GPBType::INT32, 1) + ->optional('source_file', \Google\Protobuf\Internal\GPBType::STRING, 2) + ->optional('begin', \Google\Protobuf\Internal\GPBType::INT32, 3) + ->optional('end', \Google\Protobuf\Internal\GPBType::INT32, 4) + ->finalizeToPool(); + + $pool->finish(); + static::$is_initialized = true; + } +} + diff --git a/php/src/Google/Protobuf/Internal/DescriptorProto.php b/php/src/Google/Protobuf/Internal/DescriptorProto.php new file mode 100644 index 00000000..f076f6be --- /dev/null +++ b/php/src/Google/Protobuf/Internal/DescriptorProto.php @@ -0,0 +1,325 @@ + + * Describes a message type. + * + * + * Protobuf type google.protobuf.DescriptorProto + */ +class DescriptorProto extends \Google\Protobuf\Internal\Message +{ + /** + * optional string name = 1; + */ + private $name = ''; + private $has_name = false; + /** + * repeated .google.protobuf.FieldDescriptorProto field = 2; + */ + private $field; + private $has_field = false; + /** + * repeated .google.protobuf.FieldDescriptorProto extension = 6; + */ + private $extension; + private $has_extension = false; + /** + * repeated .google.protobuf.DescriptorProto nested_type = 3; + */ + private $nested_type; + private $has_nested_type = false; + /** + * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; + */ + private $enum_type; + private $has_enum_type = false; + /** + * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; + */ + private $extension_range; + private $has_extension_range = false; + /** + * repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; + */ + private $oneof_decl; + private $has_oneof_decl = false; + /** + * optional .google.protobuf.MessageOptions options = 7; + */ + private $options = null; + private $has_options = false; + /** + * repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; + */ + private $reserved_range; + private $has_reserved_range = false; + /** + *
+     * Reserved field names, which may not be used by fields in the same message.
+     * A given name may only be reserved once.
+     * 
+ * + * repeated string reserved_name = 10; + */ + private $reserved_name; + private $has_reserved_name = false; + + public function __construct() { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct(); + } + + /** + * optional string name = 1; + */ + public function getName() + { + return $this->name; + } + + /** + * optional string name = 1; + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + $this->has_name = true; + } + + public function hasName() + { + return $this->has_name; + } + + /** + * repeated .google.protobuf.FieldDescriptorProto field = 2; + */ + public function getField() + { + return $this->field; + } + + /** + * repeated .google.protobuf.FieldDescriptorProto field = 2; + */ + public function setField(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FieldDescriptorProto::class); + $this->field = $var; + $this->has_field = true; + } + + public function hasField() + { + return $this->has_field; + } + + /** + * repeated .google.protobuf.FieldDescriptorProto extension = 6; + */ + public function getExtension() + { + return $this->extension; + } + + /** + * repeated .google.protobuf.FieldDescriptorProto extension = 6; + */ + public function setExtension(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FieldDescriptorProto::class); + $this->extension = $var; + $this->has_extension = true; + } + + public function hasExtension() + { + return $this->has_extension; + } + + /** + * repeated .google.protobuf.DescriptorProto nested_type = 3; + */ + public function getNestedType() + { + return $this->nested_type; + } + + /** + * repeated .google.protobuf.DescriptorProto nested_type = 3; + */ + public function setNestedType(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto::class); + $this->nested_type = $var; + $this->has_nested_type = true; + } + + public function hasNestedType() + { + return $this->has_nested_type; + } + + /** + * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; + */ + public function getEnumType() + { + return $this->enum_type; + } + + /** + * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; + */ + public function setEnumType(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumDescriptorProto::class); + $this->enum_type = $var; + $this->has_enum_type = true; + } + + public function hasEnumType() + { + return $this->has_enum_type; + } + + /** + * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; + */ + public function getExtensionRange() + { + return $this->extension_range; + } + + /** + * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; + */ + public function setExtensionRange(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto_ExtensionRange::class); + $this->extension_range = $var; + $this->has_extension_range = true; + } + + public function hasExtensionRange() + { + return $this->has_extension_range; + } + + /** + * repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; + */ + public function getOneofDecl() + { + return $this->oneof_decl; + } + + /** + * repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; + */ + public function setOneofDecl(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\OneofDescriptorProto::class); + $this->oneof_decl = $var; + $this->has_oneof_decl = true; + } + + public function hasOneofDecl() + { + return $this->has_oneof_decl; + } + + /** + * optional .google.protobuf.MessageOptions options = 7; + */ + public function getOptions() + { + return $this->options; + } + + /** + * optional .google.protobuf.MessageOptions options = 7; + */ + public function setOptions(&$var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\MessageOptions::class); + $this->options = $var; + $this->has_options = true; + } + + public function hasOptions() + { + return $this->has_options; + } + + /** + * repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; + */ + public function getReservedRange() + { + return $this->reserved_range; + } + + /** + * repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; + */ + public function setReservedRange(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto_ReservedRange::class); + $this->reserved_range = $var; + $this->has_reserved_range = true; + } + + public function hasReservedRange() + { + return $this->has_reserved_range; + } + + /** + *
+     * Reserved field names, which may not be used by fields in the same message.
+     * A given name may only be reserved once.
+     * 
+ * + * repeated string reserved_name = 10; + */ + public function getReservedName() + { + return $this->reserved_name; + } + + /** + *
+     * Reserved field names, which may not be used by fields in the same message.
+     * A given name may only be reserved once.
+     * 
+ * + * repeated string reserved_name = 10; + */ + public function setReservedName(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->reserved_name = $var; + $this->has_reserved_name = true; + } + + public function hasReservedName() + { + return $this->has_reserved_name; + } + +} + diff --git a/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php b/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php new file mode 100644 index 00000000..738a1738 --- /dev/null +++ b/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php @@ -0,0 +1,82 @@ +google.protobuf.DescriptorProto.ExtensionRange + */ +class DescriptorProto_ExtensionRange extends \Google\Protobuf\Internal\Message +{ + /** + * optional int32 start = 1; + */ + private $start = 0; + private $has_start = false; + /** + * optional int32 end = 2; + */ + private $end = 0; + private $has_end = false; + + public function __construct() { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct(); + } + + /** + * optional int32 start = 1; + */ + public function getStart() + { + return $this->start; + } + + /** + * optional int32 start = 1; + */ + public function setStart($var) + { + GPBUtil::checkInt32($var); + $this->start = $var; + $this->has_start = true; + } + + public function hasStart() + { + return $this->has_start; + } + + /** + * optional int32 end = 2; + */ + public function getEnd() + { + return $this->end; + } + + /** + * optional int32 end = 2; + */ + public function setEnd($var) + { + GPBUtil::checkInt32($var); + $this->end = $var; + $this->has_end = true; + } + + public function hasEnd() + { + return $this->has_end; + } + +} + diff --git a/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php b/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php new file mode 100644 index 00000000..be36b8aa --- /dev/null +++ b/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php @@ -0,0 +1,112 @@ + + * Range of reserved tag numbers. Reserved tag numbers may not be used by + * fields or extension ranges in the same message. Reserved ranges may + * not overlap. + * + * + * Protobuf type google.protobuf.DescriptorProto.ReservedRange + */ +class DescriptorProto_ReservedRange extends \Google\Protobuf\Internal\Message +{ + /** + *
+     * Inclusive.
+     * 
+ * + * optional int32 start = 1; + */ + private $start = 0; + private $has_start = false; + /** + *
+     * Exclusive.
+     * 
+ * + * optional int32 end = 2; + */ + private $end = 0; + private $has_end = false; + + public function __construct() { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct(); + } + + /** + *
+     * Inclusive.
+     * 
+ * + * optional int32 start = 1; + */ + public function getStart() + { + return $this->start; + } + + /** + *
+     * Inclusive.
+     * 
+ * + * optional int32 start = 1; + */ + public function setStart($var) + { + GPBUtil::checkInt32($var); + $this->start = $var; + $this->has_start = true; + } + + public function hasStart() + { + return $this->has_start; + } + + /** + *
+     * Exclusive.
+     * 
+ * + * optional int32 end = 2; + */ + public function getEnd() + { + return $this->end; + } + + /** + *
+     * Exclusive.
+     * 
+ * + * optional int32 end = 2; + */ + public function setEnd($var) + { + GPBUtil::checkInt32($var); + $this->end = $var; + $this->has_end = true; + } + + public function hasEnd() + { + return $this->has_end; + } + +} + diff --git a/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php b/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php new file mode 100644 index 00000000..9c5f245b --- /dev/null +++ b/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php @@ -0,0 +1,114 @@ + + * Describes an enum type. + * + * + * Protobuf type google.protobuf.EnumDescriptorProto + */ +class EnumDescriptorProto extends \Google\Protobuf\Internal\Message +{ + /** + * optional string name = 1; + */ + private $name = ''; + private $has_name = false; + /** + * repeated .google.protobuf.EnumValueDescriptorProto value = 2; + */ + private $value; + private $has_value = false; + /** + * optional .google.protobuf.EnumOptions options = 3; + */ + private $options = null; + private $has_options = false; + + public function __construct() { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct(); + } + + /** + * optional string name = 1; + */ + public function getName() + { + return $this->name; + } + + /** + * optional string name = 1; + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + $this->has_name = true; + } + + public function hasName() + { + return $this->has_name; + } + + /** + * repeated .google.protobuf.EnumValueDescriptorProto value = 2; + */ + public function getValue() + { + return $this->value; + } + + /** + * repeated .google.protobuf.EnumValueDescriptorProto value = 2; + */ + public function setValue(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumValueDescriptorProto::class); + $this->value = $var; + $this->has_value = true; + } + + public function hasValue() + { + return $this->has_value; + } + + /** + * optional .google.protobuf.EnumOptions options = 3; + */ + public function getOptions() + { + return $this->options; + } + + /** + * optional .google.protobuf.EnumOptions options = 3; + */ + public function setOptions(&$var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\EnumOptions::class); + $this->options = $var; + $this->has_options = true; + } + + public function hasOptions() + { + return $this->has_options; + } + +} + diff --git a/php/src/Google/Protobuf/Internal/EnumOptions.php b/php/src/Google/Protobuf/Internal/EnumOptions.php new file mode 100644 index 00000000..a9c4e0d7 --- /dev/null +++ b/php/src/Google/Protobuf/Internal/EnumOptions.php @@ -0,0 +1,158 @@ +google.protobuf.EnumOptions + */ +class EnumOptions extends \Google\Protobuf\Internal\Message +{ + /** + *
+     * Set this option to true to allow mapping different tag names to the same
+     * value.
+     * 
+ * + * optional bool allow_alias = 2; + */ + private $allow_alias = false; + private $has_allow_alias = false; + /** + *
+     * Is this enum deprecated?
+     * Depending on the target platform, this can emit Deprecated annotations
+     * for the enum, or it will be completely ignored; in the very least, this
+     * is a formalization for deprecating enums.
+     * 
+ * + * optional bool deprecated = 3 [default = false]; + */ + private $deprecated = false; + private $has_deprecated = false; + /** + *
+     * The parser stores options it doesn't recognize here. See above.
+     * 
+ * + * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + private $uninterpreted_option; + private $has_uninterpreted_option = false; + + public function __construct() { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct(); + } + + /** + *
+     * Set this option to true to allow mapping different tag names to the same
+     * value.
+     * 
+ * + * optional bool allow_alias = 2; + */ + public function getAllowAlias() + { + return $this->allow_alias; + } + + /** + *
+     * Set this option to true to allow mapping different tag names to the same
+     * value.
+     * 
+ * + * optional bool allow_alias = 2; + */ + public function setAllowAlias($var) + { + GPBUtil::checkBool($var); + $this->allow_alias = $var; + $this->has_allow_alias = true; + } + + public function hasAllowAlias() + { + return $this->has_allow_alias; + } + + /** + *
+     * Is this enum deprecated?
+     * Depending on the target platform, this can emit Deprecated annotations
+     * for the enum, or it will be completely ignored; in the very least, this
+     * is a formalization for deprecating enums.
+     * 
+ * + * optional bool deprecated = 3 [default = false]; + */ + public function getDeprecated() + { + return $this->deprecated; + } + + /** + *
+     * Is this enum deprecated?
+     * Depending on the target platform, this can emit Deprecated annotations
+     * for the enum, or it will be completely ignored; in the very least, this
+     * is a formalization for deprecating enums.
+     * 
+ * + * optional bool deprecated = 3 [default = false]; + */ + public function setDeprecated($var) + { + GPBUtil::checkBool($var); + $this->deprecated = $var; + $this->has_deprecated = true; + } + + public function hasDeprecated() + { + return $this->has_deprecated; + } + + /** + *
+     * The parser stores options it doesn't recognize here. See above.
+     * 
+ * + * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + public function getUninterpretedOption() + { + return $this->uninterpreted_option; + } + + /** + *
+     * The parser stores options it doesn't recognize here. See above.
+     * 
+ * + * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + public function setUninterpretedOption(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); + $this->uninterpreted_option = $var; + $this->has_uninterpreted_option = true; + } + + public function hasUninterpretedOption() + { + return $this->has_uninterpreted_option; + } + +} + diff --git a/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php b/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php new file mode 100644 index 00000000..94dc36ec --- /dev/null +++ b/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php @@ -0,0 +1,114 @@ + + * Describes a value within an enum. + * + * + * Protobuf type google.protobuf.EnumValueDescriptorProto + */ +class EnumValueDescriptorProto extends \Google\Protobuf\Internal\Message +{ + /** + * optional string name = 1; + */ + private $name = ''; + private $has_name = false; + /** + * optional int32 number = 2; + */ + private $number = 0; + private $has_number = false; + /** + * optional .google.protobuf.EnumValueOptions options = 3; + */ + private $options = null; + private $has_options = false; + + public function __construct() { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct(); + } + + /** + * optional string name = 1; + */ + public function getName() + { + return $this->name; + } + + /** + * optional string name = 1; + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + $this->has_name = true; + } + + public function hasName() + { + return $this->has_name; + } + + /** + * optional int32 number = 2; + */ + public function getNumber() + { + return $this->number; + } + + /** + * optional int32 number = 2; + */ + public function setNumber($var) + { + GPBUtil::checkInt32($var); + $this->number = $var; + $this->has_number = true; + } + + public function hasNumber() + { + return $this->has_number; + } + + /** + * optional .google.protobuf.EnumValueOptions options = 3; + */ + public function getOptions() + { + return $this->options; + } + + /** + * optional .google.protobuf.EnumValueOptions options = 3; + */ + public function setOptions(&$var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\EnumValueOptions::class); + $this->options = $var; + $this->has_options = true; + } + + public function hasOptions() + { + return $this->has_options; + } + +} + diff --git a/php/src/Google/Protobuf/Internal/EnumValueOptions.php b/php/src/Google/Protobuf/Internal/EnumValueOptions.php new file mode 100644 index 00000000..6446ecd4 --- /dev/null +++ b/php/src/Google/Protobuf/Internal/EnumValueOptions.php @@ -0,0 +1,115 @@ +google.protobuf.EnumValueOptions + */ +class EnumValueOptions extends \Google\Protobuf\Internal\Message +{ + /** + *
+     * Is this enum value deprecated?
+     * Depending on the target platform, this can emit Deprecated annotations
+     * for the enum value, or it will be completely ignored; in the very least,
+     * this is a formalization for deprecating enum values.
+     * 
+ * + * optional bool deprecated = 1 [default = false]; + */ + private $deprecated = false; + private $has_deprecated = false; + /** + *
+     * The parser stores options it doesn't recognize here. See above.
+     * 
+ * + * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + private $uninterpreted_option; + private $has_uninterpreted_option = false; + + public function __construct() { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct(); + } + + /** + *
+     * Is this enum value deprecated?
+     * Depending on the target platform, this can emit Deprecated annotations
+     * for the enum value, or it will be completely ignored; in the very least,
+     * this is a formalization for deprecating enum values.
+     * 
+ * + * optional bool deprecated = 1 [default = false]; + */ + public function getDeprecated() + { + return $this->deprecated; + } + + /** + *
+     * Is this enum value deprecated?
+     * Depending on the target platform, this can emit Deprecated annotations
+     * for the enum value, or it will be completely ignored; in the very least,
+     * this is a formalization for deprecating enum values.
+     * 
+ * + * optional bool deprecated = 1 [default = false]; + */ + public function setDeprecated($var) + { + GPBUtil::checkBool($var); + $this->deprecated = $var; + $this->has_deprecated = true; + } + + public function hasDeprecated() + { + return $this->has_deprecated; + } + + /** + *
+     * The parser stores options it doesn't recognize here. See above.
+     * 
+ * + * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + public function getUninterpretedOption() + { + return $this->uninterpreted_option; + } + + /** + *
+     * The parser stores options it doesn't recognize here. See above.
+     * 
+ * + * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + public function setUninterpretedOption(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); + $this->uninterpreted_option = $var; + $this->has_uninterpreted_option = true; + } + + public function hasUninterpretedOption() + { + return $this->has_uninterpreted_option; + } + +} + diff --git a/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php b/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php new file mode 100644 index 00000000..6ae2cd41 --- /dev/null +++ b/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php @@ -0,0 +1,424 @@ + + * Describes a field within a message. + * + * + * Protobuf type google.protobuf.FieldDescriptorProto + */ +class FieldDescriptorProto extends \Google\Protobuf\Internal\Message +{ + /** + * optional string name = 1; + */ + private $name = ''; + private $has_name = false; + /** + * optional int32 number = 3; + */ + private $number = 0; + private $has_number = false; + /** + * optional .google.protobuf.FieldDescriptorProto.Label label = 4; + */ + private $label = 0; + private $has_label = false; + /** + *
+     * If type_name is set, this need not be set.  If both this and type_name
+     * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
+     * 
+ * + * optional .google.protobuf.FieldDescriptorProto.Type type = 5; + */ + private $type = 0; + private $has_type = false; + /** + *
+     * For message and enum types, this is the name of the type.  If the name
+     * starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping
+     * rules are used to find the type (i.e. first the nested types within this
+     * message are searched, then within the parent, on up to the root
+     * namespace).
+     * 
+ * + * optional string type_name = 6; + */ + private $type_name = ''; + private $has_type_name = false; + /** + *
+     * For extensions, this is the name of the type being extended.  It is
+     * resolved in the same manner as type_name.
+     * 
+ * + * optional string extendee = 2; + */ + private $extendee = ''; + private $has_extendee = false; + /** + *
+     * For numeric types, contains the original text representation of the value.
+     * For booleans, "true" or "false".
+     * For strings, contains the default text contents (not escaped in any way).
+     * For bytes, contains the C escaped value.  All bytes >= 128 are escaped.
+     * TODO(kenton):  Base-64 encode?
+     * 
+ * + * optional string default_value = 7; + */ + private $default_value = ''; + private $has_default_value = false; + /** + *
+     * If set, gives the index of a oneof in the containing type's oneof_decl
+     * list.  This field is a member of that oneof.
+     * 
+ * + * optional int32 oneof_index = 9; + */ + private $oneof_index = 0; + private $has_oneof_index = false; + /** + *
+     * JSON name of this field. The value is set by protocol compiler. If the
+     * user has set a "json_name" option on this field, that option's value
+     * will be used. Otherwise, it's deduced from the field's name by converting
+     * it to camelCase.
+     * 
+ * + * optional string json_name = 10; + */ + private $json_name = ''; + private $has_json_name = false; + /** + * optional .google.protobuf.FieldOptions options = 8; + */ + private $options = null; + private $has_options = false; + + public function __construct() { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct(); + } + + /** + * optional string name = 1; + */ + public function getName() + { + return $this->name; + } + + /** + * optional string name = 1; + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + $this->has_name = true; + } + + public function hasName() + { + return $this->has_name; + } + + /** + * optional int32 number = 3; + */ + public function getNumber() + { + return $this->number; + } + + /** + * optional int32 number = 3; + */ + public function setNumber($var) + { + GPBUtil::checkInt32($var); + $this->number = $var; + $this->has_number = true; + } + + public function hasNumber() + { + return $this->has_number; + } + + /** + * optional .google.protobuf.FieldDescriptorProto.Label label = 4; + */ + public function getLabel() + { + return $this->label; + } + + /** + * optional .google.protobuf.FieldDescriptorProto.Label label = 4; + */ + public function setLabel($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FieldDescriptorProto_Label::class); + $this->label = $var; + $this->has_label = true; + } + + public function hasLabel() + { + return $this->has_label; + } + + /** + *
+     * If type_name is set, this need not be set.  If both this and type_name
+     * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
+     * 
+ * + * optional .google.protobuf.FieldDescriptorProto.Type type = 5; + */ + public function getType() + { + return $this->type; + } + + /** + *
+     * If type_name is set, this need not be set.  If both this and type_name
+     * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
+     * 
+ * + * optional .google.protobuf.FieldDescriptorProto.Type type = 5; + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FieldDescriptorProto_Type::class); + $this->type = $var; + $this->has_type = true; + } + + public function hasType() + { + return $this->has_type; + } + + /** + *
+     * For message and enum types, this is the name of the type.  If the name
+     * starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping
+     * rules are used to find the type (i.e. first the nested types within this
+     * message are searched, then within the parent, on up to the root
+     * namespace).
+     * 
+ * + * optional string type_name = 6; + */ + public function getTypeName() + { + return $this->type_name; + } + + /** + *
+     * For message and enum types, this is the name of the type.  If the name
+     * starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping
+     * rules are used to find the type (i.e. first the nested types within this
+     * message are searched, then within the parent, on up to the root
+     * namespace).
+     * 
+ * + * optional string type_name = 6; + */ + public function setTypeName($var) + { + GPBUtil::checkString($var, True); + $this->type_name = $var; + $this->has_type_name = true; + } + + public function hasTypeName() + { + return $this->has_type_name; + } + + /** + *
+     * For extensions, this is the name of the type being extended.  It is
+     * resolved in the same manner as type_name.
+     * 
+ * + * optional string extendee = 2; + */ + public function getExtendee() + { + return $this->extendee; + } + + /** + *
+     * For extensions, this is the name of the type being extended.  It is
+     * resolved in the same manner as type_name.
+     * 
+ * + * optional string extendee = 2; + */ + public function setExtendee($var) + { + GPBUtil::checkString($var, True); + $this->extendee = $var; + $this->has_extendee = true; + } + + public function hasExtendee() + { + return $this->has_extendee; + } + + /** + *
+     * For numeric types, contains the original text representation of the value.
+     * For booleans, "true" or "false".
+     * For strings, contains the default text contents (not escaped in any way).
+     * For bytes, contains the C escaped value.  All bytes >= 128 are escaped.
+     * TODO(kenton):  Base-64 encode?
+     * 
+ * + * optional string default_value = 7; + */ + public function getDefaultValue() + { + return $this->default_value; + } + + /** + *
+     * For numeric types, contains the original text representation of the value.
+     * For booleans, "true" or "false".
+     * For strings, contains the default text contents (not escaped in any way).
+     * For bytes, contains the C escaped value.  All bytes >= 128 are escaped.
+     * TODO(kenton):  Base-64 encode?
+     * 
+ * + * optional string default_value = 7; + */ + public function setDefaultValue($var) + { + GPBUtil::checkString($var, True); + $this->default_value = $var; + $this->has_default_value = true; + } + + public function hasDefaultValue() + { + return $this->has_default_value; + } + + /** + *
+     * If set, gives the index of a oneof in the containing type's oneof_decl
+     * list.  This field is a member of that oneof.
+     * 
+ * + * optional int32 oneof_index = 9; + */ + public function getOneofIndex() + { + return $this->oneof_index; + } + + /** + *
+     * If set, gives the index of a oneof in the containing type's oneof_decl
+     * list.  This field is a member of that oneof.
+     * 
+ * + * optional int32 oneof_index = 9; + */ + public function setOneofIndex($var) + { + GPBUtil::checkInt32($var); + $this->oneof_index = $var; + $this->has_oneof_index = true; + } + + public function hasOneofIndex() + { + return $this->has_oneof_index; + } + + /** + *
+     * JSON name of this field. The value is set by protocol compiler. If the
+     * user has set a "json_name" option on this field, that option's value
+     * will be used. Otherwise, it's deduced from the field's name by converting
+     * it to camelCase.
+     * 
+ * + * optional string json_name = 10; + */ + public function getJsonName() + { + return $this->json_name; + } + + /** + *
+     * JSON name of this field. The value is set by protocol compiler. If the
+     * user has set a "json_name" option on this field, that option's value
+     * will be used. Otherwise, it's deduced from the field's name by converting
+     * it to camelCase.
+     * 
+ * + * optional string json_name = 10; + */ + public function setJsonName($var) + { + GPBUtil::checkString($var, True); + $this->json_name = $var; + $this->has_json_name = true; + } + + public function hasJsonName() + { + return $this->has_json_name; + } + + /** + * optional .google.protobuf.FieldOptions options = 8; + */ + public function getOptions() + { + return $this->options; + } + + /** + * optional .google.protobuf.FieldOptions options = 8; + */ + public function setOptions(&$var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\FieldOptions::class); + $this->options = $var; + $this->has_options = true; + } + + public function hasOptions() + { + return $this->has_options; + } + +} + diff --git a/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php b/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php new file mode 100644 index 00000000..06f26015 --- /dev/null +++ b/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php @@ -0,0 +1,29 @@ +google.protobuf.FieldDescriptorProto.Label + */ +namespace Google\Protobuf\Internal; + +class FieldDescriptorProto_Label +{ + /** + *
+     * 0 is reserved for errors
+     * 
+ * + * LABEL_OPTIONAL = 1; + */ + const LABEL_OPTIONAL = 1; + /** + * LABEL_REQUIRED = 2; + */ + const LABEL_REQUIRED = 2; + /** + * LABEL_REPEATED = 3; + */ + const LABEL_REPEATED = 3; +} + diff --git a/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php b/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php new file mode 100644 index 00000000..9bda76c2 --- /dev/null +++ b/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php @@ -0,0 +1,120 @@ +google.protobuf.FieldDescriptorProto.Type + */ +namespace Google\Protobuf\Internal; + +class FieldDescriptorProto_Type +{ + /** + *
+     * 0 is reserved for errors.
+     * Order is weird for historical reasons.
+     * 
+ * + * TYPE_DOUBLE = 1; + */ + const TYPE_DOUBLE = 1; + /** + * TYPE_FLOAT = 2; + */ + const TYPE_FLOAT = 2; + /** + *
+     * Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT64 if
+     * negative values are likely.
+     * 
+ * + * TYPE_INT64 = 3; + */ + const TYPE_INT64 = 3; + /** + * TYPE_UINT64 = 4; + */ + const TYPE_UINT64 = 4; + /** + *
+     * Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT32 if
+     * negative values are likely.
+     * 
+ * + * TYPE_INT32 = 5; + */ + const TYPE_INT32 = 5; + /** + * TYPE_FIXED64 = 6; + */ + const TYPE_FIXED64 = 6; + /** + * TYPE_FIXED32 = 7; + */ + const TYPE_FIXED32 = 7; + /** + * TYPE_BOOL = 8; + */ + const TYPE_BOOL = 8; + /** + * TYPE_STRING = 9; + */ + const TYPE_STRING = 9; + /** + *
+     * Tag-delimited aggregate.
+     * 
+ * + * TYPE_GROUP = 10; + */ + const TYPE_GROUP = 10; + /** + *
+     * Length-delimited aggregate.
+     * 
+ * + * TYPE_MESSAGE = 11; + */ + const TYPE_MESSAGE = 11; + /** + *
+     * New in version 2.
+     * 
+ * + * TYPE_BYTES = 12; + */ + const TYPE_BYTES = 12; + /** + * TYPE_UINT32 = 13; + */ + const TYPE_UINT32 = 13; + /** + * TYPE_ENUM = 14; + */ + const TYPE_ENUM = 14; + /** + * TYPE_SFIXED32 = 15; + */ + const TYPE_SFIXED32 = 15; + /** + * TYPE_SFIXED64 = 16; + */ + const TYPE_SFIXED64 = 16; + /** + *
+     * Uses ZigZag encoding.
+     * 
+ * + * TYPE_SINT32 = 17; + */ + const TYPE_SINT32 = 17; + /** + *
+     * Uses ZigZag encoding.
+     * 
+ * + * TYPE_SINT64 = 18; + */ + const TYPE_SINT64 = 18; +} + diff --git a/php/src/Google/Protobuf/Internal/FieldOptions.php b/php/src/Google/Protobuf/Internal/FieldOptions.php new file mode 100644 index 00000000..af1393a5 --- /dev/null +++ b/php/src/Google/Protobuf/Internal/FieldOptions.php @@ -0,0 +1,429 @@ +google.protobuf.FieldOptions + */ +class FieldOptions extends \Google\Protobuf\Internal\Message +{ + /** + *
+     * The ctype option instructs the C++ code generator to use a different
+     * representation of the field than it normally would.  See the specific
+     * options below.  This option is not yet implemented in the open source
+     * release -- sorry, we'll try to include it in a future version!
+     * 
+ * + * optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; + */ + private $ctype = 0; + private $has_ctype = false; + /** + *
+     * The packed option can be enabled for repeated primitive fields to enable
+     * a more efficient representation on the wire. Rather than repeatedly
+     * writing the tag and type for each element, the entire array is encoded as
+     * a single length-delimited blob. In proto3, only explicit setting it to
+     * false will avoid using packed encoding.
+     * 
+ * + * optional bool packed = 2; + */ + private $packed = false; + private $has_packed = false; + /** + *
+     * The jstype option determines the JavaScript type used for values of the
+     * field.  The option is permitted only for 64 bit integral and fixed types
+     * (int64, uint64, sint64, fixed64, sfixed64).  By default these types are
+     * represented as JavaScript strings.  This avoids loss of precision that can
+     * happen when a large value is converted to a floating point JavaScript
+     * numbers.  Specifying JS_NUMBER for the jstype causes the generated
+     * JavaScript code to use the JavaScript "number" type instead of strings.
+     * This option is an enum to permit additional types to be added,
+     * e.g. goog.math.Integer.
+     * 
+ * + * optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL]; + */ + private $jstype = 0; + private $has_jstype = false; + /** + *
+     * Should this field be parsed lazily?  Lazy applies only to message-type
+     * fields.  It means that when the outer message is initially parsed, the
+     * inner message's contents will not be parsed but instead stored in encoded
+     * form.  The inner message will actually be parsed when it is first accessed.
+     * This is only a hint.  Implementations are free to choose whether to use
+     * eager or lazy parsing regardless of the value of this option.  However,
+     * setting this option true suggests that the protocol author believes that
+     * using lazy parsing on this field is worth the additional bookkeeping
+     * overhead typically needed to implement it.
+     * This option does not affect the public interface of any generated code;
+     * all method signatures remain the same.  Furthermore, thread-safety of the
+     * interface is not affected by this option; const methods remain safe to
+     * call from multiple threads concurrently, while non-const methods continue
+     * to require exclusive access.
+     * Note that implementations may choose not to check required fields within
+     * a lazy sub-message.  That is, calling IsInitialized() on the outer message
+     * may return true even if the inner message has missing required fields.
+     * This is necessary because otherwise the inner message would have to be
+     * parsed in order to perform the check, defeating the purpose of lazy
+     * parsing.  An implementation which chooses not to check required fields
+     * must be consistent about it.  That is, for any particular sub-message, the
+     * implementation must either *always* check its required fields, or *never*
+     * check its required fields, regardless of whether or not the message has
+     * been parsed.
+     * 
+ * + * optional bool lazy = 5 [default = false]; + */ + private $lazy = false; + private $has_lazy = false; + /** + *
+     * Is this field deprecated?
+     * Depending on the target platform, this can emit Deprecated annotations
+     * for accessors, or it will be completely ignored; in the very least, this
+     * is a formalization for deprecating fields.
+     * 
+ * + * optional bool deprecated = 3 [default = false]; + */ + private $deprecated = false; + private $has_deprecated = false; + /** + *
+     * For Google-internal migration only. Do not use.
+     * 
+ * + * optional bool weak = 10 [default = false]; + */ + private $weak = false; + private $has_weak = false; + /** + *
+     * The parser stores options it doesn't recognize here. See above.
+     * 
+ * + * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + private $uninterpreted_option; + private $has_uninterpreted_option = false; + + public function __construct() { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct(); + } + + /** + *
+     * The ctype option instructs the C++ code generator to use a different
+     * representation of the field than it normally would.  See the specific
+     * options below.  This option is not yet implemented in the open source
+     * release -- sorry, we'll try to include it in a future version!
+     * 
+ * + * optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; + */ + public function getCtype() + { + return $this->ctype; + } + + /** + *
+     * The ctype option instructs the C++ code generator to use a different
+     * representation of the field than it normally would.  See the specific
+     * options below.  This option is not yet implemented in the open source
+     * release -- sorry, we'll try to include it in a future version!
+     * 
+ * + * optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; + */ + public function setCtype($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FieldOptions_CType::class); + $this->ctype = $var; + $this->has_ctype = true; + } + + public function hasCtype() + { + return $this->has_ctype; + } + + /** + *
+     * The packed option can be enabled for repeated primitive fields to enable
+     * a more efficient representation on the wire. Rather than repeatedly
+     * writing the tag and type for each element, the entire array is encoded as
+     * a single length-delimited blob. In proto3, only explicit setting it to
+     * false will avoid using packed encoding.
+     * 
+ * + * optional bool packed = 2; + */ + public function getPacked() + { + return $this->packed; + } + + /** + *
+     * The packed option can be enabled for repeated primitive fields to enable
+     * a more efficient representation on the wire. Rather than repeatedly
+     * writing the tag and type for each element, the entire array is encoded as
+     * a single length-delimited blob. In proto3, only explicit setting it to
+     * false will avoid using packed encoding.
+     * 
+ * + * optional bool packed = 2; + */ + public function setPacked($var) + { + GPBUtil::checkBool($var); + $this->packed = $var; + $this->has_packed = true; + } + + public function hasPacked() + { + return $this->has_packed; + } + + /** + *
+     * The jstype option determines the JavaScript type used for values of the
+     * field.  The option is permitted only for 64 bit integral and fixed types
+     * (int64, uint64, sint64, fixed64, sfixed64).  By default these types are
+     * represented as JavaScript strings.  This avoids loss of precision that can
+     * happen when a large value is converted to a floating point JavaScript
+     * numbers.  Specifying JS_NUMBER for the jstype causes the generated
+     * JavaScript code to use the JavaScript "number" type instead of strings.
+     * This option is an enum to permit additional types to be added,
+     * e.g. goog.math.Integer.
+     * 
+ * + * optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL]; + */ + public function getJstype() + { + return $this->jstype; + } + + /** + *
+     * The jstype option determines the JavaScript type used for values of the
+     * field.  The option is permitted only for 64 bit integral and fixed types
+     * (int64, uint64, sint64, fixed64, sfixed64).  By default these types are
+     * represented as JavaScript strings.  This avoids loss of precision that can
+     * happen when a large value is converted to a floating point JavaScript
+     * numbers.  Specifying JS_NUMBER for the jstype causes the generated
+     * JavaScript code to use the JavaScript "number" type instead of strings.
+     * This option is an enum to permit additional types to be added,
+     * e.g. goog.math.Integer.
+     * 
+ * + * optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL]; + */ + public function setJstype($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FieldOptions_JSType::class); + $this->jstype = $var; + $this->has_jstype = true; + } + + public function hasJstype() + { + return $this->has_jstype; + } + + /** + *
+     * Should this field be parsed lazily?  Lazy applies only to message-type
+     * fields.  It means that when the outer message is initially parsed, the
+     * inner message's contents will not be parsed but instead stored in encoded
+     * form.  The inner message will actually be parsed when it is first accessed.
+     * This is only a hint.  Implementations are free to choose whether to use
+     * eager or lazy parsing regardless of the value of this option.  However,
+     * setting this option true suggests that the protocol author believes that
+     * using lazy parsing on this field is worth the additional bookkeeping
+     * overhead typically needed to implement it.
+     * This option does not affect the public interface of any generated code;
+     * all method signatures remain the same.  Furthermore, thread-safety of the
+     * interface is not affected by this option; const methods remain safe to
+     * call from multiple threads concurrently, while non-const methods continue
+     * to require exclusive access.
+     * Note that implementations may choose not to check required fields within
+     * a lazy sub-message.  That is, calling IsInitialized() on the outer message
+     * may return true even if the inner message has missing required fields.
+     * This is necessary because otherwise the inner message would have to be
+     * parsed in order to perform the check, defeating the purpose of lazy
+     * parsing.  An implementation which chooses not to check required fields
+     * must be consistent about it.  That is, for any particular sub-message, the
+     * implementation must either *always* check its required fields, or *never*
+     * check its required fields, regardless of whether or not the message has
+     * been parsed.
+     * 
+ * + * optional bool lazy = 5 [default = false]; + */ + public function getLazy() + { + return $this->lazy; + } + + /** + *
+     * Should this field be parsed lazily?  Lazy applies only to message-type
+     * fields.  It means that when the outer message is initially parsed, the
+     * inner message's contents will not be parsed but instead stored in encoded
+     * form.  The inner message will actually be parsed when it is first accessed.
+     * This is only a hint.  Implementations are free to choose whether to use
+     * eager or lazy parsing regardless of the value of this option.  However,
+     * setting this option true suggests that the protocol author believes that
+     * using lazy parsing on this field is worth the additional bookkeeping
+     * overhead typically needed to implement it.
+     * This option does not affect the public interface of any generated code;
+     * all method signatures remain the same.  Furthermore, thread-safety of the
+     * interface is not affected by this option; const methods remain safe to
+     * call from multiple threads concurrently, while non-const methods continue
+     * to require exclusive access.
+     * Note that implementations may choose not to check required fields within
+     * a lazy sub-message.  That is, calling IsInitialized() on the outer message
+     * may return true even if the inner message has missing required fields.
+     * This is necessary because otherwise the inner message would have to be
+     * parsed in order to perform the check, defeating the purpose of lazy
+     * parsing.  An implementation which chooses not to check required fields
+     * must be consistent about it.  That is, for any particular sub-message, the
+     * implementation must either *always* check its required fields, or *never*
+     * check its required fields, regardless of whether or not the message has
+     * been parsed.
+     * 
+ * + * optional bool lazy = 5 [default = false]; + */ + public function setLazy($var) + { + GPBUtil::checkBool($var); + $this->lazy = $var; + $this->has_lazy = true; + } + + public function hasLazy() + { + return $this->has_lazy; + } + + /** + *
+     * Is this field deprecated?
+     * Depending on the target platform, this can emit Deprecated annotations
+     * for accessors, or it will be completely ignored; in the very least, this
+     * is a formalization for deprecating fields.
+     * 
+ * + * optional bool deprecated = 3 [default = false]; + */ + public function getDeprecated() + { + return $this->deprecated; + } + + /** + *
+     * Is this field deprecated?
+     * Depending on the target platform, this can emit Deprecated annotations
+     * for accessors, or it will be completely ignored; in the very least, this
+     * is a formalization for deprecating fields.
+     * 
+ * + * optional bool deprecated = 3 [default = false]; + */ + public function setDeprecated($var) + { + GPBUtil::checkBool($var); + $this->deprecated = $var; + $this->has_deprecated = true; + } + + public function hasDeprecated() + { + return $this->has_deprecated; + } + + /** + *
+     * For Google-internal migration only. Do not use.
+     * 
+ * + * optional bool weak = 10 [default = false]; + */ + public function getWeak() + { + return $this->weak; + } + + /** + *
+     * For Google-internal migration only. Do not use.
+     * 
+ * + * optional bool weak = 10 [default = false]; + */ + public function setWeak($var) + { + GPBUtil::checkBool($var); + $this->weak = $var; + $this->has_weak = true; + } + + public function hasWeak() + { + return $this->has_weak; + } + + /** + *
+     * The parser stores options it doesn't recognize here. See above.
+     * 
+ * + * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + public function getUninterpretedOption() + { + return $this->uninterpreted_option; + } + + /** + *
+     * The parser stores options it doesn't recognize here. See above.
+     * 
+ * + * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + public function setUninterpretedOption(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); + $this->uninterpreted_option = $var; + $this->has_uninterpreted_option = true; + } + + public function hasUninterpretedOption() + { + return $this->has_uninterpreted_option; + } + +} + diff --git a/php/src/Google/Protobuf/Internal/FieldOptions_CType.php b/php/src/Google/Protobuf/Internal/FieldOptions_CType.php new file mode 100644 index 00000000..2ff2a478 --- /dev/null +++ b/php/src/Google/Protobuf/Internal/FieldOptions_CType.php @@ -0,0 +1,29 @@ +google.protobuf.FieldOptions.CType + */ +namespace Google\Protobuf\Internal; + +class FieldOptions_CType +{ + /** + *
+     * Default mode.
+     * 
+ * + * STRING = 0; + */ + const STRING = 0; + /** + * CORD = 1; + */ + const CORD = 1; + /** + * STRING_PIECE = 2; + */ + const STRING_PIECE = 2; +} + diff --git a/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php b/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php new file mode 100644 index 00000000..541c8ae5 --- /dev/null +++ b/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php @@ -0,0 +1,37 @@ +google.protobuf.FieldOptions.JSType + */ +namespace Google\Protobuf\Internal; + +class FieldOptions_JSType +{ + /** + *
+     * Use the default type.
+     * 
+ * + * JS_NORMAL = 0; + */ + const JS_NORMAL = 0; + /** + *
+     * Use JavaScript strings.
+     * 
+ * + * JS_STRING = 1; + */ + const JS_STRING = 1; + /** + *
+     * Use JavaScript numbers.
+     * 
+ * + * JS_NUMBER = 2; + */ + const JS_NUMBER = 2; +} + diff --git a/php/src/Google/Protobuf/Internal/FileDescriptorProto.php b/php/src/Google/Protobuf/Internal/FileDescriptorProto.php new file mode 100644 index 00000000..39f67768 --- /dev/null +++ b/php/src/Google/Protobuf/Internal/FileDescriptorProto.php @@ -0,0 +1,477 @@ + + * Describes a complete .proto file. + * + * + * Protobuf type google.protobuf.FileDescriptorProto + */ +class FileDescriptorProto extends \Google\Protobuf\Internal\Message +{ + /** + *
+     * file name, relative to root of source tree
+     * 
+ * + * optional string name = 1; + */ + private $name = ''; + private $has_name = false; + /** + *
+     * e.g. "foo", "foo.bar", etc.
+     * 
+ * + * optional string package = 2; + */ + private $package = ''; + private $has_package = false; + /** + *
+     * Names of files imported by this file.
+     * 
+ * + * repeated string dependency = 3; + */ + private $dependency; + private $has_dependency = false; + /** + *
+     * Indexes of the public imported files in the dependency list above.
+     * 
+ * + * repeated int32 public_dependency = 10; + */ + private $public_dependency; + private $has_public_dependency = false; + /** + *
+     * Indexes of the weak imported files in the dependency list.
+     * For Google-internal migration only. Do not use.
+     * 
+ * + * repeated int32 weak_dependency = 11; + */ + private $weak_dependency; + private $has_weak_dependency = false; + /** + *
+     * All top-level definitions in this file.
+     * 
+ * + * repeated .google.protobuf.DescriptorProto message_type = 4; + */ + private $message_type; + private $has_message_type = false; + /** + * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; + */ + private $enum_type; + private $has_enum_type = false; + /** + * repeated .google.protobuf.ServiceDescriptorProto service = 6; + */ + private $service; + private $has_service = false; + /** + * repeated .google.protobuf.FieldDescriptorProto extension = 7; + */ + private $extension; + private $has_extension = false; + /** + * optional .google.protobuf.FileOptions options = 8; + */ + private $options = null; + private $has_options = false; + /** + *
+     * This field contains optional information about the original source code.
+     * You may safely remove this entire field without harming runtime
+     * functionality of the descriptors -- the information is needed only by
+     * development tools.
+     * 
+ * + * optional .google.protobuf.SourceCodeInfo source_code_info = 9; + */ + private $source_code_info = null; + private $has_source_code_info = false; + /** + *
+     * The syntax of the proto file.
+     * The supported values are "proto2" and "proto3".
+     * 
+ * + * optional string syntax = 12; + */ + private $syntax = ''; + private $has_syntax = false; + + public function __construct() { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct(); + } + + /** + *
+     * file name, relative to root of source tree
+     * 
+ * + * optional string name = 1; + */ + public function getName() + { + return $this->name; + } + + /** + *
+     * file name, relative to root of source tree
+     * 
+ * + * optional string name = 1; + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + $this->has_name = true; + } + + public function hasName() + { + return $this->has_name; + } + + /** + *
+     * e.g. "foo", "foo.bar", etc.
+     * 
+ * + * optional string package = 2; + */ + public function getPackage() + { + return $this->package; + } + + /** + *
+     * e.g. "foo", "foo.bar", etc.
+     * 
+ * + * optional string package = 2; + */ + public function setPackage($var) + { + GPBUtil::checkString($var, True); + $this->package = $var; + $this->has_package = true; + } + + public function hasPackage() + { + return $this->has_package; + } + + /** + *
+     * Names of files imported by this file.
+     * 
+ * + * repeated string dependency = 3; + */ + public function getDependency() + { + return $this->dependency; + } + + /** + *
+     * Names of files imported by this file.
+     * 
+ * + * repeated string dependency = 3; + */ + public function setDependency(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->dependency = $var; + $this->has_dependency = true; + } + + public function hasDependency() + { + return $this->has_dependency; + } + + /** + *
+     * Indexes of the public imported files in the dependency list above.
+     * 
+ * + * repeated int32 public_dependency = 10; + */ + public function getPublicDependency() + { + return $this->public_dependency; + } + + /** + *
+     * Indexes of the public imported files in the dependency list above.
+     * 
+ * + * repeated int32 public_dependency = 10; + */ + public function setPublicDependency(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->public_dependency = $var; + $this->has_public_dependency = true; + } + + public function hasPublicDependency() + { + return $this->has_public_dependency; + } + + /** + *
+     * Indexes of the weak imported files in the dependency list.
+     * For Google-internal migration only. Do not use.
+     * 
+ * + * repeated int32 weak_dependency = 11; + */ + public function getWeakDependency() + { + return $this->weak_dependency; + } + + /** + *
+     * Indexes of the weak imported files in the dependency list.
+     * For Google-internal migration only. Do not use.
+     * 
+ * + * repeated int32 weak_dependency = 11; + */ + public function setWeakDependency(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->weak_dependency = $var; + $this->has_weak_dependency = true; + } + + public function hasWeakDependency() + { + return $this->has_weak_dependency; + } + + /** + *
+     * All top-level definitions in this file.
+     * 
+ * + * repeated .google.protobuf.DescriptorProto message_type = 4; + */ + public function getMessageType() + { + return $this->message_type; + } + + /** + *
+     * All top-level definitions in this file.
+     * 
+ * + * repeated .google.protobuf.DescriptorProto message_type = 4; + */ + public function setMessageType(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto::class); + $this->message_type = $var; + $this->has_message_type = true; + } + + public function hasMessageType() + { + return $this->has_message_type; + } + + /** + * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; + */ + public function getEnumType() + { + return $this->enum_type; + } + + /** + * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; + */ + public function setEnumType(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumDescriptorProto::class); + $this->enum_type = $var; + $this->has_enum_type = true; + } + + public function hasEnumType() + { + return $this->has_enum_type; + } + + /** + * repeated .google.protobuf.ServiceDescriptorProto service = 6; + */ + public function getService() + { + return $this->service; + } + + /** + * repeated .google.protobuf.ServiceDescriptorProto service = 6; + */ + public function setService(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\ServiceDescriptorProto::class); + $this->service = $var; + $this->has_service = true; + } + + public function hasService() + { + return $this->has_service; + } + + /** + * repeated .google.protobuf.FieldDescriptorProto extension = 7; + */ + public function getExtension() + { + return $this->extension; + } + + /** + * repeated .google.protobuf.FieldDescriptorProto extension = 7; + */ + public function setExtension(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FieldDescriptorProto::class); + $this->extension = $var; + $this->has_extension = true; + } + + public function hasExtension() + { + return $this->has_extension; + } + + /** + * optional .google.protobuf.FileOptions options = 8; + */ + public function getOptions() + { + return $this->options; + } + + /** + * optional .google.protobuf.FileOptions options = 8; + */ + public function setOptions(&$var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\FileOptions::class); + $this->options = $var; + $this->has_options = true; + } + + public function hasOptions() + { + return $this->has_options; + } + + /** + *
+     * This field contains optional information about the original source code.
+     * You may safely remove this entire field without harming runtime
+     * functionality of the descriptors -- the information is needed only by
+     * development tools.
+     * 
+ * + * optional .google.protobuf.SourceCodeInfo source_code_info = 9; + */ + public function getSourceCodeInfo() + { + return $this->source_code_info; + } + + /** + *
+     * This field contains optional information about the original source code.
+     * You may safely remove this entire field without harming runtime
+     * functionality of the descriptors -- the information is needed only by
+     * development tools.
+     * 
+ * + * optional .google.protobuf.SourceCodeInfo source_code_info = 9; + */ + public function setSourceCodeInfo(&$var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\SourceCodeInfo::class); + $this->source_code_info = $var; + $this->has_source_code_info = true; + } + + public function hasSourceCodeInfo() + { + return $this->has_source_code_info; + } + + /** + *
+     * The syntax of the proto file.
+     * The supported values are "proto2" and "proto3".
+     * 
+ * + * optional string syntax = 12; + */ + public function getSyntax() + { + return $this->syntax; + } + + /** + *
+     * The syntax of the proto file.
+     * The supported values are "proto2" and "proto3".
+     * 
+ * + * optional string syntax = 12; + */ + public function setSyntax($var) + { + GPBUtil::checkString($var, True); + $this->syntax = $var; + $this->has_syntax = true; + } + + public function hasSyntax() + { + return $this->has_syntax; + } + +} + diff --git a/php/src/Google/Protobuf/Internal/FileDescriptorSet.php b/php/src/Google/Protobuf/Internal/FileDescriptorSet.php new file mode 100644 index 00000000..20a165c4 --- /dev/null +++ b/php/src/Google/Protobuf/Internal/FileDescriptorSet.php @@ -0,0 +1,59 @@ + + * The protocol compiler can output a FileDescriptorSet containing the .proto + * files it parses. + * + * + * Protobuf type google.protobuf.FileDescriptorSet + */ +class FileDescriptorSet extends \Google\Protobuf\Internal\Message +{ + /** + * repeated .google.protobuf.FileDescriptorProto file = 1; + */ + private $file; + private $has_file = false; + + public function __construct() { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct(); + } + + /** + * repeated .google.protobuf.FileDescriptorProto file = 1; + */ + public function getFile() + { + return $this->file; + } + + /** + * repeated .google.protobuf.FileDescriptorProto file = 1; + */ + public function setFile(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FileDescriptorProto::class); + $this->file = $var; + $this->has_file = true; + } + + public function hasFile() + { + return $this->has_file; + } + +} + diff --git a/php/src/Google/Protobuf/Internal/FileOptions.php b/php/src/Google/Protobuf/Internal/FileOptions.php new file mode 100644 index 00000000..2422f3ee --- /dev/null +++ b/php/src/Google/Protobuf/Internal/FileOptions.php @@ -0,0 +1,741 @@ +google.protobuf.FileOptions + */ +class FileOptions extends \Google\Protobuf\Internal\Message +{ + /** + *
+     * Sets the Java package where classes generated from this .proto will be
+     * placed.  By default, the proto package is used, but this is often
+     * inappropriate because proto packages do not normally start with backwards
+     * domain names.
+     * 
+ * + * optional string java_package = 1; + */ + private $java_package = ''; + private $has_java_package = false; + /** + *
+     * If set, all the classes from the .proto file are wrapped in a single
+     * outer class with the given name.  This applies to both Proto1
+     * (equivalent to the old "--one_java_file" option) and Proto2 (where
+     * a .proto always translates to a single class, but you may want to
+     * explicitly choose the class name).
+     * 
+ * + * optional string java_outer_classname = 8; + */ + private $java_outer_classname = ''; + private $has_java_outer_classname = false; + /** + *
+     * If set true, then the Java code generator will generate a separate .java
+     * file for each top-level message, enum, and service defined in the .proto
+     * file.  Thus, these types will *not* be nested inside the outer class
+     * named by java_outer_classname.  However, the outer class will still be
+     * generated to contain the file's getDescriptor() method as well as any
+     * top-level extensions defined in the file.
+     * 
+ * + * optional bool java_multiple_files = 10 [default = false]; + */ + private $java_multiple_files = false; + private $has_java_multiple_files = false; + /** + *
+     * This option does nothing.
+     * 
+ * + * optional bool java_generate_equals_and_hash = 20 [deprecated = true]; + */ + private $java_generate_equals_and_hash = false; + private $has_java_generate_equals_and_hash = false; + /** + *
+     * If set true, then the Java2 code generator will generate code that
+     * throws an exception whenever an attempt is made to assign a non-UTF-8
+     * byte sequence to a string field.
+     * Message reflection will do the same.
+     * However, an extension field still accepts non-UTF-8 byte sequences.
+     * This option has no effect on when used with the lite runtime.
+     * 
+ * + * optional bool java_string_check_utf8 = 27 [default = false]; + */ + private $java_string_check_utf8 = false; + private $has_java_string_check_utf8 = false; + /** + * optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; + */ + private $optimize_for = 0; + private $has_optimize_for = false; + /** + *
+     * Sets the Go package where structs generated from this .proto will be
+     * placed. If omitted, the Go package will be derived from the following:
+     *   - The basename of the package import path, if provided.
+     *   - Otherwise, the package statement in the .proto file, if present.
+     *   - Otherwise, the basename of the .proto file, without extension.
+     * 
+ * + * optional string go_package = 11; + */ + private $go_package = ''; + private $has_go_package = false; + /** + *
+     * Should generic services be generated in each language?  "Generic" services
+     * are not specific to any particular RPC system.  They are generated by the
+     * main code generators in each language (without additional plugins).
+     * Generic services were the only kind of service generation supported by
+     * early versions of google.protobuf.
+     * Generic services are now considered deprecated in favor of using plugins
+     * that generate code specific to your particular RPC system.  Therefore,
+     * these default to false.  Old code which depends on generic services should
+     * explicitly set them to true.
+     * 
+ * + * optional bool cc_generic_services = 16 [default = false]; + */ + private $cc_generic_services = false; + private $has_cc_generic_services = false; + /** + * optional bool java_generic_services = 17 [default = false]; + */ + private $java_generic_services = false; + private $has_java_generic_services = false; + /** + * optional bool py_generic_services = 18 [default = false]; + */ + private $py_generic_services = false; + private $has_py_generic_services = false; + /** + *
+     * Is this file deprecated?
+     * Depending on the target platform, this can emit Deprecated annotations
+     * for everything in the file, or it will be completely ignored; in the very
+     * least, this is a formalization for deprecating files.
+     * 
+ * + * optional bool deprecated = 23 [default = false]; + */ + private $deprecated = false; + private $has_deprecated = false; + /** + *
+     * Enables the use of arenas for the proto messages in this file. This applies
+     * only to generated classes for C++.
+     * 
+ * + * optional bool cc_enable_arenas = 31 [default = false]; + */ + private $cc_enable_arenas = false; + private $has_cc_enable_arenas = false; + /** + *
+     * Sets the objective c class prefix which is prepended to all objective c
+     * generated classes from this .proto. There is no default.
+     * 
+ * + * optional string objc_class_prefix = 36; + */ + private $objc_class_prefix = ''; + private $has_objc_class_prefix = false; + /** + *
+     * Namespace for generated classes; defaults to the package.
+     * 
+ * + * optional string csharp_namespace = 37; + */ + private $csharp_namespace = ''; + private $has_csharp_namespace = false; + /** + *
+     * By default Swift generators will take the proto package and CamelCase it
+     * replacing '.' with underscore and use that to prefix the types/symbols
+     * defined. When this options is provided, they will use this value instead
+     * to prefix the types/symbols defined.
+     * 
+ * + * optional string swift_prefix = 39; + */ + private $swift_prefix = ''; + private $has_swift_prefix = false; + /** + *
+     * The parser stores options it doesn't recognize here. See above.
+     * 
+ * + * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + private $uninterpreted_option; + private $has_uninterpreted_option = false; + + public function __construct() { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct(); + } + + /** + *
+     * Sets the Java package where classes generated from this .proto will be
+     * placed.  By default, the proto package is used, but this is often
+     * inappropriate because proto packages do not normally start with backwards
+     * domain names.
+     * 
+ * + * optional string java_package = 1; + */ + public function getJavaPackage() + { + return $this->java_package; + } + + /** + *
+     * Sets the Java package where classes generated from this .proto will be
+     * placed.  By default, the proto package is used, but this is often
+     * inappropriate because proto packages do not normally start with backwards
+     * domain names.
+     * 
+ * + * optional string java_package = 1; + */ + public function setJavaPackage($var) + { + GPBUtil::checkString($var, True); + $this->java_package = $var; + $this->has_java_package = true; + } + + public function hasJavaPackage() + { + return $this->has_java_package; + } + + /** + *
+     * If set, all the classes from the .proto file are wrapped in a single
+     * outer class with the given name.  This applies to both Proto1
+     * (equivalent to the old "--one_java_file" option) and Proto2 (where
+     * a .proto always translates to a single class, but you may want to
+     * explicitly choose the class name).
+     * 
+ * + * optional string java_outer_classname = 8; + */ + public function getJavaOuterClassname() + { + return $this->java_outer_classname; + } + + /** + *
+     * If set, all the classes from the .proto file are wrapped in a single
+     * outer class with the given name.  This applies to both Proto1
+     * (equivalent to the old "--one_java_file" option) and Proto2 (where
+     * a .proto always translates to a single class, but you may want to
+     * explicitly choose the class name).
+     * 
+ * + * optional string java_outer_classname = 8; + */ + public function setJavaOuterClassname($var) + { + GPBUtil::checkString($var, True); + $this->java_outer_classname = $var; + $this->has_java_outer_classname = true; + } + + public function hasJavaOuterClassname() + { + return $this->has_java_outer_classname; + } + + /** + *
+     * If set true, then the Java code generator will generate a separate .java
+     * file for each top-level message, enum, and service defined in the .proto
+     * file.  Thus, these types will *not* be nested inside the outer class
+     * named by java_outer_classname.  However, the outer class will still be
+     * generated to contain the file's getDescriptor() method as well as any
+     * top-level extensions defined in the file.
+     * 
+ * + * optional bool java_multiple_files = 10 [default = false]; + */ + public function getJavaMultipleFiles() + { + return $this->java_multiple_files; + } + + /** + *
+     * If set true, then the Java code generator will generate a separate .java
+     * file for each top-level message, enum, and service defined in the .proto
+     * file.  Thus, these types will *not* be nested inside the outer class
+     * named by java_outer_classname.  However, the outer class will still be
+     * generated to contain the file's getDescriptor() method as well as any
+     * top-level extensions defined in the file.
+     * 
+ * + * optional bool java_multiple_files = 10 [default = false]; + */ + public function setJavaMultipleFiles($var) + { + GPBUtil::checkBool($var); + $this->java_multiple_files = $var; + $this->has_java_multiple_files = true; + } + + public function hasJavaMultipleFiles() + { + return $this->has_java_multiple_files; + } + + /** + *
+     * This option does nothing.
+     * 
+ * + * optional bool java_generate_equals_and_hash = 20 [deprecated = true]; + */ + public function getJavaGenerateEqualsAndHash() + { + return $this->java_generate_equals_and_hash; + } + + /** + *
+     * This option does nothing.
+     * 
+ * + * optional bool java_generate_equals_and_hash = 20 [deprecated = true]; + */ + public function setJavaGenerateEqualsAndHash($var) + { + GPBUtil::checkBool($var); + $this->java_generate_equals_and_hash = $var; + $this->has_java_generate_equals_and_hash = true; + } + + public function hasJavaGenerateEqualsAndHash() + { + return $this->has_java_generate_equals_and_hash; + } + + /** + *
+     * If set true, then the Java2 code generator will generate code that
+     * throws an exception whenever an attempt is made to assign a non-UTF-8
+     * byte sequence to a string field.
+     * Message reflection will do the same.
+     * However, an extension field still accepts non-UTF-8 byte sequences.
+     * This option has no effect on when used with the lite runtime.
+     * 
+ * + * optional bool java_string_check_utf8 = 27 [default = false]; + */ + public function getJavaStringCheckUtf8() + { + return $this->java_string_check_utf8; + } + + /** + *
+     * If set true, then the Java2 code generator will generate code that
+     * throws an exception whenever an attempt is made to assign a non-UTF-8
+     * byte sequence to a string field.
+     * Message reflection will do the same.
+     * However, an extension field still accepts non-UTF-8 byte sequences.
+     * This option has no effect on when used with the lite runtime.
+     * 
+ * + * optional bool java_string_check_utf8 = 27 [default = false]; + */ + public function setJavaStringCheckUtf8($var) + { + GPBUtil::checkBool($var); + $this->java_string_check_utf8 = $var; + $this->has_java_string_check_utf8 = true; + } + + public function hasJavaStringCheckUtf8() + { + return $this->has_java_string_check_utf8; + } + + /** + * optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; + */ + public function getOptimizeFor() + { + return $this->optimize_for; + } + + /** + * optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; + */ + public function setOptimizeFor($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FileOptions_OptimizeMode::class); + $this->optimize_for = $var; + $this->has_optimize_for = true; + } + + public function hasOptimizeFor() + { + return $this->has_optimize_for; + } + + /** + *
+     * Sets the Go package where structs generated from this .proto will be
+     * placed. If omitted, the Go package will be derived from the following:
+     *   - The basename of the package import path, if provided.
+     *   - Otherwise, the package statement in the .proto file, if present.
+     *   - Otherwise, the basename of the .proto file, without extension.
+     * 
+ * + * optional string go_package = 11; + */ + public function getGoPackage() + { + return $this->go_package; + } + + /** + *
+     * Sets the Go package where structs generated from this .proto will be
+     * placed. If omitted, the Go package will be derived from the following:
+     *   - The basename of the package import path, if provided.
+     *   - Otherwise, the package statement in the .proto file, if present.
+     *   - Otherwise, the basename of the .proto file, without extension.
+     * 
+ * + * optional string go_package = 11; + */ + public function setGoPackage($var) + { + GPBUtil::checkString($var, True); + $this->go_package = $var; + $this->has_go_package = true; + } + + public function hasGoPackage() + { + return $this->has_go_package; + } + + /** + *
+     * Should generic services be generated in each language?  "Generic" services
+     * are not specific to any particular RPC system.  They are generated by the
+     * main code generators in each language (without additional plugins).
+     * Generic services were the only kind of service generation supported by
+     * early versions of google.protobuf.
+     * Generic services are now considered deprecated in favor of using plugins
+     * that generate code specific to your particular RPC system.  Therefore,
+     * these default to false.  Old code which depends on generic services should
+     * explicitly set them to true.
+     * 
+ * + * optional bool cc_generic_services = 16 [default = false]; + */ + public function getCcGenericServices() + { + return $this->cc_generic_services; + } + + /** + *
+     * Should generic services be generated in each language?  "Generic" services
+     * are not specific to any particular RPC system.  They are generated by the
+     * main code generators in each language (without additional plugins).
+     * Generic services were the only kind of service generation supported by
+     * early versions of google.protobuf.
+     * Generic services are now considered deprecated in favor of using plugins
+     * that generate code specific to your particular RPC system.  Therefore,
+     * these default to false.  Old code which depends on generic services should
+     * explicitly set them to true.
+     * 
+ * + * optional bool cc_generic_services = 16 [default = false]; + */ + public function setCcGenericServices($var) + { + GPBUtil::checkBool($var); + $this->cc_generic_services = $var; + $this->has_cc_generic_services = true; + } + + public function hasCcGenericServices() + { + return $this->has_cc_generic_services; + } + + /** + * optional bool java_generic_services = 17 [default = false]; + */ + public function getJavaGenericServices() + { + return $this->java_generic_services; + } + + /** + * optional bool java_generic_services = 17 [default = false]; + */ + public function setJavaGenericServices($var) + { + GPBUtil::checkBool($var); + $this->java_generic_services = $var; + $this->has_java_generic_services = true; + } + + public function hasJavaGenericServices() + { + return $this->has_java_generic_services; + } + + /** + * optional bool py_generic_services = 18 [default = false]; + */ + public function getPyGenericServices() + { + return $this->py_generic_services; + } + + /** + * optional bool py_generic_services = 18 [default = false]; + */ + public function setPyGenericServices($var) + { + GPBUtil::checkBool($var); + $this->py_generic_services = $var; + $this->has_py_generic_services = true; + } + + public function hasPyGenericServices() + { + return $this->has_py_generic_services; + } + + /** + *
+     * Is this file deprecated?
+     * Depending on the target platform, this can emit Deprecated annotations
+     * for everything in the file, or it will be completely ignored; in the very
+     * least, this is a formalization for deprecating files.
+     * 
+ * + * optional bool deprecated = 23 [default = false]; + */ + public function getDeprecated() + { + return $this->deprecated; + } + + /** + *
+     * Is this file deprecated?
+     * Depending on the target platform, this can emit Deprecated annotations
+     * for everything in the file, or it will be completely ignored; in the very
+     * least, this is a formalization for deprecating files.
+     * 
+ * + * optional bool deprecated = 23 [default = false]; + */ + public function setDeprecated($var) + { + GPBUtil::checkBool($var); + $this->deprecated = $var; + $this->has_deprecated = true; + } + + public function hasDeprecated() + { + return $this->has_deprecated; + } + + /** + *
+     * Enables the use of arenas for the proto messages in this file. This applies
+     * only to generated classes for C++.
+     * 
+ * + * optional bool cc_enable_arenas = 31 [default = false]; + */ + public function getCcEnableArenas() + { + return $this->cc_enable_arenas; + } + + /** + *
+     * Enables the use of arenas for the proto messages in this file. This applies
+     * only to generated classes for C++.
+     * 
+ * + * optional bool cc_enable_arenas = 31 [default = false]; + */ + public function setCcEnableArenas($var) + { + GPBUtil::checkBool($var); + $this->cc_enable_arenas = $var; + $this->has_cc_enable_arenas = true; + } + + public function hasCcEnableArenas() + { + return $this->has_cc_enable_arenas; + } + + /** + *
+     * Sets the objective c class prefix which is prepended to all objective c
+     * generated classes from this .proto. There is no default.
+     * 
+ * + * optional string objc_class_prefix = 36; + */ + public function getObjcClassPrefix() + { + return $this->objc_class_prefix; + } + + /** + *
+     * Sets the objective c class prefix which is prepended to all objective c
+     * generated classes from this .proto. There is no default.
+     * 
+ * + * optional string objc_class_prefix = 36; + */ + public function setObjcClassPrefix($var) + { + GPBUtil::checkString($var, True); + $this->objc_class_prefix = $var; + $this->has_objc_class_prefix = true; + } + + public function hasObjcClassPrefix() + { + return $this->has_objc_class_prefix; + } + + /** + *
+     * Namespace for generated classes; defaults to the package.
+     * 
+ * + * optional string csharp_namespace = 37; + */ + public function getCsharpNamespace() + { + return $this->csharp_namespace; + } + + /** + *
+     * Namespace for generated classes; defaults to the package.
+     * 
+ * + * optional string csharp_namespace = 37; + */ + public function setCsharpNamespace($var) + { + GPBUtil::checkString($var, True); + $this->csharp_namespace = $var; + $this->has_csharp_namespace = true; + } + + public function hasCsharpNamespace() + { + return $this->has_csharp_namespace; + } + + /** + *
+     * By default Swift generators will take the proto package and CamelCase it
+     * replacing '.' with underscore and use that to prefix the types/symbols
+     * defined. When this options is provided, they will use this value instead
+     * to prefix the types/symbols defined.
+     * 
+ * + * optional string swift_prefix = 39; + */ + public function getSwiftPrefix() + { + return $this->swift_prefix; + } + + /** + *
+     * By default Swift generators will take the proto package and CamelCase it
+     * replacing '.' with underscore and use that to prefix the types/symbols
+     * defined. When this options is provided, they will use this value instead
+     * to prefix the types/symbols defined.
+     * 
+ * + * optional string swift_prefix = 39; + */ + public function setSwiftPrefix($var) + { + GPBUtil::checkString($var, True); + $this->swift_prefix = $var; + $this->has_swift_prefix = true; + } + + public function hasSwiftPrefix() + { + return $this->has_swift_prefix; + } + + /** + *
+     * The parser stores options it doesn't recognize here. See above.
+     * 
+ * + * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + public function getUninterpretedOption() + { + return $this->uninterpreted_option; + } + + /** + *
+     * The parser stores options it doesn't recognize here. See above.
+     * 
+ * + * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + public function setUninterpretedOption(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); + $this->uninterpreted_option = $var; + $this->has_uninterpreted_option = true; + } + + public function hasUninterpretedOption() + { + return $this->has_uninterpreted_option; + } + +} + diff --git a/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php b/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php new file mode 100644 index 00000000..7fd488eb --- /dev/null +++ b/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php @@ -0,0 +1,41 @@ + + * Generated classes can be optimized for speed or code size. + * + * + * Protobuf enum google.protobuf.FileOptions.OptimizeMode + */ +namespace Google\Protobuf\Internal; + +class FileOptions_OptimizeMode +{ + /** + *
+     * Generate complete code for parsing, serialization,
+     * 
+ * + * SPEED = 1; + */ + const SPEED = 1; + /** + *
+     * etc.
+     * 
+ * + * CODE_SIZE = 2; + */ + const CODE_SIZE = 2; + /** + *
+     * Generate code using MessageLite and the lite runtime.
+     * 
+ * + * LITE_RUNTIME = 3; + */ + const LITE_RUNTIME = 3; +} + diff --git a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php new file mode 100644 index 00000000..8e493c2f --- /dev/null +++ b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php @@ -0,0 +1,75 @@ + + * Describes the relationship between generated code and its original source + * file. A GeneratedCodeInfo message is associated with only one generated + * source file, but may contain references to different source .proto files. + * + * + * Protobuf type google.protobuf.GeneratedCodeInfo + */ +class GeneratedCodeInfo extends \Google\Protobuf\Internal\Message +{ + /** + *
+     * An Annotation connects some span of text in generated code to an element
+     * of its generating .proto file.
+     * 
+ * + * repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; + */ + private $annotation; + private $has_annotation = false; + + public function __construct() { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct(); + } + + /** + *
+     * An Annotation connects some span of text in generated code to an element
+     * of its generating .proto file.
+     * 
+ * + * repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; + */ + public function getAnnotation() + { + return $this->annotation; + } + + /** + *
+     * An Annotation connects some span of text in generated code to an element
+     * of its generating .proto file.
+     * 
+ * + * repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; + */ + public function setAnnotation(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\GeneratedCodeInfo_Annotation::class); + $this->annotation = $var; + $this->has_annotation = true; + } + + public function hasAnnotation() + { + return $this->has_annotation; + } + +} + diff --git a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php new file mode 100644 index 00000000..dcc7edfe --- /dev/null +++ b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php @@ -0,0 +1,198 @@ +google.protobuf.GeneratedCodeInfo.Annotation + */ +class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message +{ + /** + *
+     * Identifies the element in the original source .proto file. This field
+     * is formatted the same as SourceCodeInfo.Location.path.
+     * 
+ * + * repeated int32 path = 1 [packed = true]; + */ + private $path; + private $has_path = false; + /** + *
+     * Identifies the filesystem path to the original source .proto.
+     * 
+ * + * optional string source_file = 2; + */ + private $source_file = ''; + private $has_source_file = false; + /** + *
+     * Identifies the starting offset in bytes in the generated code
+     * that relates to the identified object.
+     * 
+ * + * optional int32 begin = 3; + */ + private $begin = 0; + private $has_begin = false; + /** + *
+     * Identifies the ending offset in bytes in the generated code that
+     * relates to the identified offset. The end offset should be one past
+     * the last relevant byte (so the length of the text = end - begin).
+     * 
+ * + * optional int32 end = 4; + */ + private $end = 0; + private $has_end = false; + + public function __construct() { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct(); + } + + /** + *
+     * Identifies the element in the original source .proto file. This field
+     * is formatted the same as SourceCodeInfo.Location.path.
+     * 
+ * + * repeated int32 path = 1 [packed = true]; + */ + public function getPath() + { + return $this->path; + } + + /** + *
+     * Identifies the element in the original source .proto file. This field
+     * is formatted the same as SourceCodeInfo.Location.path.
+     * 
+ * + * repeated int32 path = 1 [packed = true]; + */ + public function setPath(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->path = $var; + $this->has_path = true; + } + + public function hasPath() + { + return $this->has_path; + } + + /** + *
+     * Identifies the filesystem path to the original source .proto.
+     * 
+ * + * optional string source_file = 2; + */ + public function getSourceFile() + { + return $this->source_file; + } + + /** + *
+     * Identifies the filesystem path to the original source .proto.
+     * 
+ * + * optional string source_file = 2; + */ + public function setSourceFile($var) + { + GPBUtil::checkString($var, True); + $this->source_file = $var; + $this->has_source_file = true; + } + + public function hasSourceFile() + { + return $this->has_source_file; + } + + /** + *
+     * Identifies the starting offset in bytes in the generated code
+     * that relates to the identified object.
+     * 
+ * + * optional int32 begin = 3; + */ + public function getBegin() + { + return $this->begin; + } + + /** + *
+     * Identifies the starting offset in bytes in the generated code
+     * that relates to the identified object.
+     * 
+ * + * optional int32 begin = 3; + */ + public function setBegin($var) + { + GPBUtil::checkInt32($var); + $this->begin = $var; + $this->has_begin = true; + } + + public function hasBegin() + { + return $this->has_begin; + } + + /** + *
+     * Identifies the ending offset in bytes in the generated code that
+     * relates to the identified offset. The end offset should be one past
+     * the last relevant byte (so the length of the text = end - begin).
+     * 
+ * + * optional int32 end = 4; + */ + public function getEnd() + { + return $this->end; + } + + /** + *
+     * Identifies the ending offset in bytes in the generated code that
+     * relates to the identified offset. The end offset should be one past
+     * the last relevant byte (so the length of the text = end - begin).
+     * 
+ * + * optional int32 end = 4; + */ + public function setEnd($var) + { + GPBUtil::checkInt32($var); + $this->end = $var; + $this->has_end = true; + } + + public function hasEnd() + { + return $this->has_end; + } + +} + diff --git a/php/src/Google/Protobuf/Internal/MessageOptions.php b/php/src/Google/Protobuf/Internal/MessageOptions.php new file mode 100644 index 00000000..e4a214cb --- /dev/null +++ b/php/src/Google/Protobuf/Internal/MessageOptions.php @@ -0,0 +1,334 @@ +google.protobuf.MessageOptions + */ +class MessageOptions extends \Google\Protobuf\Internal\Message +{ + /** + *
+     * Set true to use the old proto1 MessageSet wire format for extensions.
+     * This is provided for backwards-compatibility with the MessageSet wire
+     * format.  You should not use this for any other reason:  It's less
+     * efficient, has fewer features, and is more complicated.
+     * The message must be defined exactly as follows:
+     *   message Foo {
+     *     option message_set_wire_format = true;
+     *     extensions 4 to max;
+     *   }
+     * Note that the message cannot have any defined fields; MessageSets only
+     * have extensions.
+     * All extensions of your type must be singular messages; e.g. they cannot
+     * be int32s, enums, or repeated messages.
+     * Because this is an option, the above two restrictions are not enforced by
+     * the protocol compiler.
+     * 
+ * + * optional bool message_set_wire_format = 1 [default = false]; + */ + private $message_set_wire_format = false; + private $has_message_set_wire_format = false; + /** + *
+     * Disables the generation of the standard "descriptor()" accessor, which can
+     * conflict with a field of the same name.  This is meant to make migration
+     * from proto1 easier; new code should avoid fields named "descriptor".
+     * 
+ * + * optional bool no_standard_descriptor_accessor = 2 [default = false]; + */ + private $no_standard_descriptor_accessor = false; + private $has_no_standard_descriptor_accessor = false; + /** + *
+     * Is this message deprecated?
+     * Depending on the target platform, this can emit Deprecated annotations
+     * for the message, or it will be completely ignored; in the very least,
+     * this is a formalization for deprecating messages.
+     * 
+ * + * optional bool deprecated = 3 [default = false]; + */ + private $deprecated = false; + private $has_deprecated = false; + /** + *
+     * Whether the message is an automatically generated map entry type for the
+     * maps field.
+     * For maps fields:
+     *     map<KeyType, ValueType> map_field = 1;
+     * The parsed descriptor looks like:
+     *     message MapFieldEntry {
+     *         option map_entry = true;
+     *         optional KeyType key = 1;
+     *         optional ValueType value = 2;
+     *     }
+     *     repeated MapFieldEntry map_field = 1;
+     * Implementations may choose not to generate the map_entry=true message, but
+     * use a native map in the target language to hold the keys and values.
+     * The reflection APIs in such implementions still need to work as
+     * if the field is a repeated message field.
+     * NOTE: Do not set the option in .proto files. Always use the maps syntax
+     * instead. The option should only be implicitly set by the proto compiler
+     * parser.
+     * 
+ * + * optional bool map_entry = 7; + */ + private $map_entry = false; + private $has_map_entry = false; + /** + *
+     * The parser stores options it doesn't recognize here. See above.
+     * 
+ * + * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + private $uninterpreted_option; + private $has_uninterpreted_option = false; + + public function __construct() { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct(); + } + + /** + *
+     * Set true to use the old proto1 MessageSet wire format for extensions.
+     * This is provided for backwards-compatibility with the MessageSet wire
+     * format.  You should not use this for any other reason:  It's less
+     * efficient, has fewer features, and is more complicated.
+     * The message must be defined exactly as follows:
+     *   message Foo {
+     *     option message_set_wire_format = true;
+     *     extensions 4 to max;
+     *   }
+     * Note that the message cannot have any defined fields; MessageSets only
+     * have extensions.
+     * All extensions of your type must be singular messages; e.g. they cannot
+     * be int32s, enums, or repeated messages.
+     * Because this is an option, the above two restrictions are not enforced by
+     * the protocol compiler.
+     * 
+ * + * optional bool message_set_wire_format = 1 [default = false]; + */ + public function getMessageSetWireFormat() + { + return $this->message_set_wire_format; + } + + /** + *
+     * Set true to use the old proto1 MessageSet wire format for extensions.
+     * This is provided for backwards-compatibility with the MessageSet wire
+     * format.  You should not use this for any other reason:  It's less
+     * efficient, has fewer features, and is more complicated.
+     * The message must be defined exactly as follows:
+     *   message Foo {
+     *     option message_set_wire_format = true;
+     *     extensions 4 to max;
+     *   }
+     * Note that the message cannot have any defined fields; MessageSets only
+     * have extensions.
+     * All extensions of your type must be singular messages; e.g. they cannot
+     * be int32s, enums, or repeated messages.
+     * Because this is an option, the above two restrictions are not enforced by
+     * the protocol compiler.
+     * 
+ * + * optional bool message_set_wire_format = 1 [default = false]; + */ + public function setMessageSetWireFormat($var) + { + GPBUtil::checkBool($var); + $this->message_set_wire_format = $var; + $this->has_message_set_wire_format = true; + } + + public function hasMessageSetWireFormat() + { + return $this->has_message_set_wire_format; + } + + /** + *
+     * Disables the generation of the standard "descriptor()" accessor, which can
+     * conflict with a field of the same name.  This is meant to make migration
+     * from proto1 easier; new code should avoid fields named "descriptor".
+     * 
+ * + * optional bool no_standard_descriptor_accessor = 2 [default = false]; + */ + public function getNoStandardDescriptorAccessor() + { + return $this->no_standard_descriptor_accessor; + } + + /** + *
+     * Disables the generation of the standard "descriptor()" accessor, which can
+     * conflict with a field of the same name.  This is meant to make migration
+     * from proto1 easier; new code should avoid fields named "descriptor".
+     * 
+ * + * optional bool no_standard_descriptor_accessor = 2 [default = false]; + */ + public function setNoStandardDescriptorAccessor($var) + { + GPBUtil::checkBool($var); + $this->no_standard_descriptor_accessor = $var; + $this->has_no_standard_descriptor_accessor = true; + } + + public function hasNoStandardDescriptorAccessor() + { + return $this->has_no_standard_descriptor_accessor; + } + + /** + *
+     * Is this message deprecated?
+     * Depending on the target platform, this can emit Deprecated annotations
+     * for the message, or it will be completely ignored; in the very least,
+     * this is a formalization for deprecating messages.
+     * 
+ * + * optional bool deprecated = 3 [default = false]; + */ + public function getDeprecated() + { + return $this->deprecated; + } + + /** + *
+     * Is this message deprecated?
+     * Depending on the target platform, this can emit Deprecated annotations
+     * for the message, or it will be completely ignored; in the very least,
+     * this is a formalization for deprecating messages.
+     * 
+ * + * optional bool deprecated = 3 [default = false]; + */ + public function setDeprecated($var) + { + GPBUtil::checkBool($var); + $this->deprecated = $var; + $this->has_deprecated = true; + } + + public function hasDeprecated() + { + return $this->has_deprecated; + } + + /** + *
+     * Whether the message is an automatically generated map entry type for the
+     * maps field.
+     * For maps fields:
+     *     map<KeyType, ValueType> map_field = 1;
+     * The parsed descriptor looks like:
+     *     message MapFieldEntry {
+     *         option map_entry = true;
+     *         optional KeyType key = 1;
+     *         optional ValueType value = 2;
+     *     }
+     *     repeated MapFieldEntry map_field = 1;
+     * Implementations may choose not to generate the map_entry=true message, but
+     * use a native map in the target language to hold the keys and values.
+     * The reflection APIs in such implementions still need to work as
+     * if the field is a repeated message field.
+     * NOTE: Do not set the option in .proto files. Always use the maps syntax
+     * instead. The option should only be implicitly set by the proto compiler
+     * parser.
+     * 
+ * + * optional bool map_entry = 7; + */ + public function getMapEntry() + { + return $this->map_entry; + } + + /** + *
+     * Whether the message is an automatically generated map entry type for the
+     * maps field.
+     * For maps fields:
+     *     map<KeyType, ValueType> map_field = 1;
+     * The parsed descriptor looks like:
+     *     message MapFieldEntry {
+     *         option map_entry = true;
+     *         optional KeyType key = 1;
+     *         optional ValueType value = 2;
+     *     }
+     *     repeated MapFieldEntry map_field = 1;
+     * Implementations may choose not to generate the map_entry=true message, but
+     * use a native map in the target language to hold the keys and values.
+     * The reflection APIs in such implementions still need to work as
+     * if the field is a repeated message field.
+     * NOTE: Do not set the option in .proto files. Always use the maps syntax
+     * instead. The option should only be implicitly set by the proto compiler
+     * parser.
+     * 
+ * + * optional bool map_entry = 7; + */ + public function setMapEntry($var) + { + GPBUtil::checkBool($var); + $this->map_entry = $var; + $this->has_map_entry = true; + } + + public function hasMapEntry() + { + return $this->has_map_entry; + } + + /** + *
+     * The parser stores options it doesn't recognize here. See above.
+     * 
+ * + * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + public function getUninterpretedOption() + { + return $this->uninterpreted_option; + } + + /** + *
+     * The parser stores options it doesn't recognize here. See above.
+     * 
+ * + * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + public function setUninterpretedOption(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); + $this->uninterpreted_option = $var; + $this->has_uninterpreted_option = true; + } + + public function hasUninterpretedOption() + { + return $this->has_uninterpreted_option; + } + +} + diff --git a/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php b/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php new file mode 100644 index 00000000..3d8df7af --- /dev/null +++ b/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php @@ -0,0 +1,237 @@ + + * Describes a method of a service. + * + * + * Protobuf type google.protobuf.MethodDescriptorProto + */ +class MethodDescriptorProto extends \Google\Protobuf\Internal\Message +{ + /** + * optional string name = 1; + */ + private $name = ''; + private $has_name = false; + /** + *
+     * Input and output type names.  These are resolved in the same way as
+     * FieldDescriptorProto.type_name, but must refer to a message type.
+     * 
+ * + * optional string input_type = 2; + */ + private $input_type = ''; + private $has_input_type = false; + /** + * optional string output_type = 3; + */ + private $output_type = ''; + private $has_output_type = false; + /** + * optional .google.protobuf.MethodOptions options = 4; + */ + private $options = null; + private $has_options = false; + /** + *
+     * Identifies if client streams multiple client messages
+     * 
+ * + * optional bool client_streaming = 5 [default = false]; + */ + private $client_streaming = false; + private $has_client_streaming = false; + /** + *
+     * Identifies if server streams multiple server messages
+     * 
+ * + * optional bool server_streaming = 6 [default = false]; + */ + private $server_streaming = false; + private $has_server_streaming = false; + + public function __construct() { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct(); + } + + /** + * optional string name = 1; + */ + public function getName() + { + return $this->name; + } + + /** + * optional string name = 1; + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + $this->has_name = true; + } + + public function hasName() + { + return $this->has_name; + } + + /** + *
+     * Input and output type names.  These are resolved in the same way as
+     * FieldDescriptorProto.type_name, but must refer to a message type.
+     * 
+ * + * optional string input_type = 2; + */ + public function getInputType() + { + return $this->input_type; + } + + /** + *
+     * Input and output type names.  These are resolved in the same way as
+     * FieldDescriptorProto.type_name, but must refer to a message type.
+     * 
+ * + * optional string input_type = 2; + */ + public function setInputType($var) + { + GPBUtil::checkString($var, True); + $this->input_type = $var; + $this->has_input_type = true; + } + + public function hasInputType() + { + return $this->has_input_type; + } + + /** + * optional string output_type = 3; + */ + public function getOutputType() + { + return $this->output_type; + } + + /** + * optional string output_type = 3; + */ + public function setOutputType($var) + { + GPBUtil::checkString($var, True); + $this->output_type = $var; + $this->has_output_type = true; + } + + public function hasOutputType() + { + return $this->has_output_type; + } + + /** + * optional .google.protobuf.MethodOptions options = 4; + */ + public function getOptions() + { + return $this->options; + } + + /** + * optional .google.protobuf.MethodOptions options = 4; + */ + public function setOptions(&$var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\MethodOptions::class); + $this->options = $var; + $this->has_options = true; + } + + public function hasOptions() + { + return $this->has_options; + } + + /** + *
+     * Identifies if client streams multiple client messages
+     * 
+ * + * optional bool client_streaming = 5 [default = false]; + */ + public function getClientStreaming() + { + return $this->client_streaming; + } + + /** + *
+     * Identifies if client streams multiple client messages
+     * 
+ * + * optional bool client_streaming = 5 [default = false]; + */ + public function setClientStreaming($var) + { + GPBUtil::checkBool($var); + $this->client_streaming = $var; + $this->has_client_streaming = true; + } + + public function hasClientStreaming() + { + return $this->has_client_streaming; + } + + /** + *
+     * Identifies if server streams multiple server messages
+     * 
+ * + * optional bool server_streaming = 6 [default = false]; + */ + public function getServerStreaming() + { + return $this->server_streaming; + } + + /** + *
+     * Identifies if server streams multiple server messages
+     * 
+ * + * optional bool server_streaming = 6 [default = false]; + */ + public function setServerStreaming($var) + { + GPBUtil::checkBool($var); + $this->server_streaming = $var; + $this->has_server_streaming = true; + } + + public function hasServerStreaming() + { + return $this->has_server_streaming; + } + +} + diff --git a/php/src/Google/Protobuf/Internal/MethodOptions.php b/php/src/Google/Protobuf/Internal/MethodOptions.php new file mode 100644 index 00000000..3325e52b --- /dev/null +++ b/php/src/Google/Protobuf/Internal/MethodOptions.php @@ -0,0 +1,143 @@ +google.protobuf.MethodOptions + */ +class MethodOptions extends \Google\Protobuf\Internal\Message +{ + /** + *
+     * Is this method deprecated?
+     * Depending on the target platform, this can emit Deprecated annotations
+     * for the method, or it will be completely ignored; in the very least,
+     * this is a formalization for deprecating methods.
+     * 
+ * + * optional bool deprecated = 33 [default = false]; + */ + private $deprecated = false; + private $has_deprecated = false; + /** + * optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; + */ + private $idempotency_level = 0; + private $has_idempotency_level = false; + /** + *
+     * The parser stores options it doesn't recognize here. See above.
+     * 
+ * + * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + private $uninterpreted_option; + private $has_uninterpreted_option = false; + + public function __construct() { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct(); + } + + /** + *
+     * Is this method deprecated?
+     * Depending on the target platform, this can emit Deprecated annotations
+     * for the method, or it will be completely ignored; in the very least,
+     * this is a formalization for deprecating methods.
+     * 
+ * + * optional bool deprecated = 33 [default = false]; + */ + public function getDeprecated() + { + return $this->deprecated; + } + + /** + *
+     * Is this method deprecated?
+     * Depending on the target platform, this can emit Deprecated annotations
+     * for the method, or it will be completely ignored; in the very least,
+     * this is a formalization for deprecating methods.
+     * 
+ * + * optional bool deprecated = 33 [default = false]; + */ + public function setDeprecated($var) + { + GPBUtil::checkBool($var); + $this->deprecated = $var; + $this->has_deprecated = true; + } + + public function hasDeprecated() + { + return $this->has_deprecated; + } + + /** + * optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; + */ + public function getIdempotencyLevel() + { + return $this->idempotency_level; + } + + /** + * optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; + */ + public function setIdempotencyLevel($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Internal\MethodOptions_IdempotencyLevel::class); + $this->idempotency_level = $var; + $this->has_idempotency_level = true; + } + + public function hasIdempotencyLevel() + { + return $this->has_idempotency_level; + } + + /** + *
+     * The parser stores options it doesn't recognize here. See above.
+     * 
+ * + * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + public function getUninterpretedOption() + { + return $this->uninterpreted_option; + } + + /** + *
+     * The parser stores options it doesn't recognize here. See above.
+     * 
+ * + * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + public function setUninterpretedOption(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); + $this->uninterpreted_option = $var; + $this->has_uninterpreted_option = true; + } + + public function hasUninterpretedOption() + { + return $this->has_uninterpreted_option; + } + +} + diff --git a/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php b/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php new file mode 100644 index 00000000..62768b5c --- /dev/null +++ b/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php @@ -0,0 +1,39 @@ + + * Is this method side-effect-free (or safe in HTTP parlance), or idempotent, + * or neither? HTTP based RPC implementation may choose GET verb for safe + * methods, and PUT verb for idempotent methods instead of the default POST. + * + * + * Protobuf enum google.protobuf.MethodOptions.IdempotencyLevel + */ +namespace Google\Protobuf\Internal; + +class MethodOptions_IdempotencyLevel +{ + /** + * IDEMPOTENCY_UNKNOWN = 0; + */ + const IDEMPOTENCY_UNKNOWN = 0; + /** + *
+     * implies idempotent
+     * 
+ * + * NO_SIDE_EFFECTS = 1; + */ + const NO_SIDE_EFFECTS = 1; + /** + *
+     * idempotent, but may have side effects
+     * 
+ * + * IDEMPOTENT = 2; + */ + const IDEMPOTENT = 2; +} + diff --git a/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php b/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php new file mode 100644 index 00000000..e5fbe370 --- /dev/null +++ b/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php @@ -0,0 +1,86 @@ + + * Describes a oneof. + * + * + * Protobuf type google.protobuf.OneofDescriptorProto + */ +class OneofDescriptorProto extends \Google\Protobuf\Internal\Message +{ + /** + * optional string name = 1; + */ + private $name = ''; + private $has_name = false; + /** + * optional .google.protobuf.OneofOptions options = 2; + */ + private $options = null; + private $has_options = false; + + public function __construct() { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct(); + } + + /** + * optional string name = 1; + */ + public function getName() + { + return $this->name; + } + + /** + * optional string name = 1; + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + $this->has_name = true; + } + + public function hasName() + { + return $this->has_name; + } + + /** + * optional .google.protobuf.OneofOptions options = 2; + */ + public function getOptions() + { + return $this->options; + } + + /** + * optional .google.protobuf.OneofOptions options = 2; + */ + public function setOptions(&$var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\OneofOptions::class); + $this->options = $var; + $this->has_options = true; + } + + public function hasOptions() + { + return $this->has_options; + } + +} + diff --git a/php/src/Google/Protobuf/Internal/OneofOptions.php b/php/src/Google/Protobuf/Internal/OneofOptions.php new file mode 100644 index 00000000..083d9929 --- /dev/null +++ b/php/src/Google/Protobuf/Internal/OneofOptions.php @@ -0,0 +1,66 @@ +google.protobuf.OneofOptions + */ +class OneofOptions extends \Google\Protobuf\Internal\Message +{ + /** + *
+     * The parser stores options it doesn't recognize here. See above.
+     * 
+ * + * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + private $uninterpreted_option; + private $has_uninterpreted_option = false; + + public function __construct() { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct(); + } + + /** + *
+     * The parser stores options it doesn't recognize here. See above.
+     * 
+ * + * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + public function getUninterpretedOption() + { + return $this->uninterpreted_option; + } + + /** + *
+     * The parser stores options it doesn't recognize here. See above.
+     * 
+ * + * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + public function setUninterpretedOption(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); + $this->uninterpreted_option = $var; + $this->has_uninterpreted_option = true; + } + + public function hasUninterpretedOption() + { + return $this->has_uninterpreted_option; + } + +} + diff --git a/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php b/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php new file mode 100644 index 00000000..624bde84 --- /dev/null +++ b/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php @@ -0,0 +1,114 @@ + + * Describes a service. + * + * + * Protobuf type google.protobuf.ServiceDescriptorProto + */ +class ServiceDescriptorProto extends \Google\Protobuf\Internal\Message +{ + /** + * optional string name = 1; + */ + private $name = ''; + private $has_name = false; + /** + * repeated .google.protobuf.MethodDescriptorProto method = 2; + */ + private $method; + private $has_method = false; + /** + * optional .google.protobuf.ServiceOptions options = 3; + */ + private $options = null; + private $has_options = false; + + public function __construct() { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct(); + } + + /** + * optional string name = 1; + */ + public function getName() + { + return $this->name; + } + + /** + * optional string name = 1; + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + $this->has_name = true; + } + + public function hasName() + { + return $this->has_name; + } + + /** + * repeated .google.protobuf.MethodDescriptorProto method = 2; + */ + public function getMethod() + { + return $this->method; + } + + /** + * repeated .google.protobuf.MethodDescriptorProto method = 2; + */ + public function setMethod(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\MethodDescriptorProto::class); + $this->method = $var; + $this->has_method = true; + } + + public function hasMethod() + { + return $this->has_method; + } + + /** + * optional .google.protobuf.ServiceOptions options = 3; + */ + public function getOptions() + { + return $this->options; + } + + /** + * optional .google.protobuf.ServiceOptions options = 3; + */ + public function setOptions(&$var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\ServiceOptions::class); + $this->options = $var; + $this->has_options = true; + } + + public function hasOptions() + { + return $this->has_options; + } + +} + diff --git a/php/src/Google/Protobuf/Internal/ServiceOptions.php b/php/src/Google/Protobuf/Internal/ServiceOptions.php new file mode 100644 index 00000000..5f3564e4 --- /dev/null +++ b/php/src/Google/Protobuf/Internal/ServiceOptions.php @@ -0,0 +1,115 @@ +google.protobuf.ServiceOptions + */ +class ServiceOptions extends \Google\Protobuf\Internal\Message +{ + /** + *
+     * Is this service deprecated?
+     * Depending on the target platform, this can emit Deprecated annotations
+     * for the service, or it will be completely ignored; in the very least,
+     * this is a formalization for deprecating services.
+     * 
+ * + * optional bool deprecated = 33 [default = false]; + */ + private $deprecated = false; + private $has_deprecated = false; + /** + *
+     * The parser stores options it doesn't recognize here. See above.
+     * 
+ * + * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + private $uninterpreted_option; + private $has_uninterpreted_option = false; + + public function __construct() { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct(); + } + + /** + *
+     * Is this service deprecated?
+     * Depending on the target platform, this can emit Deprecated annotations
+     * for the service, or it will be completely ignored; in the very least,
+     * this is a formalization for deprecating services.
+     * 
+ * + * optional bool deprecated = 33 [default = false]; + */ + public function getDeprecated() + { + return $this->deprecated; + } + + /** + *
+     * Is this service deprecated?
+     * Depending on the target platform, this can emit Deprecated annotations
+     * for the service, or it will be completely ignored; in the very least,
+     * this is a formalization for deprecating services.
+     * 
+ * + * optional bool deprecated = 33 [default = false]; + */ + public function setDeprecated($var) + { + GPBUtil::checkBool($var); + $this->deprecated = $var; + $this->has_deprecated = true; + } + + public function hasDeprecated() + { + return $this->has_deprecated; + } + + /** + *
+     * The parser stores options it doesn't recognize here. See above.
+     * 
+ * + * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + public function getUninterpretedOption() + { + return $this->uninterpreted_option; + } + + /** + *
+     * The parser stores options it doesn't recognize here. See above.
+     * 
+ * + * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + */ + public function setUninterpretedOption(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); + $this->uninterpreted_option = $var; + $this->has_uninterpreted_option = true; + } + + public function hasUninterpretedOption() + { + return $this->has_uninterpreted_option; + } + +} + diff --git a/php/src/Google/Protobuf/Internal/SourceCodeInfo.php b/php/src/Google/Protobuf/Internal/SourceCodeInfo.php new file mode 100644 index 00000000..d2352ddd --- /dev/null +++ b/php/src/Google/Protobuf/Internal/SourceCodeInfo.php @@ -0,0 +1,191 @@ + + * Encapsulates information about the original source file from which a + * FileDescriptorProto was generated. + * + * + * Protobuf type google.protobuf.SourceCodeInfo + */ +class SourceCodeInfo extends \Google\Protobuf\Internal\Message +{ + /** + *
+     * A Location identifies a piece of source code in a .proto file which
+     * corresponds to a particular definition.  This information is intended
+     * to be useful to IDEs, code indexers, documentation generators, and similar
+     * tools.
+     * For example, say we have a file like:
+     *   message Foo {
+     *     optional string foo = 1;
+     *   }
+     * Let's look at just the field definition:
+     *   optional string foo = 1;
+     *   ^       ^^     ^^  ^  ^^^
+     *   a       bc     de  f  ghi
+     * We have the following locations:
+     *   span   path               represents
+     *   [a,i)  [ 4, 0, 2, 0 ]     The whole field definition.
+     *   [a,b)  [ 4, 0, 2, 0, 4 ]  The label (optional).
+     *   [c,d)  [ 4, 0, 2, 0, 5 ]  The type (string).
+     *   [e,f)  [ 4, 0, 2, 0, 1 ]  The name (foo).
+     *   [g,h)  [ 4, 0, 2, 0, 3 ]  The number (1).
+     * Notes:
+     * - A location may refer to a repeated field itself (i.e. not to any
+     *   particular index within it).  This is used whenever a set of elements are
+     *   logically enclosed in a single code segment.  For example, an entire
+     *   extend block (possibly containing multiple extension definitions) will
+     *   have an outer location whose path refers to the "extensions" repeated
+     *   field without an index.
+     * - Multiple locations may have the same path.  This happens when a single
+     *   logical declaration is spread out across multiple places.  The most
+     *   obvious example is the "extend" block again -- there may be multiple
+     *   extend blocks in the same scope, each of which will have the same path.
+     * - A location's span is not always a subset of its parent's span.  For
+     *   example, the "extendee" of an extension declaration appears at the
+     *   beginning of the "extend" block and is shared by all extensions within
+     *   the block.
+     * - Just because a location's span is a subset of some other location's span
+     *   does not mean that it is a descendent.  For example, a "group" defines
+     *   both a type and a field in a single declaration.  Thus, the locations
+     *   corresponding to the type and field and their components will overlap.
+     * - Code which tries to interpret locations should probably be designed to
+     *   ignore those that it doesn't understand, as more types of locations could
+     *   be recorded in the future.
+     * 
+ * + * repeated .google.protobuf.SourceCodeInfo.Location location = 1; + */ + private $location; + private $has_location = false; + + public function __construct() { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct(); + } + + /** + *
+     * A Location identifies a piece of source code in a .proto file which
+     * corresponds to a particular definition.  This information is intended
+     * to be useful to IDEs, code indexers, documentation generators, and similar
+     * tools.
+     * For example, say we have a file like:
+     *   message Foo {
+     *     optional string foo = 1;
+     *   }
+     * Let's look at just the field definition:
+     *   optional string foo = 1;
+     *   ^       ^^     ^^  ^  ^^^
+     *   a       bc     de  f  ghi
+     * We have the following locations:
+     *   span   path               represents
+     *   [a,i)  [ 4, 0, 2, 0 ]     The whole field definition.
+     *   [a,b)  [ 4, 0, 2, 0, 4 ]  The label (optional).
+     *   [c,d)  [ 4, 0, 2, 0, 5 ]  The type (string).
+     *   [e,f)  [ 4, 0, 2, 0, 1 ]  The name (foo).
+     *   [g,h)  [ 4, 0, 2, 0, 3 ]  The number (1).
+     * Notes:
+     * - A location may refer to a repeated field itself (i.e. not to any
+     *   particular index within it).  This is used whenever a set of elements are
+     *   logically enclosed in a single code segment.  For example, an entire
+     *   extend block (possibly containing multiple extension definitions) will
+     *   have an outer location whose path refers to the "extensions" repeated
+     *   field without an index.
+     * - Multiple locations may have the same path.  This happens when a single
+     *   logical declaration is spread out across multiple places.  The most
+     *   obvious example is the "extend" block again -- there may be multiple
+     *   extend blocks in the same scope, each of which will have the same path.
+     * - A location's span is not always a subset of its parent's span.  For
+     *   example, the "extendee" of an extension declaration appears at the
+     *   beginning of the "extend" block and is shared by all extensions within
+     *   the block.
+     * - Just because a location's span is a subset of some other location's span
+     *   does not mean that it is a descendent.  For example, a "group" defines
+     *   both a type and a field in a single declaration.  Thus, the locations
+     *   corresponding to the type and field and their components will overlap.
+     * - Code which tries to interpret locations should probably be designed to
+     *   ignore those that it doesn't understand, as more types of locations could
+     *   be recorded in the future.
+     * 
+ * + * repeated .google.protobuf.SourceCodeInfo.Location location = 1; + */ + public function getLocation() + { + return $this->location; + } + + /** + *
+     * A Location identifies a piece of source code in a .proto file which
+     * corresponds to a particular definition.  This information is intended
+     * to be useful to IDEs, code indexers, documentation generators, and similar
+     * tools.
+     * For example, say we have a file like:
+     *   message Foo {
+     *     optional string foo = 1;
+     *   }
+     * Let's look at just the field definition:
+     *   optional string foo = 1;
+     *   ^       ^^     ^^  ^  ^^^
+     *   a       bc     de  f  ghi
+     * We have the following locations:
+     *   span   path               represents
+     *   [a,i)  [ 4, 0, 2, 0 ]     The whole field definition.
+     *   [a,b)  [ 4, 0, 2, 0, 4 ]  The label (optional).
+     *   [c,d)  [ 4, 0, 2, 0, 5 ]  The type (string).
+     *   [e,f)  [ 4, 0, 2, 0, 1 ]  The name (foo).
+     *   [g,h)  [ 4, 0, 2, 0, 3 ]  The number (1).
+     * Notes:
+     * - A location may refer to a repeated field itself (i.e. not to any
+     *   particular index within it).  This is used whenever a set of elements are
+     *   logically enclosed in a single code segment.  For example, an entire
+     *   extend block (possibly containing multiple extension definitions) will
+     *   have an outer location whose path refers to the "extensions" repeated
+     *   field without an index.
+     * - Multiple locations may have the same path.  This happens when a single
+     *   logical declaration is spread out across multiple places.  The most
+     *   obvious example is the "extend" block again -- there may be multiple
+     *   extend blocks in the same scope, each of which will have the same path.
+     * - A location's span is not always a subset of its parent's span.  For
+     *   example, the "extendee" of an extension declaration appears at the
+     *   beginning of the "extend" block and is shared by all extensions within
+     *   the block.
+     * - Just because a location's span is a subset of some other location's span
+     *   does not mean that it is a descendent.  For example, a "group" defines
+     *   both a type and a field in a single declaration.  Thus, the locations
+     *   corresponding to the type and field and their components will overlap.
+     * - Code which tries to interpret locations should probably be designed to
+     *   ignore those that it doesn't understand, as more types of locations could
+     *   be recorded in the future.
+     * 
+ * + * repeated .google.protobuf.SourceCodeInfo.Location location = 1; + */ + public function setLocation(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\SourceCodeInfo_Location::class); + $this->location = $var; + $this->has_location = true; + } + + public function hasLocation() + { + return $this->has_location; + } + +} + diff --git a/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php b/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php new file mode 100644 index 00000000..d1bdb166 --- /dev/null +++ b/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php @@ -0,0 +1,379 @@ +google.protobuf.SourceCodeInfo.Location + */ +class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message +{ + /** + *
+     * Identifies which part of the FileDescriptorProto was defined at this
+     * location.
+     * Each element is a field number or an index.  They form a path from
+     * the root FileDescriptorProto to the place where the definition.  For
+     * example, this path:
+     *   [ 4, 3, 2, 7, 1 ]
+     * refers to:
+     *   file.message_type(3)  // 4, 3
+     *       .field(7)         // 2, 7
+     *       .name()           // 1
+     * This is because FileDescriptorProto.message_type has field number 4:
+     *   repeated DescriptorProto message_type = 4;
+     * and DescriptorProto.field has field number 2:
+     *   repeated FieldDescriptorProto field = 2;
+     * and FieldDescriptorProto.name has field number 1:
+     *   optional string name = 1;
+     * Thus, the above path gives the location of a field name.  If we removed
+     * the last element:
+     *   [ 4, 3, 2, 7 ]
+     * this path refers to the whole field declaration (from the beginning
+     * of the label to the terminating semicolon).
+     * 
+ * + * repeated int32 path = 1 [packed = true]; + */ + private $path; + private $has_path = false; + /** + *
+     * Always has exactly three or four elements: start line, start column,
+     * end line (optional, otherwise assumed same as start line), end column.
+     * These are packed into a single field for efficiency.  Note that line
+     * and column numbers are zero-based -- typically you will want to add
+     * 1 to each before displaying to a user.
+     * 
+ * + * repeated int32 span = 2 [packed = true]; + */ + private $span; + private $has_span = false; + /** + *
+     * If this SourceCodeInfo represents a complete declaration, these are any
+     * comments appearing before and after the declaration which appear to be
+     * attached to the declaration.
+     * A series of line comments appearing on consecutive lines, with no other
+     * tokens appearing on those lines, will be treated as a single comment.
+     * leading_detached_comments will keep paragraphs of comments that appear
+     * before (but not connected to) the current element. Each paragraph,
+     * separated by empty lines, will be one comment element in the repeated
+     * field.
+     * Only the comment content is provided; comment markers (e.g. //) are
+     * stripped out.  For block comments, leading whitespace and an asterisk
+     * will be stripped from the beginning of each line other than the first.
+     * Newlines are included in the output.
+     * Examples:
+     *   optional int32 foo = 1;  // Comment attached to foo.
+     *   // Comment attached to bar.
+     *   optional int32 bar = 2;
+     *   optional string baz = 3;
+     *   // Comment attached to baz.
+     *   // Another line attached to baz.
+     *   // Comment attached to qux.
+     *   //
+     *   // Another line attached to qux.
+     *   optional double qux = 4;
+     *   // Detached comment for corge. This is not leading or trailing comments
+     *   // to qux or corge because there are blank lines separating it from
+     *   // both.
+     *   // Detached comment for corge paragraph 2.
+     *   optional string corge = 5;
+     *   /* Block comment attached
+     *    * to corge.  Leading asterisks
+     *    * will be removed. */
+     *   /* Block comment attached to
+     *    * grault. */
+     *   optional int32 grault = 6;
+     *   // ignored detached comments.
+     * 
+ * + * optional string leading_comments = 3; + */ + private $leading_comments = ''; + private $has_leading_comments = false; + /** + * optional string trailing_comments = 4; + */ + private $trailing_comments = ''; + private $has_trailing_comments = false; + /** + * repeated string leading_detached_comments = 6; + */ + private $leading_detached_comments; + private $has_leading_detached_comments = false; + + public function __construct() { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct(); + } + + /** + *
+     * Identifies which part of the FileDescriptorProto was defined at this
+     * location.
+     * Each element is a field number or an index.  They form a path from
+     * the root FileDescriptorProto to the place where the definition.  For
+     * example, this path:
+     *   [ 4, 3, 2, 7, 1 ]
+     * refers to:
+     *   file.message_type(3)  // 4, 3
+     *       .field(7)         // 2, 7
+     *       .name()           // 1
+     * This is because FileDescriptorProto.message_type has field number 4:
+     *   repeated DescriptorProto message_type = 4;
+     * and DescriptorProto.field has field number 2:
+     *   repeated FieldDescriptorProto field = 2;
+     * and FieldDescriptorProto.name has field number 1:
+     *   optional string name = 1;
+     * Thus, the above path gives the location of a field name.  If we removed
+     * the last element:
+     *   [ 4, 3, 2, 7 ]
+     * this path refers to the whole field declaration (from the beginning
+     * of the label to the terminating semicolon).
+     * 
+ * + * repeated int32 path = 1 [packed = true]; + */ + public function getPath() + { + return $this->path; + } + + /** + *
+     * Identifies which part of the FileDescriptorProto was defined at this
+     * location.
+     * Each element is a field number or an index.  They form a path from
+     * the root FileDescriptorProto to the place where the definition.  For
+     * example, this path:
+     *   [ 4, 3, 2, 7, 1 ]
+     * refers to:
+     *   file.message_type(3)  // 4, 3
+     *       .field(7)         // 2, 7
+     *       .name()           // 1
+     * This is because FileDescriptorProto.message_type has field number 4:
+     *   repeated DescriptorProto message_type = 4;
+     * and DescriptorProto.field has field number 2:
+     *   repeated FieldDescriptorProto field = 2;
+     * and FieldDescriptorProto.name has field number 1:
+     *   optional string name = 1;
+     * Thus, the above path gives the location of a field name.  If we removed
+     * the last element:
+     *   [ 4, 3, 2, 7 ]
+     * this path refers to the whole field declaration (from the beginning
+     * of the label to the terminating semicolon).
+     * 
+ * + * repeated int32 path = 1 [packed = true]; + */ + public function setPath(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->path = $var; + $this->has_path = true; + } + + public function hasPath() + { + return $this->has_path; + } + + /** + *
+     * Always has exactly three or four elements: start line, start column,
+     * end line (optional, otherwise assumed same as start line), end column.
+     * These are packed into a single field for efficiency.  Note that line
+     * and column numbers are zero-based -- typically you will want to add
+     * 1 to each before displaying to a user.
+     * 
+ * + * repeated int32 span = 2 [packed = true]; + */ + public function getSpan() + { + return $this->span; + } + + /** + *
+     * Always has exactly three or four elements: start line, start column,
+     * end line (optional, otherwise assumed same as start line), end column.
+     * These are packed into a single field for efficiency.  Note that line
+     * and column numbers are zero-based -- typically you will want to add
+     * 1 to each before displaying to a user.
+     * 
+ * + * repeated int32 span = 2 [packed = true]; + */ + public function setSpan(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->span = $var; + $this->has_span = true; + } + + public function hasSpan() + { + return $this->has_span; + } + + /** + *
+     * If this SourceCodeInfo represents a complete declaration, these are any
+     * comments appearing before and after the declaration which appear to be
+     * attached to the declaration.
+     * A series of line comments appearing on consecutive lines, with no other
+     * tokens appearing on those lines, will be treated as a single comment.
+     * leading_detached_comments will keep paragraphs of comments that appear
+     * before (but not connected to) the current element. Each paragraph,
+     * separated by empty lines, will be one comment element in the repeated
+     * field.
+     * Only the comment content is provided; comment markers (e.g. //) are
+     * stripped out.  For block comments, leading whitespace and an asterisk
+     * will be stripped from the beginning of each line other than the first.
+     * Newlines are included in the output.
+     * Examples:
+     *   optional int32 foo = 1;  // Comment attached to foo.
+     *   // Comment attached to bar.
+     *   optional int32 bar = 2;
+     *   optional string baz = 3;
+     *   // Comment attached to baz.
+     *   // Another line attached to baz.
+     *   // Comment attached to qux.
+     *   //
+     *   // Another line attached to qux.
+     *   optional double qux = 4;
+     *   // Detached comment for corge. This is not leading or trailing comments
+     *   // to qux or corge because there are blank lines separating it from
+     *   // both.
+     *   // Detached comment for corge paragraph 2.
+     *   optional string corge = 5;
+     *   /* Block comment attached
+     *    * to corge.  Leading asterisks
+     *    * will be removed. */
+     *   /* Block comment attached to
+     *    * grault. */
+     *   optional int32 grault = 6;
+     *   // ignored detached comments.
+     * 
+ * + * optional string leading_comments = 3; + */ + public function getLeadingComments() + { + return $this->leading_comments; + } + + /** + *
+     * If this SourceCodeInfo represents a complete declaration, these are any
+     * comments appearing before and after the declaration which appear to be
+     * attached to the declaration.
+     * A series of line comments appearing on consecutive lines, with no other
+     * tokens appearing on those lines, will be treated as a single comment.
+     * leading_detached_comments will keep paragraphs of comments that appear
+     * before (but not connected to) the current element. Each paragraph,
+     * separated by empty lines, will be one comment element in the repeated
+     * field.
+     * Only the comment content is provided; comment markers (e.g. //) are
+     * stripped out.  For block comments, leading whitespace and an asterisk
+     * will be stripped from the beginning of each line other than the first.
+     * Newlines are included in the output.
+     * Examples:
+     *   optional int32 foo = 1;  // Comment attached to foo.
+     *   // Comment attached to bar.
+     *   optional int32 bar = 2;
+     *   optional string baz = 3;
+     *   // Comment attached to baz.
+     *   // Another line attached to baz.
+     *   // Comment attached to qux.
+     *   //
+     *   // Another line attached to qux.
+     *   optional double qux = 4;
+     *   // Detached comment for corge. This is not leading or trailing comments
+     *   // to qux or corge because there are blank lines separating it from
+     *   // both.
+     *   // Detached comment for corge paragraph 2.
+     *   optional string corge = 5;
+     *   /* Block comment attached
+     *    * to corge.  Leading asterisks
+     *    * will be removed. */
+     *   /* Block comment attached to
+     *    * grault. */
+     *   optional int32 grault = 6;
+     *   // ignored detached comments.
+     * 
+ * + * optional string leading_comments = 3; + */ + public function setLeadingComments($var) + { + GPBUtil::checkString($var, True); + $this->leading_comments = $var; + $this->has_leading_comments = true; + } + + public function hasLeadingComments() + { + return $this->has_leading_comments; + } + + /** + * optional string trailing_comments = 4; + */ + public function getTrailingComments() + { + return $this->trailing_comments; + } + + /** + * optional string trailing_comments = 4; + */ + public function setTrailingComments($var) + { + GPBUtil::checkString($var, True); + $this->trailing_comments = $var; + $this->has_trailing_comments = true; + } + + public function hasTrailingComments() + { + return $this->has_trailing_comments; + } + + /** + * repeated string leading_detached_comments = 6; + */ + public function getLeadingDetachedComments() + { + return $this->leading_detached_comments; + } + + /** + * repeated string leading_detached_comments = 6; + */ + public function setLeadingDetachedComments(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->leading_detached_comments = $var; + $this->has_leading_detached_comments = true; + } + + public function hasLeadingDetachedComments() + { + return $this->has_leading_detached_comments; + } + +} + diff --git a/php/src/Google/Protobuf/Internal/UninterpretedOption.php b/php/src/Google/Protobuf/Internal/UninterpretedOption.php new file mode 100644 index 00000000..c0f48310 --- /dev/null +++ b/php/src/Google/Protobuf/Internal/UninterpretedOption.php @@ -0,0 +1,246 @@ + + * A message representing a option the parser does not recognize. This only + * appears in options protos created by the compiler::Parser class. + * DescriptorPool resolves these when building Descriptor objects. Therefore, + * options protos in descriptor objects (e.g. returned by Descriptor::options(), + * or produced by Descriptor::CopyTo()) will never have UninterpretedOptions + * in them. + * + * + * Protobuf type google.protobuf.UninterpretedOption + */ +class UninterpretedOption extends \Google\Protobuf\Internal\Message +{ + /** + * repeated .google.protobuf.UninterpretedOption.NamePart name = 2; + */ + private $name; + private $has_name = false; + /** + *
+     * The value of the uninterpreted option, in whatever type the tokenizer
+     * identified it as during parsing. Exactly one of these should be set.
+     * 
+ * + * optional string identifier_value = 3; + */ + private $identifier_value = ''; + private $has_identifier_value = false; + /** + * optional uint64 positive_int_value = 4; + */ + private $positive_int_value = 0; + private $has_positive_int_value = false; + /** + * optional int64 negative_int_value = 5; + */ + private $negative_int_value = 0; + private $has_negative_int_value = false; + /** + * optional double double_value = 6; + */ + private $double_value = 0.0; + private $has_double_value = false; + /** + * optional bytes string_value = 7; + */ + private $string_value = ''; + private $has_string_value = false; + /** + * optional string aggregate_value = 8; + */ + private $aggregate_value = ''; + private $has_aggregate_value = false; + + public function __construct() { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct(); + } + + /** + * repeated .google.protobuf.UninterpretedOption.NamePart name = 2; + */ + public function getName() + { + return $this->name; + } + + /** + * repeated .google.protobuf.UninterpretedOption.NamePart name = 2; + */ + public function setName(&$var) + { + GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption_NamePart::class); + $this->name = $var; + $this->has_name = true; + } + + public function hasName() + { + return $this->has_name; + } + + /** + *
+     * The value of the uninterpreted option, in whatever type the tokenizer
+     * identified it as during parsing. Exactly one of these should be set.
+     * 
+ * + * optional string identifier_value = 3; + */ + public function getIdentifierValue() + { + return $this->identifier_value; + } + + /** + *
+     * The value of the uninterpreted option, in whatever type the tokenizer
+     * identified it as during parsing. Exactly one of these should be set.
+     * 
+ * + * optional string identifier_value = 3; + */ + public function setIdentifierValue($var) + { + GPBUtil::checkString($var, True); + $this->identifier_value = $var; + $this->has_identifier_value = true; + } + + public function hasIdentifierValue() + { + return $this->has_identifier_value; + } + + /** + * optional uint64 positive_int_value = 4; + */ + public function getPositiveIntValue() + { + return $this->positive_int_value; + } + + /** + * optional uint64 positive_int_value = 4; + */ + public function setPositiveIntValue($var) + { + GPBUtil::checkUint64($var); + $this->positive_int_value = $var; + $this->has_positive_int_value = true; + } + + public function hasPositiveIntValue() + { + return $this->has_positive_int_value; + } + + /** + * optional int64 negative_int_value = 5; + */ + public function getNegativeIntValue() + { + return $this->negative_int_value; + } + + /** + * optional int64 negative_int_value = 5; + */ + public function setNegativeIntValue($var) + { + GPBUtil::checkInt64($var); + $this->negative_int_value = $var; + $this->has_negative_int_value = true; + } + + public function hasNegativeIntValue() + { + return $this->has_negative_int_value; + } + + /** + * optional double double_value = 6; + */ + public function getDoubleValue() + { + return $this->double_value; + } + + /** + * optional double double_value = 6; + */ + public function setDoubleValue($var) + { + GPBUtil::checkDouble($var); + $this->double_value = $var; + $this->has_double_value = true; + } + + public function hasDoubleValue() + { + return $this->has_double_value; + } + + /** + * optional bytes string_value = 7; + */ + public function getStringValue() + { + return $this->string_value; + } + + /** + * optional bytes string_value = 7; + */ + public function setStringValue($var) + { + GPBUtil::checkString($var, False); + $this->string_value = $var; + $this->has_string_value = true; + } + + public function hasStringValue() + { + return $this->has_string_value; + } + + /** + * optional string aggregate_value = 8; + */ + public function getAggregateValue() + { + return $this->aggregate_value; + } + + /** + * optional string aggregate_value = 8; + */ + public function setAggregateValue($var) + { + GPBUtil::checkString($var, True); + $this->aggregate_value = $var; + $this->has_aggregate_value = true; + } + + public function hasAggregateValue() + { + return $this->has_aggregate_value; + } + +} + diff --git a/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php b/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php new file mode 100644 index 00000000..86484d23 --- /dev/null +++ b/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php @@ -0,0 +1,90 @@ + + * The name of the uninterpreted option. Each string represents a segment in + * a dot-separated name. is_extension is true iff a segment represents an + * extension (denoted with parentheses in options specs in .proto files). + * E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents + * "foo.(bar.baz).qux". + * + * + * Protobuf type google.protobuf.UninterpretedOption.NamePart + */ +class UninterpretedOption_NamePart extends \Google\Protobuf\Internal\Message +{ + /** + * required string name_part = 1; + */ + private $name_part = ''; + private $has_name_part = false; + /** + * required bool is_extension = 2; + */ + private $is_extension = false; + private $has_is_extension = false; + + public function __construct() { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct(); + } + + /** + * required string name_part = 1; + */ + public function getNamePart() + { + return $this->name_part; + } + + /** + * required string name_part = 1; + */ + public function setNamePart($var) + { + GPBUtil::checkString($var, True); + $this->name_part = $var; + $this->has_name_part = true; + } + + public function hasNamePart() + { + return $this->has_name_part; + } + + /** + * required bool is_extension = 2; + */ + public function getIsExtension() + { + return $this->is_extension; + } + + /** + * required bool is_extension = 2; + */ + public function setIsExtension($var) + { + GPBUtil::checkBool($var); + $this->is_extension = $var; + $this->has_is_extension = true; + } + + public function hasIsExtension() + { + return $this->has_is_extension; + } + +} + diff --git a/php/src/Google/Protobuf/descriptor_internal.pb.php b/php/src/Google/Protobuf/descriptor_internal.pb.php deleted file mode 100644 index 161a9f52..00000000 --- a/php/src/Google/Protobuf/descriptor_internal.pb.php +++ /dev/null @@ -1,2532 +0,0 @@ -file; - } - - public function setFile(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, \Google\Protobuf\Internal\FileDescriptorProto::class); - $this->file = $var; - $this->has_file = true; - } - - public function hasFile() - { - return $this->has_file; - } - -} - -class FileDescriptorProto extends \Google\Protobuf\Internal\Message -{ - private $name = ''; - private $has_name = false; - private $package = ''; - private $has_package = false; - private $dependency; - private $has_dependency = false; - private $public_dependency; - private $has_public_dependency = false; - private $weak_dependency; - private $has_weak_dependency = false; - private $message_type; - private $has_message_type = false; - private $enum_type; - private $has_enum_type = false; - private $service; - private $has_service = false; - private $extension; - private $has_extension = false; - private $options = null; - private $has_options = false; - private $source_code_info = null; - private $has_source_code_info = false; - private $syntax = ''; - private $has_syntax = false; - - public function getName() - { - return $this->name; - } - - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - $this->has_name = true; - } - - public function hasName() - { - return $this->has_name; - } - - public function getPackage() - { - return $this->package; - } - - public function setPackage($var) - { - GPBUtil::checkString($var, True); - $this->package = $var; - $this->has_package = true; - } - - public function hasPackage() - { - return $this->has_package; - } - - public function getDependency() - { - return $this->dependency; - } - - public function setDependency(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::STRING); - $this->dependency = $var; - $this->has_dependency = true; - } - - public function hasDependency() - { - return $this->has_dependency; - } - - public function getPublicDependency() - { - return $this->public_dependency; - } - - public function setPublicDependency(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::INT32); - $this->public_dependency = $var; - $this->has_public_dependency = true; - } - - public function hasPublicDependency() - { - return $this->has_public_dependency; - } - - public function getWeakDependency() - { - return $this->weak_dependency; - } - - public function setWeakDependency(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::INT32); - $this->weak_dependency = $var; - $this->has_weak_dependency = true; - } - - public function hasWeakDependency() - { - return $this->has_weak_dependency; - } - - public function getMessageType() - { - return $this->message_type; - } - - public function setMessageType(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto::class); - $this->message_type = $var; - $this->has_message_type = true; - } - - public function hasMessageType() - { - return $this->has_message_type; - } - - public function getEnumType() - { - return $this->enum_type; - } - - public function setEnumType(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, \Google\Protobuf\Internal\EnumDescriptorProto::class); - $this->enum_type = $var; - $this->has_enum_type = true; - } - - public function hasEnumType() - { - return $this->has_enum_type; - } - - public function getService() - { - return $this->service; - } - - public function setService(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, \Google\Protobuf\Internal\ServiceDescriptorProto::class); - $this->service = $var; - $this->has_service = true; - } - - public function hasService() - { - return $this->has_service; - } - - public function getExtension() - { - return $this->extension; - } - - public function setExtension(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, \Google\Protobuf\Internal\FieldDescriptorProto::class); - $this->extension = $var; - $this->has_extension = true; - } - - public function hasExtension() - { - return $this->has_extension; - } - - public function getOptions() - { - return $this->options; - } - - public function setOptions(&$var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Internal\FileOptions::class); - $this->options = $var; - $this->has_options = true; - } - - public function hasOptions() - { - return $this->has_options; - } - - public function getSourceCodeInfo() - { - return $this->source_code_info; - } - - public function setSourceCodeInfo(&$var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Internal\SourceCodeInfo::class); - $this->source_code_info = $var; - $this->has_source_code_info = true; - } - - public function hasSourceCodeInfo() - { - return $this->has_source_code_info; - } - - public function getSyntax() - { - return $this->syntax; - } - - public function setSyntax($var) - { - GPBUtil::checkString($var, True); - $this->syntax = $var; - $this->has_syntax = true; - } - - public function hasSyntax() - { - return $this->has_syntax; - } - -} - -class DescriptorProto extends \Google\Protobuf\Internal\Message -{ - private $name = ''; - private $has_name = false; - private $field; - private $has_field = false; - private $extension; - private $has_extension = false; - private $nested_type; - private $has_nested_type = false; - private $enum_type; - private $has_enum_type = false; - private $extension_range; - private $has_extension_range = false; - private $oneof_decl; - private $has_oneof_decl = false; - private $options = null; - private $has_options = false; - private $reserved_range; - private $has_reserved_range = false; - private $reserved_name; - private $has_reserved_name = false; - - public function getName() - { - return $this->name; - } - - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - $this->has_name = true; - } - - public function hasName() - { - return $this->has_name; - } - - public function getField() - { - return $this->field; - } - - public function setField(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, \Google\Protobuf\Internal\FieldDescriptorProto::class); - $this->field = $var; - $this->has_field = true; - } - - public function hasField() - { - return $this->has_field; - } - - public function getExtension() - { - return $this->extension; - } - - public function setExtension(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, \Google\Protobuf\Internal\FieldDescriptorProto::class); - $this->extension = $var; - $this->has_extension = true; - } - - public function hasExtension() - { - return $this->has_extension; - } - - public function getNestedType() - { - return $this->nested_type; - } - - public function setNestedType(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto::class); - $this->nested_type = $var; - $this->has_nested_type = true; - } - - public function hasNestedType() - { - return $this->has_nested_type; - } - - public function getEnumType() - { - return $this->enum_type; - } - - public function setEnumType(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, \Google\Protobuf\Internal\EnumDescriptorProto::class); - $this->enum_type = $var; - $this->has_enum_type = true; - } - - public function hasEnumType() - { - return $this->has_enum_type; - } - - public function getExtensionRange() - { - return $this->extension_range; - } - - public function setExtensionRange(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto_ExtensionRange::class); - $this->extension_range = $var; - $this->has_extension_range = true; - } - - public function hasExtensionRange() - { - return $this->has_extension_range; - } - - public function getOneofDecl() - { - return $this->oneof_decl; - } - - public function setOneofDecl(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, \Google\Protobuf\Internal\OneofDescriptorProto::class); - $this->oneof_decl = $var; - $this->has_oneof_decl = true; - } - - public function hasOneofDecl() - { - return $this->has_oneof_decl; - } - - public function getOptions() - { - return $this->options; - } - - public function setOptions(&$var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Internal\MessageOptions::class); - $this->options = $var; - $this->has_options = true; - } - - public function hasOptions() - { - return $this->has_options; - } - - public function getReservedRange() - { - return $this->reserved_range; - } - - public function setReservedRange(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto_ReservedRange::class); - $this->reserved_range = $var; - $this->has_reserved_range = true; - } - - public function hasReservedRange() - { - return $this->has_reserved_range; - } - - public function getReservedName() - { - return $this->reserved_name; - } - - public function setReservedName(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::STRING); - $this->reserved_name = $var; - $this->has_reserved_name = true; - } - - public function hasReservedName() - { - return $this->has_reserved_name; - } - -} - -class DescriptorProto_ExtensionRange extends \Google\Protobuf\Internal\Message -{ - private $start = 0; - private $has_start = false; - private $end = 0; - private $has_end = false; - - public function getStart() - { - return $this->start; - } - - public function setStart($var) - { - GPBUtil::checkInt32($var); - $this->start = $var; - $this->has_start = true; - } - - public function hasStart() - { - return $this->has_start; - } - - public function getEnd() - { - return $this->end; - } - - public function setEnd($var) - { - GPBUtil::checkInt32($var); - $this->end = $var; - $this->has_end = true; - } - - public function hasEnd() - { - return $this->has_end; - } - -} - -class DescriptorProto_ReservedRange extends \Google\Protobuf\Internal\Message -{ - private $start = 0; - private $has_start = false; - private $end = 0; - private $has_end = false; - - public function getStart() - { - return $this->start; - } - - public function setStart($var) - { - GPBUtil::checkInt32($var); - $this->start = $var; - $this->has_start = true; - } - - public function hasStart() - { - return $this->has_start; - } - - public function getEnd() - { - return $this->end; - } - - public function setEnd($var) - { - GPBUtil::checkInt32($var); - $this->end = $var; - $this->has_end = true; - } - - public function hasEnd() - { - return $this->has_end; - } - -} - -class FieldDescriptorProto extends \Google\Protobuf\Internal\Message -{ - private $name = ''; - private $has_name = false; - private $number = 0; - private $has_number = false; - private $label = 0; - private $has_label = false; - private $type = 0; - private $has_type = false; - private $type_name = ''; - private $has_type_name = false; - private $extendee = ''; - private $has_extendee = false; - private $default_value = ''; - private $has_default_value = false; - private $oneof_index = 0; - private $has_oneof_index = false; - private $json_name = ''; - private $has_json_name = false; - private $options = null; - private $has_options = false; - - public function getName() - { - return $this->name; - } - - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - $this->has_name = true; - } - - public function hasName() - { - return $this->has_name; - } - - public function getNumber() - { - return $this->number; - } - - public function setNumber($var) - { - GPBUtil::checkInt32($var); - $this->number = $var; - $this->has_number = true; - } - - public function hasNumber() - { - return $this->has_number; - } - - public function getLabel() - { - return $this->label; - } - - public function setLabel($var) - { - GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FieldDescriptorProto_Label::class); - $this->label = $var; - $this->has_label = true; - } - - public function hasLabel() - { - return $this->has_label; - } - - public function getType() - { - return $this->type; - } - - public function setType($var) - { - GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FieldDescriptorProto_Type::class); - $this->type = $var; - $this->has_type = true; - } - - public function hasType() - { - return $this->has_type; - } - - public function getTypeName() - { - return $this->type_name; - } - - public function setTypeName($var) - { - GPBUtil::checkString($var, True); - $this->type_name = $var; - $this->has_type_name = true; - } - - public function hasTypeName() - { - return $this->has_type_name; - } - - public function getExtendee() - { - return $this->extendee; - } - - public function setExtendee($var) - { - GPBUtil::checkString($var, True); - $this->extendee = $var; - $this->has_extendee = true; - } - - public function hasExtendee() - { - return $this->has_extendee; - } - - public function getDefaultValue() - { - return $this->default_value; - } - - public function setDefaultValue($var) - { - GPBUtil::checkString($var, True); - $this->default_value = $var; - $this->has_default_value = true; - } - - public function hasDefaultValue() - { - return $this->has_default_value; - } - - public function getOneofIndex() - { - return $this->oneof_index; - } - - public function setOneofIndex($var) - { - GPBUtil::checkInt32($var); - $this->oneof_index = $var; - $this->has_oneof_index = true; - } - - public function hasOneofIndex() - { - return $this->has_oneof_index; - } - - public function getJsonName() - { - return $this->json_name; - } - - public function setJsonName($var) - { - GPBUtil::checkString($var, True); - $this->json_name = $var; - $this->has_json_name = true; - } - - public function hasJsonName() - { - return $this->has_json_name; - } - - public function getOptions() - { - return $this->options; - } - - public function setOptions(&$var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Internal\FieldOptions::class); - $this->options = $var; - $this->has_options = true; - } - - public function hasOptions() - { - return $this->has_options; - } - -} - -class FieldDescriptorProto_Type -{ - const TYPE_DOUBLE = 1; - const TYPE_FLOAT = 2; - const TYPE_INT64 = 3; - const TYPE_UINT64 = 4; - const TYPE_INT32 = 5; - const TYPE_FIXED64 = 6; - const TYPE_FIXED32 = 7; - const TYPE_BOOL = 8; - const TYPE_STRING = 9; - const TYPE_GROUP = 10; - const TYPE_MESSAGE = 11; - const TYPE_BYTES = 12; - const TYPE_UINT32 = 13; - const TYPE_ENUM = 14; - const TYPE_SFIXED32 = 15; - const TYPE_SFIXED64 = 16; - const TYPE_SINT32 = 17; - const TYPE_SINT64 = 18; -} - -class FieldDescriptorProto_Label -{ - const LABEL_OPTIONAL = 1; - const LABEL_REQUIRED = 2; - const LABEL_REPEATED = 3; -} - -class OneofDescriptorProto extends \Google\Protobuf\Internal\Message -{ - private $name = ''; - private $has_name = false; - private $options = null; - private $has_options = false; - - public function getName() - { - return $this->name; - } - - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - $this->has_name = true; - } - - public function hasName() - { - return $this->has_name; - } - - public function getOptions() - { - return $this->options; - } - - public function setOptions(&$var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Internal\OneofOptions::class); - $this->options = $var; - $this->has_options = true; - } - - public function hasOptions() - { - return $this->has_options; - } - -} - -class EnumDescriptorProto extends \Google\Protobuf\Internal\Message -{ - private $name = ''; - private $has_name = false; - private $value; - private $has_value = false; - private $options = null; - private $has_options = false; - - public function getName() - { - return $this->name; - } - - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - $this->has_name = true; - } - - public function hasName() - { - return $this->has_name; - } - - public function getValue() - { - return $this->value; - } - - public function setValue(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, \Google\Protobuf\Internal\EnumValueDescriptorProto::class); - $this->value = $var; - $this->has_value = true; - } - - public function hasValue() - { - return $this->has_value; - } - - public function getOptions() - { - return $this->options; - } - - public function setOptions(&$var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Internal\EnumOptions::class); - $this->options = $var; - $this->has_options = true; - } - - public function hasOptions() - { - return $this->has_options; - } - -} - -class EnumValueDescriptorProto extends \Google\Protobuf\Internal\Message -{ - private $name = ''; - private $has_name = false; - private $number = 0; - private $has_number = false; - private $options = null; - private $has_options = false; - - public function getName() - { - return $this->name; - } - - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - $this->has_name = true; - } - - public function hasName() - { - return $this->has_name; - } - - public function getNumber() - { - return $this->number; - } - - public function setNumber($var) - { - GPBUtil::checkInt32($var); - $this->number = $var; - $this->has_number = true; - } - - public function hasNumber() - { - return $this->has_number; - } - - public function getOptions() - { - return $this->options; - } - - public function setOptions(&$var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Internal\EnumValueOptions::class); - $this->options = $var; - $this->has_options = true; - } - - public function hasOptions() - { - return $this->has_options; - } - -} - -class ServiceDescriptorProto extends \Google\Protobuf\Internal\Message -{ - private $name = ''; - private $has_name = false; - private $method; - private $has_method = false; - private $options = null; - private $has_options = false; - - public function getName() - { - return $this->name; - } - - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - $this->has_name = true; - } - - public function hasName() - { - return $this->has_name; - } - - public function getMethod() - { - return $this->method; - } - - public function setMethod(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, \Google\Protobuf\Internal\MethodDescriptorProto::class); - $this->method = $var; - $this->has_method = true; - } - - public function hasMethod() - { - return $this->has_method; - } - - public function getOptions() - { - return $this->options; - } - - public function setOptions(&$var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Internal\ServiceOptions::class); - $this->options = $var; - $this->has_options = true; - } - - public function hasOptions() - { - return $this->has_options; - } - -} - -class MethodDescriptorProto extends \Google\Protobuf\Internal\Message -{ - private $name = ''; - private $has_name = false; - private $input_type = ''; - private $has_input_type = false; - private $output_type = ''; - private $has_output_type = false; - private $options = null; - private $has_options = false; - private $client_streaming = false; - private $has_client_streaming = false; - private $server_streaming = false; - private $has_server_streaming = false; - - public function getName() - { - return $this->name; - } - - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - $this->has_name = true; - } - - public function hasName() - { - return $this->has_name; - } - - public function getInputType() - { - return $this->input_type; - } - - public function setInputType($var) - { - GPBUtil::checkString($var, True); - $this->input_type = $var; - $this->has_input_type = true; - } - - public function hasInputType() - { - return $this->has_input_type; - } - - public function getOutputType() - { - return $this->output_type; - } - - public function setOutputType($var) - { - GPBUtil::checkString($var, True); - $this->output_type = $var; - $this->has_output_type = true; - } - - public function hasOutputType() - { - return $this->has_output_type; - } - - public function getOptions() - { - return $this->options; - } - - public function setOptions(&$var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Internal\MethodOptions::class); - $this->options = $var; - $this->has_options = true; - } - - public function hasOptions() - { - return $this->has_options; - } - - public function getClientStreaming() - { - return $this->client_streaming; - } - - public function setClientStreaming($var) - { - GPBUtil::checkBool($var); - $this->client_streaming = $var; - $this->has_client_streaming = true; - } - - public function hasClientStreaming() - { - return $this->has_client_streaming; - } - - public function getServerStreaming() - { - return $this->server_streaming; - } - - public function setServerStreaming($var) - { - GPBUtil::checkBool($var); - $this->server_streaming = $var; - $this->has_server_streaming = true; - } - - public function hasServerStreaming() - { - return $this->has_server_streaming; - } - -} - -class FileOptions extends \Google\Protobuf\Internal\Message -{ - private $java_package = ''; - private $has_java_package = false; - private $java_outer_classname = ''; - private $has_java_outer_classname = false; - private $java_multiple_files = false; - private $has_java_multiple_files = false; - private $java_generate_equals_and_hash = false; - private $has_java_generate_equals_and_hash = false; - private $java_string_check_utf8 = false; - private $has_java_string_check_utf8 = false; - private $optimize_for = 0; - private $has_optimize_for = false; - private $go_package = ''; - private $has_go_package = false; - private $cc_generic_services = false; - private $has_cc_generic_services = false; - private $java_generic_services = false; - private $has_java_generic_services = false; - private $py_generic_services = false; - private $has_py_generic_services = false; - private $deprecated = false; - private $has_deprecated = false; - private $cc_enable_arenas = false; - private $has_cc_enable_arenas = false; - private $objc_class_prefix = ''; - private $has_objc_class_prefix = false; - private $csharp_namespace = ''; - private $has_csharp_namespace = false; - private $uninterpreted_option; - private $has_uninterpreted_option = false; - - public function getJavaPackage() - { - return $this->java_package; - } - - public function setJavaPackage($var) - { - GPBUtil::checkString($var, True); - $this->java_package = $var; - $this->has_java_package = true; - } - - public function hasJavaPackage() - { - return $this->has_java_package; - } - - public function getJavaOuterClassname() - { - return $this->java_outer_classname; - } - - public function setJavaOuterClassname($var) - { - GPBUtil::checkString($var, True); - $this->java_outer_classname = $var; - $this->has_java_outer_classname = true; - } - - public function hasJavaOuterClassname() - { - return $this->has_java_outer_classname; - } - - public function getJavaMultipleFiles() - { - return $this->java_multiple_files; - } - - public function setJavaMultipleFiles($var) - { - GPBUtil::checkBool($var); - $this->java_multiple_files = $var; - $this->has_java_multiple_files = true; - } - - public function hasJavaMultipleFiles() - { - return $this->has_java_multiple_files; - } - - public function getJavaGenerateEqualsAndHash() - { - return $this->java_generate_equals_and_hash; - } - - public function setJavaGenerateEqualsAndHash($var) - { - GPBUtil::checkBool($var); - $this->java_generate_equals_and_hash = $var; - $this->has_java_generate_equals_and_hash = true; - } - - public function hasJavaGenerateEqualsAndHash() - { - return $this->has_java_generate_equals_and_hash; - } - - public function getJavaStringCheckUtf8() - { - return $this->java_string_check_utf8; - } - - public function setJavaStringCheckUtf8($var) - { - GPBUtil::checkBool($var); - $this->java_string_check_utf8 = $var; - $this->has_java_string_check_utf8 = true; - } - - public function hasJavaStringCheckUtf8() - { - return $this->has_java_string_check_utf8; - } - - public function getOptimizeFor() - { - return $this->optimize_for; - } - - public function setOptimizeFor($var) - { - GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FileOptions_OptimizeMode::class); - $this->optimize_for = $var; - $this->has_optimize_for = true; - } - - public function hasOptimizeFor() - { - return $this->has_optimize_for; - } - - public function getGoPackage() - { - return $this->go_package; - } - - public function setGoPackage($var) - { - GPBUtil::checkString($var, True); - $this->go_package = $var; - $this->has_go_package = true; - } - - public function hasGoPackage() - { - return $this->has_go_package; - } - - public function getCcGenericServices() - { - return $this->cc_generic_services; - } - - public function setCcGenericServices($var) - { - GPBUtil::checkBool($var); - $this->cc_generic_services = $var; - $this->has_cc_generic_services = true; - } - - public function hasCcGenericServices() - { - return $this->has_cc_generic_services; - } - - public function getJavaGenericServices() - { - return $this->java_generic_services; - } - - public function setJavaGenericServices($var) - { - GPBUtil::checkBool($var); - $this->java_generic_services = $var; - $this->has_java_generic_services = true; - } - - public function hasJavaGenericServices() - { - return $this->has_java_generic_services; - } - - public function getPyGenericServices() - { - return $this->py_generic_services; - } - - public function setPyGenericServices($var) - { - GPBUtil::checkBool($var); - $this->py_generic_services = $var; - $this->has_py_generic_services = true; - } - - public function hasPyGenericServices() - { - return $this->has_py_generic_services; - } - - public function getDeprecated() - { - return $this->deprecated; - } - - public function setDeprecated($var) - { - GPBUtil::checkBool($var); - $this->deprecated = $var; - $this->has_deprecated = true; - } - - public function hasDeprecated() - { - return $this->has_deprecated; - } - - public function getCcEnableArenas() - { - return $this->cc_enable_arenas; - } - - public function setCcEnableArenas($var) - { - GPBUtil::checkBool($var); - $this->cc_enable_arenas = $var; - $this->has_cc_enable_arenas = true; - } - - public function hasCcEnableArenas() - { - return $this->has_cc_enable_arenas; - } - - public function getObjcClassPrefix() - { - return $this->objc_class_prefix; - } - - public function setObjcClassPrefix($var) - { - GPBUtil::checkString($var, True); - $this->objc_class_prefix = $var; - $this->has_objc_class_prefix = true; - } - - public function hasObjcClassPrefix() - { - return $this->has_objc_class_prefix; - } - - public function getCsharpNamespace() - { - return $this->csharp_namespace; - } - - public function setCsharpNamespace($var) - { - GPBUtil::checkString($var, True); - $this->csharp_namespace = $var; - $this->has_csharp_namespace = true; - } - - public function hasCsharpNamespace() - { - return $this->has_csharp_namespace; - } - - public function getUninterpretedOption() - { - return $this->uninterpreted_option; - } - - public function setUninterpretedOption(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); - $this->uninterpreted_option = $var; - $this->has_uninterpreted_option = true; - } - - public function hasUninterpretedOption() - { - return $this->has_uninterpreted_option; - } - -} - -class FileOptions_OptimizeMode -{ - const SPEED = 1; - const CODE_SIZE = 2; - const LITE_RUNTIME = 3; -} - -class MessageOptions extends \Google\Protobuf\Internal\Message -{ - private $message_set_wire_format = false; - private $has_message_set_wire_format = false; - private $no_standard_descriptor_accessor = false; - private $has_no_standard_descriptor_accessor = false; - private $deprecated = false; - private $has_deprecated = false; - private $map_entry = false; - private $has_map_entry = false; - private $uninterpreted_option; - private $has_uninterpreted_option = false; - - public function getMessageSetWireFormat() - { - return $this->message_set_wire_format; - } - - public function setMessageSetWireFormat($var) - { - GPBUtil::checkBool($var); - $this->message_set_wire_format = $var; - $this->has_message_set_wire_format = true; - } - - public function hasMessageSetWireFormat() - { - return $this->has_message_set_wire_format; - } - - public function getNoStandardDescriptorAccessor() - { - return $this->no_standard_descriptor_accessor; - } - - public function setNoStandardDescriptorAccessor($var) - { - GPBUtil::checkBool($var); - $this->no_standard_descriptor_accessor = $var; - $this->has_no_standard_descriptor_accessor = true; - } - - public function hasNoStandardDescriptorAccessor() - { - return $this->has_no_standard_descriptor_accessor; - } - - public function getDeprecated() - { - return $this->deprecated; - } - - public function setDeprecated($var) - { - GPBUtil::checkBool($var); - $this->deprecated = $var; - $this->has_deprecated = true; - } - - public function hasDeprecated() - { - return $this->has_deprecated; - } - - public function getMapEntry() - { - return $this->map_entry; - } - - public function setMapEntry($var) - { - GPBUtil::checkBool($var); - $this->map_entry = $var; - $this->has_map_entry = true; - } - - public function hasMapEntry() - { - return $this->has_map_entry; - } - - public function getUninterpretedOption() - { - return $this->uninterpreted_option; - } - - public function setUninterpretedOption(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); - $this->uninterpreted_option = $var; - $this->has_uninterpreted_option = true; - } - - public function hasUninterpretedOption() - { - return $this->has_uninterpreted_option; - } - -} - -class FieldOptions extends \Google\Protobuf\Internal\Message -{ - private $ctype = 0; - private $has_ctype = false; - private $packed = false; - private $has_packed = false; - private $jstype = 0; - private $has_jstype = false; - private $lazy = false; - private $has_lazy = false; - private $deprecated = false; - private $has_deprecated = false; - private $weak = false; - private $has_weak = false; - private $uninterpreted_option; - private $has_uninterpreted_option = false; - - public function getCtype() - { - return $this->ctype; - } - - public function setCtype($var) - { - GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FieldOptions_CType::class); - $this->ctype = $var; - $this->has_ctype = true; - } - - public function hasCtype() - { - return $this->has_ctype; - } - - public function getPacked() - { - return $this->packed; - } - - public function setPacked($var) - { - GPBUtil::checkBool($var); - $this->packed = $var; - $this->has_packed = true; - } - - public function hasPacked() - { - return $this->has_packed; - } - - public function getJstype() - { - return $this->jstype; - } - - public function setJstype($var) - { - GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FieldOptions_JSType::class); - $this->jstype = $var; - $this->has_jstype = true; - } - - public function hasJstype() - { - return $this->has_jstype; - } - - public function getLazy() - { - return $this->lazy; - } - - public function setLazy($var) - { - GPBUtil::checkBool($var); - $this->lazy = $var; - $this->has_lazy = true; - } - - public function hasLazy() - { - return $this->has_lazy; - } - - public function getDeprecated() - { - return $this->deprecated; - } - - public function setDeprecated($var) - { - GPBUtil::checkBool($var); - $this->deprecated = $var; - $this->has_deprecated = true; - } - - public function hasDeprecated() - { - return $this->has_deprecated; - } - - public function getWeak() - { - return $this->weak; - } - - public function setWeak($var) - { - GPBUtil::checkBool($var); - $this->weak = $var; - $this->has_weak = true; - } - - public function hasWeak() - { - return $this->has_weak; - } - - public function getUninterpretedOption() - { - return $this->uninterpreted_option; - } - - public function setUninterpretedOption(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); - $this->uninterpreted_option = $var; - $this->has_uninterpreted_option = true; - } - - public function hasUninterpretedOption() - { - return $this->has_uninterpreted_option; - } - -} - -class FieldOptions_CType -{ - const STRING = 0; - const CORD = 1; - const STRING_PIECE = 2; -} - -class FieldOptions_JSType -{ - const JS_NORMAL = 0; - const JS_STRING = 1; - const JS_NUMBER = 2; -} - -class OneofOptions extends \Google\Protobuf\Internal\Message -{ - private $uninterpreted_option; - private $has_uninterpreted_option = false; - - public function getUninterpretedOption() - { - return $this->uninterpreted_option; - } - - public function setUninterpretedOption(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); - $this->uninterpreted_option = $var; - $this->has_uninterpreted_option = true; - } - - public function hasUninterpretedOption() - { - return $this->has_uninterpreted_option; - } - -} - -class EnumOptions extends \Google\Protobuf\Internal\Message -{ - private $allow_alias = false; - private $has_allow_alias = false; - private $deprecated = false; - private $has_deprecated = false; - private $uninterpreted_option; - private $has_uninterpreted_option = false; - - public function getAllowAlias() - { - return $this->allow_alias; - } - - public function setAllowAlias($var) - { - GPBUtil::checkBool($var); - $this->allow_alias = $var; - $this->has_allow_alias = true; - } - - public function hasAllowAlias() - { - return $this->has_allow_alias; - } - - public function getDeprecated() - { - return $this->deprecated; - } - - public function setDeprecated($var) - { - GPBUtil::checkBool($var); - $this->deprecated = $var; - $this->has_deprecated = true; - } - - public function hasDeprecated() - { - return $this->has_deprecated; - } - - public function getUninterpretedOption() - { - return $this->uninterpreted_option; - } - - public function setUninterpretedOption(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); - $this->uninterpreted_option = $var; - $this->has_uninterpreted_option = true; - } - - public function hasUninterpretedOption() - { - return $this->has_uninterpreted_option; - } - -} - -class EnumValueOptions extends \Google\Protobuf\Internal\Message -{ - private $deprecated = false; - private $has_deprecated = false; - private $uninterpreted_option; - private $has_uninterpreted_option = false; - - public function getDeprecated() - { - return $this->deprecated; - } - - public function setDeprecated($var) - { - GPBUtil::checkBool($var); - $this->deprecated = $var; - $this->has_deprecated = true; - } - - public function hasDeprecated() - { - return $this->has_deprecated; - } - - public function getUninterpretedOption() - { - return $this->uninterpreted_option; - } - - public function setUninterpretedOption(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); - $this->uninterpreted_option = $var; - $this->has_uninterpreted_option = true; - } - - public function hasUninterpretedOption() - { - return $this->has_uninterpreted_option; - } - -} - -class ServiceOptions extends \Google\Protobuf\Internal\Message -{ - private $deprecated = false; - private $has_deprecated = false; - private $uninterpreted_option; - private $has_uninterpreted_option = false; - - public function getDeprecated() - { - return $this->deprecated; - } - - public function setDeprecated($var) - { - GPBUtil::checkBool($var); - $this->deprecated = $var; - $this->has_deprecated = true; - } - - public function hasDeprecated() - { - return $this->has_deprecated; - } - - public function getUninterpretedOption() - { - return $this->uninterpreted_option; - } - - public function setUninterpretedOption(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); - $this->uninterpreted_option = $var; - $this->has_uninterpreted_option = true; - } - - public function hasUninterpretedOption() - { - return $this->has_uninterpreted_option; - } - -} - -class MethodOptions extends \Google\Protobuf\Internal\Message -{ - private $deprecated = false; - private $has_deprecated = false; - private $uninterpreted_option; - private $has_uninterpreted_option = false; - - public function getDeprecated() - { - return $this->deprecated; - } - - public function setDeprecated($var) - { - GPBUtil::checkBool($var); - $this->deprecated = $var; - $this->has_deprecated = true; - } - - public function hasDeprecated() - { - return $this->has_deprecated; - } - - public function getUninterpretedOption() - { - return $this->uninterpreted_option; - } - - public function setUninterpretedOption(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); - $this->uninterpreted_option = $var; - $this->has_uninterpreted_option = true; - } - - public function hasUninterpretedOption() - { - return $this->has_uninterpreted_option; - } - -} - -class UninterpretedOption extends \Google\Protobuf\Internal\Message -{ - private $name; - private $has_name = false; - private $identifier_value = ''; - private $has_identifier_value = false; - private $positive_int_value = 0; - private $has_positive_int_value = false; - private $negative_int_value = 0; - private $has_negative_int_value = false; - private $double_value = 0.0; - private $has_double_value = false; - private $string_value = ''; - private $has_string_value = false; - private $aggregate_value = ''; - private $has_aggregate_value = false; - - public function getName() - { - return $this->name; - } - - public function setName(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption_NamePart::class); - $this->name = $var; - $this->has_name = true; - } - - public function hasName() - { - return $this->has_name; - } - - public function getIdentifierValue() - { - return $this->identifier_value; - } - - public function setIdentifierValue($var) - { - GPBUtil::checkString($var, True); - $this->identifier_value = $var; - $this->has_identifier_value = true; - } - - public function hasIdentifierValue() - { - return $this->has_identifier_value; - } - - public function getPositiveIntValue() - { - return $this->positive_int_value; - } - - public function setPositiveIntValue($var) - { - GPBUtil::checkUint64($var); - $this->positive_int_value = $var; - $this->has_positive_int_value = true; - } - - public function hasPositiveIntValue() - { - return $this->has_positive_int_value; - } - - public function getNegativeIntValue() - { - return $this->negative_int_value; - } - - public function setNegativeIntValue($var) - { - GPBUtil::checkInt64($var); - $this->negative_int_value = $var; - $this->has_negative_int_value = true; - } - - public function hasNegativeIntValue() - { - return $this->has_negative_int_value; - } - - public function getDoubleValue() - { - return $this->double_value; - } - - public function setDoubleValue($var) - { - GPBUtil::checkDouble($var); - $this->double_value = $var; - $this->has_double_value = true; - } - - public function hasDoubleValue() - { - return $this->has_double_value; - } - - public function getStringValue() - { - return $this->string_value; - } - - public function setStringValue($var) - { - GPBUtil::checkString($var, False); - $this->string_value = $var; - $this->has_string_value = true; - } - - public function hasStringValue() - { - return $this->has_string_value; - } - - public function getAggregateValue() - { - return $this->aggregate_value; - } - - public function setAggregateValue($var) - { - GPBUtil::checkString($var, True); - $this->aggregate_value = $var; - $this->has_aggregate_value = true; - } - - public function hasAggregateValue() - { - return $this->has_aggregate_value; - } - -} - -class UninterpretedOption_NamePart extends \Google\Protobuf\Internal\Message -{ - private $name_part = ''; - private $has_name_part = false; - private $is_extension = false; - private $has_is_extension = false; - - public function getNamePart() - { - return $this->name_part; - } - - public function setNamePart($var) - { - GPBUtil::checkString($var, True); - $this->name_part = $var; - $this->has_name_part = true; - } - - public function hasNamePart() - { - return $this->has_name_part; - } - - public function getIsExtension() - { - return $this->is_extension; - } - - public function setIsExtension($var) - { - GPBUtil::checkBool($var); - $this->is_extension = $var; - $this->has_is_extension = true; - } - - public function hasIsExtension() - { - return $this->has_is_extension; - } - -} - -class SourceCodeInfo extends \Google\Protobuf\Internal\Message -{ - private $location; - private $has_location = false; - - public function getLocation() - { - return $this->location; - } - - public function setLocation(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, \Google\Protobuf\Internal\SourceCodeInfo_Location::class); - $this->location = $var; - $this->has_location = true; - } - - public function hasLocation() - { - return $this->has_location; - } - -} - -class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message -{ - private $path; - private $has_path = false; - private $span; - private $has_span = false; - private $leading_comments = ''; - private $has_leading_comments = false; - private $trailing_comments = ''; - private $has_trailing_comments = false; - private $leading_detached_comments; - private $has_leading_detached_comments = false; - - public function getPath() - { - return $this->path; - } - - public function setPath(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::INT32); - $this->path = $var; - $this->has_path = true; - } - - public function hasPath() - { - return $this->has_path; - } - - public function getSpan() - { - return $this->span; - } - - public function setSpan(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::INT32); - $this->span = $var; - $this->has_span = true; - } - - public function hasSpan() - { - return $this->has_span; - } - - public function getLeadingComments() - { - return $this->leading_comments; - } - - public function setLeadingComments($var) - { - GPBUtil::checkString($var, True); - $this->leading_comments = $var; - $this->has_leading_comments = true; - } - - public function hasLeadingComments() - { - return $this->has_leading_comments; - } - - public function getTrailingComments() - { - return $this->trailing_comments; - } - - public function setTrailingComments($var) - { - GPBUtil::checkString($var, True); - $this->trailing_comments = $var; - $this->has_trailing_comments = true; - } - - public function hasTrailingComments() - { - return $this->has_trailing_comments; - } - - public function getLeadingDetachedComments() - { - return $this->leading_detached_comments; - } - - public function setLeadingDetachedComments(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::STRING); - $this->leading_detached_comments = $var; - $this->has_leading_detached_comments = true; - } - - public function hasLeadingDetachedComments() - { - return $this->has_leading_detached_comments; - } - -} - -class GeneratedCodeInfo extends \Google\Protobuf\Internal\Message -{ - private $annotation; - private $has_annotation = false; - - public function getAnnotation() - { - return $this->annotation; - } - - public function setAnnotation(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, \Google\Protobuf\Internal\GeneratedCodeInfo_Annotation::class); - $this->annotation = $var; - $this->has_annotation = true; - } - - public function hasAnnotation() - { - return $this->has_annotation; - } - -} - -class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message -{ - private $path; - private $has_path = false; - private $source_file = ''; - private $has_source_file = false; - private $begin = 0; - private $has_begin = false; - private $end = 0; - private $has_end = false; - - public function getPath() - { - return $this->path; - } - - public function setPath(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::INT32); - $this->path = $var; - $this->has_path = true; - } - - public function hasPath() - { - return $this->has_path; - } - - public function getSourceFile() - { - return $this->source_file; - } - - public function setSourceFile($var) - { - GPBUtil::checkString($var, True); - $this->source_file = $var; - $this->has_source_file = true; - } - - public function hasSourceFile() - { - return $this->has_source_file; - } - - public function getBegin() - { - return $this->begin; - } - - public function setBegin($var) - { - GPBUtil::checkInt32($var); - $this->begin = $var; - $this->has_begin = true; - } - - public function hasBegin() - { - return $this->has_begin; - } - - public function getEnd() - { - return $this->end; - } - - public function setEnd($var) - { - GPBUtil::checkInt32($var); - $this->end = $var; - $this->has_end = true; - } - - public function hasEnd() - { - return $this->has_end; - } - -} - -$pool = DescriptorPool::getGeneratedPool(); - -$pool->addMessage('google.protobuf.internal.FileDescriptorSet', FileDescriptorSet::class) - ->repeated('file', GPBType::MESSAGE, 1, 'google.protobuf.internal.FileDescriptorProto') - ->finalizeToPool(); - -$pool->addMessage('google.protobuf.internal.FileDescriptorProto', FileDescriptorProto::class) - ->optional('name', GPBType::STRING, 1) - ->optional('package', GPBType::STRING, 2) - ->repeated('dependency', GPBType::STRING, 3) - ->repeated('public_dependency', GPBType::INT32, 10) - ->repeated('weak_dependency', GPBType::INT32, 11) - ->repeated('message_type', GPBType::MESSAGE, 4, 'google.protobuf.internal.DescriptorProto') - ->repeated('enum_type', GPBType::MESSAGE, 5, 'google.protobuf.internal.EnumDescriptorProto') - ->repeated('service', GPBType::MESSAGE, 6, 'google.protobuf.internal.ServiceDescriptorProto') - ->repeated('extension', GPBType::MESSAGE, 7, 'google.protobuf.internal.FieldDescriptorProto') - ->optional('options', GPBType::MESSAGE, 8, 'google.protobuf.internal.FileOptions') - ->optional('source_code_info', GPBType::MESSAGE, 9, 'google.protobuf.internal.SourceCodeInfo') - ->optional('syntax', GPBType::STRING, 12) - ->finalizeToPool(); - -$pool->addMessage('google.protobuf.internal.DescriptorProto', DescriptorProto::class) - ->optional('name', GPBType::STRING, 1) - ->repeated('field', GPBType::MESSAGE, 2, 'google.protobuf.internal.FieldDescriptorProto') - ->repeated('extension', GPBType::MESSAGE, 6, 'google.protobuf.internal.FieldDescriptorProto') - ->repeated('nested_type', GPBType::MESSAGE, 3, 'google.protobuf.internal.DescriptorProto') - ->repeated('enum_type', GPBType::MESSAGE, 4, 'google.protobuf.internal.EnumDescriptorProto') - ->repeated('extension_range', GPBType::MESSAGE, 5, 'google.protobuf.internal.DescriptorProto.ExtensionRange') - ->repeated('oneof_decl', GPBType::MESSAGE, 8, 'google.protobuf.internal.OneofDescriptorProto') - ->optional('options', GPBType::MESSAGE, 7, 'google.protobuf.internal.MessageOptions') - ->repeated('reserved_range', GPBType::MESSAGE, 9, 'google.protobuf.internal.DescriptorProto.ReservedRange') - ->repeated('reserved_name', GPBType::STRING, 10) - ->finalizeToPool(); - -$pool->addMessage('google.protobuf.internal.DescriptorProto.ExtensionRange', DescriptorProto_ExtensionRange::class) - ->optional('start', GPBType::INT32, 1) - ->optional('end', GPBType::INT32, 2) - ->finalizeToPool(); - -$pool->addMessage('google.protobuf.internal.DescriptorProto.ReservedRange', DescriptorProto_ReservedRange::class) - ->optional('start', GPBType::INT32, 1) - ->optional('end', GPBType::INT32, 2) - ->finalizeToPool(); - -$pool->addMessage('google.protobuf.internal.FieldDescriptorProto', FieldDescriptorProto::class) - ->optional('name', GPBType::STRING, 1) - ->optional('number', GPBType::INT32, 3) - ->optional('label', GPBType::ENUM, 4, 'google.protobuf.internal.FieldDescriptorProto.Label') - ->optional('type', GPBType::ENUM, 5, 'google.protobuf.internal.FieldDescriptorProto.Type') - ->optional('type_name', GPBType::STRING, 6) - ->optional('extendee', GPBType::STRING, 2) - ->optional('default_value', GPBType::STRING, 7) - ->optional('oneof_index', GPBType::INT32, 9) - ->optional('json_name', GPBType::STRING, 10) - ->optional('options', GPBType::MESSAGE, 8, 'google.protobuf.internal.FieldOptions') - ->finalizeToPool(); - -$pool->addEnum('google.protobuf.internal.FieldDescriptorProto.Type', Type::class) - ->value("TYPE_DOUBLE", 1) - ->value("TYPE_FLOAT", 2) - ->value("TYPE_INT64", 3) - ->value("TYPE_UINT64", 4) - ->value("TYPE_INT32", 5) - ->value("TYPE_FIXED64", 6) - ->value("TYPE_FIXED32", 7) - ->value("TYPE_BOOL", 8) - ->value("TYPE_STRING", 9) - ->value("TYPE_GROUP", 10) - ->value("TYPE_MESSAGE", 11) - ->value("TYPE_BYTES", 12) - ->value("TYPE_UINT32", 13) - ->value("TYPE_ENUM", 14) - ->value("TYPE_SFIXED32", 15) - ->value("TYPE_SFIXED64", 16) - ->value("TYPE_SINT32", 17) - ->value("TYPE_SINT64", 18) - ->finalizeToPool(); - -$pool->addEnum('google.protobuf.internal.FieldDescriptorProto.Label', Label::class) - ->value("LABEL_OPTIONAL", 1) - ->value("LABEL_REQUIRED", 2) - ->value("LABEL_REPEATED", 3) - ->finalizeToPool(); - -$pool->addMessage('google.protobuf.internal.OneofDescriptorProto', OneofDescriptorProto::class) - ->optional('name', GPBType::STRING, 1) - ->optional('options', GPBType::MESSAGE, 2, 'google.protobuf.internal.OneofOptions') - ->finalizeToPool(); - -$pool->addMessage('google.protobuf.internal.EnumDescriptorProto', EnumDescriptorProto::class) - ->optional('name', GPBType::STRING, 1) - ->repeated('value', GPBType::MESSAGE, 2, 'google.protobuf.internal.EnumValueDescriptorProto') - ->optional('options', GPBType::MESSAGE, 3, 'google.protobuf.internal.EnumOptions') - ->finalizeToPool(); - -$pool->addMessage('google.protobuf.internal.EnumValueDescriptorProto', EnumValueDescriptorProto::class) - ->optional('name', GPBType::STRING, 1) - ->optional('number', GPBType::INT32, 2) - ->optional('options', GPBType::MESSAGE, 3, 'google.protobuf.internal.EnumValueOptions') - ->finalizeToPool(); - -$pool->addMessage('google.protobuf.internal.ServiceDescriptorProto', ServiceDescriptorProto::class) - ->optional('name', GPBType::STRING, 1) - ->repeated('method', GPBType::MESSAGE, 2, 'google.protobuf.internal.MethodDescriptorProto') - ->optional('options', GPBType::MESSAGE, 3, 'google.protobuf.internal.ServiceOptions') - ->finalizeToPool(); - -$pool->addMessage('google.protobuf.internal.MethodDescriptorProto', MethodDescriptorProto::class) - ->optional('name', GPBType::STRING, 1) - ->optional('input_type', GPBType::STRING, 2) - ->optional('output_type', GPBType::STRING, 3) - ->optional('options', GPBType::MESSAGE, 4, 'google.protobuf.internal.MethodOptions') - ->optional('client_streaming', GPBType::BOOL, 5) - ->optional('server_streaming', GPBType::BOOL, 6) - ->finalizeToPool(); - -$pool->addMessage('google.protobuf.internal.FileOptions', FileOptions::class) - ->optional('java_package', GPBType::STRING, 1) - ->optional('java_outer_classname', GPBType::STRING, 8) - ->optional('java_multiple_files', GPBType::BOOL, 10) - ->optional('java_generate_equals_and_hash', GPBType::BOOL, 20) - ->optional('java_string_check_utf8', GPBType::BOOL, 27) - ->optional('optimize_for', GPBType::ENUM, 9, 'google.protobuf.internal.FileOptions.OptimizeMode') - ->optional('go_package', GPBType::STRING, 11) - ->optional('cc_generic_services', GPBType::BOOL, 16) - ->optional('java_generic_services', GPBType::BOOL, 17) - ->optional('py_generic_services', GPBType::BOOL, 18) - ->optional('deprecated', GPBType::BOOL, 23) - ->optional('cc_enable_arenas', GPBType::BOOL, 31) - ->optional('objc_class_prefix', GPBType::STRING, 36) - ->optional('csharp_namespace', GPBType::STRING, 37) - ->repeated('uninterpreted_option', GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') - ->finalizeToPool(); - -$pool->addEnum('google.protobuf.internal.FileOptions.OptimizeMode', OptimizeMode::class) - ->value("SPEED", 1) - ->value("CODE_SIZE", 2) - ->value("LITE_RUNTIME", 3) - ->finalizeToPool(); - -$pool->addMessage('google.protobuf.internal.MessageOptions', MessageOptions::class) - ->optional('message_set_wire_format', GPBType::BOOL, 1) - ->optional('no_standard_descriptor_accessor', GPBType::BOOL, 2) - ->optional('deprecated', GPBType::BOOL, 3) - ->optional('map_entry', GPBType::BOOL, 7) - ->repeated('uninterpreted_option', GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') - ->finalizeToPool(); - -$pool->addMessage('google.protobuf.internal.FieldOptions', FieldOptions::class) - ->optional('ctype', GPBType::ENUM, 1, 'google.protobuf.internal.FieldOptions.CType') - ->optional('packed', GPBType::BOOL, 2) - ->optional('jstype', GPBType::ENUM, 6, 'google.protobuf.internal.FieldOptions.JSType') - ->optional('lazy', GPBType::BOOL, 5) - ->optional('deprecated', GPBType::BOOL, 3) - ->optional('weak', GPBType::BOOL, 10) - ->repeated('uninterpreted_option', GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') - ->finalizeToPool(); - -$pool->addEnum('google.protobuf.internal.FieldOptions.CType', CType::class) - ->value("STRING", 0) - ->value("CORD", 1) - ->value("STRING_PIECE", 2) - ->finalizeToPool(); - -$pool->addEnum('google.protobuf.internal.FieldOptions.JSType', JSType::class) - ->value("JS_NORMAL", 0) - ->value("JS_STRING", 1) - ->value("JS_NUMBER", 2) - ->finalizeToPool(); - -$pool->addMessage('google.protobuf.internal.OneofOptions', OneofOptions::class) - ->repeated('uninterpreted_option', GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') - ->finalizeToPool(); - -$pool->addMessage('google.protobuf.internal.EnumOptions', EnumOptions::class) - ->optional('allow_alias', GPBType::BOOL, 2) - ->optional('deprecated', GPBType::BOOL, 3) - ->repeated('uninterpreted_option', GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') - ->finalizeToPool(); - -$pool->addMessage('google.protobuf.internal.EnumValueOptions', EnumValueOptions::class) - ->optional('deprecated', GPBType::BOOL, 1) - ->repeated('uninterpreted_option', GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') - ->finalizeToPool(); - -$pool->addMessage('google.protobuf.internal.ServiceOptions', ServiceOptions::class) - ->optional('deprecated', GPBType::BOOL, 33) - ->repeated('uninterpreted_option', GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') - ->finalizeToPool(); - -$pool->addMessage('google.protobuf.internal.MethodOptions', MethodOptions::class) - ->optional('deprecated', GPBType::BOOL, 33) - ->repeated('uninterpreted_option', GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') - ->finalizeToPool(); - -$pool->addMessage('google.protobuf.internal.UninterpretedOption', UninterpretedOption::class) - ->repeated('name', GPBType::MESSAGE, 2, 'google.protobuf.internal.UninterpretedOption.NamePart') - ->optional('identifier_value', GPBType::STRING, 3) - ->optional('positive_int_value', GPBType::UINT64, 4) - ->optional('negative_int_value', GPBType::INT64, 5) - ->optional('double_value', GPBType::DOUBLE, 6) - ->optional('string_value', GPBType::BYTES, 7) - ->optional('aggregate_value', GPBType::STRING, 8) - ->finalizeToPool(); - -$pool->addMessage('google.protobuf.internal.UninterpretedOption.NamePart', UninterpretedOption_NamePart::class) - ->required('name_part', GPBType::STRING, 1) - ->required('is_extension', GPBType::BOOL, 2) - ->finalizeToPool(); - -$pool->addMessage('google.protobuf.internal.SourceCodeInfo', SourceCodeInfo::class) - ->repeated('location', GPBType::MESSAGE, 1, 'google.protobuf.internal.SourceCodeInfo.Location') - ->finalizeToPool(); - -$pool->addMessage('google.protobuf.internal.SourceCodeInfo.Location', SourceCodeInfo_Location::class) - ->repeated('path', GPBType::INT32, 1) - ->repeated('span', GPBType::INT32, 2) - ->optional('leading_comments', GPBType::STRING, 3) - ->optional('trailing_comments', GPBType::STRING, 4) - ->repeated('leading_detached_comments', GPBType::STRING, 6) - ->finalizeToPool(); - -$pool->addMessage('google.protobuf.internal.GeneratedCodeInfo', GeneratedCodeInfo::class) - ->repeated('annotation', GPBType::MESSAGE, 1, 'google.protobuf.internal.GeneratedCodeInfo.Annotation') - ->finalizeToPool(); - -$pool->addMessage('google.protobuf.internal.GeneratedCodeInfo.Annotation', GeneratedCodeInfo_Annotation::class) - ->repeated('path', GPBType::INT32, 1) - ->optional('source_file', GPBType::STRING, 2) - ->optional('begin', GPBType::INT32, 3) - ->optional('end', GPBType::INT32, 4) - ->finalizeToPool(); - -$pool->finish(); diff --git a/php/tests/array_test.php b/php/tests/array_test.php index a79a08bc..a4cad719 100644 --- a/php/tests/array_test.php +++ b/php/tests/array_test.php @@ -1,6 +1,5 @@ $value) { + $path = realpath($dir.DIRECTORY_SEPARATOR.$value); + if (!is_dir($path)) { + $results[] = $path; + } else if ($value != "." && $value != "..") { + getGeneratedFiles($path, $results); + } + } + return $results; +} + +foreach (getGeneratedFiles("generated") as $filename) +{ + if (!is_dir($filename)) { + include_once $filename; + } + +} + diff --git a/php/tests/encode_decode_test.php b/php/tests/encode_decode_test.php index d07907c0..af9c0415 100644 --- a/php/tests/encode_decode_test.php +++ b/php/tests/encode_decode_test.php @@ -1,6 +1,5 @@ internalAddGeneratedFile(hex2bin( - "0ab7010a1b676f6f676c652f70726f746f6275662f656d7074792e70726f" . - "746f120f676f6f676c652e70726f746f62756622070a05456d7074794276" . - "0a13636f6d2e676f6f676c652e70726f746f627566420a456d7074795072" . - "6f746f50015a276769746875622e636f6d2f676f6c616e672f70726f746f" . - "6275662f7074797065732f656d707479f80101a20203475042aa021e476f" . - "6f676c652e50726f746f6275662e57656c6c4b6e6f776e54797065736206" . - "70726f746f33" -)); - diff --git a/php/tests/map_field_test.php b/php/tests/map_field_test.php index 4e42361d..d4ec44fc 100644 --- a/php/tests/map_field_test.php +++ b/php/tests/map_field_test.php @@ -1,6 +1,5 @@ map_int32_int32 = 71; + map map_int64_int64 = 72; + map map_uint32_uint32 = 73; + map map_uint64_uint64 = 74; + map map_sint32_sint32 = 75; + map map_sint64_sint64 = 76; + map map_fixed32_fixed32 = 77; + map map_fixed64_fixed64 = 78; + map map_sfixed32_sfixed32 = 79; + map map_sfixed64_sfixed64 = 80; + map map_int32_float = 81; + map map_int32_double = 82; + map map_bool_bool = 83; + map map_string_string = 84; + map map_int32_bytes = 85; + map map_int32_enum = 86; + map map_int32_message = 87; + + map map_recursive = 88; + + message Sub { + int32 a = 1; + } + + // NestedMessage nested_message = 90; +} + +enum TestEnum { + ZERO = 0; + ONE = 1; +} + +message TestPackedMessage { + repeated int32 repeated_int32 = 90 [packed = true]; + repeated int64 repeated_int64 = 91 [packed = true]; + repeated uint32 repeated_uint32 = 92 [packed = true]; + repeated uint64 repeated_uint64 = 93 [packed = true]; + repeated sint32 repeated_sint32 = 94 [packed = true]; + repeated sint64 repeated_sint64 = 95 [packed = true]; + repeated fixed32 repeated_fixed32 = 96 [packed = true]; + repeated fixed64 repeated_fixed64 = 97 [packed = true]; + repeated sfixed32 repeated_sfixed32 = 98 [packed = true]; + repeated sfixed64 repeated_sfixed64 = 99 [packed = true]; + repeated float repeated_float = 100 [packed = true]; + repeated double repeated_double = 101 [packed = true]; + repeated bool repeated_bool = 102 [packed = true]; + repeated TestEnum repeated_enum = 103 [packed = true]; +} + +// Need to be in sync with TestPackedMessage. +message TestUnpackedMessage { + repeated int32 repeated_int32 = 90 [packed = false]; + repeated int64 repeated_int64 = 91 [packed = false]; + repeated uint32 repeated_uint32 = 92 [packed = false]; + repeated uint64 repeated_uint64 = 93 [packed = false]; + repeated sint32 repeated_sint32 = 94 [packed = false]; + repeated sint64 repeated_sint64 = 95 [packed = false]; + repeated fixed32 repeated_fixed32 = 96 [packed = false]; + repeated fixed64 repeated_fixed64 = 97 [packed = false]; + repeated sfixed32 repeated_sfixed32 = 98 [packed = false]; + repeated sfixed64 repeated_sfixed64 = 99 [packed = false]; + repeated float repeated_float = 100 [packed = false]; + repeated double repeated_double = 101 [packed = false]; + repeated bool repeated_bool = 102 [packed = false]; + repeated TestEnum repeated_enum = 103 [packed = false]; +} + +// /**/@<>&\{ +message TestPhpDoc { + int32 a = 1; +} diff --git a/php/tests/proto/test_include.proto b/php/tests/proto/test_include.proto new file mode 100644 index 00000000..9844617f --- /dev/null +++ b/php/tests/proto/test_include.proto @@ -0,0 +1,7 @@ +syntax = "proto3"; + +package bar; + +message TestInclude { + int32 a = 1; +} diff --git a/php/tests/proto/test_no_namespace.proto b/php/tests/proto/test_no_namespace.proto new file mode 100644 index 00000000..4331aeab --- /dev/null +++ b/php/tests/proto/test_no_namespace.proto @@ -0,0 +1,5 @@ +syntax = "proto3"; + +message NoNameSpace { + int32 a = 1; +} diff --git a/php/tests/test.pb.php b/php/tests/test.pb.php deleted file mode 100644 index 87332ae9..00000000 --- a/php/tests/test.pb.php +++ /dev/null @@ -1,2325 +0,0 @@ -foo.TestMessage - */ -class TestMessage extends \Google\Protobuf\Internal\Message -{ - /** - *
-     * Singular
-     * 
- * - * optional int32 optional_int32 = 1; - */ - private $optional_int32 = 0; - /** - * optional int64 optional_int64 = 2; - */ - private $optional_int64 = 0; - /** - * optional uint32 optional_uint32 = 3; - */ - private $optional_uint32 = 0; - /** - * optional uint64 optional_uint64 = 4; - */ - private $optional_uint64 = 0; - /** - * optional sint32 optional_sint32 = 5; - */ - private $optional_sint32 = 0; - /** - * optional sint64 optional_sint64 = 6; - */ - private $optional_sint64 = 0; - /** - * optional fixed32 optional_fixed32 = 7; - */ - private $optional_fixed32 = 0; - /** - * optional fixed64 optional_fixed64 = 8; - */ - private $optional_fixed64 = 0; - /** - * optional sfixed32 optional_sfixed32 = 9; - */ - private $optional_sfixed32 = 0; - /** - * optional sfixed64 optional_sfixed64 = 10; - */ - private $optional_sfixed64 = 0; - /** - * optional float optional_float = 11; - */ - private $optional_float = 0.0; - /** - * optional double optional_double = 12; - */ - private $optional_double = 0.0; - /** - * optional bool optional_bool = 13; - */ - private $optional_bool = false; - /** - * optional string optional_string = 14; - */ - private $optional_string = ''; - /** - * optional bytes optional_bytes = 15; - */ - private $optional_bytes = ''; - /** - * optional .foo.TestEnum optional_enum = 16; - */ - private $optional_enum = 0; - /** - * optional .foo.TestMessage.Sub optional_message = 17; - */ - private $optional_message = null; - /** - * optional .bar.TestInclude optional_included_message = 18; - */ - private $optional_included_message = null; - /** - * optional .foo.TestMessage recursive = 19; - */ - private $recursive = null; - /** - *
-     * Repeated
-     * 
- * - * repeated int32 repeated_int32 = 31; - */ - private $repeated_int32; - /** - * repeated int64 repeated_int64 = 32; - */ - private $repeated_int64; - /** - * repeated uint32 repeated_uint32 = 33; - */ - private $repeated_uint32; - /** - * repeated uint64 repeated_uint64 = 34; - */ - private $repeated_uint64; - /** - * repeated sint32 repeated_sint32 = 35; - */ - private $repeated_sint32; - /** - * repeated sint64 repeated_sint64 = 36; - */ - private $repeated_sint64; - /** - * repeated fixed32 repeated_fixed32 = 37; - */ - private $repeated_fixed32; - /** - * repeated fixed64 repeated_fixed64 = 38; - */ - private $repeated_fixed64; - /** - * repeated sfixed32 repeated_sfixed32 = 39; - */ - private $repeated_sfixed32; - /** - * repeated sfixed64 repeated_sfixed64 = 40; - */ - private $repeated_sfixed64; - /** - * repeated float repeated_float = 41; - */ - private $repeated_float; - /** - * repeated double repeated_double = 42; - */ - private $repeated_double; - /** - * repeated bool repeated_bool = 43; - */ - private $repeated_bool; - /** - * repeated string repeated_string = 44; - */ - private $repeated_string; - /** - * repeated bytes repeated_bytes = 45; - */ - private $repeated_bytes; - /** - * repeated .foo.TestEnum repeated_enum = 46; - */ - private $repeated_enum; - /** - * repeated .foo.TestMessage.Sub repeated_message = 47; - */ - private $repeated_message; - /** - * repeated .foo.TestMessage repeated_recursive = 48; - */ - private $repeated_recursive; - /** - * map<int32, int32> map_int32_int32 = 71; - */ - private $map_int32_int32; - /** - * map<int64, int64> map_int64_int64 = 72; - */ - private $map_int64_int64; - /** - * map<uint32, uint32> map_uint32_uint32 = 73; - */ - private $map_uint32_uint32; - /** - * map<uint64, uint64> map_uint64_uint64 = 74; - */ - private $map_uint64_uint64; - /** - * map<sint32, sint32> map_sint32_sint32 = 75; - */ - private $map_sint32_sint32; - /** - * map<sint64, sint64> map_sint64_sint64 = 76; - */ - private $map_sint64_sint64; - /** - * map<fixed32, fixed32> map_fixed32_fixed32 = 77; - */ - private $map_fixed32_fixed32; - /** - * map<fixed64, fixed64> map_fixed64_fixed64 = 78; - */ - private $map_fixed64_fixed64; - /** - * map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 79; - */ - private $map_sfixed32_sfixed32; - /** - * map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 80; - */ - private $map_sfixed64_sfixed64; - /** - * map<int32, float> map_int32_float = 81; - */ - private $map_int32_float; - /** - * map<int32, double> map_int32_double = 82; - */ - private $map_int32_double; - /** - * map<bool, bool> map_bool_bool = 83; - */ - private $map_bool_bool; - /** - * map<string, string> map_string_string = 84; - */ - private $map_string_string; - /** - * map<int32, bytes> map_int32_bytes = 85; - */ - private $map_int32_bytes; - /** - * map<int32, .foo.TestEnum> map_int32_enum = 86; - */ - private $map_int32_enum; - /** - * map<int32, .foo.TestMessage.Sub> map_int32_message = 87; - */ - private $map_int32_message; - /** - * map<int32, .foo.TestMessage> map_recursive = 88; - */ - private $map_recursive; - protected $my_oneof; - - /** - *
-     * Singular
-     * 
- * - * optional int32 optional_int32 = 1; - */ - public function getOptionalInt32() - { - return $this->optional_int32; - } - - /** - *
-     * Singular
-     * 
- * - * optional int32 optional_int32 = 1; - */ - public function setOptionalInt32($var) - { - GPBUtil::checkInt32($var); - $this->optional_int32 = $var; - } - - /** - * optional int64 optional_int64 = 2; - */ - public function getOptionalInt64() - { - return $this->optional_int64; - } - - /** - * optional int64 optional_int64 = 2; - */ - public function setOptionalInt64($var) - { - GPBUtil::checkInt64($var); - $this->optional_int64 = $var; - } - - /** - * optional uint32 optional_uint32 = 3; - */ - public function getOptionalUint32() - { - return $this->optional_uint32; - } - - /** - * optional uint32 optional_uint32 = 3; - */ - public function setOptionalUint32($var) - { - GPBUtil::checkUint32($var); - $this->optional_uint32 = $var; - } - - /** - * optional uint64 optional_uint64 = 4; - */ - public function getOptionalUint64() - { - return $this->optional_uint64; - } - - /** - * optional uint64 optional_uint64 = 4; - */ - public function setOptionalUint64($var) - { - GPBUtil::checkUint64($var); - $this->optional_uint64 = $var; - } - - /** - * optional sint32 optional_sint32 = 5; - */ - public function getOptionalSint32() - { - return $this->optional_sint32; - } - - /** - * optional sint32 optional_sint32 = 5; - */ - public function setOptionalSint32($var) - { - GPBUtil::checkInt32($var); - $this->optional_sint32 = $var; - } - - /** - * optional sint64 optional_sint64 = 6; - */ - public function getOptionalSint64() - { - return $this->optional_sint64; - } - - /** - * optional sint64 optional_sint64 = 6; - */ - public function setOptionalSint64($var) - { - GPBUtil::checkInt64($var); - $this->optional_sint64 = $var; - } - - /** - * optional fixed32 optional_fixed32 = 7; - */ - public function getOptionalFixed32() - { - return $this->optional_fixed32; - } - - /** - * optional fixed32 optional_fixed32 = 7; - */ - public function setOptionalFixed32($var) - { - GPBUtil::checkUint32($var); - $this->optional_fixed32 = $var; - } - - /** - * optional fixed64 optional_fixed64 = 8; - */ - public function getOptionalFixed64() - { - return $this->optional_fixed64; - } - - /** - * optional fixed64 optional_fixed64 = 8; - */ - public function setOptionalFixed64($var) - { - GPBUtil::checkUint64($var); - $this->optional_fixed64 = $var; - } - - /** - * optional sfixed32 optional_sfixed32 = 9; - */ - public function getOptionalSfixed32() - { - return $this->optional_sfixed32; - } - - /** - * optional sfixed32 optional_sfixed32 = 9; - */ - public function setOptionalSfixed32($var) - { - GPBUtil::checkInt32($var); - $this->optional_sfixed32 = $var; - } - - /** - * optional sfixed64 optional_sfixed64 = 10; - */ - public function getOptionalSfixed64() - { - return $this->optional_sfixed64; - } - - /** - * optional sfixed64 optional_sfixed64 = 10; - */ - public function setOptionalSfixed64($var) - { - GPBUtil::checkInt64($var); - $this->optional_sfixed64 = $var; - } - - /** - * optional float optional_float = 11; - */ - public function getOptionalFloat() - { - return $this->optional_float; - } - - /** - * optional float optional_float = 11; - */ - public function setOptionalFloat($var) - { - GPBUtil::checkFloat($var); - $this->optional_float = $var; - } - - /** - * optional double optional_double = 12; - */ - public function getOptionalDouble() - { - return $this->optional_double; - } - - /** - * optional double optional_double = 12; - */ - public function setOptionalDouble($var) - { - GPBUtil::checkDouble($var); - $this->optional_double = $var; - } - - /** - * optional bool optional_bool = 13; - */ - public function getOptionalBool() - { - return $this->optional_bool; - } - - /** - * optional bool optional_bool = 13; - */ - public function setOptionalBool($var) - { - GPBUtil::checkBool($var); - $this->optional_bool = $var; - } - - /** - * optional string optional_string = 14; - */ - public function getOptionalString() - { - return $this->optional_string; - } - - /** - * optional string optional_string = 14; - */ - public function setOptionalString($var) - { - GPBUtil::checkString($var, True); - $this->optional_string = $var; - } - - /** - * optional bytes optional_bytes = 15; - */ - public function getOptionalBytes() - { - return $this->optional_bytes; - } - - /** - * optional bytes optional_bytes = 15; - */ - public function setOptionalBytes($var) - { - GPBUtil::checkString($var, False); - $this->optional_bytes = $var; - } - - /** - * optional .foo.TestEnum optional_enum = 16; - */ - public function getOptionalEnum() - { - return $this->optional_enum; - } - - /** - * optional .foo.TestEnum optional_enum = 16; - */ - public function setOptionalEnum($var) - { - GPBUtil::checkEnum($var, \Foo\TestEnum::class); - $this->optional_enum = $var; - } - - /** - * optional .foo.TestMessage.Sub optional_message = 17; - */ - public function getOptionalMessage() - { - return $this->optional_message; - } - - /** - * optional .foo.TestMessage.Sub optional_message = 17; - */ - public function setOptionalMessage(&$var) - { - GPBUtil::checkMessage($var, \Foo\TestMessage_Sub::class); - $this->optional_message = $var; - } - - /** - * optional .bar.TestInclude optional_included_message = 18; - */ - public function getOptionalIncludedMessage() - { - return $this->optional_included_message; - } - - /** - * optional .bar.TestInclude optional_included_message = 18; - */ - public function setOptionalIncludedMessage(&$var) - { - GPBUtil::checkMessage($var, \Bar\TestInclude::class); - $this->optional_included_message = $var; - } - - /** - * optional .foo.TestMessage recursive = 19; - */ - public function getRecursive() - { - return $this->recursive; - } - - /** - * optional .foo.TestMessage recursive = 19; - */ - public function setRecursive(&$var) - { - GPBUtil::checkMessage($var, \Foo\TestMessage::class); - $this->recursive = $var; - } - - /** - *
-     * Repeated
-     * 
- * - * repeated int32 repeated_int32 = 31; - */ - public function getRepeatedInt32() - { - return $this->repeated_int32; - } - - /** - *
-     * Repeated
-     * 
- * - * repeated int32 repeated_int32 = 31; - */ - public function setRepeatedInt32(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::INT32); - $this->repeated_int32 = $var; - } - - /** - * repeated int64 repeated_int64 = 32; - */ - public function getRepeatedInt64() - { - return $this->repeated_int64; - } - - /** - * repeated int64 repeated_int64 = 32; - */ - public function setRepeatedInt64(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::INT64); - $this->repeated_int64 = $var; - } - - /** - * repeated uint32 repeated_uint32 = 33; - */ - public function getRepeatedUint32() - { - return $this->repeated_uint32; - } - - /** - * repeated uint32 repeated_uint32 = 33; - */ - public function setRepeatedUint32(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::UINT32); - $this->repeated_uint32 = $var; - } - - /** - * repeated uint64 repeated_uint64 = 34; - */ - public function getRepeatedUint64() - { - return $this->repeated_uint64; - } - - /** - * repeated uint64 repeated_uint64 = 34; - */ - public function setRepeatedUint64(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::UINT64); - $this->repeated_uint64 = $var; - } - - /** - * repeated sint32 repeated_sint32 = 35; - */ - public function getRepeatedSint32() - { - return $this->repeated_sint32; - } - - /** - * repeated sint32 repeated_sint32 = 35; - */ - public function setRepeatedSint32(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::SINT32); - $this->repeated_sint32 = $var; - } - - /** - * repeated sint64 repeated_sint64 = 36; - */ - public function getRepeatedSint64() - { - return $this->repeated_sint64; - } - - /** - * repeated sint64 repeated_sint64 = 36; - */ - public function setRepeatedSint64(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::SINT64); - $this->repeated_sint64 = $var; - } - - /** - * repeated fixed32 repeated_fixed32 = 37; - */ - public function getRepeatedFixed32() - { - return $this->repeated_fixed32; - } - - /** - * repeated fixed32 repeated_fixed32 = 37; - */ - public function setRepeatedFixed32(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::FIXED32); - $this->repeated_fixed32 = $var; - } - - /** - * repeated fixed64 repeated_fixed64 = 38; - */ - public function getRepeatedFixed64() - { - return $this->repeated_fixed64; - } - - /** - * repeated fixed64 repeated_fixed64 = 38; - */ - public function setRepeatedFixed64(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::FIXED64); - $this->repeated_fixed64 = $var; - } - - /** - * repeated sfixed32 repeated_sfixed32 = 39; - */ - public function getRepeatedSfixed32() - { - return $this->repeated_sfixed32; - } - - /** - * repeated sfixed32 repeated_sfixed32 = 39; - */ - public function setRepeatedSfixed32(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::SFIXED32); - $this->repeated_sfixed32 = $var; - } - - /** - * repeated sfixed64 repeated_sfixed64 = 40; - */ - public function getRepeatedSfixed64() - { - return $this->repeated_sfixed64; - } - - /** - * repeated sfixed64 repeated_sfixed64 = 40; - */ - public function setRepeatedSfixed64(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::SFIXED64); - $this->repeated_sfixed64 = $var; - } - - /** - * repeated float repeated_float = 41; - */ - public function getRepeatedFloat() - { - return $this->repeated_float; - } - - /** - * repeated float repeated_float = 41; - */ - public function setRepeatedFloat(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::FLOAT); - $this->repeated_float = $var; - } - - /** - * repeated double repeated_double = 42; - */ - public function getRepeatedDouble() - { - return $this->repeated_double; - } - - /** - * repeated double repeated_double = 42; - */ - public function setRepeatedDouble(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::DOUBLE); - $this->repeated_double = $var; - } - - /** - * repeated bool repeated_bool = 43; - */ - public function getRepeatedBool() - { - return $this->repeated_bool; - } - - /** - * repeated bool repeated_bool = 43; - */ - public function setRepeatedBool(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::BOOL); - $this->repeated_bool = $var; - } - - /** - * repeated string repeated_string = 44; - */ - public function getRepeatedString() - { - return $this->repeated_string; - } - - /** - * repeated string repeated_string = 44; - */ - public function setRepeatedString(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::STRING); - $this->repeated_string = $var; - } - - /** - * repeated bytes repeated_bytes = 45; - */ - public function getRepeatedBytes() - { - return $this->repeated_bytes; - } - - /** - * repeated bytes repeated_bytes = 45; - */ - public function setRepeatedBytes(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::BYTES); - $this->repeated_bytes = $var; - } - - /** - * repeated .foo.TestEnum repeated_enum = 46; - */ - public function getRepeatedEnum() - { - return $this->repeated_enum; - } - - /** - * repeated .foo.TestEnum repeated_enum = 46; - */ - public function setRepeatedEnum(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::ENUM, Foo\TestEnum::class); - $this->repeated_enum = $var; - } - - /** - * repeated .foo.TestMessage.Sub repeated_message = 47; - */ - public function getRepeatedMessage() - { - return $this->repeated_message; - } - - /** - * repeated .foo.TestMessage.Sub repeated_message = 47; - */ - public function setRepeatedMessage(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, \Foo\TestMessage_Sub::class); - $this->repeated_message = $var; - } - - /** - * repeated .foo.TestMessage repeated_recursive = 48; - */ - public function getRepeatedRecursive() - { - return $this->repeated_recursive; - } - - /** - * repeated .foo.TestMessage repeated_recursive = 48; - */ - public function setRepeatedRecursive(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, \Foo\TestMessage::class); - $this->repeated_recursive = $var; - } - - /** - * optional int32 oneof_int32 = 51; - */ - public function getOneofInt32() - { - return $this->readOneof(51); - } - - /** - * optional int32 oneof_int32 = 51; - */ - public function setOneofInt32($var) - { - GPBUtil::checkInt32($var); - $this->writeOneof(51, $var); - } - - /** - * optional int64 oneof_int64 = 52; - */ - public function getOneofInt64() - { - return $this->readOneof(52); - } - - /** - * optional int64 oneof_int64 = 52; - */ - public function setOneofInt64($var) - { - GPBUtil::checkInt64($var); - $this->writeOneof(52, $var); - } - - /** - * optional uint32 oneof_uint32 = 53; - */ - public function getOneofUint32() - { - return $this->readOneof(53); - } - - /** - * optional uint32 oneof_uint32 = 53; - */ - public function setOneofUint32($var) - { - GPBUtil::checkUint32($var); - $this->writeOneof(53, $var); - } - - /** - * optional uint64 oneof_uint64 = 54; - */ - public function getOneofUint64() - { - return $this->readOneof(54); - } - - /** - * optional uint64 oneof_uint64 = 54; - */ - public function setOneofUint64($var) - { - GPBUtil::checkUint64($var); - $this->writeOneof(54, $var); - } - - /** - * optional uint32 oneof_sint32 = 55; - */ - public function getOneofSint32() - { - return $this->readOneof(55); - } - - /** - * optional uint32 oneof_sint32 = 55; - */ - public function setOneofSint32($var) - { - GPBUtil::checkUint32($var); - $this->writeOneof(55, $var); - } - - /** - * optional uint64 oneof_sint64 = 56; - */ - public function getOneofSint64() - { - return $this->readOneof(56); - } - - /** - * optional uint64 oneof_sint64 = 56; - */ - public function setOneofSint64($var) - { - GPBUtil::checkUint64($var); - $this->writeOneof(56, $var); - } - - /** - * optional uint32 oneof_fixed32 = 57; - */ - public function getOneofFixed32() - { - return $this->readOneof(57); - } - - /** - * optional uint32 oneof_fixed32 = 57; - */ - public function setOneofFixed32($var) - { - GPBUtil::checkUint32($var); - $this->writeOneof(57, $var); - } - - /** - * optional uint64 oneof_fixed64 = 58; - */ - public function getOneofFixed64() - { - return $this->readOneof(58); - } - - /** - * optional uint64 oneof_fixed64 = 58; - */ - public function setOneofFixed64($var) - { - GPBUtil::checkUint64($var); - $this->writeOneof(58, $var); - } - - /** - * optional uint32 oneof_sfixed32 = 59; - */ - public function getOneofSfixed32() - { - return $this->readOneof(59); - } - - /** - * optional uint32 oneof_sfixed32 = 59; - */ - public function setOneofSfixed32($var) - { - GPBUtil::checkUint32($var); - $this->writeOneof(59, $var); - } - - /** - * optional uint64 oneof_sfixed64 = 60; - */ - public function getOneofSfixed64() - { - return $this->readOneof(60); - } - - /** - * optional uint64 oneof_sfixed64 = 60; - */ - public function setOneofSfixed64($var) - { - GPBUtil::checkUint64($var); - $this->writeOneof(60, $var); - } - - /** - * optional double oneof_double = 61; - */ - public function getOneofDouble() - { - return $this->readOneof(61); - } - - /** - * optional double oneof_double = 61; - */ - public function setOneofDouble($var) - { - GPBUtil::checkDouble($var); - $this->writeOneof(61, $var); - } - - /** - * optional float oneof_float = 62; - */ - public function getOneofFloat() - { - return $this->readOneof(62); - } - - /** - * optional float oneof_float = 62; - */ - public function setOneofFloat($var) - { - GPBUtil::checkFloat($var); - $this->writeOneof(62, $var); - } - - /** - * optional bool oneof_bool = 63; - */ - public function getOneofBool() - { - return $this->readOneof(63); - } - - /** - * optional bool oneof_bool = 63; - */ - public function setOneofBool($var) - { - GPBUtil::checkBool($var); - $this->writeOneof(63, $var); - } - - /** - * optional string oneof_string = 64; - */ - public function getOneofString() - { - return $this->readOneof(64); - } - - /** - * optional string oneof_string = 64; - */ - public function setOneofString($var) - { - GPBUtil::checkString($var, True); - $this->writeOneof(64, $var); - } - - /** - * optional bytes oneof_bytes = 65; - */ - public function getOneofBytes() - { - return $this->readOneof(65); - } - - /** - * optional bytes oneof_bytes = 65; - */ - public function setOneofBytes($var) - { - GPBUtil::checkString($var, False); - $this->writeOneof(65, $var); - } - - /** - * optional .foo.TestEnum oneof_enum = 66; - */ - public function getOneofEnum() - { - return $this->readOneof(66); - } - - /** - * optional .foo.TestEnum oneof_enum = 66; - */ - public function setOneofEnum($var) - { - GPBUtil::checkEnum($var, \Foo\TestEnum::class); - $this->writeOneof(66, $var); - } - - /** - * optional .foo.TestMessage.Sub oneof_message = 67; - */ - public function getOneofMessage() - { - return $this->readOneof(67); - } - - /** - * optional .foo.TestMessage.Sub oneof_message = 67; - */ - public function setOneofMessage(&$var) - { - GPBUtil::checkMessage($var, \Foo\TestMessage_Sub::class); - $this->writeOneof(67, $var); - } - - /** - * map<int32, int32> map_int32_int32 = 71; - */ - public function getMapInt32Int32() - { - return $this->map_int32_int32; - } - - /** - * map<int32, int32> map_int32_int32 = 71; - */ - public function setMapInt32Int32(&$var) - { - $this->map_int32_int32 = $var; - } - - /** - * map<int64, int64> map_int64_int64 = 72; - */ - public function getMapInt64Int64() - { - return $this->map_int64_int64; - } - - /** - * map<int64, int64> map_int64_int64 = 72; - */ - public function setMapInt64Int64(&$var) - { - $this->map_int64_int64 = $var; - } - - /** - * map<uint32, uint32> map_uint32_uint32 = 73; - */ - public function getMapUint32Uint32() - { - return $this->map_uint32_uint32; - } - - /** - * map<uint32, uint32> map_uint32_uint32 = 73; - */ - public function setMapUint32Uint32(&$var) - { - $this->map_uint32_uint32 = $var; - } - - /** - * map<uint64, uint64> map_uint64_uint64 = 74; - */ - public function getMapUint64Uint64() - { - return $this->map_uint64_uint64; - } - - /** - * map<uint64, uint64> map_uint64_uint64 = 74; - */ - public function setMapUint64Uint64(&$var) - { - $this->map_uint64_uint64 = $var; - } - - /** - * map<sint32, sint32> map_sint32_sint32 = 75; - */ - public function getMapSint32Sint32() - { - return $this->map_sint32_sint32; - } - - /** - * map<sint32, sint32> map_sint32_sint32 = 75; - */ - public function setMapSint32Sint32(&$var) - { - $this->map_sint32_sint32 = $var; - } - - /** - * map<sint64, sint64> map_sint64_sint64 = 76; - */ - public function getMapSint64Sint64() - { - return $this->map_sint64_sint64; - } - - /** - * map<sint64, sint64> map_sint64_sint64 = 76; - */ - public function setMapSint64Sint64(&$var) - { - $this->map_sint64_sint64 = $var; - } - - /** - * map<fixed32, fixed32> map_fixed32_fixed32 = 77; - */ - public function getMapFixed32Fixed32() - { - return $this->map_fixed32_fixed32; - } - - /** - * map<fixed32, fixed32> map_fixed32_fixed32 = 77; - */ - public function setMapFixed32Fixed32(&$var) - { - $this->map_fixed32_fixed32 = $var; - } - - /** - * map<fixed64, fixed64> map_fixed64_fixed64 = 78; - */ - public function getMapFixed64Fixed64() - { - return $this->map_fixed64_fixed64; - } - - /** - * map<fixed64, fixed64> map_fixed64_fixed64 = 78; - */ - public function setMapFixed64Fixed64(&$var) - { - $this->map_fixed64_fixed64 = $var; - } - - /** - * map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 79; - */ - public function getMapSfixed32Sfixed32() - { - return $this->map_sfixed32_sfixed32; - } - - /** - * map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 79; - */ - public function setMapSfixed32Sfixed32(&$var) - { - $this->map_sfixed32_sfixed32 = $var; - } - - /** - * map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 80; - */ - public function getMapSfixed64Sfixed64() - { - return $this->map_sfixed64_sfixed64; - } - - /** - * map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 80; - */ - public function setMapSfixed64Sfixed64(&$var) - { - $this->map_sfixed64_sfixed64 = $var; - } - - /** - * map<int32, float> map_int32_float = 81; - */ - public function getMapInt32Float() - { - return $this->map_int32_float; - } - - /** - * map<int32, float> map_int32_float = 81; - */ - public function setMapInt32Float(&$var) - { - $this->map_int32_float = $var; - } - - /** - * map<int32, double> map_int32_double = 82; - */ - public function getMapInt32Double() - { - return $this->map_int32_double; - } - - /** - * map<int32, double> map_int32_double = 82; - */ - public function setMapInt32Double(&$var) - { - $this->map_int32_double = $var; - } - - /** - * map<bool, bool> map_bool_bool = 83; - */ - public function getMapBoolBool() - { - return $this->map_bool_bool; - } - - /** - * map<bool, bool> map_bool_bool = 83; - */ - public function setMapBoolBool(&$var) - { - $this->map_bool_bool = $var; - } - - /** - * map<string, string> map_string_string = 84; - */ - public function getMapStringString() - { - return $this->map_string_string; - } - - /** - * map<string, string> map_string_string = 84; - */ - public function setMapStringString(&$var) - { - $this->map_string_string = $var; - } - - /** - * map<int32, bytes> map_int32_bytes = 85; - */ - public function getMapInt32Bytes() - { - return $this->map_int32_bytes; - } - - /** - * map<int32, bytes> map_int32_bytes = 85; - */ - public function setMapInt32Bytes(&$var) - { - $this->map_int32_bytes = $var; - } - - /** - * map<int32, .foo.TestEnum> map_int32_enum = 86; - */ - public function getMapInt32Enum() - { - return $this->map_int32_enum; - } - - /** - * map<int32, .foo.TestEnum> map_int32_enum = 86; - */ - public function setMapInt32Enum(&$var) - { - $this->map_int32_enum = $var; - } - - /** - * map<int32, .foo.TestMessage.Sub> map_int32_message = 87; - */ - public function getMapInt32Message() - { - return $this->map_int32_message; - } - - /** - * map<int32, .foo.TestMessage.Sub> map_int32_message = 87; - */ - public function setMapInt32Message(&$var) - { - $this->map_int32_message = $var; - } - - /** - * map<int32, .foo.TestMessage> map_recursive = 88; - */ - public function getMapRecursive() - { - return $this->map_recursive; - } - - /** - * map<int32, .foo.TestMessage> map_recursive = 88; - */ - public function setMapRecursive(&$var) - { - $this->map_recursive = $var; - } - - public function getMyOneof() - { - return $this->my_oneof; - } - -} - -/** - * Protobuf type foo.TestMessage.Sub - */ -class TestMessage_Sub extends \Google\Protobuf\Internal\Message -{ - /** - * optional int32 a = 1; - */ - private $a = 0; - - /** - * optional int32 a = 1; - */ - public function getA() - { - return $this->a; - } - - /** - * optional int32 a = 1; - */ - public function setA($var) - { - GPBUtil::checkInt32($var); - $this->a = $var; - } - -} - -/** - * Protobuf type foo.TestPackedMessage - */ -class TestPackedMessage extends \Google\Protobuf\Internal\Message -{ - /** - * repeated int32 repeated_int32 = 90 [packed = true]; - */ - private $repeated_int32; - /** - * repeated int64 repeated_int64 = 91 [packed = true]; - */ - private $repeated_int64; - /** - * repeated uint32 repeated_uint32 = 92 [packed = true]; - */ - private $repeated_uint32; - /** - * repeated uint64 repeated_uint64 = 93 [packed = true]; - */ - private $repeated_uint64; - /** - * repeated sint32 repeated_sint32 = 94 [packed = true]; - */ - private $repeated_sint32; - /** - * repeated sint64 repeated_sint64 = 95 [packed = true]; - */ - private $repeated_sint64; - /** - * repeated fixed32 repeated_fixed32 = 96 [packed = true]; - */ - private $repeated_fixed32; - /** - * repeated fixed64 repeated_fixed64 = 97 [packed = true]; - */ - private $repeated_fixed64; - /** - * repeated sfixed32 repeated_sfixed32 = 98 [packed = true]; - */ - private $repeated_sfixed32; - /** - * repeated sfixed64 repeated_sfixed64 = 99 [packed = true]; - */ - private $repeated_sfixed64; - /** - * repeated float repeated_float = 100 [packed = true]; - */ - private $repeated_float; - /** - * repeated double repeated_double = 101 [packed = true]; - */ - private $repeated_double; - /** - * repeated bool repeated_bool = 102 [packed = true]; - */ - private $repeated_bool; - /** - * repeated .foo.TestEnum repeated_enum = 103 [packed = true]; - */ - private $repeated_enum; - - /** - * repeated int32 repeated_int32 = 90 [packed = true]; - */ - public function getRepeatedInt32() - { - return $this->repeated_int32; - } - - /** - * repeated int32 repeated_int32 = 90 [packed = true]; - */ - public function setRepeatedInt32(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::INT32); - $this->repeated_int32 = $var; - } - - /** - * repeated int64 repeated_int64 = 91 [packed = true]; - */ - public function getRepeatedInt64() - { - return $this->repeated_int64; - } - - /** - * repeated int64 repeated_int64 = 91 [packed = true]; - */ - public function setRepeatedInt64(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::INT64); - $this->repeated_int64 = $var; - } - - /** - * repeated uint32 repeated_uint32 = 92 [packed = true]; - */ - public function getRepeatedUint32() - { - return $this->repeated_uint32; - } - - /** - * repeated uint32 repeated_uint32 = 92 [packed = true]; - */ - public function setRepeatedUint32(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::UINT32); - $this->repeated_uint32 = $var; - } - - /** - * repeated uint64 repeated_uint64 = 93 [packed = true]; - */ - public function getRepeatedUint64() - { - return $this->repeated_uint64; - } - - /** - * repeated uint64 repeated_uint64 = 93 [packed = true]; - */ - public function setRepeatedUint64(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::UINT64); - $this->repeated_uint64 = $var; - } - - /** - * repeated sint32 repeated_sint32 = 94 [packed = true]; - */ - public function getRepeatedSint32() - { - return $this->repeated_sint32; - } - - /** - * repeated sint32 repeated_sint32 = 94 [packed = true]; - */ - public function setRepeatedSint32(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::SINT32); - $this->repeated_sint32 = $var; - } - - /** - * repeated sint64 repeated_sint64 = 95 [packed = true]; - */ - public function getRepeatedSint64() - { - return $this->repeated_sint64; - } - - /** - * repeated sint64 repeated_sint64 = 95 [packed = true]; - */ - public function setRepeatedSint64(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::SINT64); - $this->repeated_sint64 = $var; - } - - /** - * repeated fixed32 repeated_fixed32 = 96 [packed = true]; - */ - public function getRepeatedFixed32() - { - return $this->repeated_fixed32; - } - - /** - * repeated fixed32 repeated_fixed32 = 96 [packed = true]; - */ - public function setRepeatedFixed32(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::FIXED32); - $this->repeated_fixed32 = $var; - } - - /** - * repeated fixed64 repeated_fixed64 = 97 [packed = true]; - */ - public function getRepeatedFixed64() - { - return $this->repeated_fixed64; - } - - /** - * repeated fixed64 repeated_fixed64 = 97 [packed = true]; - */ - public function setRepeatedFixed64(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::FIXED64); - $this->repeated_fixed64 = $var; - } - - /** - * repeated sfixed32 repeated_sfixed32 = 98 [packed = true]; - */ - public function getRepeatedSfixed32() - { - return $this->repeated_sfixed32; - } - - /** - * repeated sfixed32 repeated_sfixed32 = 98 [packed = true]; - */ - public function setRepeatedSfixed32(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::SFIXED32); - $this->repeated_sfixed32 = $var; - } - - /** - * repeated sfixed64 repeated_sfixed64 = 99 [packed = true]; - */ - public function getRepeatedSfixed64() - { - return $this->repeated_sfixed64; - } - - /** - * repeated sfixed64 repeated_sfixed64 = 99 [packed = true]; - */ - public function setRepeatedSfixed64(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::SFIXED64); - $this->repeated_sfixed64 = $var; - } - - /** - * repeated float repeated_float = 100 [packed = true]; - */ - public function getRepeatedFloat() - { - return $this->repeated_float; - } - - /** - * repeated float repeated_float = 100 [packed = true]; - */ - public function setRepeatedFloat(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::FLOAT); - $this->repeated_float = $var; - } - - /** - * repeated double repeated_double = 101 [packed = true]; - */ - public function getRepeatedDouble() - { - return $this->repeated_double; - } - - /** - * repeated double repeated_double = 101 [packed = true]; - */ - public function setRepeatedDouble(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::DOUBLE); - $this->repeated_double = $var; - } - - /** - * repeated bool repeated_bool = 102 [packed = true]; - */ - public function getRepeatedBool() - { - return $this->repeated_bool; - } - - /** - * repeated bool repeated_bool = 102 [packed = true]; - */ - public function setRepeatedBool(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::BOOL); - $this->repeated_bool = $var; - } - - /** - * repeated .foo.TestEnum repeated_enum = 103 [packed = true]; - */ - public function getRepeatedEnum() - { - return $this->repeated_enum; - } - - /** - * repeated .foo.TestEnum repeated_enum = 103 [packed = true]; - */ - public function setRepeatedEnum(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::ENUM, Foo\TestEnum::class); - $this->repeated_enum = $var; - } - -} - -/** - *
- * Need to be in sync with TestPackedMessage.
- * 
- * - * Protobuf type foo.TestUnpackedMessage - */ -class TestUnpackedMessage extends \Google\Protobuf\Internal\Message -{ - /** - * repeated int32 repeated_int32 = 90 [packed = false]; - */ - private $repeated_int32; - /** - * repeated int64 repeated_int64 = 91 [packed = false]; - */ - private $repeated_int64; - /** - * repeated uint32 repeated_uint32 = 92 [packed = false]; - */ - private $repeated_uint32; - /** - * repeated uint64 repeated_uint64 = 93 [packed = false]; - */ - private $repeated_uint64; - /** - * repeated sint32 repeated_sint32 = 94 [packed = false]; - */ - private $repeated_sint32; - /** - * repeated sint64 repeated_sint64 = 95 [packed = false]; - */ - private $repeated_sint64; - /** - * repeated fixed32 repeated_fixed32 = 96 [packed = false]; - */ - private $repeated_fixed32; - /** - * repeated fixed64 repeated_fixed64 = 97 [packed = false]; - */ - private $repeated_fixed64; - /** - * repeated sfixed32 repeated_sfixed32 = 98 [packed = false]; - */ - private $repeated_sfixed32; - /** - * repeated sfixed64 repeated_sfixed64 = 99 [packed = false]; - */ - private $repeated_sfixed64; - /** - * repeated float repeated_float = 100 [packed = false]; - */ - private $repeated_float; - /** - * repeated double repeated_double = 101 [packed = false]; - */ - private $repeated_double; - /** - * repeated bool repeated_bool = 102 [packed = false]; - */ - private $repeated_bool; - /** - * repeated .foo.TestEnum repeated_enum = 103 [packed = false]; - */ - private $repeated_enum; - - /** - * repeated int32 repeated_int32 = 90 [packed = false]; - */ - public function getRepeatedInt32() - { - return $this->repeated_int32; - } - - /** - * repeated int32 repeated_int32 = 90 [packed = false]; - */ - public function setRepeatedInt32(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::INT32); - $this->repeated_int32 = $var; - } - - /** - * repeated int64 repeated_int64 = 91 [packed = false]; - */ - public function getRepeatedInt64() - { - return $this->repeated_int64; - } - - /** - * repeated int64 repeated_int64 = 91 [packed = false]; - */ - public function setRepeatedInt64(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::INT64); - $this->repeated_int64 = $var; - } - - /** - * repeated uint32 repeated_uint32 = 92 [packed = false]; - */ - public function getRepeatedUint32() - { - return $this->repeated_uint32; - } - - /** - * repeated uint32 repeated_uint32 = 92 [packed = false]; - */ - public function setRepeatedUint32(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::UINT32); - $this->repeated_uint32 = $var; - } - - /** - * repeated uint64 repeated_uint64 = 93 [packed = false]; - */ - public function getRepeatedUint64() - { - return $this->repeated_uint64; - } - - /** - * repeated uint64 repeated_uint64 = 93 [packed = false]; - */ - public function setRepeatedUint64(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::UINT64); - $this->repeated_uint64 = $var; - } - - /** - * repeated sint32 repeated_sint32 = 94 [packed = false]; - */ - public function getRepeatedSint32() - { - return $this->repeated_sint32; - } - - /** - * repeated sint32 repeated_sint32 = 94 [packed = false]; - */ - public function setRepeatedSint32(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::SINT32); - $this->repeated_sint32 = $var; - } - - /** - * repeated sint64 repeated_sint64 = 95 [packed = false]; - */ - public function getRepeatedSint64() - { - return $this->repeated_sint64; - } - - /** - * repeated sint64 repeated_sint64 = 95 [packed = false]; - */ - public function setRepeatedSint64(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::SINT64); - $this->repeated_sint64 = $var; - } - - /** - * repeated fixed32 repeated_fixed32 = 96 [packed = false]; - */ - public function getRepeatedFixed32() - { - return $this->repeated_fixed32; - } - - /** - * repeated fixed32 repeated_fixed32 = 96 [packed = false]; - */ - public function setRepeatedFixed32(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::FIXED32); - $this->repeated_fixed32 = $var; - } - - /** - * repeated fixed64 repeated_fixed64 = 97 [packed = false]; - */ - public function getRepeatedFixed64() - { - return $this->repeated_fixed64; - } - - /** - * repeated fixed64 repeated_fixed64 = 97 [packed = false]; - */ - public function setRepeatedFixed64(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::FIXED64); - $this->repeated_fixed64 = $var; - } - - /** - * repeated sfixed32 repeated_sfixed32 = 98 [packed = false]; - */ - public function getRepeatedSfixed32() - { - return $this->repeated_sfixed32; - } - - /** - * repeated sfixed32 repeated_sfixed32 = 98 [packed = false]; - */ - public function setRepeatedSfixed32(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::SFIXED32); - $this->repeated_sfixed32 = $var; - } - - /** - * repeated sfixed64 repeated_sfixed64 = 99 [packed = false]; - */ - public function getRepeatedSfixed64() - { - return $this->repeated_sfixed64; - } - - /** - * repeated sfixed64 repeated_sfixed64 = 99 [packed = false]; - */ - public function setRepeatedSfixed64(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::SFIXED64); - $this->repeated_sfixed64 = $var; - } - - /** - * repeated float repeated_float = 100 [packed = false]; - */ - public function getRepeatedFloat() - { - return $this->repeated_float; - } - - /** - * repeated float repeated_float = 100 [packed = false]; - */ - public function setRepeatedFloat(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::FLOAT); - $this->repeated_float = $var; - } - - /** - * repeated double repeated_double = 101 [packed = false]; - */ - public function getRepeatedDouble() - { - return $this->repeated_double; - } - - /** - * repeated double repeated_double = 101 [packed = false]; - */ - public function setRepeatedDouble(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::DOUBLE); - $this->repeated_double = $var; - } - - /** - * repeated bool repeated_bool = 102 [packed = false]; - */ - public function getRepeatedBool() - { - return $this->repeated_bool; - } - - /** - * repeated bool repeated_bool = 102 [packed = false]; - */ - public function setRepeatedBool(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::BOOL); - $this->repeated_bool = $var; - } - - /** - * repeated .foo.TestEnum repeated_enum = 103 [packed = false]; - */ - public function getRepeatedEnum() - { - return $this->repeated_enum; - } - - /** - * repeated .foo.TestEnum repeated_enum = 103 [packed = false]; - */ - public function setRepeatedEnum(&$var) - { - GPBUtil::checkRepeatedField($var, GPBType::ENUM, Foo\TestEnum::class); - $this->repeated_enum = $var; - } - -} - -/** - *
- * /**/@<>&\{
- * 
- * - * Protobuf type foo.TestPhpDoc - */ -class TestPhpDoc extends \Google\Protobuf\Internal\Message -{ - /** - * optional int32 a = 1; - */ - private $a = 0; - - /** - * optional int32 a = 1; - */ - public function getA() - { - return $this->a; - } - - /** - * optional int32 a = 1; - */ - public function setA($var) - { - GPBUtil::checkInt32($var); - $this->a = $var; - } - -} - -/** - * Protobuf enum foo.TestEnum - */ -class TestEnum -{ - /** - * ZERO = 0; - */ - const ZERO = 0; - /** - * ONE = 1; - */ - const ONE = 1; -} - -$pool = DescriptorPool::getGeneratedPool(); - -$pool->internalAddGeneratedFile(hex2bin( - "0a9c250a0a746573742e70726f746f1203666f6f1a12746573745f696e63" . - "6c7564652e70726f746f22be1d0a0b546573744d65737361676512160a0e" . - "6f7074696f6e616c5f696e74333218012001280512160a0e6f7074696f6e" . - "616c5f696e74363418022001280312170a0f6f7074696f6e616c5f75696e" . - "74333218032001280d12170a0f6f7074696f6e616c5f75696e7436341804" . - "2001280412170a0f6f7074696f6e616c5f73696e74333218052001281112" . - "170a0f6f7074696f6e616c5f73696e74363418062001281212180a106f70" . - "74696f6e616c5f6669786564333218072001280712180a106f7074696f6e" . - "616c5f6669786564363418082001280612190a116f7074696f6e616c5f73" . - "6669786564333218092001280f12190a116f7074696f6e616c5f73666978" . - "65643634180a2001281012160a0e6f7074696f6e616c5f666c6f6174180b" . - "2001280212170a0f6f7074696f6e616c5f646f75626c65180c2001280112" . - "150a0d6f7074696f6e616c5f626f6f6c180d2001280812170a0f6f707469" . - "6f6e616c5f737472696e67180e2001280912160a0e6f7074696f6e616c5f" . - "6279746573180f2001280c12240a0d6f7074696f6e616c5f656e756d1810" . - "2001280e320d2e666f6f2e54657374456e756d122e0a106f7074696f6e61" . - "6c5f6d65737361676518112001280b32142e666f6f2e546573744d657373" . - "6167652e53756212330a196f7074696f6e616c5f696e636c756465645f6d" . - "65737361676518122001280b32102e6261722e54657374496e636c756465" . - "12230a0972656375727369766518132001280b32102e666f6f2e54657374" . - "4d65737361676512160a0e72657065617465645f696e743332181f200328" . - "0512160a0e72657065617465645f696e74363418202003280312170a0f72" . - "657065617465645f75696e74333218212003280d12170a0f726570656174" . - "65645f75696e74363418222003280412170a0f72657065617465645f7369" . - "6e74333218232003281112170a0f72657065617465645f73696e74363418" . - "242003281212180a1072657065617465645f666978656433321825200328" . - "0712180a1072657065617465645f6669786564363418262003280612190a" . - "1172657065617465645f736669786564333218272003280f12190a117265" . - "7065617465645f736669786564363418282003281012160a0e7265706561" . - "7465645f666c6f617418292003280212170a0f72657065617465645f646f" . - "75626c65182a2003280112150a0d72657065617465645f626f6f6c182b20" . - "03280812170a0f72657065617465645f737472696e67182c200328091216" . - "0a0e72657065617465645f6279746573182d2003280c12240a0d72657065" . - "617465645f656e756d182e2003280e320d2e666f6f2e54657374456e756d" . - "122e0a1072657065617465645f6d657373616765182f2003280b32142e66" . - "6f6f2e546573744d6573736167652e537562122c0a127265706561746564" . - "5f72656375727369766518302003280b32102e666f6f2e546573744d6573" . - "7361676512150a0b6f6e656f665f696e743332183320012805480012150a" . - "0b6f6e656f665f696e743634183420012803480012160a0c6f6e656f665f" . - "75696e74333218352001280d480012160a0c6f6e656f665f75696e743634" . - "183620012804480012160a0c6f6e656f665f73696e74333218372001280d" . - "480012160a0c6f6e656f665f73696e743634183820012804480012170a0d" . - "6f6e656f665f6669786564333218392001280d480012170a0d6f6e656f66" . - "5f66697865643634183a20012804480012180a0e6f6e656f665f73666978" . - "65643332183b2001280d480012180a0e6f6e656f665f7366697865643634" . - "183c20012804480012160a0c6f6e656f665f646f75626c65183d20012801" . - "480012150a0b6f6e656f665f666c6f6174183e20012802480012140a0a6f" . - "6e656f665f626f6f6c183f20012808480012160a0c6f6e656f665f737472" . - "696e67184020012809480012150a0b6f6e656f665f627974657318412001" . - "280c480012230a0a6f6e656f665f656e756d18422001280e320d2e666f6f" . - "2e54657374456e756d4800122d0a0d6f6e656f665f6d6573736167651843" . - "2001280b32142e666f6f2e546573744d6573736167652e5375624800123c" . - "0a0f6d61705f696e7433325f696e74333218472003280b32232e666f6f2e" . - "546573744d6573736167652e4d6170496e743332496e743332456e747279" . - "123c0a0f6d61705f696e7436345f696e74363418482003280b32232e666f" . - "6f2e546573744d6573736167652e4d6170496e743634496e743634456e74" . - "727912400a116d61705f75696e7433325f75696e74333218492003280b32" . - "252e666f6f2e546573744d6573736167652e4d617055696e74333255696e" . - "743332456e74727912400a116d61705f75696e7436345f75696e74363418" . - "4a2003280b32252e666f6f2e546573744d6573736167652e4d617055696e" . - "74363455696e743634456e74727912400a116d61705f73696e7433325f73" . - "696e743332184b2003280b32252e666f6f2e546573744d6573736167652e" . - "4d617053696e74333253696e743332456e74727912400a116d61705f7369" . - "6e7436345f73696e743634184c2003280b32252e666f6f2e546573744d65" . - "73736167652e4d617053696e74363453696e743634456e74727912440a13" . - "6d61705f666978656433325f66697865643332184d2003280b32272e666f" . - "6f2e546573744d6573736167652e4d617046697865643332466978656433" . - "32456e74727912440a136d61705f666978656436345f6669786564363418" . - "4e2003280b32272e666f6f2e546573744d6573736167652e4d6170466978" . - "6564363446697865643634456e74727912480a156d61705f736669786564" . - "33325f7366697865643332184f2003280b32292e666f6f2e546573744d65" . - "73736167652e4d617053666978656433325366697865643332456e747279" . - "12480a156d61705f73666978656436345f73666978656436341850200328" . - "0b32292e666f6f2e546573744d6573736167652e4d617053666978656436" . - "345366697865643634456e747279123c0a0f6d61705f696e7433325f666c" . - "6f617418512003280b32232e666f6f2e546573744d6573736167652e4d61" . - "70496e743332466c6f6174456e747279123e0a106d61705f696e7433325f" . - "646f75626c6518522003280b32242e666f6f2e546573744d657373616765" . - "2e4d6170496e743332446f75626c65456e74727912380a0d6d61705f626f" . - "6f6c5f626f6f6c18532003280b32212e666f6f2e546573744d6573736167" . - "652e4d6170426f6f6c426f6f6c456e74727912400a116d61705f73747269" . - "6e675f737472696e6718542003280b32252e666f6f2e546573744d657373" . - "6167652e4d6170537472696e67537472696e67456e747279123c0a0f6d61" . - "705f696e7433325f627974657318552003280b32232e666f6f2e54657374" . - "4d6573736167652e4d6170496e7433324279746573456e747279123a0a0e" . - "6d61705f696e7433325f656e756d18562003280b32222e666f6f2e546573" . - "744d6573736167652e4d6170496e743332456e756d456e74727912400a11" . - "6d61705f696e7433325f6d65737361676518572003280b32252e666f6f2e" . - "546573744d6573736167652e4d6170496e7433324d657373616765456e74" . - "727912390a0d6d61705f72656375727369766518582003280b32222e666f" . - "6f2e546573744d6573736167652e4d6170526563757273697665456e7472" . - "791a340a124d6170496e743332496e743332456e747279120b0a036b6579" . - "180120012805120d0a0576616c75651802200128053a0238011a340a124d" . - "6170496e743634496e743634456e747279120b0a036b6579180120012803" . - "120d0a0576616c75651802200128033a0238011a360a144d617055696e74" . - "333255696e743332456e747279120b0a036b657918012001280d120d0a05" . - "76616c756518022001280d3a0238011a360a144d617055696e7436345569" . - "6e743634456e747279120b0a036b6579180120012804120d0a0576616c75" . - "651802200128043a0238011a360a144d617053696e74333253696e743332" . - "456e747279120b0a036b6579180120012811120d0a0576616c7565180220" . - "0128113a0238011a360a144d617053696e74363453696e743634456e7472" . - "79120b0a036b6579180120012812120d0a0576616c75651802200128123a" . - "0238011a380a164d61704669786564333246697865643332456e74727912" . - "0b0a036b6579180120012807120d0a0576616c75651802200128073a0238" . - "011a380a164d61704669786564363446697865643634456e747279120b0a" . - "036b6579180120012806120d0a0576616c75651802200128063a0238011a" . - "3a0a184d617053666978656433325366697865643332456e747279120b0a" . - "036b657918012001280f120d0a0576616c756518022001280f3a0238011a" . - "3a0a184d617053666978656436345366697865643634456e747279120b0a" . - "036b6579180120012810120d0a0576616c75651802200128103a0238011a" . - "340a124d6170496e743332466c6f6174456e747279120b0a036b65791801" . - "20012805120d0a0576616c75651802200128023a0238011a350a134d6170" . - "496e743332446f75626c65456e747279120b0a036b657918012001280512" . - "0d0a0576616c75651802200128013a0238011a320a104d6170426f6f6c42" . - "6f6f6c456e747279120b0a036b6579180120012808120d0a0576616c7565" . - "1802200128083a0238011a360a144d6170537472696e67537472696e6745" . - "6e747279120b0a036b6579180120012809120d0a0576616c756518022001" . - "28093a0238011a340a124d6170496e7433324279746573456e747279120b" . - "0a036b6579180120012805120d0a0576616c756518022001280c3a023801" . - "1a420a114d6170496e743332456e756d456e747279120b0a036b65791801" . - "20012805121c0a0576616c756518022001280e320d2e666f6f2e54657374" . - "456e756d3a0238011a4c0a144d6170496e7433324d657373616765456e74" . - "7279120b0a036b657918012001280512230a0576616c756518022001280b" . - "32142e666f6f2e546573744d6573736167652e5375623a0238011a450a11" . - "4d6170526563757273697665456e747279120b0a036b6579180120012805" . - "121f0a0576616c756518022001280b32102e666f6f2e546573744d657373" . - "6167653a0238011a100a0353756212090a0161180120012805420a0a086d" . - "795f6f6e656f6622b7030a11546573745061636b65644d65737361676512" . - "1a0a0e72657065617465645f696e743332185a2003280542021001121a0a" . - "0e72657065617465645f696e743634185b2003280342021001121b0a0f72" . - "657065617465645f75696e743332185c2003280d42021001121b0a0f7265" . - "7065617465645f75696e743634185d2003280442021001121b0a0f726570" . - "65617465645f73696e743332185e2003281142021001121b0a0f72657065" . - "617465645f73696e743634185f2003281242021001121c0a107265706561" . - "7465645f6669786564333218602003280742021001121c0a107265706561" . - "7465645f6669786564363418612003280642021001121d0a117265706561" . - "7465645f736669786564333218622003280f42021001121d0a1172657065" . - "617465645f736669786564363418632003281042021001121a0a0e726570" . - "65617465645f666c6f617418642003280242021001121b0a0f7265706561" . - "7465645f646f75626c651865200328014202100112190a0d726570656174" . - "65645f626f6f6c1866200328084202100112280a0d72657065617465645f" . - "656e756d18672003280e320d2e666f6f2e54657374456e756d4202100122" . - "b9030a1354657374556e7061636b65644d657373616765121a0a0e726570" . - "65617465645f696e743332185a2003280542021000121a0a0e7265706561" . - "7465645f696e743634185b2003280342021000121b0a0f72657065617465" . - "645f75696e743332185c2003280d42021000121b0a0f7265706561746564" . - "5f75696e743634185d2003280442021000121b0a0f72657065617465645f" . - "73696e743332185e2003281142021000121b0a0f72657065617465645f73" . - "696e743634185f2003281242021000121c0a1072657065617465645f6669" . - "786564333218602003280742021000121c0a1072657065617465645f6669" . - "786564363418612003280642021000121d0a1172657065617465645f7366" . - "69786564333218622003280f42021000121d0a1172657065617465645f73" . - "6669786564363418632003281042021000121a0a0e72657065617465645f" . - "666c6f617418642003280242021000121b0a0f72657065617465645f646f" . - "75626c651865200328014202100012190a0d72657065617465645f626f6f" . - "6c1866200328084202100012280a0d72657065617465645f656e756d1867" . - "2003280e320d2e666f6f2e54657374456e756d4202100022170a0a546573" . - "74506870446f6312090a01611801200128052a1d0a0854657374456e756d" . - "12080a045a45524f100012070a034f4e451001620670726f746f33" -)); - diff --git a/php/tests/test.proto b/php/tests/test.proto deleted file mode 100644 index f15f6297..00000000 --- a/php/tests/test.proto +++ /dev/null @@ -1,141 +0,0 @@ -syntax = "proto3"; - -import 'test_include.proto'; - -package foo; - -message TestMessage { - // Singular - int32 optional_int32 = 1; - int64 optional_int64 = 2; - uint32 optional_uint32 = 3; - uint64 optional_uint64 = 4; - sint32 optional_sint32 = 5; - sint64 optional_sint64 = 6; - fixed32 optional_fixed32 = 7; - fixed64 optional_fixed64 = 8; - sfixed32 optional_sfixed32 = 9; - sfixed64 optional_sfixed64 = 10; - float optional_float = 11; - double optional_double = 12; - bool optional_bool = 13; - string optional_string = 14; - bytes optional_bytes = 15; - - TestEnum optional_enum = 16; - Sub optional_message = 17; - bar.TestInclude optional_included_message = 18; - TestMessage recursive = 19; - - // Repeated - repeated int32 repeated_int32 = 31; - repeated int64 repeated_int64 = 32; - repeated uint32 repeated_uint32 = 33; - repeated uint64 repeated_uint64 = 34; - repeated sint32 repeated_sint32 = 35; - repeated sint64 repeated_sint64 = 36; - repeated fixed32 repeated_fixed32 = 37; - repeated fixed64 repeated_fixed64 = 38; - repeated sfixed32 repeated_sfixed32 = 39; - repeated sfixed64 repeated_sfixed64 = 40; - repeated float repeated_float = 41; - repeated double repeated_double = 42; - repeated bool repeated_bool = 43; - repeated string repeated_string = 44; - repeated bytes repeated_bytes = 45; - - repeated TestEnum repeated_enum = 46; - repeated Sub repeated_message = 47; - repeated TestMessage repeated_recursive = 48; - - oneof my_oneof { - int32 oneof_int32 = 51; - int64 oneof_int64 = 52; - uint32 oneof_uint32 = 53; - uint64 oneof_uint64 = 54; - uint32 oneof_sint32 = 55; - uint64 oneof_sint64 = 56; - uint32 oneof_fixed32 = 57; - uint64 oneof_fixed64 = 58; - uint32 oneof_sfixed32 = 59; - uint64 oneof_sfixed64 = 60; - double oneof_double = 61; - float oneof_float = 62; - bool oneof_bool = 63; - string oneof_string = 64; - bytes oneof_bytes = 65; - TestEnum oneof_enum = 66; - Sub oneof_message = 67; - } - - map map_int32_int32 = 71; - map map_int64_int64 = 72; - map map_uint32_uint32 = 73; - map map_uint64_uint64 = 74; - map map_sint32_sint32 = 75; - map map_sint64_sint64 = 76; - map map_fixed32_fixed32 = 77; - map map_fixed64_fixed64 = 78; - map map_sfixed32_sfixed32 = 79; - map map_sfixed64_sfixed64 = 80; - map map_int32_float = 81; - map map_int32_double = 82; - map map_bool_bool = 83; - map map_string_string = 84; - map map_int32_bytes = 85; - map map_int32_enum = 86; - map map_int32_message = 87; - - map map_recursive = 88; - - message Sub { - int32 a = 1; - } - - // NestedMessage nested_message = 90; -} - -enum TestEnum { - ZERO = 0; - ONE = 1; -} - -message TestPackedMessage { - repeated int32 repeated_int32 = 90 [packed = true]; - repeated int64 repeated_int64 = 91 [packed = true]; - repeated uint32 repeated_uint32 = 92 [packed = true]; - repeated uint64 repeated_uint64 = 93 [packed = true]; - repeated sint32 repeated_sint32 = 94 [packed = true]; - repeated sint64 repeated_sint64 = 95 [packed = true]; - repeated fixed32 repeated_fixed32 = 96 [packed = true]; - repeated fixed64 repeated_fixed64 = 97 [packed = true]; - repeated sfixed32 repeated_sfixed32 = 98 [packed = true]; - repeated sfixed64 repeated_sfixed64 = 99 [packed = true]; - repeated float repeated_float = 100 [packed = true]; - repeated double repeated_double = 101 [packed = true]; - repeated bool repeated_bool = 102 [packed = true]; - repeated TestEnum repeated_enum = 103 [packed = true]; -} - -// Need to be in sync with TestPackedMessage. -message TestUnpackedMessage { - repeated int32 repeated_int32 = 90 [packed = false]; - repeated int64 repeated_int64 = 91 [packed = false]; - repeated uint32 repeated_uint32 = 92 [packed = false]; - repeated uint64 repeated_uint64 = 93 [packed = false]; - repeated sint32 repeated_sint32 = 94 [packed = false]; - repeated sint64 repeated_sint64 = 95 [packed = false]; - repeated fixed32 repeated_fixed32 = 96 [packed = false]; - repeated fixed64 repeated_fixed64 = 97 [packed = false]; - repeated sfixed32 repeated_sfixed32 = 98 [packed = false]; - repeated sfixed64 repeated_sfixed64 = 99 [packed = false]; - repeated float repeated_float = 100 [packed = false]; - repeated double repeated_double = 101 [packed = false]; - repeated bool repeated_bool = 102 [packed = false]; - repeated TestEnum repeated_enum = 103 [packed = false]; -} - -// /**/@<>&\{ -message TestPhpDoc { - int32 a = 1; -} diff --git a/php/tests/test.sh b/php/tests/test.sh index a6ca89b9..3635d86c 100755 --- a/php/tests/test.sh +++ b/php/tests/test.sh @@ -1,14 +1,11 @@ #!/bin/bash -# Generate test file -../../src/protoc --php_out=. test.proto test_include.proto - # Compile c extension pushd ../ext/google/protobuf/ make clean set -e # Add following in configure for debug: --enable-debug CFLAGS='-g -O0' -phpize && ./configure && make +phpize && ./configure --enable-debug CFLAGS='-g -O0' && make popd tests=( array_test.php encode_decode_test.php generated_class_test.php map_field_test.php well_known_test.php ) @@ -18,7 +15,7 @@ do echo "****************************" echo "* $t" echo "****************************" - php -dextension=../ext/google/protobuf/modules/protobuf.so `which phpunit` $t + php -dextension=../ext/google/protobuf/modules/protobuf.so `which phpunit` --bootstrap autoload.php $t echo "" done diff --git a/php/tests/test_include.pb.php b/php/tests/test_include.pb.php deleted file mode 100644 index 11ff59cb..00000000 --- a/php/tests/test_include.pb.php +++ /dev/null @@ -1,48 +0,0 @@ -bar.TestInclude - */ -class TestInclude extends \Google\Protobuf\Internal\Message -{ - /** - * optional int32 a = 1; - */ - private $a = 0; - - /** - * optional int32 a = 1; - */ - public function getA() - { - return $this->a; - } - - /** - * optional int32 a = 1; - */ - public function setA($var) - { - GPBUtil::checkInt32($var); - $this->a = $var; - } - -} - -$pool = DescriptorPool::getGeneratedPool(); - -$pool->internalAddGeneratedFile(hex2bin( - "0a3b0a12746573745f696e636c7564652e70726f746f120362617222180a" . - "0b54657374496e636c75646512090a0161180120012805620670726f746f" . - "33" -)); - diff --git a/php/tests/test_include.proto b/php/tests/test_include.proto deleted file mode 100644 index 9844617f..00000000 --- a/php/tests/test_include.proto +++ /dev/null @@ -1,7 +0,0 @@ -syntax = "proto3"; - -package bar; - -message TestInclude { - int32 a = 1; -} diff --git a/php/tests/test_no_namespace.pb.php b/php/tests/test_no_namespace.pb.php deleted file mode 100644 index 2f92c955..00000000 --- a/php/tests/test_no_namespace.pb.php +++ /dev/null @@ -1,34 +0,0 @@ -a; - } - - public function setA($var) - { - GPBUtil::checkInt32($var); - $this->a = $var; - } - -} - -$pool = DescriptorPool::getGeneratedPool(); - -$pool->internalAddGeneratedFile(hex2bin( - "0a3b0a17746573745f6e6f5f6e616d6573706163652e70726f746f22180a" . - "0b4e6f4e616d65537061636512090a0161180120012805620670726f746f" . - "33" -)); - diff --git a/php/tests/test_no_namespace.proto b/php/tests/test_no_namespace.proto deleted file mode 100644 index 4331aeab..00000000 --- a/php/tests/test_no_namespace.proto +++ /dev/null @@ -1,5 +0,0 @@ -syntax = "proto3"; - -message NoNameSpace { - int32 a = 1; -} diff --git a/php/tests/well_known_test.php b/php/tests/well_known_test.php index 30715ba9..40ff1c8f 100644 --- a/php/tests/well_known_test.php +++ b/php/tests/well_known_test.php @@ -1,7 +1,5 @@ - - - - php/tests/php_implementation_test.php - php/tests/array_test.php - php/tests/encode_decode_test.php - php/tests/generated_class_test.php - php/tests/map_field_test.php - php/tests/well_known_test.php - - - diff --git a/src/google/protobuf/compiler/php/php_generator.cc b/src/google/protobuf/compiler/php/php_generator.cc index aac4e8af..6634680d 100644 --- a/src/google/protobuf/compiler/php/php_generator.cc +++ b/src/google/protobuf/compiler/php/php_generator.cc @@ -43,6 +43,11 @@ using google::protobuf::internal::scoped_ptr; const std::string kDescriptorFile = "google/protobuf/descriptor.proto"; +const std::string kEmptyFile = "google/protobuf/empty.proto"; +const std::string kEmptyMetadataFile = "GPBMetadata/Google/Protobuf/GPBEmpty.php"; +const std::string kDescriptorMetadataFile = + "GPBMetadata/Google/Protobuf/Internal/Descriptor.php"; +const std::string kDescriptorDirName = "Google/Protobuf/Internal"; const std::string kDescriptorPackageName = "Google\\Protobuf\\Internal"; namespace google { @@ -54,16 +59,14 @@ namespace php { std::string PhpName(const std::string& full_name, bool is_descriptor); std::string DefaultForField(FieldDescriptor* field); std::string IntToString(int32 value); -std::string GeneratedFileName(const std::string& proto_file, - bool is_descriptor); +std::string FilenameToClassname(const string& filename); +std::string GeneratedMetadataFileName(const std::string& proto_file, + bool is_descriptor); std::string LabelForField(FieldDescriptor* field); std::string TypeName(FieldDescriptor* field); std::string UnderscoresToCamelCase(const string& name, bool cap_first_letter); std::string EscapeDollor(const string& to_escape); std::string BinaryToHex(const string& binary); -void GenerateMessage(const string& name_prefix, const Descriptor* message, - bool is_descriptor, io::Printer* printer); -void GenerateEnum(const EnumDescriptor* en, io::Printer* printer); void Indent(io::Printer* printer); void Outdent(io::Printer* printer); void GenerateMessageDocComment(io::Printer* printer, const Descriptor* message); @@ -73,6 +76,14 @@ void GenerateEnumDocComment(io::Printer* printer, const EnumDescriptor* enum_); void GenerateEnumValueDocComment(io::Printer* printer, const EnumValueDescriptor* value); +std::string RenameEmpty(const std::string& name) { + if (name == "Empty") { + return "GPBEmpty"; + } else { + return name; + } +} + std::string MessagePrefix(const Descriptor* message) { // Empty cannot be php class name. if (message->name() == "Empty" && @@ -177,14 +188,66 @@ std::string DefaultForField(const FieldDescriptor* field) { } } -std::string GeneratedFileName(const std::string& proto_file, - bool is_descriptor) { +std::string GeneratedMetadataFileName(const std::string& proto_file, + bool is_descriptor) { + int start_index = 0; + int first_index = proto_file.find_first_of("/", start_index); + std::string result = "GPBMetadata/"; + + if (proto_file == kEmptyFile) { + return kEmptyMetadataFile; + } if (is_descriptor) { - return "descriptor_internal.pb.php"; + return kDescriptorMetadataFile; + } + + // Append directory name. + std::string file_no_suffix; + int lastindex = proto_file.find_last_of("."); + if (proto_file == kEmptyFile) { + return kEmptyMetadataFile; } else { - int lastindex = proto_file.find_last_of("."); - return proto_file.substr(0, lastindex) + ".pb.php"; + file_no_suffix = proto_file.substr(0, lastindex); + } + + while (first_index != string::npos) { + result += UnderscoresToCamelCase( + file_no_suffix.substr(start_index, first_index - start_index), true); + result += "/"; + GOOGLE_LOG(INFO) << start_index << " " << first_index; + GOOGLE_LOG(INFO) << file_no_suffix.substr(start_index, + first_index - start_index); + start_index = first_index + 1; + first_index = file_no_suffix.find_first_of("/", start_index); + } + + // Append file name. + result += RenameEmpty(UnderscoresToCamelCase( + file_no_suffix.substr(start_index, first_index - start_index), true)); + + return result += ".php"; +} + +std::string GeneratedMessageFileName(const Descriptor* message, + bool is_descriptor) { + std::string result = MessageName(message, is_descriptor); + for (int i = 0; i < result.size(); i++) { + if (result[i] == '\\') { + result[i] = '/'; + } + } + return result + ".php"; +} + +std::string GeneratedEnumFileName(const EnumDescriptor* en, + bool is_descriptor) { + std::string result = EnumName(en, is_descriptor); + for (int i = 0; i < result.size(); i++) { + if (result[i] == '\\') { + result[i] = '/'; + } } + return result + ".php"; } std::string IntToString(int32 value) { @@ -381,7 +444,8 @@ void GenerateFieldAccessor(const FieldDescriptor* field, bool is_descriptor, if (field->is_map()) { } else if (field->is_repeated()) { printer->Print( - "GPBUtil::checkRepeatedField($var, GPBType::^type^", + "GPBUtil::checkRepeatedField($var, " + "\\Google\\Protobuf\\Internal\\GPBType::^type^", "type", ToUpper(field->type_name())); if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { printer->Print( @@ -449,107 +513,11 @@ void GenerateFieldAccessor(const FieldDescriptor* field, bool is_descriptor, } } -void GenerateRepeatedFieldDecode(const FieldDescriptor* field, - io::Printer* printer) { - printer->Print( - "if ($input->read^cap_wire_type^($var)) return False;\n" - "$this->get^cap_field_name^() []= $var;\n", - "cap_field_name", UnderscoresToCamelCase(field->name(), true), - "cap_wire_type", UnderscoresToCamelCase(field->type_name(), true)); -} - -void GeneratePrimitiveFieldDecode(const FieldDescriptor* field, - io::Printer* printer) { - printer->Print( - "if ($input->read^cap_wire_type^($var)) return False;\n" - "$this->set^cap_field_name^($var);\n", - "cap_field_name", UnderscoresToCamelCase(field->name(), true), - "cap_wire_type", UnderscoresToCamelCase(field->type_name(), true)); -} - -void GenerateFieldDecode(const FieldDescriptor* field, io::Printer* printer) { - printer->Print( - "case ^number^:\n", - "number", IntToString(field->number())); - Indent(printer); - - if (field->is_repeated()) { - GenerateRepeatedFieldDecode(field, printer); - } else { - GeneratePrimitiveFieldDecode(field, printer); - } - - printer->Print( - "break;\n"); - Outdent(printer); -} - -void GenerateMessage(const string& name_prefix, const Descriptor* message, - bool is_descriptor, io::Printer* printer) { - // Don't generate MapEntry messages -- we use the PHP extension's native - // support for map fields instead. - if (message->options().map_entry()) { - return; - } - - GenerateMessageDocComment(printer, message); - - string message_name = - name_prefix.empty() - ? message->name() - : name_prefix + "_" + MessagePrefix(message) + message->name(); - +void GenerateEnumToPool(const EnumDescriptor* en, io::Printer* printer) { printer->Print( - "class ^name^ extends \\Google\\Protobuf\\Internal\\Message\n" - "{\n", - "name", message_name); - Indent(printer); - - // Field and oneof definitions. - for (int i = 0; i < message->field_count(); i++) { - const FieldDescriptor* field = message->field(i); - GenerateField(field, printer, is_descriptor); - } - for (int i = 0; i < message->oneof_decl_count(); i++) { - const OneofDescriptor* oneof = message->oneof_decl(i); - GenerateOneofField(oneof, printer); - } - printer->Print("\n"); - - // Field and oneof accessors. - for (int i = 0; i < message->field_count(); i++) { - const FieldDescriptor* field = message->field(i); - GenerateFieldAccessor(field, is_descriptor, printer); - } - for (int i = 0; i < message->oneof_decl_count(); i++) { - const OneofDescriptor* oneof = message->oneof_decl(i); - printer->Print( - "public function get^camel_name^()\n" - "{\n" - " return $this->^name^;\n" - "}\n\n", - "camel_name", UnderscoresToCamelCase(oneof->name(), true), "name", - oneof->name()); - } - - Outdent(printer); - printer->Print("}\n\n"); - - // Nested messages and enums. - for (int i = 0; i < message->nested_type_count(); i++) { - GenerateMessage(message_name, message->nested_type(i), is_descriptor, - printer); - } - for (int i = 0; i < message->enum_type_count(); i++) { - GenerateEnum(message->enum_type(i), printer); - } -} - -void GenerateEnumToPool(const EnumDescriptor* en, bool is_descriptor, - io::Printer* printer) { - printer->Print( - "$pool->addEnum('^name^', ^class_name^::class)\n", - "name", EnumFullName(en, is_descriptor), + "$pool->addEnum('^name^', " + "\\Google\\Protobuf\\Internal\\^class_name^::class)\n", + "name", EnumFullName(en, true), "class_name", en->name()); Indent(printer); @@ -565,7 +533,7 @@ void GenerateEnumToPool(const EnumDescriptor* en, bool is_descriptor, } void GenerateMessageToPool(const string& name_prefix, const Descriptor* message, - bool is_descriptor, io::Printer* printer) { + io::Printer* printer) { // Don't generate MapEntry messages -- we use the PHP extension's native // support for map fields instead. if (message->options().map_entry()) { @@ -575,8 +543,9 @@ void GenerateMessageToPool(const string& name_prefix, const Descriptor* message, message->name() : name_prefix + "_" + message->name(); printer->Print( - "$pool->addMessage('^message^', ^class_name^::class)\n", - "message", MessageFullName(message, is_descriptor), + "$pool->addMessage('^message^', " + "\\Google\\Protobuf\\Internal\\^class_name^::class)\n", + "message", MessageFullName(message, true), "class_name", class_name); Indent(printer); @@ -589,21 +558,22 @@ void GenerateMessageToPool(const string& name_prefix, const Descriptor* message, const FieldDescriptor* val = field->message_type()->FindFieldByName("value"); printer->Print( - "->map('^field^', GPBType::^key^, " - "GPBType::^value^, ^number^^other^)\n", + "->map('^field^', \\Google\\Protobuf\\Internal\\GPBType::^key^, " + "\\Google\\Protobuf\\Internal\\GPBType::^value^, ^number^^other^)\n", "field", field->name(), "key", ToUpper(key->type_name()), "value", ToUpper(val->type_name()), "number", SimpleItoa(field->number()), - "other", EnumOrMessageSuffix(val, is_descriptor)); + "other", EnumOrMessageSuffix(val, true)); } else if (!field->containing_oneof()) { printer->Print( - "->^label^('^field^', GPBType::^type^, ^number^^other^)\n", + "->^label^('^field^', " + "\\Google\\Protobuf\\Internal\\GPBType::^type^, ^number^^other^)\n", "field", field->name(), "label", LabelForField(field), "type", ToUpper(field->type_name()), "number", SimpleItoa(field->number()), - "other", EnumOrMessageSuffix(field, is_descriptor)); + "other", EnumOrMessageSuffix(field, true)); } } @@ -616,11 +586,12 @@ void GenerateMessageToPool(const string& name_prefix, const Descriptor* message, for (int index = 0; index < oneof->field_count(); index++) { const FieldDescriptor* field = oneof->field(index); printer->Print( - "->value('^field^', GPBType::^type^, ^number^^other^)\n", + "->value('^field^', " + "\\Google\\Protobuf\\Internal\\GPBType::^type^, ^number^^other^)\n", "field", field->name(), "type", ToUpper(field->type_name()), "number", SimpleItoa(field->number()), - "other", EnumOrMessageSuffix(field, is_descriptor)); + "other", EnumOrMessageSuffix(field, true)); } printer->Print("->finish()\n"); Outdent(printer); @@ -635,32 +606,48 @@ void GenerateMessageToPool(const string& name_prefix, const Descriptor* message, "\n"); for (int i = 0; i < message->nested_type_count(); i++) { - GenerateMessageToPool(class_name, message->nested_type(i), is_descriptor, - printer); + GenerateMessageToPool(class_name, message->nested_type(i), printer); } for (int i = 0; i < message->enum_type_count(); i++) { - GenerateEnumToPool(message->enum_type(i), is_descriptor, printer); + GenerateEnumToPool(message->enum_type(i), printer); } } void GenerateAddFileToPool(const FileDescriptor* file, bool is_descriptor, io::Printer* printer) { - if (is_descriptor) { - printer->Print("$pool = DescriptorPool::getGeneratedPool();\n\n"); + printer->Print( + "public static $is_initialized = false;\n\n" + "public static function initOnce() {\n"); + Indent(printer); + + printer->Print( + "$pool = \\Google\\Protobuf\\Internal\\" + "DescriptorPool::getGeneratedPool();\n\n" + "if (static::$is_initialized == true) {\n" + " return;\n" + "}\n"); + if (is_descriptor) { for (int i = 0; i < file->message_type_count(); i++) { - GenerateMessageToPool("", file->message_type(i), is_descriptor, printer); + GenerateMessageToPool("", file->message_type(i), printer); } for (int i = 0; i < file->enum_type_count(); i++) { - GenerateEnumToPool(file->enum_type(i), is_descriptor, printer); + GenerateEnumToPool(file->enum_type(i), printer); } printer->Print( "$pool->finish();\n"); } else { - // Add messages and enums to descriptor pool. - printer->Print("$pool = DescriptorPool::getGeneratedPool();\n\n"); + for (int i = 0; i < file->dependency_count(); i++) { + const std::string& name = file->dependency(i)->name(); + std::string dependency_filename = + GeneratedMetadataFileName(name, is_descriptor); + printer->Print( + "\\^name^::initOnce();\n", + "name", FilenameToClassname(dependency_filename)); + } + // Add messages and enums to descriptor pool. FileDescriptorSet files; FileDescriptorProto* file_proto = files.add_file(); file->CopyTo(file_proto); @@ -683,38 +670,20 @@ void GenerateAddFileToPool(const FileDescriptor* file, bool is_descriptor, printer->Print( "));\n\n"); } - -} - -void GenerateEnum(const EnumDescriptor* en, io::Printer* printer) { - GenerateEnumDocComment(printer, en); printer->Print( - "class ^name^\n" - "{\n", - "name", EnumClassName(en)); - Indent(printer); - - for (int i = 0; i < en->value_count(); i++) { - const EnumValueDescriptor* value = en->value(i); - GenerateEnumValueDocComment(printer, value); - printer->Print("const ^name^ = ^number^;\n", - "name", value->name(), - "number", IntToString(value->number())); - } + "static::$is_initialized = true;\n"); Outdent(printer); - printer->Print("}\n\n"); + printer->Print("}\n"); } void GenerateUseDeclaration(bool is_descriptor, io::Printer* printer) { if (!is_descriptor) { printer->Print( - "use Google\\Protobuf\\Internal\\DescriptorPool;\n" "use Google\\Protobuf\\Internal\\GPBType;\n" "use Google\\Protobuf\\Internal\\RepeatedField;\n" "use Google\\Protobuf\\Internal\\GPBUtil;\n\n"); } else { printer->Print( - "use Google\\Protobuf\\Internal\\DescriptorPool;\n" "use Google\\Protobuf\\Internal\\GPBType;\n" "use Google\\Protobuf\\Internal\\GPBWire;\n" "use Google\\Protobuf\\Internal\\RepeatedField;\n" @@ -723,35 +692,212 @@ void GenerateUseDeclaration(bool is_descriptor, io::Printer* printer) { } } -void GenerateFile(const FileDescriptor* file, bool is_descriptor, - io::Printer* printer) { +void GenerateHead(const FileDescriptor* file, io::Printer* printer) { printer->Print( "name()); +} + +std::string FilenameToClassname(const string& filename) { + int lastindex = filename.find_last_of("."); + std::string result = filename.substr(0, lastindex); + for (int i = 0; i < result.size(); i++) { + if (result[i] == '/') { + result[i] = '\\'; + } + } + return result; +} + +void GenerateMetadataFile(const FileDescriptor* file, + bool is_descriptor, + GeneratorContext* generator_context) { + std::string filename = GeneratedMetadataFileName(file->name(), is_descriptor); + scoped_ptr output( + generator_context->Open(filename)); + io::Printer printer(output.get(), '^'); + + GenerateHead(file, &printer); + + std::string fullname = FilenameToClassname(filename); + int lastindex = fullname.find_last_of("\\"); + + printer.Print( + "namespace ^name^;\n\n", + "name", fullname.substr(0, lastindex)); + + if (lastindex != string::npos) { + printer.Print( + "class ^name^\n" + "{\n", + "name", fullname.substr(lastindex + 1)); + } else { + printer.Print( + "class ^name^\n" + "{\n", + "name", fullname); + } + Indent(&printer); + + GenerateAddFileToPool(file, is_descriptor, &printer); + + Outdent(&printer); + printer.Print("}\n\n"); +} + +void GenerateEnumFile(const FileDescriptor* file, const EnumDescriptor* en, + bool is_descriptor, GeneratorContext* generator_context) { + std::string filename = GeneratedEnumFileName(en, is_descriptor); + scoped_ptr output( + generator_context->Open(filename)); + io::Printer printer(output.get(), '^'); + + GenerateHead(file, &printer); + + std::string fullname = FilenameToClassname(filename); + int lastindex = fullname.find_last_of("\\"); + + GenerateEnumDocComment(&printer, en); + if (lastindex != string::npos) { + printer.Print( + "namespace ^name^;\n\n", + "name", fullname.substr(0, lastindex)); + + printer.Print( + "class ^name^\n" + "{\n", + "name", fullname.substr(lastindex + 1)); + } else { + printer.Print( + "class ^name^\n" + "{\n", + "name", fullname); + } + Indent(&printer); + + for (int i = 0; i < en->value_count(); i++) { + const EnumValueDescriptor* value = en->value(i); + GenerateEnumValueDocComment(&printer, value); + printer.Print("const ^name^ = ^number^;\n", + "name", value->name(), + "number", IntToString(value->number())); + } + + Outdent(&printer); + printer.Print("}\n\n"); +} + +void GenerateMessageFile(const FileDescriptor* file, const Descriptor* message, + bool is_descriptor, + GeneratorContext* generator_context) { + // Don't generate MapEntry messages -- we use the PHP extension's native + // support for map fields instead. + if (message->options().map_entry()) { + return; + } + + std::string filename = GeneratedMessageFileName(message, is_descriptor); + scoped_ptr output( + generator_context->Open(filename)); + io::Printer printer(output.get(), '^'); + + GenerateHead(file, &printer); + + std::string fullname = FilenameToClassname(filename); + int lastindex = fullname.find_last_of("\\"); + if (!file->package().empty()) { - printer->Print("namespace ^name^;\n\n", - "name", PhpName(file->package(), is_descriptor)); + printer.Print( + "namespace ^name^;\n\n", + "name", fullname.substr(0, lastindex)); + } + + GenerateUseDeclaration(is_descriptor, &printer); + + GenerateMessageDocComment(&printer, message); + if (lastindex != string::npos) { + printer.Print( + "class ^name^ extends \\Google\\Protobuf\\Internal\\Message\n" + "{\n", + "name", fullname.substr(lastindex + 1)); + } else { + printer.Print( + "class ^name^ extends \\Google\\Protobuf\\Internal\\Message\n" + "{\n", + "name", fullname); } + Indent(&printer); - for (int i = 0; i < file->dependency_count(); i++) { - const std::string& name = file->dependency(i)->name(); - printer->Print("require_once('^name^');\n", "name", - GeneratedFileName(name, is_descriptor)); + // Field and oneof definitions. + for (int i = 0; i < message->field_count(); i++) { + const FieldDescriptor* field = message->field(i); + GenerateField(field, &printer, is_descriptor); + } + for (int i = 0; i < message->oneof_decl_count(); i++) { + const OneofDescriptor* oneof = message->oneof_decl(i); + GenerateOneofField(oneof, &printer); } + printer.Print("\n"); + + printer.Print( + "public function __construct() {\n"); + Indent(&printer); - GenerateUseDeclaration(is_descriptor, printer); + std::string metadata_filename = + GeneratedMetadataFileName(file->name(), is_descriptor); + std::string metadata_fullname = FilenameToClassname(metadata_filename); + printer.Print( + "\\^fullname^::initOnce();\n" + "parent::__construct();\n", + "fullname", metadata_fullname); + Outdent(&printer); + printer.Print("}\n\n"); + + // Field and oneof accessors. + for (int i = 0; i < message->field_count(); i++) { + const FieldDescriptor* field = message->field(i); + GenerateFieldAccessor(field, is_descriptor, &printer); + } + for (int i = 0; i < message->oneof_decl_count(); i++) { + const OneofDescriptor* oneof = message->oneof_decl(i); + printer.Print( + "public function get^camel_name^()\n" + "{\n" + " return $this->^name^;\n" + "}\n\n", + "camel_name", UnderscoresToCamelCase(oneof->name(), true), "name", + oneof->name()); + } + + Outdent(&printer); + printer.Print("}\n\n"); + + // Nested messages and enums. + for (int i = 0; i < message->nested_type_count(); i++) { + GenerateMessageFile(file, message->nested_type(i), is_descriptor, + generator_context); + } + for (int i = 0; i < message->enum_type_count(); i++) { + GenerateEnumFile(file, message->enum_type(i), is_descriptor, + generator_context); + } +} + +void GenerateFile(const FileDescriptor* file, bool is_descriptor, + GeneratorContext* generator_context) { + GenerateMetadataFile(file, is_descriptor, generator_context); for (int i = 0; i < file->message_type_count(); i++) { - GenerateMessage("", file->message_type(i), is_descriptor, printer); + GenerateMessageFile(file, file->message_type(i), is_descriptor, + generator_context); } for (int i = 0; i < file->enum_type_count(); i++) { - GenerateEnum(file->enum_type(i), printer); + GenerateEnumFile(file, file->enum_type(i), is_descriptor, + generator_context); } - - GenerateAddFileToPool(file, is_descriptor, printer); } static string EscapePhpdoc(const string& input) { @@ -932,12 +1078,7 @@ bool Generator::Generate(const FileDescriptor* file, const string& parameter, return false; } - std::string filename = GeneratedFileName(file->name(), is_descriptor); - scoped_ptr output( - generator_context->Open(filename)); - io::Printer printer(output.get(), '^'); - - GenerateFile(file, is_descriptor, &printer); + GenerateFile(file, is_descriptor, generator_context); return true; } diff --git a/tests.sh b/tests.sh index eb8255e1..5a5fdf83 100755 --- a/tests.sh +++ b/tests.sh @@ -89,7 +89,7 @@ build_csharp() { echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list sudo apt-get update -qq sudo apt-get install -qq mono-devel referenceassemblies-pcl nunit - + # Then install the dotnet SDK as per Ubuntu 14.04 instructions on dot.net. sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list' sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893 @@ -335,6 +335,19 @@ build_javascript() { cd js && npm install && npm test && cd .. } +generate_php_test_proto() { + internal_build_cpp + pushd php/tests + # Generate test file + rm -rf generated + mkdir generated + ../../src/protoc --php_out=generated proto/test.proto proto/test_include.proto proto/test_no_namespace.proto + pushd ../../src + ./protoc --php_out=../php/tests/generated google/protobuf/empty.proto + popd + popd +} + use_php() { VERSION=$1 PHP=`which php` @@ -346,6 +359,7 @@ use_php() { cp "/usr/bin/php$VERSION" $PHP cp "/usr/bin/php-config$VERSION" $PHP_CONFIG cp "/usr/bin/phpize$VERSION" $PHPIZE + generate_php_test_proto } use_php_zts() { @@ -356,6 +370,7 @@ use_php_zts() { ln -sfn "/usr/local/php-${VERSION}-zts/bin/php" $PHP ln -sfn "/usr/local/php-${VERSION}-zts/bin/php-config" $PHP_CONFIG ln -sfn "/usr/local/php-${VERSION}-zts/bin/phpize" $PHPIZE + generate_php_test_proto } use_php_bc() { @@ -366,10 +381,12 @@ use_php_bc() { ln -sfn "/usr/local/php-${VERSION}-bc/bin/php" $PHP ln -sfn "/usr/local/php-${VERSION}-bc/bin/php-config" $PHP_CONFIG ln -sfn "/usr/local/php-${VERSION}-bc/bin/phpize" $PHPIZE + generate_php_test_proto } build_php5.5() { use_php 5.5 + cd php rm -rf vendor cp -r /usr/local/vendor-5.5 vendor ./vendor/bin/phpunit @@ -388,6 +405,7 @@ build_php5.5_zts_c() { build_php5.5_32() { use_php_bc 5.5 + cd php rm -rf vendor cp -r /usr/local/vendor-5.5 vendor ./vendor/bin/phpunit @@ -401,6 +419,7 @@ build_php5.5_c_32() { build_php5.6() { use_php 5.6 + cd php rm -rf vendor cp -r /usr/local/vendor-5.6 vendor ./vendor/bin/phpunit @@ -412,6 +431,7 @@ build_php5.6_c() { } build_php5.6_mac() { + generate_php_test_proto # Install PHP curl -s https://php-osx.liip.ch/install.sh | bash -s 5.6 PHP_FOLDER=`find /usr/local -type d -name "php5-5.6*"` # The folder name may change upon time @@ -433,6 +453,7 @@ build_php5.6_mac() { build_php7.0() { use_php 7.0 + cd php rm -rf vendor cp -r /usr/local/vendor-7.0 vendor ./vendor/bin/phpunit -- cgit v1.2.3