protoc 2.6.1.1 → 2.6.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/protoc/Makefile.in +10 -13
- data/ext/protoc/extconf.rb +0 -1
- data/ext/protoc/protobuf/CHANGES.txt +593 -0
- data/ext/protoc/protobuf/CONTRIBUTORS.txt +93 -0
- data/ext/protoc/protobuf/INSTALL.txt +237 -0
- data/ext/protoc/protobuf/LICENSE +33 -0
- data/ext/protoc/protobuf/Makefile.am +267 -0
- data/ext/protoc/protobuf/README.md +167 -0
- data/ext/protoc/protobuf/autogen.sh +41 -0
- data/ext/protoc/protobuf/benchmarks/ProtoBench.java +203 -0
- data/ext/protoc/protobuf/benchmarks/google_message1.dat +0 -0
- data/ext/protoc/protobuf/benchmarks/google_message2.dat +0 -0
- data/ext/protoc/protobuf/benchmarks/google_size.proto +136 -0
- data/ext/protoc/protobuf/benchmarks/google_speed.proto +136 -0
- data/ext/protoc/protobuf/benchmarks/readme.txt +50 -0
- data/ext/protoc/protobuf/configure.ac +159 -0
- data/ext/protoc/protobuf/editors/README.txt +5 -0
- data/ext/protoc/protobuf/editors/proto.vim +105 -0
- data/ext/protoc/protobuf/editors/protobuf-mode.el +220 -0
- data/ext/protoc/protobuf/examples/AddPerson.java +95 -0
- data/ext/protoc/protobuf/examples/ListPeople.java +50 -0
- data/ext/protoc/protobuf/examples/Makefile +58 -0
- data/ext/protoc/protobuf/examples/README.txt +29 -0
- data/ext/protoc/protobuf/examples/add_person.cc +95 -0
- data/ext/protoc/protobuf/examples/add_person.py +58 -0
- data/ext/protoc/protobuf/examples/addressbook.proto +30 -0
- data/ext/protoc/protobuf/examples/list_people.cc +68 -0
- data/ext/protoc/protobuf/examples/list_people.py +38 -0
- data/ext/protoc/protobuf/generate_descriptor_proto.sh +33 -0
- data/ext/protoc/protobuf/java/README.txt +96 -0
- data/ext/protoc/protobuf/java/pom.xml +217 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/AbstractMessage.java +466 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/AbstractMessageLite.java +355 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/AbstractParser.java +253 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/BlockingRpcChannel.java +51 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/BlockingService.java +64 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/BoundedByteString.java +163 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ByteString.java +1022 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/CodedInputStream.java +1311 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/CodedOutputStream.java +1297 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Descriptors.java +2238 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/DynamicMessage.java +622 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Extension.java +96 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ExtensionRegistry.java +392 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ExtensionRegistryLite.java +185 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/FieldSet.java +907 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/GeneratedMessage.java +2213 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/GeneratedMessageLite.java +949 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Internal.java +391 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java +122 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/LazyField.java +154 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/LazyFieldLite.java +176 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/LazyStringArrayList.java +367 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/LazyStringList.java +163 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/LiteralByteString.java +362 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Message.java +244 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/MessageLite.java +320 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java +60 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/MessageOrBuilder.java +143 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/MessageReflection.java +931 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Parser.java +261 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ProtocolMessageEnum.java +58 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ProtocolStringList.java +48 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RepeatedFieldBuilder.java +696 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RopeByteString.java +957 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RpcCallback.java +47 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RpcChannel.java +71 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RpcController.java +118 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RpcUtil.java +134 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Service.java +117 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ServiceException.java +52 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/SingleFieldBuilder.java +241 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/SmallSortedMap.java +618 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/TextFormat.java +1984 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/UninitializedMessageException.java +99 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/UnknownFieldSet.java +995 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java +205 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Utf8.java +349 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/WireFormat.java +163 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/AbstractMessageTest.java +527 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/BoundedByteStringTest.java +68 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/ByteStringTest.java +759 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/CheckUtf8Test.java +141 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/CodedInputStreamTest.java +769 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/CodedOutputStreamTest.java +401 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/DeprecatedFieldTest.java +80 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/DescriptorsTest.java +735 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/DynamicMessageTest.java +326 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/ForceFieldBuildersPreRun.java +48 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/GeneratedMessageTest.java +1515 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/IsValidUtf8Test.java +180 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java +421 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LazyFieldLiteTest.java +134 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LazyFieldTest.java +121 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LazyMessageLiteTest.java +319 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LazyStringArrayListTest.java +174 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LazyStringEndToEndTest.java +143 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java +85 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LiteTest.java +148 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LiteralByteStringTest.java +396 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/MessageTest.java +353 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/NestedBuildersTest.java +185 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/ParserTest.java +381 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/RepeatedFieldBuilderTest.java +190 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/RopeByteStringSubstringTest.java +97 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/RopeByteStringTest.java +115 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/ServiceTest.java +320 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/SingleFieldBuilderTest.java +155 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/SmallSortedMapTest.java +420 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/TestBadIdentifiers.java +96 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/TestUtil.java +4124 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/TextFormatTest.java +994 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/UnknownFieldSetTest.java +653 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/UnmodifiableLazyStringListTest.java +227 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/WireFormatTest.java +606 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/lazy_fields_lite.proto +61 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/lite_equals_and_hash.proto +55 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/multiple_files_test.proto +77 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/nested_builders_test.proto +53 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/nested_extension.proto +46 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/nested_extension_lite.proto +48 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/non_nested_extension.proto +49 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/non_nested_extension_lite.proto +50 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/outer_class_name_test.proto +38 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/outer_class_name_test2.proto +42 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/outer_class_name_test3.proto +43 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/test_bad_identifiers.proto +157 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/test_check_utf8.proto +50 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/test_check_utf8_size.proto +51 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/test_custom_options.proto +43 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/test_extra_interfaces.proto +60 -0
- data/ext/protoc/protobuf/m4/ac_system_extensions.m4 +37 -0
- data/ext/protoc/protobuf/m4/acx_check_suncc.m4 +75 -0
- data/ext/protoc/protobuf/m4/acx_pthread.m4 +397 -0
- data/ext/protoc/protobuf/m4/stl_hash.m4 +72 -0
- data/ext/protoc/protobuf/more_tests/Makefile +41 -0
- data/ext/protoc/protobuf/post_process_dist.sh +60 -0
- data/ext/protoc/protobuf/protobuf-lite.pc.in +13 -0
- data/ext/protoc/protobuf/protobuf.pc.in +14 -0
- data/ext/protoc/protobuf/python/README.txt +105 -0
- data/ext/protoc/protobuf/python/ez_setup.py +284 -0
- data/ext/protoc/protobuf/python/google/__init__.py +1 -0
- data/ext/protoc/protobuf/python/google/protobuf/__init__.py +0 -0
- data/ext/protoc/protobuf/python/google/protobuf/descriptor.py +849 -0
- data/ext/protoc/protobuf/python/google/protobuf/descriptor_database.py +137 -0
- data/ext/protoc/protobuf/python/google/protobuf/descriptor_pool.py +643 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/__init__.py +0 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/api_implementation.cc +139 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/api_implementation.py +89 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/api_implementation_default_test.py +63 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/containers.py +269 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/cpp_message.py +663 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/decoder.py +831 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_database_test.py +63 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_pool_test.py +564 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_pool_test1.proto +94 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_pool_test2.proto +70 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_python_test.py +54 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_test.py +669 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/encoder.py +788 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/enum_type_wrapper.py +89 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/factory_test1.proto +57 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/factory_test2.proto +92 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/generator_test.py +343 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/message_factory_python_test.py +54 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/message_factory_test.py +131 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/message_listener.py +78 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/message_python_test.py +54 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/message_test.py +681 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/missing_enum_values.proto +50 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/more_extensions.proto +58 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/more_extensions_dynamic.proto +49 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/more_messages.proto +51 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/python_message.py +1251 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/reflection_test.py +2934 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/service_reflection_test.py +136 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/symbol_database_test.py +120 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/test_bad_identifiers.proto +52 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/test_util.py +662 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/text_encoding_test.py +68 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/text_format_test.py +743 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/type_checkers.py +328 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/unknown_fields_test.py +231 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/wire_format.py +268 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/wire_format_test.py +253 -0
- data/ext/protoc/protobuf/python/google/protobuf/message.py +284 -0
- data/ext/protoc/protobuf/python/google/protobuf/message_factory.py +155 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/README +6 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/__init__.py +0 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/cpp_message.py +61 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/descriptor.cc +357 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/descriptor.h +96 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/descriptor_cpp2_test.py +58 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/extension_dict.cc +338 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/extension_dict.h +123 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/message.cc +2561 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/message.h +305 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/message_factory_cpp2_test.py +56 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/proto2_api_test.proto +38 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/python.proto +66 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/python_protobuf.h +57 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/reflection_cpp2_generated_test.py +94 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc +763 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/repeated_composite_container.h +172 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/repeated_scalar_container.cc +825 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/repeated_scalar_container.h +112 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/scoped_pyobject_ptr.h +95 -0
- data/ext/protoc/protobuf/python/google/protobuf/reflection.py +205 -0
- data/ext/protoc/protobuf/python/google/protobuf/service.py +226 -0
- data/ext/protoc/protobuf/python/google/protobuf/service_reflection.py +284 -0
- data/ext/protoc/protobuf/python/google/protobuf/symbol_database.py +185 -0
- data/ext/protoc/protobuf/python/google/protobuf/text_encoding.py +110 -0
- data/ext/protoc/protobuf/python/google/protobuf/text_format.py +873 -0
- data/ext/protoc/protobuf/python/mox.py +1401 -0
- data/ext/protoc/protobuf/python/setup.py +201 -0
- data/ext/protoc/protobuf/python/stubout.py +140 -0
- data/ext/protoc/protobuf/src/Makefile.am +418 -0
- data/ext/protoc/protobuf/src/google/protobuf/SEBS +240 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/code_generator.cc +84 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/code_generator.h +145 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/command_line_interface.cc +1603 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/command_line_interface.h +378 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/command_line_interface_unittest.cc +1654 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc +158 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_enum.cc +288 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_enum.h +103 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_enum_field.cc +431 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_enum_field.h +122 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_extension.cc +210 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_extension.h +86 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_field.cc +166 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_field.h +185 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc +665 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_file.h +99 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_generator.cc +125 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_generator.h +72 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc +494 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.h +206 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_message.cc +2645 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_message.h +175 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_message_field.cc +375 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_message_field.h +121 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_options.h +58 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc +123 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc +451 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_primitive_field.h +123 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_service.cc +334 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_service.h +118 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_string_field.cc +642 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_string_field.h +127 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto +132 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_unittest.cc +2074 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_unittest.h +51 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/importer.cc +480 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/importer.h +317 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/importer_unittest.cc +617 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_context.cc +195 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_context.h +95 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_doc_comment.cc +233 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_doc_comment.h +69 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_doc_comment_unittest.cc +67 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_enum.cc +333 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_enum.h +99 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_enum_field.cc +778 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_enum_field.h +158 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_extension.cc +207 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_extension.h +109 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_field.cc +213 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_field.h +162 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_file.cc +534 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_file.h +115 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_generator.cc +158 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_generator.h +72 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_generator_factory.cc +77 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_generator_factory.h +101 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_helpers.cc +737 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_helpers.h +322 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_lazy_message_field.cc +826 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_lazy_message_field.h +121 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_message.cc +1666 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_message.h +140 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_message_field.cc +1343 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_message_field.h +173 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_name_resolver.cc +266 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_name_resolver.h +124 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_plugin_unittest.cc +124 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_primitive_field.cc +877 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_primitive_field.h +160 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_service.cc +473 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_service.h +135 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_shared_code_generator.cc +201 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_shared_code_generator.h +90 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_string_field.cc +1056 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_string_field.h +160 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/main.cc +61 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/mock_code_generator.cc +240 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/mock_code_generator.h +117 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/package_info.h +64 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/parser.cc +1750 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/parser.h +522 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/parser_unittest.cc +2612 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/plugin.cc +163 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/plugin.h +72 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/plugin.pb.cc +1148 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/plugin.pb.h +897 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/plugin.proto +147 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/python/python_generator.cc +1262 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/python/python_generator.h +166 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/python/python_plugin_unittest.cc +118 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/subprocess.cc +463 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/subprocess.h +108 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/test_plugin.cc +51 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/zip_output_unittest.sh +91 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/zip_writer.cc +218 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/zip_writer.h +93 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor.cc +5420 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor.h +1691 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor.pb.cc +9135 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor.pb.h +6761 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor.proto +687 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor_database.cc +543 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor_database.h +369 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor_database_unittest.cc +748 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor_pb2_test.py +54 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor_unittest.cc +5501 -0
- data/ext/protoc/protobuf/src/google/protobuf/dynamic_message.cc +764 -0
- data/ext/protoc/protobuf/src/google/protobuf/dynamic_message.h +148 -0
- data/ext/protoc/protobuf/src/google/protobuf/dynamic_message_unittest.cc +230 -0
- data/ext/protoc/protobuf/src/google/protobuf/extension_set.cc +1663 -0
- data/ext/protoc/protobuf/src/google/protobuf/extension_set.h +1234 -0
- data/ext/protoc/protobuf/src/google/protobuf/extension_set_heavy.cc +734 -0
- data/ext/protoc/protobuf/src/google/protobuf/extension_set_unittest.cc +1095 -0
- data/ext/protoc/protobuf/src/google/protobuf/generated_enum_reflection.h +91 -0
- data/ext/protoc/protobuf/src/google/protobuf/generated_message_reflection.cc +1683 -0
- data/ext/protoc/protobuf/src/google/protobuf/generated_message_reflection.h +504 -0
- data/ext/protoc/protobuf/src/google/protobuf/generated_message_reflection_unittest.cc +795 -0
- data/ext/protoc/protobuf/src/google/protobuf/generated_message_util.cc +65 -0
- data/ext/protoc/protobuf/src/google/protobuf/generated_message_util.h +113 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/coded_stream.cc +914 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/coded_stream.h +1220 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/coded_stream_inl.h +69 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/coded_stream_unittest.cc +1378 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/gzip_stream.cc +326 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/gzip_stream.h +209 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/gzip_stream_unittest.sh +44 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/package_info.h +54 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/printer.cc +198 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/printer.h +136 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/printer_unittest.cc +285 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/strtod.cc +113 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/strtod.h +50 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/tokenizer.cc +1127 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/tokenizer.h +402 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/tokenizer_unittest.cc +999 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream.cc +57 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream.h +248 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc +473 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h +358 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc +405 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h +354 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream_unittest.cc +965 -0
- data/ext/protoc/protobuf/src/google/protobuf/lite_unittest.cc +350 -0
- data/ext/protoc/protobuf/src/google/protobuf/message.cc +358 -0
- data/ext/protoc/protobuf/src/google/protobuf/message.h +866 -0
- data/ext/protoc/protobuf/src/google/protobuf/message_lite.cc +335 -0
- data/ext/protoc/protobuf/src/google/protobuf/message_lite.h +247 -0
- data/ext/protoc/protobuf/src/google/protobuf/message_unittest.cc +427 -0
- data/ext/protoc/protobuf/src/google/protobuf/package_info.h +64 -0
- data/ext/protoc/protobuf/src/google/protobuf/reflection_ops.cc +269 -0
- data/ext/protoc/protobuf/src/google/protobuf/reflection_ops.h +81 -0
- data/ext/protoc/protobuf/src/google/protobuf/reflection_ops_unittest.cc +475 -0
- data/ext/protoc/protobuf/src/google/protobuf/repeated_field.cc +87 -0
- data/ext/protoc/protobuf/src/google/protobuf/repeated_field.h +1603 -0
- data/ext/protoc/protobuf/src/google/protobuf/repeated_field_reflection_unittest.cc +195 -0
- data/ext/protoc/protobuf/src/google/protobuf/repeated_field_unittest.cc +1442 -0
- data/ext/protoc/protobuf/src/google/protobuf/service.cc +46 -0
- data/ext/protoc/protobuf/src/google/protobuf/service.h +291 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops.h +227 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_arm64_gcc.h +325 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_arm_gcc.h +151 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_arm_qnx.h +146 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_atomicword_compat.h +122 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h +137 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h +225 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_mips_gcc.h +313 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_pnacl.h +73 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_solaris.h +188 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_tsan.h +219 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc +137 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_gcc.h +293 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc +112 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_msvc.h +150 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/common.cc +395 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/common.h +1226 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/common_unittest.cc +357 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/hash.h +232 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/map_util.h +771 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/once.cc +99 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/once.h +166 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/once_unittest.cc +253 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/platform_macros.h +103 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/shared_ptr.h +470 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/stl_util.h +121 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/stringprintf.cc +175 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/stringprintf.h +76 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/stringprintf_unittest.cc +152 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/structurally_valid.cc +536 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/structurally_valid_unittest.cc +40 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/strutil.cc +1279 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/strutil.h +562 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/strutil_unittest.cc +73 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/substitute.cc +134 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/substitute.h +170 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/template_util.h +138 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/template_util_unittest.cc +130 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/type_traits.h +336 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/type_traits_unittest.cc +628 -0
- data/ext/protoc/protobuf/src/google/protobuf/test_util.cc +3345 -0
- data/ext/protoc/protobuf/src/google/protobuf/test_util.h +215 -0
- data/ext/protoc/protobuf/src/google/protobuf/test_util_lite.cc +1585 -0
- data/ext/protoc/protobuf/src/google/protobuf/test_util_lite.h +101 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/bad_utf8_string +1 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/golden_message +0 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/golden_message_oneof_implemented +0 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/golden_packed_fields_message +0 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_data.txt +134 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_data_oneof_implemented.txt +129 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_data_pointy.txt +134 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_data_pointy_oneof.txt +129 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_extensions_data.txt +134 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_extensions_data_pointy.txt +134 -0
- data/ext/protoc/protobuf/src/google/protobuf/testing/file.cc +194 -0
- data/ext/protoc/protobuf/src/google/protobuf/testing/file.h +97 -0
- data/ext/protoc/protobuf/src/google/protobuf/testing/googletest.cc +255 -0
- data/ext/protoc/protobuf/src/google/protobuf/testing/googletest.h +102 -0
- data/ext/protoc/protobuf/src/google/protobuf/testing/zcgunzip.cc +73 -0
- data/ext/protoc/protobuf/src/google/protobuf/testing/zcgzip.cc +79 -0
- data/ext/protoc/protobuf/src/google/protobuf/text_format.cc +1746 -0
- data/ext/protoc/protobuf/src/google/protobuf/text_format.h +473 -0
- data/ext/protoc/protobuf/src/google/protobuf/text_format_unittest.cc +1479 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest.proto +861 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_custom_options.proto +393 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_embed_optimize_for.proto +50 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_empty.proto +37 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_enormous_descriptor.proto +1046 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_import.proto +64 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_import_lite.proto +51 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_import_public.proto +40 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_import_public_lite.proto +42 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_lite.proto +384 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_lite_imports_nonlite.proto +43 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_mset.proto +83 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_no_generic_services.proto +53 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_optimize_for.proto +66 -0
- data/ext/protoc/protobuf/src/google/protobuf/unknown_field_set.cc +265 -0
- data/ext/protoc/protobuf/src/google/protobuf/unknown_field_set.h +318 -0
- data/ext/protoc/protobuf/src/google/protobuf/unknown_field_set_unittest.cc +599 -0
- data/ext/protoc/protobuf/src/google/protobuf/wire_format.cc +1101 -0
- data/ext/protoc/protobuf/src/google/protobuf/wire_format.h +336 -0
- data/ext/protoc/protobuf/src/google/protobuf/wire_format_lite.cc +471 -0
- data/ext/protoc/protobuf/src/google/protobuf/wire_format_lite.h +661 -0
- data/ext/protoc/protobuf/src/google/protobuf/wire_format_lite_inl.h +860 -0
- data/ext/protoc/protobuf/src/google/protobuf/wire_format_unittest.cc +1120 -0
- data/ext/protoc/protobuf/src/solaris/libstdc++.la +51 -0
- data/ext/protoc/protobuf/vsprojects/config.h +29 -0
- data/ext/protoc/protobuf/vsprojects/convert2008to2005.sh +20 -0
- data/ext/protoc/protobuf/vsprojects/extract_includes.bat +50 -0
- data/ext/protoc/protobuf/vsprojects/libprotobuf-lite.vcproj +302 -0
- data/ext/protoc/protobuf/vsprojects/libprotobuf.vcproj +470 -0
- data/ext/protoc/protobuf/vsprojects/libprotoc.vcproj +466 -0
- data/ext/protoc/protobuf/vsprojects/lite-test.vcproj +305 -0
- data/ext/protoc/protobuf/vsprojects/protobuf.sln +92 -0
- data/ext/protoc/protobuf/vsprojects/protoc.vcproj +192 -0
- data/ext/protoc/protobuf/vsprojects/readme.txt +114 -0
- data/ext/protoc/protobuf/vsprojects/test_plugin.vcproj +209 -0
- data/ext/protoc/protobuf/vsprojects/tests.vcproj +681 -0
- data/lib/protoc/version.rb +1 -1
- metadata +480 -3
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Protocol Buffers - Google's data interchange format
|
|
2
|
+
// Copyright 2008 Google Inc. All rights reserved.
|
|
3
|
+
// https://developers.google.com/protocol-buffers/
|
|
4
|
+
//
|
|
5
|
+
// Redistribution and use in source and binary forms, with or without
|
|
6
|
+
// modification, are permitted provided that the following conditions are
|
|
7
|
+
// met:
|
|
8
|
+
//
|
|
9
|
+
// * Redistributions of source code must retain the above copyright
|
|
10
|
+
// notice, this list of conditions and the following disclaimer.
|
|
11
|
+
// * Redistributions in binary form must reproduce the above
|
|
12
|
+
// copyright notice, this list of conditions and the following disclaimer
|
|
13
|
+
// in the documentation and/or other materials provided with the
|
|
14
|
+
// distribution.
|
|
15
|
+
// * Neither the name of Google Inc. nor the names of its
|
|
16
|
+
// contributors may be used to endorse or promote products derived from
|
|
17
|
+
// this software without specific prior written permission.
|
|
18
|
+
//
|
|
19
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
20
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
21
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
22
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
23
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
24
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
25
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
26
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
27
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
28
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
30
|
+
|
|
31
|
+
// Author: qrczak@google.com (Marcin Kowalczyk)
|
|
32
|
+
//
|
|
33
|
+
// This module exposes the C proto inside the given Python proto, in
|
|
34
|
+
// case the Python proto is implemented with a C proto.
|
|
35
|
+
|
|
36
|
+
#ifndef GOOGLE_PROTOBUF_PYTHON_PYTHON_PROTOBUF_H__
|
|
37
|
+
#define GOOGLE_PROTOBUF_PYTHON_PYTHON_PROTOBUF_H__
|
|
38
|
+
|
|
39
|
+
#include <Python.h>
|
|
40
|
+
|
|
41
|
+
namespace google {
|
|
42
|
+
namespace protobuf {
|
|
43
|
+
|
|
44
|
+
class Message;
|
|
45
|
+
|
|
46
|
+
namespace python {
|
|
47
|
+
|
|
48
|
+
// Return the pointer to the C proto inside the given Python proto,
|
|
49
|
+
// or NULL when this is not a Python proto implemented with a C proto.
|
|
50
|
+
const Message* GetCProtoInsidePyProto(PyObject* msg);
|
|
51
|
+
Message* MutableCProtoInsidePyProto(PyObject* msg);
|
|
52
|
+
|
|
53
|
+
} // namespace python
|
|
54
|
+
} // namespace protobuf
|
|
55
|
+
|
|
56
|
+
} // namespace google
|
|
57
|
+
#endif // GOOGLE_PROTOBUF_PYTHON_PYTHON_PROTOBUF_H__
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
#! /usr/bin/python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
#
|
|
4
|
+
# Protocol Buffers - Google's data interchange format
|
|
5
|
+
# Copyright 2008 Google Inc. All rights reserved.
|
|
6
|
+
# https://developers.google.com/protocol-buffers/
|
|
7
|
+
#
|
|
8
|
+
# Redistribution and use in source and binary forms, with or without
|
|
9
|
+
# modification, are permitted provided that the following conditions are
|
|
10
|
+
# met:
|
|
11
|
+
#
|
|
12
|
+
# * Redistributions of source code must retain the above copyright
|
|
13
|
+
# notice, this list of conditions and the following disclaimer.
|
|
14
|
+
# * Redistributions in binary form must reproduce the above
|
|
15
|
+
# copyright notice, this list of conditions and the following disclaimer
|
|
16
|
+
# in the documentation and/or other materials provided with the
|
|
17
|
+
# distribution.
|
|
18
|
+
# * Neither the name of Google Inc. nor the names of its
|
|
19
|
+
# contributors may be used to endorse or promote products derived from
|
|
20
|
+
# this software without specific prior written permission.
|
|
21
|
+
#
|
|
22
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
23
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
24
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
25
|
+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
26
|
+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
27
|
+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
28
|
+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
29
|
+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
30
|
+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
31
|
+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
32
|
+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
33
|
+
|
|
34
|
+
"""Unittest for reflection.py, which tests the generated C++ implementation."""
|
|
35
|
+
|
|
36
|
+
__author__ = 'jasonh@google.com (Jason Hsueh)'
|
|
37
|
+
|
|
38
|
+
import os
|
|
39
|
+
os.environ['PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION'] = 'cpp'
|
|
40
|
+
os.environ['PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION'] = '2'
|
|
41
|
+
|
|
42
|
+
from google.apputils import basetest
|
|
43
|
+
from google.protobuf.internal import api_implementation
|
|
44
|
+
from google.protobuf.internal import more_extensions_dynamic_pb2
|
|
45
|
+
from google.protobuf.internal import more_extensions_pb2
|
|
46
|
+
from google.protobuf.internal.reflection_test import *
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class ReflectionCppTest(basetest.TestCase):
|
|
50
|
+
def testImplementationSetting(self):
|
|
51
|
+
self.assertEqual('cpp', api_implementation.Type())
|
|
52
|
+
self.assertEqual(2, api_implementation.Version())
|
|
53
|
+
|
|
54
|
+
def testExtensionOfGeneratedTypeInDynamicFile(self):
|
|
55
|
+
"""Tests that a file built dynamically can extend a generated C++ type.
|
|
56
|
+
|
|
57
|
+
The C++ implementation uses a DescriptorPool that has the generated
|
|
58
|
+
DescriptorPool as an underlay. Typically, a type can only find
|
|
59
|
+
extensions in its own pool. With the python C-extension, the generated C++
|
|
60
|
+
extendee may be available, but not the extension. This tests that the
|
|
61
|
+
C-extension implements the correct special handling to make such extensions
|
|
62
|
+
available.
|
|
63
|
+
"""
|
|
64
|
+
pb1 = more_extensions_pb2.ExtendedMessage()
|
|
65
|
+
# Test that basic accessors work.
|
|
66
|
+
self.assertFalse(
|
|
67
|
+
pb1.HasExtension(more_extensions_dynamic_pb2.dynamic_int32_extension))
|
|
68
|
+
self.assertFalse(
|
|
69
|
+
pb1.HasExtension(more_extensions_dynamic_pb2.dynamic_message_extension))
|
|
70
|
+
pb1.Extensions[more_extensions_dynamic_pb2.dynamic_int32_extension] = 17
|
|
71
|
+
pb1.Extensions[more_extensions_dynamic_pb2.dynamic_message_extension].a = 24
|
|
72
|
+
self.assertTrue(
|
|
73
|
+
pb1.HasExtension(more_extensions_dynamic_pb2.dynamic_int32_extension))
|
|
74
|
+
self.assertTrue(
|
|
75
|
+
pb1.HasExtension(more_extensions_dynamic_pb2.dynamic_message_extension))
|
|
76
|
+
|
|
77
|
+
# Now serialize the data and parse to a new message.
|
|
78
|
+
pb2 = more_extensions_pb2.ExtendedMessage()
|
|
79
|
+
pb2.MergeFromString(pb1.SerializeToString())
|
|
80
|
+
|
|
81
|
+
self.assertTrue(
|
|
82
|
+
pb2.HasExtension(more_extensions_dynamic_pb2.dynamic_int32_extension))
|
|
83
|
+
self.assertTrue(
|
|
84
|
+
pb2.HasExtension(more_extensions_dynamic_pb2.dynamic_message_extension))
|
|
85
|
+
self.assertEqual(
|
|
86
|
+
17, pb2.Extensions[more_extensions_dynamic_pb2.dynamic_int32_extension])
|
|
87
|
+
self.assertEqual(
|
|
88
|
+
24,
|
|
89
|
+
pb2.Extensions[more_extensions_dynamic_pb2.dynamic_message_extension].a)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
if __name__ == '__main__':
|
|
94
|
+
basetest.main()
|
|
@@ -0,0 +1,763 @@
|
|
|
1
|
+
// Protocol Buffers - Google's data interchange format
|
|
2
|
+
// Copyright 2008 Google Inc. All rights reserved.
|
|
3
|
+
// https://developers.google.com/protocol-buffers/
|
|
4
|
+
//
|
|
5
|
+
// Redistribution and use in source and binary forms, with or without
|
|
6
|
+
// modification, are permitted provided that the following conditions are
|
|
7
|
+
// met:
|
|
8
|
+
//
|
|
9
|
+
// * Redistributions of source code must retain the above copyright
|
|
10
|
+
// notice, this list of conditions and the following disclaimer.
|
|
11
|
+
// * Redistributions in binary form must reproduce the above
|
|
12
|
+
// copyright notice, this list of conditions and the following disclaimer
|
|
13
|
+
// in the documentation and/or other materials provided with the
|
|
14
|
+
// distribution.
|
|
15
|
+
// * Neither the name of Google Inc. nor the names of its
|
|
16
|
+
// contributors may be used to endorse or promote products derived from
|
|
17
|
+
// this software without specific prior written permission.
|
|
18
|
+
//
|
|
19
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
20
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
21
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
22
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
23
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
24
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
25
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
26
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
27
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
28
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
30
|
+
|
|
31
|
+
// Author: anuraag@google.com (Anuraag Agrawal)
|
|
32
|
+
// Author: tibell@google.com (Johan Tibell)
|
|
33
|
+
|
|
34
|
+
#include <google/protobuf/pyext/repeated_composite_container.h>
|
|
35
|
+
|
|
36
|
+
#include <memory>
|
|
37
|
+
#ifndef _SHARED_PTR_H
|
|
38
|
+
#include <google/protobuf/stubs/shared_ptr.h>
|
|
39
|
+
#endif
|
|
40
|
+
|
|
41
|
+
#include <google/protobuf/stubs/common.h>
|
|
42
|
+
#include <google/protobuf/descriptor.h>
|
|
43
|
+
#include <google/protobuf/dynamic_message.h>
|
|
44
|
+
#include <google/protobuf/message.h>
|
|
45
|
+
#include <google/protobuf/pyext/descriptor.h>
|
|
46
|
+
#include <google/protobuf/pyext/message.h>
|
|
47
|
+
#include <google/protobuf/pyext/scoped_pyobject_ptr.h>
|
|
48
|
+
|
|
49
|
+
#if PY_MAJOR_VERSION >= 3
|
|
50
|
+
#define PyInt_Check PyLong_Check
|
|
51
|
+
#define PyInt_AsLong PyLong_AsLong
|
|
52
|
+
#define PyInt_FromLong PyLong_FromLong
|
|
53
|
+
#endif
|
|
54
|
+
|
|
55
|
+
namespace google {
|
|
56
|
+
namespace protobuf {
|
|
57
|
+
namespace python {
|
|
58
|
+
|
|
59
|
+
extern google::protobuf::DynamicMessageFactory* global_message_factory;
|
|
60
|
+
|
|
61
|
+
namespace repeated_composite_container {
|
|
62
|
+
|
|
63
|
+
// TODO(tibell): We might also want to check:
|
|
64
|
+
// GOOGLE_CHECK_NOTNULL((self)->owner.get());
|
|
65
|
+
#define GOOGLE_CHECK_ATTACHED(self) \
|
|
66
|
+
do { \
|
|
67
|
+
GOOGLE_CHECK_NOTNULL((self)->message); \
|
|
68
|
+
GOOGLE_CHECK_NOTNULL((self)->parent_field); \
|
|
69
|
+
} while (0);
|
|
70
|
+
|
|
71
|
+
#define GOOGLE_CHECK_RELEASED(self) \
|
|
72
|
+
do { \
|
|
73
|
+
GOOGLE_CHECK((self)->owner.get() == NULL); \
|
|
74
|
+
GOOGLE_CHECK((self)->message == NULL); \
|
|
75
|
+
GOOGLE_CHECK((self)->parent_field == NULL); \
|
|
76
|
+
GOOGLE_CHECK((self)->parent == NULL); \
|
|
77
|
+
} while (0);
|
|
78
|
+
|
|
79
|
+
// Returns a new reference.
|
|
80
|
+
static PyObject* GetKey(PyObject* x) {
|
|
81
|
+
// Just the identity function.
|
|
82
|
+
Py_INCREF(x);
|
|
83
|
+
return x;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
#define GET_KEY(keyfunc, value) \
|
|
87
|
+
((keyfunc) == NULL ? \
|
|
88
|
+
GetKey((value)) : \
|
|
89
|
+
PyObject_CallFunctionObjArgs((keyfunc), (value), NULL))
|
|
90
|
+
|
|
91
|
+
// Converts a comparison function that returns -1, 0, or 1 into a
|
|
92
|
+
// less-than predicate.
|
|
93
|
+
//
|
|
94
|
+
// Returns -1 on error, 1 if x < y, 0 if x >= y.
|
|
95
|
+
static int islt(PyObject *x, PyObject *y, PyObject *compare) {
|
|
96
|
+
if (compare == NULL)
|
|
97
|
+
return PyObject_RichCompareBool(x, y, Py_LT);
|
|
98
|
+
|
|
99
|
+
ScopedPyObjectPtr res(PyObject_CallFunctionObjArgs(compare, x, y, NULL));
|
|
100
|
+
if (res == NULL)
|
|
101
|
+
return -1;
|
|
102
|
+
if (!PyInt_Check(res)) {
|
|
103
|
+
PyErr_Format(PyExc_TypeError,
|
|
104
|
+
"comparison function must return int, not %.200s",
|
|
105
|
+
Py_TYPE(res)->tp_name);
|
|
106
|
+
return -1;
|
|
107
|
+
}
|
|
108
|
+
return PyInt_AsLong(res) < 0;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Copied from uarrsort.c but swaps memcpy swaps with protobuf/python swaps
|
|
112
|
+
// TODO(anuraag): Is there a better way to do this then reinventing the wheel?
|
|
113
|
+
static int InternalQuickSort(RepeatedCompositeContainer* self,
|
|
114
|
+
Py_ssize_t start,
|
|
115
|
+
Py_ssize_t limit,
|
|
116
|
+
PyObject* cmp,
|
|
117
|
+
PyObject* keyfunc) {
|
|
118
|
+
if (limit - start <= 1)
|
|
119
|
+
return 0; // Nothing to sort.
|
|
120
|
+
|
|
121
|
+
GOOGLE_CHECK_ATTACHED(self);
|
|
122
|
+
|
|
123
|
+
google::protobuf::Message* message = self->message;
|
|
124
|
+
const google::protobuf::Reflection* reflection = message->GetReflection();
|
|
125
|
+
const google::protobuf::FieldDescriptor* descriptor = self->parent_field->descriptor;
|
|
126
|
+
Py_ssize_t left;
|
|
127
|
+
Py_ssize_t right;
|
|
128
|
+
|
|
129
|
+
PyObject* children = self->child_messages;
|
|
130
|
+
|
|
131
|
+
do {
|
|
132
|
+
left = start;
|
|
133
|
+
right = limit;
|
|
134
|
+
ScopedPyObjectPtr mid(
|
|
135
|
+
GET_KEY(keyfunc, PyList_GET_ITEM(children, (start + limit) / 2)));
|
|
136
|
+
do {
|
|
137
|
+
ScopedPyObjectPtr key(GET_KEY(keyfunc, PyList_GET_ITEM(children, left)));
|
|
138
|
+
int is_lt = islt(key, mid, cmp);
|
|
139
|
+
if (is_lt == -1)
|
|
140
|
+
return -1;
|
|
141
|
+
/* array[left]<x */
|
|
142
|
+
while (is_lt) {
|
|
143
|
+
++left;
|
|
144
|
+
ScopedPyObjectPtr key(GET_KEY(keyfunc,
|
|
145
|
+
PyList_GET_ITEM(children, left)));
|
|
146
|
+
is_lt = islt(key, mid, cmp);
|
|
147
|
+
if (is_lt == -1)
|
|
148
|
+
return -1;
|
|
149
|
+
}
|
|
150
|
+
key.reset(GET_KEY(keyfunc, PyList_GET_ITEM(children, right - 1)));
|
|
151
|
+
is_lt = islt(mid, key, cmp);
|
|
152
|
+
if (is_lt == -1)
|
|
153
|
+
return -1;
|
|
154
|
+
while (is_lt) {
|
|
155
|
+
--right;
|
|
156
|
+
ScopedPyObjectPtr key(GET_KEY(keyfunc,
|
|
157
|
+
PyList_GET_ITEM(children, right - 1)));
|
|
158
|
+
is_lt = islt(mid, key, cmp);
|
|
159
|
+
if (is_lt == -1)
|
|
160
|
+
return -1;
|
|
161
|
+
}
|
|
162
|
+
if (left < right) {
|
|
163
|
+
--right;
|
|
164
|
+
if (left < right) {
|
|
165
|
+
reflection->SwapElements(message, descriptor, left, right);
|
|
166
|
+
PyObject* tmp = PyList_GET_ITEM(children, left);
|
|
167
|
+
PyList_SET_ITEM(children, left, PyList_GET_ITEM(children, right));
|
|
168
|
+
PyList_SET_ITEM(children, right, tmp);
|
|
169
|
+
}
|
|
170
|
+
++left;
|
|
171
|
+
}
|
|
172
|
+
} while (left < right);
|
|
173
|
+
|
|
174
|
+
if ((right - start) < (limit - left)) {
|
|
175
|
+
/* sort [start..right[ */
|
|
176
|
+
if (start < (right - 1)) {
|
|
177
|
+
InternalQuickSort(self, start, right, cmp, keyfunc);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/* sort [left..limit[ */
|
|
181
|
+
start = left;
|
|
182
|
+
} else {
|
|
183
|
+
/* sort [left..limit[ */
|
|
184
|
+
if (left < (limit - 1)) {
|
|
185
|
+
InternalQuickSort(self, left, limit, cmp, keyfunc);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/* sort [start..right[ */
|
|
189
|
+
limit = right;
|
|
190
|
+
}
|
|
191
|
+
} while (start < (limit - 1));
|
|
192
|
+
|
|
193
|
+
return 0;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
#undef GET_KEY
|
|
197
|
+
|
|
198
|
+
// ---------------------------------------------------------------------
|
|
199
|
+
// len()
|
|
200
|
+
|
|
201
|
+
static Py_ssize_t Length(RepeatedCompositeContainer* self) {
|
|
202
|
+
google::protobuf::Message* message = self->message;
|
|
203
|
+
if (message != NULL) {
|
|
204
|
+
return message->GetReflection()->FieldSize(*message,
|
|
205
|
+
self->parent_field->descriptor);
|
|
206
|
+
} else {
|
|
207
|
+
// The container has been released (i.e. by a call to Clear() or
|
|
208
|
+
// ClearField() on the parent) and thus there's no message.
|
|
209
|
+
return PyList_GET_SIZE(self->child_messages);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// Returns 0 if successful; returns -1 and sets an exception if
|
|
214
|
+
// unsuccessful.
|
|
215
|
+
static int UpdateChildMessages(RepeatedCompositeContainer* self) {
|
|
216
|
+
if (self->message == NULL)
|
|
217
|
+
return 0;
|
|
218
|
+
|
|
219
|
+
// A MergeFrom on a parent message could have caused extra messages to be
|
|
220
|
+
// added in the underlying protobuf so add them to our list. They can never
|
|
221
|
+
// be removed in such a way so there's no need to worry about that.
|
|
222
|
+
Py_ssize_t message_length = Length(self);
|
|
223
|
+
Py_ssize_t child_length = PyList_GET_SIZE(self->child_messages);
|
|
224
|
+
google::protobuf::Message* message = self->message;
|
|
225
|
+
const google::protobuf::Reflection* reflection = message->GetReflection();
|
|
226
|
+
for (Py_ssize_t i = child_length; i < message_length; ++i) {
|
|
227
|
+
const Message& sub_message = reflection->GetRepeatedMessage(
|
|
228
|
+
*(self->message), self->parent_field->descriptor, i);
|
|
229
|
+
ScopedPyObjectPtr py_cmsg(cmessage::NewEmpty(self->subclass_init));
|
|
230
|
+
if (py_cmsg == NULL) {
|
|
231
|
+
return -1;
|
|
232
|
+
}
|
|
233
|
+
CMessage* cmsg = reinterpret_cast<CMessage*>(py_cmsg.get());
|
|
234
|
+
cmsg->owner = self->owner;
|
|
235
|
+
cmsg->message = const_cast<google::protobuf::Message*>(&sub_message);
|
|
236
|
+
cmsg->parent = self->parent;
|
|
237
|
+
if (cmessage::InitAttributes(cmsg, NULL, NULL) < 0) {
|
|
238
|
+
return -1;
|
|
239
|
+
}
|
|
240
|
+
PyList_Append(self->child_messages, py_cmsg);
|
|
241
|
+
}
|
|
242
|
+
return 0;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// ---------------------------------------------------------------------
|
|
246
|
+
// add()
|
|
247
|
+
|
|
248
|
+
static PyObject* AddToAttached(RepeatedCompositeContainer* self,
|
|
249
|
+
PyObject* args,
|
|
250
|
+
PyObject* kwargs) {
|
|
251
|
+
GOOGLE_CHECK_ATTACHED(self);
|
|
252
|
+
|
|
253
|
+
if (UpdateChildMessages(self) < 0) {
|
|
254
|
+
return NULL;
|
|
255
|
+
}
|
|
256
|
+
if (cmessage::AssureWritable(self->parent) == -1)
|
|
257
|
+
return NULL;
|
|
258
|
+
google::protobuf::Message* message = self->message;
|
|
259
|
+
google::protobuf::Message* sub_message =
|
|
260
|
+
message->GetReflection()->AddMessage(message,
|
|
261
|
+
self->parent_field->descriptor);
|
|
262
|
+
PyObject* py_cmsg = cmessage::NewEmpty(self->subclass_init);
|
|
263
|
+
if (py_cmsg == NULL) {
|
|
264
|
+
return NULL;
|
|
265
|
+
}
|
|
266
|
+
CMessage* cmsg = reinterpret_cast<CMessage*>(py_cmsg);
|
|
267
|
+
|
|
268
|
+
cmsg->owner = self->owner;
|
|
269
|
+
cmsg->message = sub_message;
|
|
270
|
+
cmsg->parent = self->parent;
|
|
271
|
+
// cmessage::InitAttributes must be called after cmsg->message has
|
|
272
|
+
// been set.
|
|
273
|
+
if (cmessage::InitAttributes(cmsg, NULL, kwargs) < 0) {
|
|
274
|
+
Py_DECREF(py_cmsg);
|
|
275
|
+
return NULL;
|
|
276
|
+
}
|
|
277
|
+
PyList_Append(self->child_messages, py_cmsg);
|
|
278
|
+
return py_cmsg;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
static PyObject* AddToReleased(RepeatedCompositeContainer* self,
|
|
282
|
+
PyObject* args,
|
|
283
|
+
PyObject* kwargs) {
|
|
284
|
+
GOOGLE_CHECK_RELEASED(self);
|
|
285
|
+
|
|
286
|
+
// Create the CMessage
|
|
287
|
+
PyObject* py_cmsg = PyObject_CallObject(self->subclass_init, NULL);
|
|
288
|
+
if (py_cmsg == NULL)
|
|
289
|
+
return NULL;
|
|
290
|
+
CMessage* cmsg = reinterpret_cast<CMessage*>(py_cmsg);
|
|
291
|
+
if (cmessage::InitAttributes(cmsg, NULL, kwargs) < 0) {
|
|
292
|
+
Py_DECREF(py_cmsg);
|
|
293
|
+
return NULL;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// The Message got created by the call to subclass_init above and
|
|
297
|
+
// it set self->owner to the newly allocated message.
|
|
298
|
+
|
|
299
|
+
PyList_Append(self->child_messages, py_cmsg);
|
|
300
|
+
return py_cmsg;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
PyObject* Add(RepeatedCompositeContainer* self,
|
|
304
|
+
PyObject* args,
|
|
305
|
+
PyObject* kwargs) {
|
|
306
|
+
if (self->message == NULL)
|
|
307
|
+
return AddToReleased(self, args, kwargs);
|
|
308
|
+
else
|
|
309
|
+
return AddToAttached(self, args, kwargs);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// ---------------------------------------------------------------------
|
|
313
|
+
// extend()
|
|
314
|
+
|
|
315
|
+
PyObject* Extend(RepeatedCompositeContainer* self, PyObject* value) {
|
|
316
|
+
cmessage::AssureWritable(self->parent);
|
|
317
|
+
if (UpdateChildMessages(self) < 0) {
|
|
318
|
+
return NULL;
|
|
319
|
+
}
|
|
320
|
+
ScopedPyObjectPtr iter(PyObject_GetIter(value));
|
|
321
|
+
if (iter == NULL) {
|
|
322
|
+
PyErr_SetString(PyExc_TypeError, "Value must be iterable");
|
|
323
|
+
return NULL;
|
|
324
|
+
}
|
|
325
|
+
ScopedPyObjectPtr next;
|
|
326
|
+
while ((next.reset(PyIter_Next(iter))) != NULL) {
|
|
327
|
+
if (!PyObject_TypeCheck(next, &CMessage_Type)) {
|
|
328
|
+
PyErr_SetString(PyExc_TypeError, "Not a cmessage");
|
|
329
|
+
return NULL;
|
|
330
|
+
}
|
|
331
|
+
ScopedPyObjectPtr new_message(Add(self, NULL, NULL));
|
|
332
|
+
if (new_message == NULL) {
|
|
333
|
+
return NULL;
|
|
334
|
+
}
|
|
335
|
+
CMessage* new_cmessage = reinterpret_cast<CMessage*>(new_message.get());
|
|
336
|
+
if (cmessage::MergeFrom(new_cmessage, next) == NULL) {
|
|
337
|
+
return NULL;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
if (PyErr_Occurred()) {
|
|
341
|
+
return NULL;
|
|
342
|
+
}
|
|
343
|
+
Py_RETURN_NONE;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
PyObject* MergeFrom(RepeatedCompositeContainer* self, PyObject* other) {
|
|
347
|
+
if (UpdateChildMessages(self) < 0) {
|
|
348
|
+
return NULL;
|
|
349
|
+
}
|
|
350
|
+
return Extend(self, other);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
PyObject* Subscript(RepeatedCompositeContainer* self, PyObject* slice) {
|
|
354
|
+
if (UpdateChildMessages(self) < 0) {
|
|
355
|
+
return NULL;
|
|
356
|
+
}
|
|
357
|
+
Py_ssize_t from;
|
|
358
|
+
Py_ssize_t to;
|
|
359
|
+
Py_ssize_t step;
|
|
360
|
+
Py_ssize_t length = Length(self);
|
|
361
|
+
Py_ssize_t slicelength;
|
|
362
|
+
if (PySlice_Check(slice)) {
|
|
363
|
+
#if PY_MAJOR_VERSION >= 3
|
|
364
|
+
if (PySlice_GetIndicesEx(slice,
|
|
365
|
+
#else
|
|
366
|
+
if (PySlice_GetIndicesEx(reinterpret_cast<PySliceObject*>(slice),
|
|
367
|
+
#endif
|
|
368
|
+
length, &from, &to, &step, &slicelength) == -1) {
|
|
369
|
+
return NULL;
|
|
370
|
+
}
|
|
371
|
+
return PyList_GetSlice(self->child_messages, from, to);
|
|
372
|
+
} else if (PyInt_Check(slice) || PyLong_Check(slice)) {
|
|
373
|
+
from = to = PyLong_AsLong(slice);
|
|
374
|
+
if (from < 0) {
|
|
375
|
+
from = to = length + from;
|
|
376
|
+
}
|
|
377
|
+
PyObject* result = PyList_GetItem(self->child_messages, from);
|
|
378
|
+
if (result == NULL) {
|
|
379
|
+
return NULL;
|
|
380
|
+
}
|
|
381
|
+
Py_INCREF(result);
|
|
382
|
+
return result;
|
|
383
|
+
}
|
|
384
|
+
PyErr_SetString(PyExc_TypeError, "index must be an integer or slice");
|
|
385
|
+
return NULL;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
int AssignSubscript(RepeatedCompositeContainer* self,
|
|
389
|
+
PyObject* slice,
|
|
390
|
+
PyObject* value) {
|
|
391
|
+
if (UpdateChildMessages(self) < 0) {
|
|
392
|
+
return -1;
|
|
393
|
+
}
|
|
394
|
+
if (value != NULL) {
|
|
395
|
+
PyErr_SetString(PyExc_TypeError, "does not support assignment");
|
|
396
|
+
return -1;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// Delete from the underlying Message, if any.
|
|
400
|
+
if (self->message != NULL) {
|
|
401
|
+
if (cmessage::InternalDeleteRepeatedField(self->message,
|
|
402
|
+
self->parent_field->descriptor,
|
|
403
|
+
slice,
|
|
404
|
+
self->child_messages) < 0) {
|
|
405
|
+
return -1;
|
|
406
|
+
}
|
|
407
|
+
} else {
|
|
408
|
+
Py_ssize_t from;
|
|
409
|
+
Py_ssize_t to;
|
|
410
|
+
Py_ssize_t step;
|
|
411
|
+
Py_ssize_t length = Length(self);
|
|
412
|
+
Py_ssize_t slicelength;
|
|
413
|
+
if (PySlice_Check(slice)) {
|
|
414
|
+
#if PY_MAJOR_VERSION >= 3
|
|
415
|
+
if (PySlice_GetIndicesEx(slice,
|
|
416
|
+
#else
|
|
417
|
+
if (PySlice_GetIndicesEx(reinterpret_cast<PySliceObject*>(slice),
|
|
418
|
+
#endif
|
|
419
|
+
length, &from, &to, &step, &slicelength) == -1) {
|
|
420
|
+
return -1;
|
|
421
|
+
}
|
|
422
|
+
return PySequence_DelSlice(self->child_messages, from, to);
|
|
423
|
+
} else if (PyInt_Check(slice) || PyLong_Check(slice)) {
|
|
424
|
+
from = to = PyLong_AsLong(slice);
|
|
425
|
+
if (from < 0) {
|
|
426
|
+
from = to = length + from;
|
|
427
|
+
}
|
|
428
|
+
return PySequence_DelItem(self->child_messages, from);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
return 0;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
static PyObject* Remove(RepeatedCompositeContainer* self, PyObject* value) {
|
|
436
|
+
if (UpdateChildMessages(self) < 0) {
|
|
437
|
+
return NULL;
|
|
438
|
+
}
|
|
439
|
+
Py_ssize_t index = PySequence_Index(self->child_messages, value);
|
|
440
|
+
if (index == -1) {
|
|
441
|
+
return NULL;
|
|
442
|
+
}
|
|
443
|
+
ScopedPyObjectPtr py_index(PyLong_FromLong(index));
|
|
444
|
+
if (AssignSubscript(self, py_index, NULL) < 0) {
|
|
445
|
+
return NULL;
|
|
446
|
+
}
|
|
447
|
+
Py_RETURN_NONE;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
static PyObject* RichCompare(RepeatedCompositeContainer* self,
|
|
451
|
+
PyObject* other,
|
|
452
|
+
int opid) {
|
|
453
|
+
if (UpdateChildMessages(self) < 0) {
|
|
454
|
+
return NULL;
|
|
455
|
+
}
|
|
456
|
+
if (!PyObject_TypeCheck(other, &RepeatedCompositeContainer_Type)) {
|
|
457
|
+
PyErr_SetString(PyExc_TypeError,
|
|
458
|
+
"Can only compare repeated composite fields "
|
|
459
|
+
"against other repeated composite fields.");
|
|
460
|
+
return NULL;
|
|
461
|
+
}
|
|
462
|
+
if (opid == Py_EQ || opid == Py_NE) {
|
|
463
|
+
// TODO(anuraag): Don't make new lists just for this...
|
|
464
|
+
ScopedPyObjectPtr full_slice(PySlice_New(NULL, NULL, NULL));
|
|
465
|
+
if (full_slice == NULL) {
|
|
466
|
+
return NULL;
|
|
467
|
+
}
|
|
468
|
+
ScopedPyObjectPtr list(Subscript(self, full_slice));
|
|
469
|
+
if (list == NULL) {
|
|
470
|
+
return NULL;
|
|
471
|
+
}
|
|
472
|
+
ScopedPyObjectPtr other_list(
|
|
473
|
+
Subscript(
|
|
474
|
+
reinterpret_cast<RepeatedCompositeContainer*>(other), full_slice));
|
|
475
|
+
if (other_list == NULL) {
|
|
476
|
+
return NULL;
|
|
477
|
+
}
|
|
478
|
+
return PyObject_RichCompare(list, other_list, opid);
|
|
479
|
+
} else {
|
|
480
|
+
Py_INCREF(Py_NotImplemented);
|
|
481
|
+
return Py_NotImplemented;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
// ---------------------------------------------------------------------
|
|
486
|
+
// sort()
|
|
487
|
+
|
|
488
|
+
static PyObject* SortAttached(RepeatedCompositeContainer* self,
|
|
489
|
+
PyObject* args,
|
|
490
|
+
PyObject* kwds) {
|
|
491
|
+
// Sort the underlying Message array.
|
|
492
|
+
PyObject *compare = NULL;
|
|
493
|
+
int reverse = 0;
|
|
494
|
+
PyObject *keyfunc = NULL;
|
|
495
|
+
static char *kwlist[] = {"cmp", "key", "reverse", 0};
|
|
496
|
+
|
|
497
|
+
if (args != NULL) {
|
|
498
|
+
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OOi:sort",
|
|
499
|
+
kwlist, &compare, &keyfunc, &reverse))
|
|
500
|
+
return NULL;
|
|
501
|
+
}
|
|
502
|
+
if (compare == Py_None)
|
|
503
|
+
compare = NULL;
|
|
504
|
+
if (keyfunc == Py_None)
|
|
505
|
+
keyfunc = NULL;
|
|
506
|
+
|
|
507
|
+
const Py_ssize_t length = Length(self);
|
|
508
|
+
if (InternalQuickSort(self, 0, length, compare, keyfunc) < 0)
|
|
509
|
+
return NULL;
|
|
510
|
+
|
|
511
|
+
// Finally reverse the result if requested.
|
|
512
|
+
if (reverse) {
|
|
513
|
+
google::protobuf::Message* message = self->message;
|
|
514
|
+
const google::protobuf::Reflection* reflection = message->GetReflection();
|
|
515
|
+
const google::protobuf::FieldDescriptor* descriptor = self->parent_field->descriptor;
|
|
516
|
+
|
|
517
|
+
// Reverse the Message array.
|
|
518
|
+
for (int i = 0; i < length / 2; ++i)
|
|
519
|
+
reflection->SwapElements(message, descriptor, i, length - i - 1);
|
|
520
|
+
|
|
521
|
+
// Reverse the Python list.
|
|
522
|
+
ScopedPyObjectPtr res(PyObject_CallMethod(self->child_messages,
|
|
523
|
+
"reverse", NULL));
|
|
524
|
+
if (res == NULL)
|
|
525
|
+
return NULL;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
Py_RETURN_NONE;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
static PyObject* SortReleased(RepeatedCompositeContainer* self,
|
|
532
|
+
PyObject* args,
|
|
533
|
+
PyObject* kwds) {
|
|
534
|
+
ScopedPyObjectPtr m(PyObject_GetAttrString(self->child_messages, "sort"));
|
|
535
|
+
if (m == NULL)
|
|
536
|
+
return NULL;
|
|
537
|
+
if (PyObject_Call(m, args, kwds) == NULL)
|
|
538
|
+
return NULL;
|
|
539
|
+
Py_RETURN_NONE;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
static PyObject* Sort(RepeatedCompositeContainer* self,
|
|
543
|
+
PyObject* args,
|
|
544
|
+
PyObject* kwds) {
|
|
545
|
+
// Support the old sort_function argument for backwards
|
|
546
|
+
// compatibility.
|
|
547
|
+
if (kwds != NULL) {
|
|
548
|
+
PyObject* sort_func = PyDict_GetItemString(kwds, "sort_function");
|
|
549
|
+
if (sort_func != NULL) {
|
|
550
|
+
// Must set before deleting as sort_func is a borrowed reference
|
|
551
|
+
// and kwds might be the only thing keeping it alive.
|
|
552
|
+
PyDict_SetItemString(kwds, "cmp", sort_func);
|
|
553
|
+
PyDict_DelItemString(kwds, "sort_function");
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
if (UpdateChildMessages(self) < 0)
|
|
558
|
+
return NULL;
|
|
559
|
+
if (self->message == NULL) {
|
|
560
|
+
return SortReleased(self, args, kwds);
|
|
561
|
+
} else {
|
|
562
|
+
return SortAttached(self, args, kwds);
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
// ---------------------------------------------------------------------
|
|
567
|
+
|
|
568
|
+
static PyObject* Item(RepeatedCompositeContainer* self, Py_ssize_t index) {
|
|
569
|
+
if (UpdateChildMessages(self) < 0) {
|
|
570
|
+
return NULL;
|
|
571
|
+
}
|
|
572
|
+
Py_ssize_t length = Length(self);
|
|
573
|
+
if (index < 0) {
|
|
574
|
+
index = length + index;
|
|
575
|
+
}
|
|
576
|
+
PyObject* item = PyList_GetItem(self->child_messages, index);
|
|
577
|
+
if (item == NULL) {
|
|
578
|
+
return NULL;
|
|
579
|
+
}
|
|
580
|
+
Py_INCREF(item);
|
|
581
|
+
return item;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
// The caller takes ownership of the returned Message.
|
|
585
|
+
Message* ReleaseLast(const FieldDescriptor* field,
|
|
586
|
+
const Descriptor* type,
|
|
587
|
+
Message* message) {
|
|
588
|
+
GOOGLE_CHECK_NOTNULL(field);
|
|
589
|
+
GOOGLE_CHECK_NOTNULL(type);
|
|
590
|
+
GOOGLE_CHECK_NOTNULL(message);
|
|
591
|
+
|
|
592
|
+
Message* released_message = message->GetReflection()->ReleaseLast(
|
|
593
|
+
message, field);
|
|
594
|
+
// TODO(tibell): Deal with proto1.
|
|
595
|
+
|
|
596
|
+
// ReleaseMessage will return NULL which differs from
|
|
597
|
+
// child_cmessage->message, if the field does not exist. In this case,
|
|
598
|
+
// the latter points to the default instance via a const_cast<>, so we
|
|
599
|
+
// have to reset it to a new mutable object since we are taking ownership.
|
|
600
|
+
if (released_message == NULL) {
|
|
601
|
+
const Message* prototype = global_message_factory->GetPrototype(type);
|
|
602
|
+
GOOGLE_CHECK_NOTNULL(prototype);
|
|
603
|
+
return prototype->New();
|
|
604
|
+
} else {
|
|
605
|
+
return released_message;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
// Release field of message and transfer the ownership to cmessage.
|
|
610
|
+
void ReleaseLastTo(const FieldDescriptor* field,
|
|
611
|
+
Message* message,
|
|
612
|
+
CMessage* cmessage) {
|
|
613
|
+
GOOGLE_CHECK_NOTNULL(field);
|
|
614
|
+
GOOGLE_CHECK_NOTNULL(message);
|
|
615
|
+
GOOGLE_CHECK_NOTNULL(cmessage);
|
|
616
|
+
|
|
617
|
+
shared_ptr<Message> released_message(
|
|
618
|
+
ReleaseLast(field, cmessage->message->GetDescriptor(), message));
|
|
619
|
+
cmessage->parent = NULL;
|
|
620
|
+
cmessage->parent_field = NULL;
|
|
621
|
+
cmessage->message = released_message.get();
|
|
622
|
+
cmessage->read_only = false;
|
|
623
|
+
cmessage::SetOwner(cmessage, released_message);
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
// Called to release a container using
|
|
627
|
+
// ClearField('container_field_name') on the parent.
|
|
628
|
+
int Release(RepeatedCompositeContainer* self) {
|
|
629
|
+
if (UpdateChildMessages(self) < 0) {
|
|
630
|
+
PyErr_WriteUnraisable(PyBytes_FromString("Failed to update released "
|
|
631
|
+
"messages"));
|
|
632
|
+
return -1;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
Message* message = self->message;
|
|
636
|
+
const FieldDescriptor* field = self->parent_field->descriptor;
|
|
637
|
+
|
|
638
|
+
// The reflection API only lets us release the last message in a
|
|
639
|
+
// repeated field. Therefore we iterate through the children
|
|
640
|
+
// starting with the last one.
|
|
641
|
+
const Py_ssize_t size = PyList_GET_SIZE(self->child_messages);
|
|
642
|
+
GOOGLE_DCHECK_EQ(size, message->GetReflection()->FieldSize(*message, field));
|
|
643
|
+
for (Py_ssize_t i = size - 1; i >= 0; --i) {
|
|
644
|
+
CMessage* child_cmessage = reinterpret_cast<CMessage*>(
|
|
645
|
+
PyList_GET_ITEM(self->child_messages, i));
|
|
646
|
+
ReleaseLastTo(field, message, child_cmessage);
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
// Detach from containing message.
|
|
650
|
+
self->parent = NULL;
|
|
651
|
+
self->parent_field = NULL;
|
|
652
|
+
self->message = NULL;
|
|
653
|
+
self->owner.reset();
|
|
654
|
+
|
|
655
|
+
return 0;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
int SetOwner(RepeatedCompositeContainer* self,
|
|
659
|
+
const shared_ptr<Message>& new_owner) {
|
|
660
|
+
GOOGLE_CHECK_ATTACHED(self);
|
|
661
|
+
|
|
662
|
+
self->owner = new_owner;
|
|
663
|
+
const Py_ssize_t n = PyList_GET_SIZE(self->child_messages);
|
|
664
|
+
for (Py_ssize_t i = 0; i < n; ++i) {
|
|
665
|
+
PyObject* msg = PyList_GET_ITEM(self->child_messages, i);
|
|
666
|
+
if (cmessage::SetOwner(reinterpret_cast<CMessage*>(msg), new_owner) == -1) {
|
|
667
|
+
return -1;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
return 0;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
static int Init(RepeatedCompositeContainer* self,
|
|
674
|
+
PyObject* args,
|
|
675
|
+
PyObject* kwargs) {
|
|
676
|
+
self->message = NULL;
|
|
677
|
+
self->parent = NULL;
|
|
678
|
+
self->parent_field = NULL;
|
|
679
|
+
self->subclass_init = NULL;
|
|
680
|
+
self->child_messages = PyList_New(0);
|
|
681
|
+
return 0;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
static void Dealloc(RepeatedCompositeContainer* self) {
|
|
685
|
+
Py_CLEAR(self->child_messages);
|
|
686
|
+
// TODO(tibell): Do we need to call delete on these objects to make
|
|
687
|
+
// sure their destructors are called?
|
|
688
|
+
self->owner.reset();
|
|
689
|
+
Py_TYPE(self)->tp_free(reinterpret_cast<PyObject*>(self));
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
static PySequenceMethods SqMethods = {
|
|
693
|
+
(lenfunc)Length, /* sq_length */
|
|
694
|
+
0, /* sq_concat */
|
|
695
|
+
0, /* sq_repeat */
|
|
696
|
+
(ssizeargfunc)Item /* sq_item */
|
|
697
|
+
};
|
|
698
|
+
|
|
699
|
+
static PyMappingMethods MpMethods = {
|
|
700
|
+
(lenfunc)Length, /* mp_length */
|
|
701
|
+
(binaryfunc)Subscript, /* mp_subscript */
|
|
702
|
+
(objobjargproc)AssignSubscript,/* mp_ass_subscript */
|
|
703
|
+
};
|
|
704
|
+
|
|
705
|
+
static PyMethodDef Methods[] = {
|
|
706
|
+
{ "add", (PyCFunction) Add, METH_VARARGS | METH_KEYWORDS,
|
|
707
|
+
"Adds an object to the repeated container." },
|
|
708
|
+
{ "extend", (PyCFunction) Extend, METH_O,
|
|
709
|
+
"Adds objects to the repeated container." },
|
|
710
|
+
{ "remove", (PyCFunction) Remove, METH_O,
|
|
711
|
+
"Removes an object from the repeated container." },
|
|
712
|
+
{ "sort", (PyCFunction) Sort, METH_VARARGS | METH_KEYWORDS,
|
|
713
|
+
"Sorts the repeated container." },
|
|
714
|
+
{ "MergeFrom", (PyCFunction) MergeFrom, METH_O,
|
|
715
|
+
"Adds objects to the repeated container." },
|
|
716
|
+
{ NULL, NULL }
|
|
717
|
+
};
|
|
718
|
+
|
|
719
|
+
} // namespace repeated_composite_container
|
|
720
|
+
|
|
721
|
+
PyTypeObject RepeatedCompositeContainer_Type = {
|
|
722
|
+
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
|
723
|
+
"google.protobuf.internal."
|
|
724
|
+
"cpp._message.RepeatedCompositeContainer", // tp_name
|
|
725
|
+
sizeof(RepeatedCompositeContainer), // tp_basicsize
|
|
726
|
+
0, // tp_itemsize
|
|
727
|
+
(destructor)repeated_composite_container::Dealloc, // tp_dealloc
|
|
728
|
+
0, // tp_print
|
|
729
|
+
0, // tp_getattr
|
|
730
|
+
0, // tp_setattr
|
|
731
|
+
0, // tp_compare
|
|
732
|
+
0, // tp_repr
|
|
733
|
+
0, // tp_as_number
|
|
734
|
+
&repeated_composite_container::SqMethods, // tp_as_sequence
|
|
735
|
+
&repeated_composite_container::MpMethods, // tp_as_mapping
|
|
736
|
+
0, // tp_hash
|
|
737
|
+
0, // tp_call
|
|
738
|
+
0, // tp_str
|
|
739
|
+
0, // tp_getattro
|
|
740
|
+
0, // tp_setattro
|
|
741
|
+
0, // tp_as_buffer
|
|
742
|
+
Py_TPFLAGS_DEFAULT, // tp_flags
|
|
743
|
+
"A Repeated scalar container", // tp_doc
|
|
744
|
+
0, // tp_traverse
|
|
745
|
+
0, // tp_clear
|
|
746
|
+
(richcmpfunc)repeated_composite_container::RichCompare, // tp_richcompare
|
|
747
|
+
0, // tp_weaklistoffset
|
|
748
|
+
0, // tp_iter
|
|
749
|
+
0, // tp_iternext
|
|
750
|
+
repeated_composite_container::Methods, // tp_methods
|
|
751
|
+
0, // tp_members
|
|
752
|
+
0, // tp_getset
|
|
753
|
+
0, // tp_base
|
|
754
|
+
0, // tp_dict
|
|
755
|
+
0, // tp_descr_get
|
|
756
|
+
0, // tp_descr_set
|
|
757
|
+
0, // tp_dictoffset
|
|
758
|
+
(initproc)repeated_composite_container::Init, // tp_init
|
|
759
|
+
};
|
|
760
|
+
|
|
761
|
+
} // namespace python
|
|
762
|
+
} // namespace protobuf
|
|
763
|
+
} // namespace google
|