protoc 2.6.1.1 → 2.6.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (479) hide show
  1. checksums.yaml +4 -4
  2. data/ext/protoc/Makefile.in +10 -13
  3. data/ext/protoc/extconf.rb +0 -1
  4. data/ext/protoc/protobuf/CHANGES.txt +593 -0
  5. data/ext/protoc/protobuf/CONTRIBUTORS.txt +93 -0
  6. data/ext/protoc/protobuf/INSTALL.txt +237 -0
  7. data/ext/protoc/protobuf/LICENSE +33 -0
  8. data/ext/protoc/protobuf/Makefile.am +267 -0
  9. data/ext/protoc/protobuf/README.md +167 -0
  10. data/ext/protoc/protobuf/autogen.sh +41 -0
  11. data/ext/protoc/protobuf/benchmarks/ProtoBench.java +203 -0
  12. data/ext/protoc/protobuf/benchmarks/google_message1.dat +0 -0
  13. data/ext/protoc/protobuf/benchmarks/google_message2.dat +0 -0
  14. data/ext/protoc/protobuf/benchmarks/google_size.proto +136 -0
  15. data/ext/protoc/protobuf/benchmarks/google_speed.proto +136 -0
  16. data/ext/protoc/protobuf/benchmarks/readme.txt +50 -0
  17. data/ext/protoc/protobuf/configure.ac +159 -0
  18. data/ext/protoc/protobuf/editors/README.txt +5 -0
  19. data/ext/protoc/protobuf/editors/proto.vim +105 -0
  20. data/ext/protoc/protobuf/editors/protobuf-mode.el +220 -0
  21. data/ext/protoc/protobuf/examples/AddPerson.java +95 -0
  22. data/ext/protoc/protobuf/examples/ListPeople.java +50 -0
  23. data/ext/protoc/protobuf/examples/Makefile +58 -0
  24. data/ext/protoc/protobuf/examples/README.txt +29 -0
  25. data/ext/protoc/protobuf/examples/add_person.cc +95 -0
  26. data/ext/protoc/protobuf/examples/add_person.py +58 -0
  27. data/ext/protoc/protobuf/examples/addressbook.proto +30 -0
  28. data/ext/protoc/protobuf/examples/list_people.cc +68 -0
  29. data/ext/protoc/protobuf/examples/list_people.py +38 -0
  30. data/ext/protoc/protobuf/generate_descriptor_proto.sh +33 -0
  31. data/ext/protoc/protobuf/java/README.txt +96 -0
  32. data/ext/protoc/protobuf/java/pom.xml +217 -0
  33. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/AbstractMessage.java +466 -0
  34. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/AbstractMessageLite.java +355 -0
  35. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/AbstractParser.java +253 -0
  36. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/BlockingRpcChannel.java +51 -0
  37. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/BlockingService.java +64 -0
  38. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/BoundedByteString.java +163 -0
  39. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ByteString.java +1022 -0
  40. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/CodedInputStream.java +1311 -0
  41. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/CodedOutputStream.java +1297 -0
  42. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Descriptors.java +2238 -0
  43. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/DynamicMessage.java +622 -0
  44. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Extension.java +96 -0
  45. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ExtensionRegistry.java +392 -0
  46. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ExtensionRegistryLite.java +185 -0
  47. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/FieldSet.java +907 -0
  48. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/GeneratedMessage.java +2213 -0
  49. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/GeneratedMessageLite.java +949 -0
  50. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Internal.java +391 -0
  51. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java +122 -0
  52. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/LazyField.java +154 -0
  53. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/LazyFieldLite.java +176 -0
  54. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/LazyStringArrayList.java +367 -0
  55. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/LazyStringList.java +163 -0
  56. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/LiteralByteString.java +362 -0
  57. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Message.java +244 -0
  58. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/MessageLite.java +320 -0
  59. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java +60 -0
  60. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/MessageOrBuilder.java +143 -0
  61. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/MessageReflection.java +931 -0
  62. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Parser.java +261 -0
  63. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ProtocolMessageEnum.java +58 -0
  64. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ProtocolStringList.java +48 -0
  65. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RepeatedFieldBuilder.java +696 -0
  66. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RopeByteString.java +957 -0
  67. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RpcCallback.java +47 -0
  68. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RpcChannel.java +71 -0
  69. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RpcController.java +118 -0
  70. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RpcUtil.java +134 -0
  71. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Service.java +117 -0
  72. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ServiceException.java +52 -0
  73. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/SingleFieldBuilder.java +241 -0
  74. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/SmallSortedMap.java +618 -0
  75. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/TextFormat.java +1984 -0
  76. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/UninitializedMessageException.java +99 -0
  77. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/UnknownFieldSet.java +995 -0
  78. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java +205 -0
  79. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Utf8.java +349 -0
  80. data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/WireFormat.java +163 -0
  81. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/AbstractMessageTest.java +527 -0
  82. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/BoundedByteStringTest.java +68 -0
  83. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/ByteStringTest.java +759 -0
  84. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/CheckUtf8Test.java +141 -0
  85. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/CodedInputStreamTest.java +769 -0
  86. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/CodedOutputStreamTest.java +401 -0
  87. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/DeprecatedFieldTest.java +80 -0
  88. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/DescriptorsTest.java +735 -0
  89. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/DynamicMessageTest.java +326 -0
  90. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/ForceFieldBuildersPreRun.java +48 -0
  91. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/GeneratedMessageTest.java +1515 -0
  92. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/IsValidUtf8Test.java +180 -0
  93. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java +421 -0
  94. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LazyFieldLiteTest.java +134 -0
  95. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LazyFieldTest.java +121 -0
  96. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LazyMessageLiteTest.java +319 -0
  97. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LazyStringArrayListTest.java +174 -0
  98. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LazyStringEndToEndTest.java +143 -0
  99. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java +85 -0
  100. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LiteTest.java +148 -0
  101. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LiteralByteStringTest.java +396 -0
  102. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/MessageTest.java +353 -0
  103. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/NestedBuildersTest.java +185 -0
  104. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/ParserTest.java +381 -0
  105. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/RepeatedFieldBuilderTest.java +190 -0
  106. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/RopeByteStringSubstringTest.java +97 -0
  107. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/RopeByteStringTest.java +115 -0
  108. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/ServiceTest.java +320 -0
  109. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/SingleFieldBuilderTest.java +155 -0
  110. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/SmallSortedMapTest.java +420 -0
  111. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/TestBadIdentifiers.java +96 -0
  112. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/TestUtil.java +4124 -0
  113. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/TextFormatTest.java +994 -0
  114. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/UnknownFieldSetTest.java +653 -0
  115. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/UnmodifiableLazyStringListTest.java +227 -0
  116. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/WireFormatTest.java +606 -0
  117. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/lazy_fields_lite.proto +61 -0
  118. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/lite_equals_and_hash.proto +55 -0
  119. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/multiple_files_test.proto +77 -0
  120. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/nested_builders_test.proto +53 -0
  121. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/nested_extension.proto +46 -0
  122. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/nested_extension_lite.proto +48 -0
  123. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/non_nested_extension.proto +49 -0
  124. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/non_nested_extension_lite.proto +50 -0
  125. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/outer_class_name_test.proto +38 -0
  126. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/outer_class_name_test2.proto +42 -0
  127. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/outer_class_name_test3.proto +43 -0
  128. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/test_bad_identifiers.proto +157 -0
  129. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/test_check_utf8.proto +50 -0
  130. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/test_check_utf8_size.proto +51 -0
  131. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/test_custom_options.proto +43 -0
  132. data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/test_extra_interfaces.proto +60 -0
  133. data/ext/protoc/protobuf/m4/ac_system_extensions.m4 +37 -0
  134. data/ext/protoc/protobuf/m4/acx_check_suncc.m4 +75 -0
  135. data/ext/protoc/protobuf/m4/acx_pthread.m4 +397 -0
  136. data/ext/protoc/protobuf/m4/stl_hash.m4 +72 -0
  137. data/ext/protoc/protobuf/more_tests/Makefile +41 -0
  138. data/ext/protoc/protobuf/post_process_dist.sh +60 -0
  139. data/ext/protoc/protobuf/protobuf-lite.pc.in +13 -0
  140. data/ext/protoc/protobuf/protobuf.pc.in +14 -0
  141. data/ext/protoc/protobuf/python/README.txt +105 -0
  142. data/ext/protoc/protobuf/python/ez_setup.py +284 -0
  143. data/ext/protoc/protobuf/python/google/__init__.py +1 -0
  144. data/ext/protoc/protobuf/python/google/protobuf/__init__.py +0 -0
  145. data/ext/protoc/protobuf/python/google/protobuf/descriptor.py +849 -0
  146. data/ext/protoc/protobuf/python/google/protobuf/descriptor_database.py +137 -0
  147. data/ext/protoc/protobuf/python/google/protobuf/descriptor_pool.py +643 -0
  148. data/ext/protoc/protobuf/python/google/protobuf/internal/__init__.py +0 -0
  149. data/ext/protoc/protobuf/python/google/protobuf/internal/api_implementation.cc +139 -0
  150. data/ext/protoc/protobuf/python/google/protobuf/internal/api_implementation.py +89 -0
  151. data/ext/protoc/protobuf/python/google/protobuf/internal/api_implementation_default_test.py +63 -0
  152. data/ext/protoc/protobuf/python/google/protobuf/internal/containers.py +269 -0
  153. data/ext/protoc/protobuf/python/google/protobuf/internal/cpp_message.py +663 -0
  154. data/ext/protoc/protobuf/python/google/protobuf/internal/decoder.py +831 -0
  155. data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_database_test.py +63 -0
  156. data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_pool_test.py +564 -0
  157. data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_pool_test1.proto +94 -0
  158. data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_pool_test2.proto +70 -0
  159. data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_python_test.py +54 -0
  160. data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_test.py +669 -0
  161. data/ext/protoc/protobuf/python/google/protobuf/internal/encoder.py +788 -0
  162. data/ext/protoc/protobuf/python/google/protobuf/internal/enum_type_wrapper.py +89 -0
  163. data/ext/protoc/protobuf/python/google/protobuf/internal/factory_test1.proto +57 -0
  164. data/ext/protoc/protobuf/python/google/protobuf/internal/factory_test2.proto +92 -0
  165. data/ext/protoc/protobuf/python/google/protobuf/internal/generator_test.py +343 -0
  166. data/ext/protoc/protobuf/python/google/protobuf/internal/message_factory_python_test.py +54 -0
  167. data/ext/protoc/protobuf/python/google/protobuf/internal/message_factory_test.py +131 -0
  168. data/ext/protoc/protobuf/python/google/protobuf/internal/message_listener.py +78 -0
  169. data/ext/protoc/protobuf/python/google/protobuf/internal/message_python_test.py +54 -0
  170. data/ext/protoc/protobuf/python/google/protobuf/internal/message_test.py +681 -0
  171. data/ext/protoc/protobuf/python/google/protobuf/internal/missing_enum_values.proto +50 -0
  172. data/ext/protoc/protobuf/python/google/protobuf/internal/more_extensions.proto +58 -0
  173. data/ext/protoc/protobuf/python/google/protobuf/internal/more_extensions_dynamic.proto +49 -0
  174. data/ext/protoc/protobuf/python/google/protobuf/internal/more_messages.proto +51 -0
  175. data/ext/protoc/protobuf/python/google/protobuf/internal/python_message.py +1251 -0
  176. data/ext/protoc/protobuf/python/google/protobuf/internal/reflection_test.py +2934 -0
  177. data/ext/protoc/protobuf/python/google/protobuf/internal/service_reflection_test.py +136 -0
  178. data/ext/protoc/protobuf/python/google/protobuf/internal/symbol_database_test.py +120 -0
  179. data/ext/protoc/protobuf/python/google/protobuf/internal/test_bad_identifiers.proto +52 -0
  180. data/ext/protoc/protobuf/python/google/protobuf/internal/test_util.py +662 -0
  181. data/ext/protoc/protobuf/python/google/protobuf/internal/text_encoding_test.py +68 -0
  182. data/ext/protoc/protobuf/python/google/protobuf/internal/text_format_test.py +743 -0
  183. data/ext/protoc/protobuf/python/google/protobuf/internal/type_checkers.py +328 -0
  184. data/ext/protoc/protobuf/python/google/protobuf/internal/unknown_fields_test.py +231 -0
  185. data/ext/protoc/protobuf/python/google/protobuf/internal/wire_format.py +268 -0
  186. data/ext/protoc/protobuf/python/google/protobuf/internal/wire_format_test.py +253 -0
  187. data/ext/protoc/protobuf/python/google/protobuf/message.py +284 -0
  188. data/ext/protoc/protobuf/python/google/protobuf/message_factory.py +155 -0
  189. data/ext/protoc/protobuf/python/google/protobuf/pyext/README +6 -0
  190. data/ext/protoc/protobuf/python/google/protobuf/pyext/__init__.py +0 -0
  191. data/ext/protoc/protobuf/python/google/protobuf/pyext/cpp_message.py +61 -0
  192. data/ext/protoc/protobuf/python/google/protobuf/pyext/descriptor.cc +357 -0
  193. data/ext/protoc/protobuf/python/google/protobuf/pyext/descriptor.h +96 -0
  194. data/ext/protoc/protobuf/python/google/protobuf/pyext/descriptor_cpp2_test.py +58 -0
  195. data/ext/protoc/protobuf/python/google/protobuf/pyext/extension_dict.cc +338 -0
  196. data/ext/protoc/protobuf/python/google/protobuf/pyext/extension_dict.h +123 -0
  197. data/ext/protoc/protobuf/python/google/protobuf/pyext/message.cc +2561 -0
  198. data/ext/protoc/protobuf/python/google/protobuf/pyext/message.h +305 -0
  199. data/ext/protoc/protobuf/python/google/protobuf/pyext/message_factory_cpp2_test.py +56 -0
  200. data/ext/protoc/protobuf/python/google/protobuf/pyext/proto2_api_test.proto +38 -0
  201. data/ext/protoc/protobuf/python/google/protobuf/pyext/python.proto +66 -0
  202. data/ext/protoc/protobuf/python/google/protobuf/pyext/python_protobuf.h +57 -0
  203. data/ext/protoc/protobuf/python/google/protobuf/pyext/reflection_cpp2_generated_test.py +94 -0
  204. data/ext/protoc/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc +763 -0
  205. data/ext/protoc/protobuf/python/google/protobuf/pyext/repeated_composite_container.h +172 -0
  206. data/ext/protoc/protobuf/python/google/protobuf/pyext/repeated_scalar_container.cc +825 -0
  207. data/ext/protoc/protobuf/python/google/protobuf/pyext/repeated_scalar_container.h +112 -0
  208. data/ext/protoc/protobuf/python/google/protobuf/pyext/scoped_pyobject_ptr.h +95 -0
  209. data/ext/protoc/protobuf/python/google/protobuf/reflection.py +205 -0
  210. data/ext/protoc/protobuf/python/google/protobuf/service.py +226 -0
  211. data/ext/protoc/protobuf/python/google/protobuf/service_reflection.py +284 -0
  212. data/ext/protoc/protobuf/python/google/protobuf/symbol_database.py +185 -0
  213. data/ext/protoc/protobuf/python/google/protobuf/text_encoding.py +110 -0
  214. data/ext/protoc/protobuf/python/google/protobuf/text_format.py +873 -0
  215. data/ext/protoc/protobuf/python/mox.py +1401 -0
  216. data/ext/protoc/protobuf/python/setup.py +201 -0
  217. data/ext/protoc/protobuf/python/stubout.py +140 -0
  218. data/ext/protoc/protobuf/src/Makefile.am +418 -0
  219. data/ext/protoc/protobuf/src/google/protobuf/SEBS +240 -0
  220. data/ext/protoc/protobuf/src/google/protobuf/compiler/code_generator.cc +84 -0
  221. data/ext/protoc/protobuf/src/google/protobuf/compiler/code_generator.h +145 -0
  222. data/ext/protoc/protobuf/src/google/protobuf/compiler/command_line_interface.cc +1603 -0
  223. data/ext/protoc/protobuf/src/google/protobuf/compiler/command_line_interface.h +378 -0
  224. data/ext/protoc/protobuf/src/google/protobuf/compiler/command_line_interface_unittest.cc +1654 -0
  225. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc +158 -0
  226. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_enum.cc +288 -0
  227. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_enum.h +103 -0
  228. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_enum_field.cc +431 -0
  229. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_enum_field.h +122 -0
  230. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_extension.cc +210 -0
  231. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_extension.h +86 -0
  232. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_field.cc +166 -0
  233. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_field.h +185 -0
  234. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc +665 -0
  235. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_file.h +99 -0
  236. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_generator.cc +125 -0
  237. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_generator.h +72 -0
  238. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc +494 -0
  239. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.h +206 -0
  240. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_message.cc +2645 -0
  241. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_message.h +175 -0
  242. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_message_field.cc +375 -0
  243. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_message_field.h +121 -0
  244. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_options.h +58 -0
  245. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc +123 -0
  246. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc +451 -0
  247. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_primitive_field.h +123 -0
  248. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_service.cc +334 -0
  249. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_service.h +118 -0
  250. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_string_field.cc +642 -0
  251. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_string_field.h +127 -0
  252. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto +132 -0
  253. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_unittest.cc +2074 -0
  254. data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_unittest.h +51 -0
  255. data/ext/protoc/protobuf/src/google/protobuf/compiler/importer.cc +480 -0
  256. data/ext/protoc/protobuf/src/google/protobuf/compiler/importer.h +317 -0
  257. data/ext/protoc/protobuf/src/google/protobuf/compiler/importer_unittest.cc +617 -0
  258. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_context.cc +195 -0
  259. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_context.h +95 -0
  260. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_doc_comment.cc +233 -0
  261. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_doc_comment.h +69 -0
  262. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_doc_comment_unittest.cc +67 -0
  263. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_enum.cc +333 -0
  264. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_enum.h +99 -0
  265. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_enum_field.cc +778 -0
  266. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_enum_field.h +158 -0
  267. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_extension.cc +207 -0
  268. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_extension.h +109 -0
  269. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_field.cc +213 -0
  270. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_field.h +162 -0
  271. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_file.cc +534 -0
  272. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_file.h +115 -0
  273. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_generator.cc +158 -0
  274. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_generator.h +72 -0
  275. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_generator_factory.cc +77 -0
  276. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_generator_factory.h +101 -0
  277. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_helpers.cc +737 -0
  278. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_helpers.h +322 -0
  279. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_lazy_message_field.cc +826 -0
  280. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_lazy_message_field.h +121 -0
  281. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_message.cc +1666 -0
  282. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_message.h +140 -0
  283. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_message_field.cc +1343 -0
  284. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_message_field.h +173 -0
  285. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_name_resolver.cc +266 -0
  286. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_name_resolver.h +124 -0
  287. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_plugin_unittest.cc +124 -0
  288. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_primitive_field.cc +877 -0
  289. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_primitive_field.h +160 -0
  290. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_service.cc +473 -0
  291. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_service.h +135 -0
  292. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_shared_code_generator.cc +201 -0
  293. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_shared_code_generator.h +90 -0
  294. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_string_field.cc +1056 -0
  295. data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_string_field.h +160 -0
  296. data/ext/protoc/protobuf/src/google/protobuf/compiler/main.cc +61 -0
  297. data/ext/protoc/protobuf/src/google/protobuf/compiler/mock_code_generator.cc +240 -0
  298. data/ext/protoc/protobuf/src/google/protobuf/compiler/mock_code_generator.h +117 -0
  299. data/ext/protoc/protobuf/src/google/protobuf/compiler/package_info.h +64 -0
  300. data/ext/protoc/protobuf/src/google/protobuf/compiler/parser.cc +1750 -0
  301. data/ext/protoc/protobuf/src/google/protobuf/compiler/parser.h +522 -0
  302. data/ext/protoc/protobuf/src/google/protobuf/compiler/parser_unittest.cc +2612 -0
  303. data/ext/protoc/protobuf/src/google/protobuf/compiler/plugin.cc +163 -0
  304. data/ext/protoc/protobuf/src/google/protobuf/compiler/plugin.h +72 -0
  305. data/ext/protoc/protobuf/src/google/protobuf/compiler/plugin.pb.cc +1148 -0
  306. data/ext/protoc/protobuf/src/google/protobuf/compiler/plugin.pb.h +897 -0
  307. data/ext/protoc/protobuf/src/google/protobuf/compiler/plugin.proto +147 -0
  308. data/ext/protoc/protobuf/src/google/protobuf/compiler/python/python_generator.cc +1262 -0
  309. data/ext/protoc/protobuf/src/google/protobuf/compiler/python/python_generator.h +166 -0
  310. data/ext/protoc/protobuf/src/google/protobuf/compiler/python/python_plugin_unittest.cc +118 -0
  311. data/ext/protoc/protobuf/src/google/protobuf/compiler/subprocess.cc +463 -0
  312. data/ext/protoc/protobuf/src/google/protobuf/compiler/subprocess.h +108 -0
  313. data/ext/protoc/protobuf/src/google/protobuf/compiler/test_plugin.cc +51 -0
  314. data/ext/protoc/protobuf/src/google/protobuf/compiler/zip_output_unittest.sh +91 -0
  315. data/ext/protoc/protobuf/src/google/protobuf/compiler/zip_writer.cc +218 -0
  316. data/ext/protoc/protobuf/src/google/protobuf/compiler/zip_writer.h +93 -0
  317. data/ext/protoc/protobuf/src/google/protobuf/descriptor.cc +5420 -0
  318. data/ext/protoc/protobuf/src/google/protobuf/descriptor.h +1691 -0
  319. data/ext/protoc/protobuf/src/google/protobuf/descriptor.pb.cc +9135 -0
  320. data/ext/protoc/protobuf/src/google/protobuf/descriptor.pb.h +6761 -0
  321. data/ext/protoc/protobuf/src/google/protobuf/descriptor.proto +687 -0
  322. data/ext/protoc/protobuf/src/google/protobuf/descriptor_database.cc +543 -0
  323. data/ext/protoc/protobuf/src/google/protobuf/descriptor_database.h +369 -0
  324. data/ext/protoc/protobuf/src/google/protobuf/descriptor_database_unittest.cc +748 -0
  325. data/ext/protoc/protobuf/src/google/protobuf/descriptor_pb2_test.py +54 -0
  326. data/ext/protoc/protobuf/src/google/protobuf/descriptor_unittest.cc +5501 -0
  327. data/ext/protoc/protobuf/src/google/protobuf/dynamic_message.cc +764 -0
  328. data/ext/protoc/protobuf/src/google/protobuf/dynamic_message.h +148 -0
  329. data/ext/protoc/protobuf/src/google/protobuf/dynamic_message_unittest.cc +230 -0
  330. data/ext/protoc/protobuf/src/google/protobuf/extension_set.cc +1663 -0
  331. data/ext/protoc/protobuf/src/google/protobuf/extension_set.h +1234 -0
  332. data/ext/protoc/protobuf/src/google/protobuf/extension_set_heavy.cc +734 -0
  333. data/ext/protoc/protobuf/src/google/protobuf/extension_set_unittest.cc +1095 -0
  334. data/ext/protoc/protobuf/src/google/protobuf/generated_enum_reflection.h +91 -0
  335. data/ext/protoc/protobuf/src/google/protobuf/generated_message_reflection.cc +1683 -0
  336. data/ext/protoc/protobuf/src/google/protobuf/generated_message_reflection.h +504 -0
  337. data/ext/protoc/protobuf/src/google/protobuf/generated_message_reflection_unittest.cc +795 -0
  338. data/ext/protoc/protobuf/src/google/protobuf/generated_message_util.cc +65 -0
  339. data/ext/protoc/protobuf/src/google/protobuf/generated_message_util.h +113 -0
  340. data/ext/protoc/protobuf/src/google/protobuf/io/coded_stream.cc +914 -0
  341. data/ext/protoc/protobuf/src/google/protobuf/io/coded_stream.h +1220 -0
  342. data/ext/protoc/protobuf/src/google/protobuf/io/coded_stream_inl.h +69 -0
  343. data/ext/protoc/protobuf/src/google/protobuf/io/coded_stream_unittest.cc +1378 -0
  344. data/ext/protoc/protobuf/src/google/protobuf/io/gzip_stream.cc +326 -0
  345. data/ext/protoc/protobuf/src/google/protobuf/io/gzip_stream.h +209 -0
  346. data/ext/protoc/protobuf/src/google/protobuf/io/gzip_stream_unittest.sh +44 -0
  347. data/ext/protoc/protobuf/src/google/protobuf/io/package_info.h +54 -0
  348. data/ext/protoc/protobuf/src/google/protobuf/io/printer.cc +198 -0
  349. data/ext/protoc/protobuf/src/google/protobuf/io/printer.h +136 -0
  350. data/ext/protoc/protobuf/src/google/protobuf/io/printer_unittest.cc +285 -0
  351. data/ext/protoc/protobuf/src/google/protobuf/io/strtod.cc +113 -0
  352. data/ext/protoc/protobuf/src/google/protobuf/io/strtod.h +50 -0
  353. data/ext/protoc/protobuf/src/google/protobuf/io/tokenizer.cc +1127 -0
  354. data/ext/protoc/protobuf/src/google/protobuf/io/tokenizer.h +402 -0
  355. data/ext/protoc/protobuf/src/google/protobuf/io/tokenizer_unittest.cc +999 -0
  356. data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream.cc +57 -0
  357. data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream.h +248 -0
  358. data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc +473 -0
  359. data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h +358 -0
  360. data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc +405 -0
  361. data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h +354 -0
  362. data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream_unittest.cc +965 -0
  363. data/ext/protoc/protobuf/src/google/protobuf/lite_unittest.cc +350 -0
  364. data/ext/protoc/protobuf/src/google/protobuf/message.cc +358 -0
  365. data/ext/protoc/protobuf/src/google/protobuf/message.h +866 -0
  366. data/ext/protoc/protobuf/src/google/protobuf/message_lite.cc +335 -0
  367. data/ext/protoc/protobuf/src/google/protobuf/message_lite.h +247 -0
  368. data/ext/protoc/protobuf/src/google/protobuf/message_unittest.cc +427 -0
  369. data/ext/protoc/protobuf/src/google/protobuf/package_info.h +64 -0
  370. data/ext/protoc/protobuf/src/google/protobuf/reflection_ops.cc +269 -0
  371. data/ext/protoc/protobuf/src/google/protobuf/reflection_ops.h +81 -0
  372. data/ext/protoc/protobuf/src/google/protobuf/reflection_ops_unittest.cc +475 -0
  373. data/ext/protoc/protobuf/src/google/protobuf/repeated_field.cc +87 -0
  374. data/ext/protoc/protobuf/src/google/protobuf/repeated_field.h +1603 -0
  375. data/ext/protoc/protobuf/src/google/protobuf/repeated_field_reflection_unittest.cc +195 -0
  376. data/ext/protoc/protobuf/src/google/protobuf/repeated_field_unittest.cc +1442 -0
  377. data/ext/protoc/protobuf/src/google/protobuf/service.cc +46 -0
  378. data/ext/protoc/protobuf/src/google/protobuf/service.h +291 -0
  379. data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops.h +227 -0
  380. data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_arm64_gcc.h +325 -0
  381. data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_arm_gcc.h +151 -0
  382. data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_arm_qnx.h +146 -0
  383. data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_atomicword_compat.h +122 -0
  384. data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h +137 -0
  385. data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h +225 -0
  386. data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_mips_gcc.h +313 -0
  387. data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_pnacl.h +73 -0
  388. data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_solaris.h +188 -0
  389. data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_tsan.h +219 -0
  390. data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc +137 -0
  391. data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_gcc.h +293 -0
  392. data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc +112 -0
  393. data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_msvc.h +150 -0
  394. data/ext/protoc/protobuf/src/google/protobuf/stubs/common.cc +395 -0
  395. data/ext/protoc/protobuf/src/google/protobuf/stubs/common.h +1226 -0
  396. data/ext/protoc/protobuf/src/google/protobuf/stubs/common_unittest.cc +357 -0
  397. data/ext/protoc/protobuf/src/google/protobuf/stubs/hash.h +232 -0
  398. data/ext/protoc/protobuf/src/google/protobuf/stubs/map_util.h +771 -0
  399. data/ext/protoc/protobuf/src/google/protobuf/stubs/once.cc +99 -0
  400. data/ext/protoc/protobuf/src/google/protobuf/stubs/once.h +166 -0
  401. data/ext/protoc/protobuf/src/google/protobuf/stubs/once_unittest.cc +253 -0
  402. data/ext/protoc/protobuf/src/google/protobuf/stubs/platform_macros.h +103 -0
  403. data/ext/protoc/protobuf/src/google/protobuf/stubs/shared_ptr.h +470 -0
  404. data/ext/protoc/protobuf/src/google/protobuf/stubs/stl_util.h +121 -0
  405. data/ext/protoc/protobuf/src/google/protobuf/stubs/stringprintf.cc +175 -0
  406. data/ext/protoc/protobuf/src/google/protobuf/stubs/stringprintf.h +76 -0
  407. data/ext/protoc/protobuf/src/google/protobuf/stubs/stringprintf_unittest.cc +152 -0
  408. data/ext/protoc/protobuf/src/google/protobuf/stubs/structurally_valid.cc +536 -0
  409. data/ext/protoc/protobuf/src/google/protobuf/stubs/structurally_valid_unittest.cc +40 -0
  410. data/ext/protoc/protobuf/src/google/protobuf/stubs/strutil.cc +1279 -0
  411. data/ext/protoc/protobuf/src/google/protobuf/stubs/strutil.h +562 -0
  412. data/ext/protoc/protobuf/src/google/protobuf/stubs/strutil_unittest.cc +73 -0
  413. data/ext/protoc/protobuf/src/google/protobuf/stubs/substitute.cc +134 -0
  414. data/ext/protoc/protobuf/src/google/protobuf/stubs/substitute.h +170 -0
  415. data/ext/protoc/protobuf/src/google/protobuf/stubs/template_util.h +138 -0
  416. data/ext/protoc/protobuf/src/google/protobuf/stubs/template_util_unittest.cc +130 -0
  417. data/ext/protoc/protobuf/src/google/protobuf/stubs/type_traits.h +336 -0
  418. data/ext/protoc/protobuf/src/google/protobuf/stubs/type_traits_unittest.cc +628 -0
  419. data/ext/protoc/protobuf/src/google/protobuf/test_util.cc +3345 -0
  420. data/ext/protoc/protobuf/src/google/protobuf/test_util.h +215 -0
  421. data/ext/protoc/protobuf/src/google/protobuf/test_util_lite.cc +1585 -0
  422. data/ext/protoc/protobuf/src/google/protobuf/test_util_lite.h +101 -0
  423. data/ext/protoc/protobuf/src/google/protobuf/testdata/bad_utf8_string +1 -0
  424. data/ext/protoc/protobuf/src/google/protobuf/testdata/golden_message +0 -0
  425. data/ext/protoc/protobuf/src/google/protobuf/testdata/golden_message_oneof_implemented +0 -0
  426. data/ext/protoc/protobuf/src/google/protobuf/testdata/golden_packed_fields_message +0 -0
  427. data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_data.txt +134 -0
  428. data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_data_oneof_implemented.txt +129 -0
  429. data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_data_pointy.txt +134 -0
  430. data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_data_pointy_oneof.txt +129 -0
  431. data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_extensions_data.txt +134 -0
  432. data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_extensions_data_pointy.txt +134 -0
  433. data/ext/protoc/protobuf/src/google/protobuf/testing/file.cc +194 -0
  434. data/ext/protoc/protobuf/src/google/protobuf/testing/file.h +97 -0
  435. data/ext/protoc/protobuf/src/google/protobuf/testing/googletest.cc +255 -0
  436. data/ext/protoc/protobuf/src/google/protobuf/testing/googletest.h +102 -0
  437. data/ext/protoc/protobuf/src/google/protobuf/testing/zcgunzip.cc +73 -0
  438. data/ext/protoc/protobuf/src/google/protobuf/testing/zcgzip.cc +79 -0
  439. data/ext/protoc/protobuf/src/google/protobuf/text_format.cc +1746 -0
  440. data/ext/protoc/protobuf/src/google/protobuf/text_format.h +473 -0
  441. data/ext/protoc/protobuf/src/google/protobuf/text_format_unittest.cc +1479 -0
  442. data/ext/protoc/protobuf/src/google/protobuf/unittest.proto +861 -0
  443. data/ext/protoc/protobuf/src/google/protobuf/unittest_custom_options.proto +393 -0
  444. data/ext/protoc/protobuf/src/google/protobuf/unittest_embed_optimize_for.proto +50 -0
  445. data/ext/protoc/protobuf/src/google/protobuf/unittest_empty.proto +37 -0
  446. data/ext/protoc/protobuf/src/google/protobuf/unittest_enormous_descriptor.proto +1046 -0
  447. data/ext/protoc/protobuf/src/google/protobuf/unittest_import.proto +64 -0
  448. data/ext/protoc/protobuf/src/google/protobuf/unittest_import_lite.proto +51 -0
  449. data/ext/protoc/protobuf/src/google/protobuf/unittest_import_public.proto +40 -0
  450. data/ext/protoc/protobuf/src/google/protobuf/unittest_import_public_lite.proto +42 -0
  451. data/ext/protoc/protobuf/src/google/protobuf/unittest_lite.proto +384 -0
  452. data/ext/protoc/protobuf/src/google/protobuf/unittest_lite_imports_nonlite.proto +43 -0
  453. data/ext/protoc/protobuf/src/google/protobuf/unittest_mset.proto +83 -0
  454. data/ext/protoc/protobuf/src/google/protobuf/unittest_no_generic_services.proto +53 -0
  455. data/ext/protoc/protobuf/src/google/protobuf/unittest_optimize_for.proto +66 -0
  456. data/ext/protoc/protobuf/src/google/protobuf/unknown_field_set.cc +265 -0
  457. data/ext/protoc/protobuf/src/google/protobuf/unknown_field_set.h +318 -0
  458. data/ext/protoc/protobuf/src/google/protobuf/unknown_field_set_unittest.cc +599 -0
  459. data/ext/protoc/protobuf/src/google/protobuf/wire_format.cc +1101 -0
  460. data/ext/protoc/protobuf/src/google/protobuf/wire_format.h +336 -0
  461. data/ext/protoc/protobuf/src/google/protobuf/wire_format_lite.cc +471 -0
  462. data/ext/protoc/protobuf/src/google/protobuf/wire_format_lite.h +661 -0
  463. data/ext/protoc/protobuf/src/google/protobuf/wire_format_lite_inl.h +860 -0
  464. data/ext/protoc/protobuf/src/google/protobuf/wire_format_unittest.cc +1120 -0
  465. data/ext/protoc/protobuf/src/solaris/libstdc++.la +51 -0
  466. data/ext/protoc/protobuf/vsprojects/config.h +29 -0
  467. data/ext/protoc/protobuf/vsprojects/convert2008to2005.sh +20 -0
  468. data/ext/protoc/protobuf/vsprojects/extract_includes.bat +50 -0
  469. data/ext/protoc/protobuf/vsprojects/libprotobuf-lite.vcproj +302 -0
  470. data/ext/protoc/protobuf/vsprojects/libprotobuf.vcproj +470 -0
  471. data/ext/protoc/protobuf/vsprojects/libprotoc.vcproj +466 -0
  472. data/ext/protoc/protobuf/vsprojects/lite-test.vcproj +305 -0
  473. data/ext/protoc/protobuf/vsprojects/protobuf.sln +92 -0
  474. data/ext/protoc/protobuf/vsprojects/protoc.vcproj +192 -0
  475. data/ext/protoc/protobuf/vsprojects/readme.txt +114 -0
  476. data/ext/protoc/protobuf/vsprojects/test_plugin.vcproj +209 -0
  477. data/ext/protoc/protobuf/vsprojects/tests.vcproj +681 -0
  478. data/lib/protoc/version.rb +1 -1
  479. metadata +480 -3
@@ -0,0 +1,771 @@
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2014 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
+ // from google3/util/gtl/map_util.h
32
+ // Author: Anton Carver
33
+
34
+ #ifndef GOOGLE_PROTOBUF_STUBS_MAP_UTIL_H__
35
+ #define GOOGLE_PROTOBUF_STUBS_MAP_UTIL_H__
36
+
37
+ #include <stddef.h>
38
+ #include <iterator>
39
+ #include <string>
40
+ #include <utility>
41
+ #include <vector>
42
+
43
+ #include <google/protobuf/stubs/common.h>
44
+
45
+ namespace google {
46
+ namespace protobuf {
47
+ namespace internal {
48
+ // Local implementation of RemoveConst to avoid including base/type_traits.h.
49
+ template <class T> struct RemoveConst { typedef T type; };
50
+ template <class T> struct RemoveConst<const T> : RemoveConst<T> {};
51
+ } // namespace internal
52
+
53
+ //
54
+ // Find*()
55
+ //
56
+
57
+ // Returns a const reference to the value associated with the given key if it
58
+ // exists. Crashes otherwise.
59
+ //
60
+ // This is intended as a replacement for operator[] as an rvalue (for reading)
61
+ // when the key is guaranteed to exist.
62
+ //
63
+ // operator[] for lookup is discouraged for several reasons:
64
+ // * It has a side-effect of inserting missing keys
65
+ // * It is not thread-safe (even when it is not inserting, it can still
66
+ // choose to resize the underlying storage)
67
+ // * It invalidates iterators (when it chooses to resize)
68
+ // * It default constructs a value object even if it doesn't need to
69
+ //
70
+ // This version assumes the key is printable, and includes it in the fatal log
71
+ // message.
72
+ template <class Collection>
73
+ const typename Collection::value_type::second_type&
74
+ FindOrDie(const Collection& collection,
75
+ const typename Collection::value_type::first_type& key) {
76
+ typename Collection::const_iterator it = collection.find(key);
77
+ GOOGLE_CHECK(it != collection.end()) << "Map key not found: " << key;
78
+ return it->second;
79
+ }
80
+
81
+ // Same as above, but returns a non-const reference.
82
+ template <class Collection>
83
+ typename Collection::value_type::second_type&
84
+ FindOrDie(Collection& collection, // NOLINT
85
+ const typename Collection::value_type::first_type& key) {
86
+ typename Collection::iterator it = collection.find(key);
87
+ GOOGLE_CHECK(it != collection.end()) << "Map key not found: " << key;
88
+ return it->second;
89
+ }
90
+
91
+ // Same as FindOrDie above, but doesn't log the key on failure.
92
+ template <class Collection>
93
+ const typename Collection::value_type::second_type&
94
+ FindOrDieNoPrint(const Collection& collection,
95
+ const typename Collection::value_type::first_type& key) {
96
+ typename Collection::const_iterator it = collection.find(key);
97
+ GOOGLE_CHECK(it != collection.end()) << "Map key not found";
98
+ return it->second;
99
+ }
100
+
101
+ // Same as above, but returns a non-const reference.
102
+ template <class Collection>
103
+ typename Collection::value_type::second_type&
104
+ FindOrDieNoPrint(Collection& collection, // NOLINT
105
+ const typename Collection::value_type::first_type& key) {
106
+ typename Collection::iterator it = collection.find(key);
107
+ GOOGLE_CHECK(it != collection.end()) << "Map key not found";
108
+ return it->second;
109
+ }
110
+
111
+ // Returns a const reference to the value associated with the given key if it
112
+ // exists, otherwise returns a const reference to the provided default value.
113
+ //
114
+ // WARNING: If a temporary object is passed as the default "value,"
115
+ // this function will return a reference to that temporary object,
116
+ // which will be destroyed at the end of the statement. A common
117
+ // example: if you have a map with string values, and you pass a char*
118
+ // as the default "value," either use the returned value immediately
119
+ // or store it in a string (not string&).
120
+ // Details: http://go/findwithdefault
121
+ template <class Collection>
122
+ const typename Collection::value_type::second_type&
123
+ FindWithDefault(const Collection& collection,
124
+ const typename Collection::value_type::first_type& key,
125
+ const typename Collection::value_type::second_type& value) {
126
+ typename Collection::const_iterator it = collection.find(key);
127
+ if (it == collection.end()) {
128
+ return value;
129
+ }
130
+ return it->second;
131
+ }
132
+
133
+ // Returns a pointer to the const value associated with the given key if it
134
+ // exists, or NULL otherwise.
135
+ template <class Collection>
136
+ const typename Collection::value_type::second_type*
137
+ FindOrNull(const Collection& collection,
138
+ const typename Collection::value_type::first_type& key) {
139
+ typename Collection::const_iterator it = collection.find(key);
140
+ if (it == collection.end()) {
141
+ return 0;
142
+ }
143
+ return &it->second;
144
+ }
145
+
146
+ // Same as above but returns a pointer to the non-const value.
147
+ template <class Collection>
148
+ typename Collection::value_type::second_type*
149
+ FindOrNull(Collection& collection, // NOLINT
150
+ const typename Collection::value_type::first_type& key) {
151
+ typename Collection::iterator it = collection.find(key);
152
+ if (it == collection.end()) {
153
+ return 0;
154
+ }
155
+ return &it->second;
156
+ }
157
+
158
+ // Returns the pointer value associated with the given key. If none is found,
159
+ // NULL is returned. The function is designed to be used with a map of keys to
160
+ // pointers.
161
+ //
162
+ // This function does not distinguish between a missing key and a key mapped
163
+ // to a NULL value.
164
+ template <class Collection>
165
+ typename Collection::value_type::second_type
166
+ FindPtrOrNull(const Collection& collection,
167
+ const typename Collection::value_type::first_type& key) {
168
+ typename Collection::const_iterator it = collection.find(key);
169
+ if (it == collection.end()) {
170
+ return typename Collection::value_type::second_type();
171
+ }
172
+ return it->second;
173
+ }
174
+
175
+ // Same as above, except takes non-const reference to collection.
176
+ //
177
+ // This function is needed for containers that propagate constness to the
178
+ // pointee, such as boost::ptr_map.
179
+ template <class Collection>
180
+ typename Collection::value_type::second_type
181
+ FindPtrOrNull(Collection& collection, // NOLINT
182
+ const typename Collection::value_type::first_type& key) {
183
+ typename Collection::iterator it = collection.find(key);
184
+ if (it == collection.end()) {
185
+ return typename Collection::value_type::second_type();
186
+ }
187
+ return it->second;
188
+ }
189
+
190
+ // Finds the pointer value associated with the given key in a map whose values
191
+ // are linked_ptrs. Returns NULL if key is not found.
192
+ template <class Collection>
193
+ typename Collection::value_type::second_type::element_type*
194
+ FindLinkedPtrOrNull(const Collection& collection,
195
+ const typename Collection::value_type::first_type& key) {
196
+ typename Collection::const_iterator it = collection.find(key);
197
+ if (it == collection.end()) {
198
+ return 0;
199
+ }
200
+ // Since linked_ptr::get() is a const member returning a non const,
201
+ // we do not need a version of this function taking a non const collection.
202
+ return it->second.get();
203
+ }
204
+
205
+ // Same as above, but dies if the key is not found.
206
+ template <class Collection>
207
+ typename Collection::value_type::second_type::element_type&
208
+ FindLinkedPtrOrDie(const Collection& collection,
209
+ const typename Collection::value_type::first_type& key) {
210
+ typename Collection::const_iterator it = collection.find(key);
211
+ CHECK(it != collection.end()) << "key not found: " << key;
212
+ // Since linked_ptr::operator*() is a const member returning a non const,
213
+ // we do not need a version of this function taking a non const collection.
214
+ return *it->second;
215
+ }
216
+
217
+ // Finds the value associated with the given key and copies it to *value (if not
218
+ // NULL). Returns false if the key was not found, true otherwise.
219
+ template <class Collection, class Key, class Value>
220
+ bool FindCopy(const Collection& collection,
221
+ const Key& key,
222
+ Value* const value) {
223
+ typename Collection::const_iterator it = collection.find(key);
224
+ if (it == collection.end()) {
225
+ return false;
226
+ }
227
+ if (value) {
228
+ *value = it->second;
229
+ }
230
+ return true;
231
+ }
232
+
233
+ //
234
+ // Contains*()
235
+ //
236
+
237
+ // Returns true if and only if the given collection contains the given key.
238
+ template <class Collection, class Key>
239
+ bool ContainsKey(const Collection& collection, const Key& key) {
240
+ return collection.find(key) != collection.end();
241
+ }
242
+
243
+ // Returns true if and only if the given collection contains the given key-value
244
+ // pair.
245
+ template <class Collection, class Key, class Value>
246
+ bool ContainsKeyValuePair(const Collection& collection,
247
+ const Key& key,
248
+ const Value& value) {
249
+ typedef typename Collection::const_iterator const_iterator;
250
+ std::pair<const_iterator, const_iterator> range = collection.equal_range(key);
251
+ for (const_iterator it = range.first; it != range.second; ++it) {
252
+ if (it->second == value) {
253
+ return true;
254
+ }
255
+ }
256
+ return false;
257
+ }
258
+
259
+ //
260
+ // Insert*()
261
+ //
262
+
263
+ // Inserts the given key-value pair into the collection. Returns true if and
264
+ // only if the key from the given pair didn't previously exist. Otherwise, the
265
+ // value in the map is replaced with the value from the given pair.
266
+ template <class Collection>
267
+ bool InsertOrUpdate(Collection* const collection,
268
+ const typename Collection::value_type& vt) {
269
+ std::pair<typename Collection::iterator, bool> ret = collection->insert(vt);
270
+ if (!ret.second) {
271
+ // update
272
+ ret.first->second = vt.second;
273
+ return false;
274
+ }
275
+ return true;
276
+ }
277
+
278
+ // Same as above, except that the key and value are passed separately.
279
+ template <class Collection>
280
+ bool InsertOrUpdate(Collection* const collection,
281
+ const typename Collection::value_type::first_type& key,
282
+ const typename Collection::value_type::second_type& value) {
283
+ return InsertOrUpdate(
284
+ collection, typename Collection::value_type(key, value));
285
+ }
286
+
287
+ // Inserts/updates all the key-value pairs from the range defined by the
288
+ // iterators "first" and "last" into the given collection.
289
+ template <class Collection, class InputIterator>
290
+ void InsertOrUpdateMany(Collection* const collection,
291
+ InputIterator first, InputIterator last) {
292
+ for (; first != last; ++first) {
293
+ InsertOrUpdate(collection, *first);
294
+ }
295
+ }
296
+
297
+ // Change the value associated with a particular key in a map or hash_map
298
+ // of the form map<Key, Value*> which owns the objects pointed to by the
299
+ // value pointers. If there was an existing value for the key, it is deleted.
300
+ // True indicates an insert took place, false indicates an update + delete.
301
+ template <class Collection>
302
+ bool InsertAndDeleteExisting(
303
+ Collection* const collection,
304
+ const typename Collection::value_type::first_type& key,
305
+ const typename Collection::value_type::second_type& value) {
306
+ std::pair<typename Collection::iterator, bool> ret =
307
+ collection->insert(typename Collection::value_type(key, value));
308
+ if (!ret.second) {
309
+ delete ret.first->second;
310
+ ret.first->second = value;
311
+ return false;
312
+ }
313
+ return true;
314
+ }
315
+
316
+ // Inserts the given key and value into the given collection if and only if the
317
+ // given key did NOT already exist in the collection. If the key previously
318
+ // existed in the collection, the value is not changed. Returns true if the
319
+ // key-value pair was inserted; returns false if the key was already present.
320
+ template <class Collection>
321
+ bool InsertIfNotPresent(Collection* const collection,
322
+ const typename Collection::value_type& vt) {
323
+ return collection->insert(vt).second;
324
+ }
325
+
326
+ // Same as above except the key and value are passed separately.
327
+ template <class Collection>
328
+ bool InsertIfNotPresent(
329
+ Collection* const collection,
330
+ const typename Collection::value_type::first_type& key,
331
+ const typename Collection::value_type::second_type& value) {
332
+ return InsertIfNotPresent(
333
+ collection, typename Collection::value_type(key, value));
334
+ }
335
+
336
+ // Same as above except dies if the key already exists in the collection.
337
+ template <class Collection>
338
+ void InsertOrDie(Collection* const collection,
339
+ const typename Collection::value_type& value) {
340
+ CHECK(InsertIfNotPresent(collection, value)) << "duplicate value: " << value;
341
+ }
342
+
343
+ // Same as above except doesn't log the value on error.
344
+ template <class Collection>
345
+ void InsertOrDieNoPrint(Collection* const collection,
346
+ const typename Collection::value_type& value) {
347
+ CHECK(InsertIfNotPresent(collection, value)) << "duplicate value.";
348
+ }
349
+
350
+ // Inserts the key-value pair into the collection. Dies if key was already
351
+ // present.
352
+ template <class Collection>
353
+ void InsertOrDie(Collection* const collection,
354
+ const typename Collection::value_type::first_type& key,
355
+ const typename Collection::value_type::second_type& data) {
356
+ typedef typename Collection::value_type value_type;
357
+ GOOGLE_CHECK(InsertIfNotPresent(collection, key, data))
358
+ << "duplicate key: " << key;
359
+ }
360
+
361
+ // Same as above except doesn't log the key on error.
362
+ template <class Collection>
363
+ void InsertOrDieNoPrint(
364
+ Collection* const collection,
365
+ const typename Collection::value_type::first_type& key,
366
+ const typename Collection::value_type::second_type& data) {
367
+ typedef typename Collection::value_type value_type;
368
+ GOOGLE_CHECK(InsertIfNotPresent(collection, key, data)) << "duplicate key.";
369
+ }
370
+
371
+ // Inserts a new key and default-initialized value. Dies if the key was already
372
+ // present. Returns a reference to the value. Example usage:
373
+ //
374
+ // map<int, SomeProto> m;
375
+ // SomeProto& proto = InsertKeyOrDie(&m, 3);
376
+ // proto.set_field("foo");
377
+ template <class Collection>
378
+ typename Collection::value_type::second_type& InsertKeyOrDie(
379
+ Collection* const collection,
380
+ const typename Collection::value_type::first_type& key) {
381
+ typedef typename Collection::value_type value_type;
382
+ std::pair<typename Collection::iterator, bool> res =
383
+ collection->insert(value_type(key, typename value_type::second_type()));
384
+ GOOGLE_CHECK(res.second) << "duplicate key: " << key;
385
+ return res.first->second;
386
+ }
387
+
388
+ //
389
+ // Lookup*()
390
+ //
391
+
392
+ // Looks up a given key and value pair in a collection and inserts the key-value
393
+ // pair if it's not already present. Returns a reference to the value associated
394
+ // with the key.
395
+ template <class Collection>
396
+ typename Collection::value_type::second_type&
397
+ LookupOrInsert(Collection* const collection,
398
+ const typename Collection::value_type& vt) {
399
+ return collection->insert(vt).first->second;
400
+ }
401
+
402
+ // Same as above except the key-value are passed separately.
403
+ template <class Collection>
404
+ typename Collection::value_type::second_type&
405
+ LookupOrInsert(Collection* const collection,
406
+ const typename Collection::value_type::first_type& key,
407
+ const typename Collection::value_type::second_type& value) {
408
+ return LookupOrInsert(
409
+ collection, typename Collection::value_type(key, value));
410
+ }
411
+
412
+ // Counts the number of equivalent elements in the given "sequence", and stores
413
+ // the results in "count_map" with element as the key and count as the value.
414
+ //
415
+ // Example:
416
+ // vector<string> v = {"a", "b", "c", "a", "b"};
417
+ // map<string, int> m;
418
+ // AddTokenCounts(v, 1, &m);
419
+ // assert(m["a"] == 2);
420
+ // assert(m["b"] == 2);
421
+ // assert(m["c"] == 1);
422
+ template <typename Sequence, typename Collection>
423
+ void AddTokenCounts(
424
+ const Sequence& sequence,
425
+ const typename Collection::value_type::second_type& increment,
426
+ Collection* const count_map) {
427
+ for (typename Sequence::const_iterator it = sequence.begin();
428
+ it != sequence.end(); ++it) {
429
+ typename Collection::value_type::second_type& value =
430
+ LookupOrInsert(count_map, *it,
431
+ typename Collection::value_type::second_type());
432
+ value += increment;
433
+ }
434
+ }
435
+
436
+ // Returns a reference to the value associated with key. If not found, a value
437
+ // is default constructed on the heap and added to the map.
438
+ //
439
+ // This function is useful for containers of the form map<Key, Value*>, where
440
+ // inserting a new key, value pair involves constructing a new heap-allocated
441
+ // Value, and storing a pointer to that in the collection.
442
+ template <class Collection>
443
+ typename Collection::value_type::second_type&
444
+ LookupOrInsertNew(Collection* const collection,
445
+ const typename Collection::value_type::first_type& key) {
446
+ typedef typename std::iterator_traits<
447
+ typename Collection::value_type::second_type>::value_type Element;
448
+ std::pair<typename Collection::iterator, bool> ret =
449
+ collection->insert(typename Collection::value_type(
450
+ key,
451
+ static_cast<typename Collection::value_type::second_type>(NULL)));
452
+ if (ret.second) {
453
+ ret.first->second = new Element();
454
+ }
455
+ return ret.first->second;
456
+ }
457
+
458
+ // Same as above but constructs the value using the single-argument constructor
459
+ // and the given "arg".
460
+ template <class Collection, class Arg>
461
+ typename Collection::value_type::second_type&
462
+ LookupOrInsertNew(Collection* const collection,
463
+ const typename Collection::value_type::first_type& key,
464
+ const Arg& arg) {
465
+ typedef typename std::iterator_traits<
466
+ typename Collection::value_type::second_type>::value_type Element;
467
+ std::pair<typename Collection::iterator, bool> ret =
468
+ collection->insert(typename Collection::value_type(
469
+ key,
470
+ static_cast<typename Collection::value_type::second_type>(NULL)));
471
+ if (ret.second) {
472
+ ret.first->second = new Element(arg);
473
+ }
474
+ return ret.first->second;
475
+ }
476
+
477
+ // Lookup of linked/shared pointers is used in two scenarios:
478
+ //
479
+ // Use LookupOrInsertNewLinkedPtr if the container owns the elements.
480
+ // In this case it is fine working with the raw pointer as long as it is
481
+ // guaranteed that no other thread can delete/update an accessed element.
482
+ // A mutex will need to lock the container operation as well as the use
483
+ // of the returned elements. Finding an element may be performed using
484
+ // FindLinkedPtr*().
485
+ //
486
+ // Use LookupOrInsertNewSharedPtr if the container does not own the elements
487
+ // for their whole lifetime. This is typically the case when a reader allows
488
+ // parallel updates to the container. In this case a Mutex only needs to lock
489
+ // container operations, but all element operations must be performed on the
490
+ // shared pointer. Finding an element must be performed using FindPtr*() and
491
+ // cannot be done with FindLinkedPtr*() even though it compiles.
492
+
493
+ // Lookup a key in a map or hash_map whose values are linked_ptrs. If it is
494
+ // missing, set collection[key].reset(new Value::element_type) and return that.
495
+ // Value::element_type must be default constructable.
496
+ template <class Collection>
497
+ typename Collection::value_type::second_type::element_type*
498
+ LookupOrInsertNewLinkedPtr(
499
+ Collection* const collection,
500
+ const typename Collection::value_type::first_type& key) {
501
+ typedef typename Collection::value_type::second_type Value;
502
+ std::pair<typename Collection::iterator, bool> ret =
503
+ collection->insert(typename Collection::value_type(key, Value()));
504
+ if (ret.second) {
505
+ ret.first->second.reset(new typename Value::element_type);
506
+ }
507
+ return ret.first->second.get();
508
+ }
509
+
510
+ // A variant of LookupOrInsertNewLinkedPtr where the value is constructed using
511
+ // a single-parameter constructor. Note: the constructor argument is computed
512
+ // even if it will not be used, so only values cheap to compute should be passed
513
+ // here. On the other hand it does not matter how expensive the construction of
514
+ // the actual stored value is, as that only occurs if necessary.
515
+ template <class Collection, class Arg>
516
+ typename Collection::value_type::second_type::element_type*
517
+ LookupOrInsertNewLinkedPtr(
518
+ Collection* const collection,
519
+ const typename Collection::value_type::first_type& key,
520
+ const Arg& arg) {
521
+ typedef typename Collection::value_type::second_type Value;
522
+ std::pair<typename Collection::iterator, bool> ret =
523
+ collection->insert(typename Collection::value_type(key, Value()));
524
+ if (ret.second) {
525
+ ret.first->second.reset(new typename Value::element_type(arg));
526
+ }
527
+ return ret.first->second.get();
528
+ }
529
+
530
+ // Lookup a key in a map or hash_map whose values are shared_ptrs. If it is
531
+ // missing, set collection[key].reset(new Value::element_type). Unlike
532
+ // LookupOrInsertNewLinkedPtr, this function returns the shared_ptr instead of
533
+ // the raw pointer. Value::element_type must be default constructable.
534
+ template <class Collection>
535
+ typename Collection::value_type::second_type&
536
+ LookupOrInsertNewSharedPtr(
537
+ Collection* const collection,
538
+ const typename Collection::value_type::first_type& key) {
539
+ typedef typename Collection::value_type::second_type SharedPtr;
540
+ typedef typename Collection::value_type::second_type::element_type Element;
541
+ std::pair<typename Collection::iterator, bool> ret =
542
+ collection->insert(typename Collection::value_type(key, SharedPtr()));
543
+ if (ret.second) {
544
+ ret.first->second.reset(new Element());
545
+ }
546
+ return ret.first->second;
547
+ }
548
+
549
+ // A variant of LookupOrInsertNewSharedPtr where the value is constructed using
550
+ // a single-parameter constructor. Note: the constructor argument is computed
551
+ // even if it will not be used, so only values cheap to compute should be passed
552
+ // here. On the other hand it does not matter how expensive the construction of
553
+ // the actual stored value is, as that only occurs if necessary.
554
+ template <class Collection, class Arg>
555
+ typename Collection::value_type::second_type&
556
+ LookupOrInsertNewSharedPtr(
557
+ Collection* const collection,
558
+ const typename Collection::value_type::first_type& key,
559
+ const Arg& arg) {
560
+ typedef typename Collection::value_type::second_type SharedPtr;
561
+ typedef typename Collection::value_type::second_type::element_type Element;
562
+ std::pair<typename Collection::iterator, bool> ret =
563
+ collection->insert(typename Collection::value_type(key, SharedPtr()));
564
+ if (ret.second) {
565
+ ret.first->second.reset(new Element(arg));
566
+ }
567
+ return ret.first->second;
568
+ }
569
+
570
+ //
571
+ // Misc Utility Functions
572
+ //
573
+
574
+ // Updates the value associated with the given key. If the key was not already
575
+ // present, then the key-value pair are inserted and "previous" is unchanged. If
576
+ // the key was already present, the value is updated and "*previous" will
577
+ // contain a copy of the old value.
578
+ //
579
+ // InsertOrReturnExisting has complementary behavior that returns the
580
+ // address of an already existing value, rather than updating it.
581
+ template <class Collection>
582
+ bool UpdateReturnCopy(Collection* const collection,
583
+ const typename Collection::value_type::first_type& key,
584
+ const typename Collection::value_type::second_type& value,
585
+ typename Collection::value_type::second_type* previous) {
586
+ std::pair<typename Collection::iterator, bool> ret =
587
+ collection->insert(typename Collection::value_type(key, value));
588
+ if (!ret.second) {
589
+ // update
590
+ if (previous) {
591
+ *previous = ret.first->second;
592
+ }
593
+ ret.first->second = value;
594
+ return true;
595
+ }
596
+ return false;
597
+ }
598
+
599
+ // Same as above except that the key and value are passed as a pair.
600
+ template <class Collection>
601
+ bool UpdateReturnCopy(Collection* const collection,
602
+ const typename Collection::value_type& vt,
603
+ typename Collection::value_type::second_type* previous) {
604
+ std::pair<typename Collection::iterator, bool> ret = collection->insert(vt);
605
+ if (!ret.second) {
606
+ // update
607
+ if (previous) {
608
+ *previous = ret.first->second;
609
+ }
610
+ ret.first->second = vt.second;
611
+ return true;
612
+ }
613
+ return false;
614
+ }
615
+
616
+ // Tries to insert the given key-value pair into the collection. Returns NULL if
617
+ // the insert succeeds. Otherwise, returns a pointer to the existing value.
618
+ //
619
+ // This complements UpdateReturnCopy in that it allows to update only after
620
+ // verifying the old value and still insert quickly without having to look up
621
+ // twice. Unlike UpdateReturnCopy this also does not come with the issue of an
622
+ // undefined previous* in case new data was inserted.
623
+ template <class Collection>
624
+ typename Collection::value_type::second_type* const
625
+ InsertOrReturnExisting(Collection* const collection,
626
+ const typename Collection::value_type& vt) {
627
+ std::pair<typename Collection::iterator, bool> ret = collection->insert(vt);
628
+ if (ret.second) {
629
+ return NULL; // Inserted, no existing previous value.
630
+ } else {
631
+ return &ret.first->second; // Return address of already existing value.
632
+ }
633
+ }
634
+
635
+ // Same as above, except for explicit key and data.
636
+ template <class Collection>
637
+ typename Collection::value_type::second_type* const
638
+ InsertOrReturnExisting(
639
+ Collection* const collection,
640
+ const typename Collection::value_type::first_type& key,
641
+ const typename Collection::value_type::second_type& data) {
642
+ return InsertOrReturnExisting(collection,
643
+ typename Collection::value_type(key, data));
644
+ }
645
+
646
+ // Erases the collection item identified by the given key, and returns the value
647
+ // associated with that key. It is assumed that the value (i.e., the
648
+ // mapped_type) is a pointer. Returns NULL if the key was not found in the
649
+ // collection.
650
+ //
651
+ // Examples:
652
+ // map<string, MyType*> my_map;
653
+ //
654
+ // One line cleanup:
655
+ // delete EraseKeyReturnValuePtr(&my_map, "abc");
656
+ //
657
+ // Use returned value:
658
+ // scoped_ptr<MyType> value_ptr(EraseKeyReturnValuePtr(&my_map, "abc"));
659
+ // if (value_ptr.get())
660
+ // value_ptr->DoSomething();
661
+ //
662
+ template <class Collection>
663
+ typename Collection::value_type::second_type EraseKeyReturnValuePtr(
664
+ Collection* const collection,
665
+ const typename Collection::value_type::first_type& key) {
666
+ typename Collection::iterator it = collection->find(key);
667
+ if (it == collection->end()) {
668
+ return NULL;
669
+ }
670
+ typename Collection::value_type::second_type v = it->second;
671
+ collection->erase(it);
672
+ return v;
673
+ }
674
+
675
+ // Inserts all the keys from map_container into key_container, which must
676
+ // support insert(MapContainer::key_type).
677
+ //
678
+ // Note: any initial contents of the key_container are not cleared.
679
+ template <class MapContainer, class KeyContainer>
680
+ void InsertKeysFromMap(const MapContainer& map_container,
681
+ KeyContainer* key_container) {
682
+ GOOGLE_CHECK(key_container != NULL);
683
+ for (typename MapContainer::const_iterator it = map_container.begin();
684
+ it != map_container.end(); ++it) {
685
+ key_container->insert(it->first);
686
+ }
687
+ }
688
+
689
+ // Appends all the keys from map_container into key_container, which must
690
+ // support push_back(MapContainer::key_type).
691
+ //
692
+ // Note: any initial contents of the key_container are not cleared.
693
+ template <class MapContainer, class KeyContainer>
694
+ void AppendKeysFromMap(const MapContainer& map_container,
695
+ KeyContainer* key_container) {
696
+ GOOGLE_CHECK(key_container != NULL);
697
+ for (typename MapContainer::const_iterator it = map_container.begin();
698
+ it != map_container.end(); ++it) {
699
+ key_container->push_back(it->first);
700
+ }
701
+ }
702
+
703
+ // A more specialized overload of AppendKeysFromMap to optimize reallocations
704
+ // for the common case in which we're appending keys to a vector and hence can
705
+ // (and sometimes should) call reserve() first.
706
+ //
707
+ // (It would be possible to play SFINAE games to call reserve() for any
708
+ // container that supports it, but this seems to get us 99% of what we need
709
+ // without the complexity of a SFINAE-based solution.)
710
+ template <class MapContainer, class KeyType>
711
+ void AppendKeysFromMap(const MapContainer& map_container,
712
+ vector<KeyType>* key_container) {
713
+ GOOGLE_CHECK(key_container != NULL);
714
+ // We now have the opportunity to call reserve(). Calling reserve() every
715
+ // time is a bad idea for some use cases: libstdc++'s implementation of
716
+ // vector<>::reserve() resizes the vector's backing store to exactly the
717
+ // given size (unless it's already at least that big). Because of this,
718
+ // the use case that involves appending a lot of small maps (total size
719
+ // N) one by one to a vector would be O(N^2). But never calling reserve()
720
+ // loses the opportunity to improve the use case of adding from a large
721
+ // map to an empty vector (this improves performance by up to 33%). A
722
+ // number of heuristics are possible; see the discussion in
723
+ // cl/34081696. Here we use the simplest one.
724
+ if (key_container->empty()) {
725
+ key_container->reserve(map_container.size());
726
+ }
727
+ for (typename MapContainer::const_iterator it = map_container.begin();
728
+ it != map_container.end(); ++it) {
729
+ key_container->push_back(it->first);
730
+ }
731
+ }
732
+
733
+ // Inserts all the values from map_container into value_container, which must
734
+ // support push_back(MapContainer::mapped_type).
735
+ //
736
+ // Note: any initial contents of the value_container are not cleared.
737
+ template <class MapContainer, class ValueContainer>
738
+ void AppendValuesFromMap(const MapContainer& map_container,
739
+ ValueContainer* value_container) {
740
+ GOOGLE_CHECK(value_container != NULL);
741
+ for (typename MapContainer::const_iterator it = map_container.begin();
742
+ it != map_container.end(); ++it) {
743
+ value_container->push_back(it->second);
744
+ }
745
+ }
746
+
747
+ // A more specialized overload of AppendValuesFromMap to optimize reallocations
748
+ // for the common case in which we're appending values to a vector and hence
749
+ // can (and sometimes should) call reserve() first.
750
+ //
751
+ // (It would be possible to play SFINAE games to call reserve() for any
752
+ // container that supports it, but this seems to get us 99% of what we need
753
+ // without the complexity of a SFINAE-based solution.)
754
+ template <class MapContainer, class ValueType>
755
+ void AppendValuesFromMap(const MapContainer& map_container,
756
+ vector<ValueType>* value_container) {
757
+ GOOGLE_CHECK(value_container != NULL);
758
+ // See AppendKeysFromMap for why this is done.
759
+ if (value_container->empty()) {
760
+ value_container->reserve(map_container.size());
761
+ }
762
+ for (typename MapContainer::const_iterator it = map_container.begin();
763
+ it != map_container.end(); ++it) {
764
+ value_container->push_back(it->second);
765
+ }
766
+ }
767
+
768
+ } // namespace protobuf
769
+ } // namespace google
770
+
771
+ #endif // GOOGLE_PROTOBUF_STUBS_MAP_UTIL_H__