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.
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,1226 @@
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: kenton@google.com (Kenton Varda) and others
32
+ //
33
+ // Contains basic types and utilities used by the rest of the library.
34
+
35
+ #ifndef GOOGLE_PROTOBUF_COMMON_H__
36
+ #define GOOGLE_PROTOBUF_COMMON_H__
37
+
38
+ #include <assert.h>
39
+ #include <stdlib.h>
40
+ #include <cstddef>
41
+ #include <string>
42
+ #include <string.h>
43
+ #if defined(__osf__)
44
+ // Tru64 lacks stdint.h, but has inttypes.h which defines a superset of
45
+ // what stdint.h would define.
46
+ #include <inttypes.h>
47
+ #elif !defined(_MSC_VER)
48
+ #include <stdint.h>
49
+ #endif
50
+
51
+ #ifndef PROTOBUF_USE_EXCEPTIONS
52
+ #if defined(_MSC_VER) && defined(_CPPUNWIND)
53
+ #define PROTOBUF_USE_EXCEPTIONS 1
54
+ #elif defined(__EXCEPTIONS)
55
+ #define PROTOBUF_USE_EXCEPTIONS 1
56
+ #else
57
+ #define PROTOBUF_USE_EXCEPTIONS 0
58
+ #endif
59
+ #endif
60
+
61
+ #if PROTOBUF_USE_EXCEPTIONS
62
+ #include <exception>
63
+ #endif
64
+
65
+ #if defined(_WIN32) && defined(GetMessage)
66
+ // Allow GetMessage to be used as a valid method name in protobuf classes.
67
+ // windows.h defines GetMessage() as a macro. Let's re-define it as an inline
68
+ // function. The inline function should be equivalent for C++ users.
69
+ inline BOOL GetMessage_Win32(
70
+ LPMSG lpMsg, HWND hWnd,
71
+ UINT wMsgFilterMin, UINT wMsgFilterMax) {
72
+ return GetMessage(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
73
+ }
74
+ #undef GetMessage
75
+ inline BOOL GetMessage(
76
+ LPMSG lpMsg, HWND hWnd,
77
+ UINT wMsgFilterMin, UINT wMsgFilterMax) {
78
+ return GetMessage_Win32(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
79
+ }
80
+ #endif
81
+
82
+
83
+ namespace std {}
84
+
85
+ namespace google {
86
+ namespace protobuf {
87
+
88
+ #undef GOOGLE_DISALLOW_EVIL_CONSTRUCTORS
89
+ #define GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(TypeName) \
90
+ TypeName(const TypeName&); \
91
+ void operator=(const TypeName&)
92
+
93
+ #if defined(_MSC_VER) && defined(PROTOBUF_USE_DLLS)
94
+ #ifdef LIBPROTOBUF_EXPORTS
95
+ #define LIBPROTOBUF_EXPORT __declspec(dllexport)
96
+ #else
97
+ #define LIBPROTOBUF_EXPORT __declspec(dllimport)
98
+ #endif
99
+ #ifdef LIBPROTOC_EXPORTS
100
+ #define LIBPROTOC_EXPORT __declspec(dllexport)
101
+ #else
102
+ #define LIBPROTOC_EXPORT __declspec(dllimport)
103
+ #endif
104
+ #else
105
+ #define LIBPROTOBUF_EXPORT
106
+ #define LIBPROTOC_EXPORT
107
+ #endif
108
+
109
+ namespace internal {
110
+
111
+ // Some of these constants are macros rather than const ints so that they can
112
+ // be used in #if directives.
113
+
114
+ // The current version, represented as a single integer to make comparison
115
+ // easier: major * 10^6 + minor * 10^3 + micro
116
+ #define GOOGLE_PROTOBUF_VERSION 2006001
117
+
118
+ // The minimum library version which works with the current version of the
119
+ // headers.
120
+ #define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 2006000
121
+
122
+ // The minimum header version which works with the current version of
123
+ // the library. This constant should only be used by protoc's C++ code
124
+ // generator.
125
+ static const int kMinHeaderVersionForLibrary = 2006000;
126
+
127
+ // The minimum protoc version which works with the current version of the
128
+ // headers.
129
+ #define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 2006000
130
+
131
+ // The minimum header version which works with the current version of
132
+ // protoc. This constant should only be used in VerifyVersion().
133
+ static const int kMinHeaderVersionForProtoc = 2006000;
134
+
135
+ // Verifies that the headers and libraries are compatible. Use the macro
136
+ // below to call this.
137
+ void LIBPROTOBUF_EXPORT VerifyVersion(int headerVersion, int minLibraryVersion,
138
+ const char* filename);
139
+
140
+ // Converts a numeric version number to a string.
141
+ std::string LIBPROTOBUF_EXPORT VersionString(int version);
142
+
143
+ } // namespace internal
144
+
145
+ // Place this macro in your main() function (or somewhere before you attempt
146
+ // to use the protobuf library) to verify that the version you link against
147
+ // matches the headers you compiled against. If a version mismatch is
148
+ // detected, the process will abort.
149
+ #define GOOGLE_PROTOBUF_VERIFY_VERSION \
150
+ ::google::protobuf::internal::VerifyVersion( \
151
+ GOOGLE_PROTOBUF_VERSION, GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION, \
152
+ __FILE__)
153
+
154
+ // ===================================================================
155
+ // from google3/base/port.h
156
+
157
+ typedef unsigned int uint;
158
+
159
+ #ifdef _MSC_VER
160
+ typedef __int8 int8;
161
+ typedef __int16 int16;
162
+ typedef __int32 int32;
163
+ typedef __int64 int64;
164
+
165
+ typedef unsigned __int8 uint8;
166
+ typedef unsigned __int16 uint16;
167
+ typedef unsigned __int32 uint32;
168
+ typedef unsigned __int64 uint64;
169
+ #else
170
+ typedef int8_t int8;
171
+ typedef int16_t int16;
172
+ typedef int32_t int32;
173
+ typedef int64_t int64;
174
+
175
+ typedef uint8_t uint8;
176
+ typedef uint16_t uint16;
177
+ typedef uint32_t uint32;
178
+ typedef uint64_t uint64;
179
+ #endif
180
+
181
+ // long long macros to be used because gcc and vc++ use different suffixes,
182
+ // and different size specifiers in format strings
183
+ #undef GOOGLE_LONGLONG
184
+ #undef GOOGLE_ULONGLONG
185
+ #undef GOOGLE_LL_FORMAT
186
+
187
+ #ifdef _MSC_VER
188
+ #define GOOGLE_LONGLONG(x) x##I64
189
+ #define GOOGLE_ULONGLONG(x) x##UI64
190
+ #define GOOGLE_LL_FORMAT "I64" // As in printf("%I64d", ...)
191
+ #else
192
+ #define GOOGLE_LONGLONG(x) x##LL
193
+ #define GOOGLE_ULONGLONG(x) x##ULL
194
+ #define GOOGLE_LL_FORMAT "ll" // As in "%lld". Note that "q" is poor form also.
195
+ #endif
196
+
197
+ static const int32 kint32max = 0x7FFFFFFF;
198
+ static const int32 kint32min = -kint32max - 1;
199
+ static const int64 kint64max = GOOGLE_LONGLONG(0x7FFFFFFFFFFFFFFF);
200
+ static const int64 kint64min = -kint64max - 1;
201
+ static const uint32 kuint32max = 0xFFFFFFFFu;
202
+ static const uint64 kuint64max = GOOGLE_ULONGLONG(0xFFFFFFFFFFFFFFFF);
203
+
204
+ // -------------------------------------------------------------------
205
+ // Annotations: Some parts of the code have been annotated in ways that might
206
+ // be useful to some compilers or tools, but are not supported universally.
207
+ // You can #define these annotations yourself if the default implementation
208
+ // is not right for you.
209
+
210
+ #ifndef GOOGLE_ATTRIBUTE_ALWAYS_INLINE
211
+ #if defined(__GNUC__) && (__GNUC__ > 3 ||(__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
212
+ // For functions we want to force inline.
213
+ // Introduced in gcc 3.1.
214
+ #define GOOGLE_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((always_inline))
215
+ #else
216
+ // Other compilers will have to figure it out for themselves.
217
+ #define GOOGLE_ATTRIBUTE_ALWAYS_INLINE
218
+ #endif
219
+ #endif
220
+
221
+ #ifndef GOOGLE_ATTRIBUTE_DEPRECATED
222
+ #ifdef __GNUC__
223
+ // If the method/variable/type is used anywhere, produce a warning.
224
+ #define GOOGLE_ATTRIBUTE_DEPRECATED __attribute__((deprecated))
225
+ #else
226
+ #define GOOGLE_ATTRIBUTE_DEPRECATED
227
+ #endif
228
+ #endif
229
+
230
+ #ifndef GOOGLE_PREDICT_TRUE
231
+ #ifdef __GNUC__
232
+ // Provided at least since GCC 3.0.
233
+ #define GOOGLE_PREDICT_TRUE(x) (__builtin_expect(!!(x), 1))
234
+ #else
235
+ #define GOOGLE_PREDICT_TRUE
236
+ #endif
237
+ #endif
238
+
239
+ // Delimits a block of code which may write to memory which is simultaneously
240
+ // written by other threads, but which has been determined to be thread-safe
241
+ // (e.g. because it is an idempotent write).
242
+ #ifndef GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN
243
+ #define GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN()
244
+ #endif
245
+ #ifndef GOOGLE_SAFE_CONCURRENT_WRITES_END
246
+ #define GOOGLE_SAFE_CONCURRENT_WRITES_END()
247
+ #endif
248
+
249
+ // ===================================================================
250
+ // from google3/base/basictypes.h
251
+
252
+ // The GOOGLE_ARRAYSIZE(arr) macro returns the # of elements in an array arr.
253
+ // The expression is a compile-time constant, and therefore can be
254
+ // used in defining new arrays, for example.
255
+ //
256
+ // GOOGLE_ARRAYSIZE catches a few type errors. If you see a compiler error
257
+ //
258
+ // "warning: division by zero in ..."
259
+ //
260
+ // when using GOOGLE_ARRAYSIZE, you are (wrongfully) giving it a pointer.
261
+ // You should only use GOOGLE_ARRAYSIZE on statically allocated arrays.
262
+ //
263
+ // The following comments are on the implementation details, and can
264
+ // be ignored by the users.
265
+ //
266
+ // ARRAYSIZE(arr) works by inspecting sizeof(arr) (the # of bytes in
267
+ // the array) and sizeof(*(arr)) (the # of bytes in one array
268
+ // element). If the former is divisible by the latter, perhaps arr is
269
+ // indeed an array, in which case the division result is the # of
270
+ // elements in the array. Otherwise, arr cannot possibly be an array,
271
+ // and we generate a compiler error to prevent the code from
272
+ // compiling.
273
+ //
274
+ // Since the size of bool is implementation-defined, we need to cast
275
+ // !(sizeof(a) & sizeof(*(a))) to size_t in order to ensure the final
276
+ // result has type size_t.
277
+ //
278
+ // This macro is not perfect as it wrongfully accepts certain
279
+ // pointers, namely where the pointer size is divisible by the pointee
280
+ // size. Since all our code has to go through a 32-bit compiler,
281
+ // where a pointer is 4 bytes, this means all pointers to a type whose
282
+ // size is 3 or greater than 4 will be (righteously) rejected.
283
+ //
284
+ // Kudos to Jorg Brown for this simple and elegant implementation.
285
+
286
+ #undef GOOGLE_ARRAYSIZE
287
+ #define GOOGLE_ARRAYSIZE(a) \
288
+ ((sizeof(a) / sizeof(*(a))) / \
289
+ static_cast<size_t>(!(sizeof(a) % sizeof(*(a)))))
290
+
291
+ namespace internal {
292
+
293
+ // Use implicit_cast as a safe version of static_cast or const_cast
294
+ // for upcasting in the type hierarchy (i.e. casting a pointer to Foo
295
+ // to a pointer to SuperclassOfFoo or casting a pointer to Foo to
296
+ // a const pointer to Foo).
297
+ // When you use implicit_cast, the compiler checks that the cast is safe.
298
+ // Such explicit implicit_casts are necessary in surprisingly many
299
+ // situations where C++ demands an exact type match instead of an
300
+ // argument type convertable to a target type.
301
+ //
302
+ // The From type can be inferred, so the preferred syntax for using
303
+ // implicit_cast is the same as for static_cast etc.:
304
+ //
305
+ // implicit_cast<ToType>(expr)
306
+ //
307
+ // implicit_cast would have been part of the C++ standard library,
308
+ // but the proposal was submitted too late. It will probably make
309
+ // its way into the language in the future.
310
+ template<typename To, typename From>
311
+ inline To implicit_cast(From const &f) {
312
+ return f;
313
+ }
314
+
315
+ // When you upcast (that is, cast a pointer from type Foo to type
316
+ // SuperclassOfFoo), it's fine to use implicit_cast<>, since upcasts
317
+ // always succeed. When you downcast (that is, cast a pointer from
318
+ // type Foo to type SubclassOfFoo), static_cast<> isn't safe, because
319
+ // how do you know the pointer is really of type SubclassOfFoo? It
320
+ // could be a bare Foo, or of type DifferentSubclassOfFoo. Thus,
321
+ // when you downcast, you should use this macro. In debug mode, we
322
+ // use dynamic_cast<> to double-check the downcast is legal (we die
323
+ // if it's not). In normal mode, we do the efficient static_cast<>
324
+ // instead. Thus, it's important to test in debug mode to make sure
325
+ // the cast is legal!
326
+ // This is the only place in the code we should use dynamic_cast<>.
327
+ // In particular, you SHOULDN'T be using dynamic_cast<> in order to
328
+ // do RTTI (eg code like this:
329
+ // if (dynamic_cast<Subclass1>(foo)) HandleASubclass1Object(foo);
330
+ // if (dynamic_cast<Subclass2>(foo)) HandleASubclass2Object(foo);
331
+ // You should design the code some other way not to need this.
332
+
333
+ template<typename To, typename From> // use like this: down_cast<T*>(foo);
334
+ inline To down_cast(From* f) { // so we only accept pointers
335
+ // Ensures that To is a sub-type of From *. This test is here only
336
+ // for compile-time type checking, and has no overhead in an
337
+ // optimized build at run-time, as it will be optimized away
338
+ // completely.
339
+ if (false) {
340
+ implicit_cast<From*, To>(0);
341
+ }
342
+
343
+ #if !defined(NDEBUG) && !defined(GOOGLE_PROTOBUF_NO_RTTI)
344
+ assert(f == NULL || dynamic_cast<To>(f) != NULL); // RTTI: debug mode only!
345
+ #endif
346
+ return static_cast<To>(f);
347
+ }
348
+
349
+ } // namespace internal
350
+
351
+ // We made these internal so that they would show up as such in the docs,
352
+ // but we don't want to stick "internal::" in front of them everywhere.
353
+ using internal::implicit_cast;
354
+ using internal::down_cast;
355
+
356
+ // The COMPILE_ASSERT macro can be used to verify that a compile time
357
+ // expression is true. For example, you could use it to verify the
358
+ // size of a static array:
359
+ //
360
+ // COMPILE_ASSERT(ARRAYSIZE(content_type_names) == CONTENT_NUM_TYPES,
361
+ // content_type_names_incorrect_size);
362
+ //
363
+ // or to make sure a struct is smaller than a certain size:
364
+ //
365
+ // COMPILE_ASSERT(sizeof(foo) < 128, foo_too_large);
366
+ //
367
+ // The second argument to the macro is the name of the variable. If
368
+ // the expression is false, most compilers will issue a warning/error
369
+ // containing the name of the variable.
370
+
371
+ namespace internal {
372
+
373
+ template <bool>
374
+ struct CompileAssert {
375
+ };
376
+
377
+ } // namespace internal
378
+
379
+ #undef GOOGLE_COMPILE_ASSERT
380
+ #define GOOGLE_COMPILE_ASSERT(expr, msg) \
381
+ typedef ::google::protobuf::internal::CompileAssert<(bool(expr))> \
382
+ msg[bool(expr) ? 1 : -1]
383
+
384
+
385
+ // Implementation details of COMPILE_ASSERT:
386
+ //
387
+ // - COMPILE_ASSERT works by defining an array type that has -1
388
+ // elements (and thus is invalid) when the expression is false.
389
+ //
390
+ // - The simpler definition
391
+ //
392
+ // #define COMPILE_ASSERT(expr, msg) typedef char msg[(expr) ? 1 : -1]
393
+ //
394
+ // does not work, as gcc supports variable-length arrays whose sizes
395
+ // are determined at run-time (this is gcc's extension and not part
396
+ // of the C++ standard). As a result, gcc fails to reject the
397
+ // following code with the simple definition:
398
+ //
399
+ // int foo;
400
+ // COMPILE_ASSERT(foo, msg); // not supposed to compile as foo is
401
+ // // not a compile-time constant.
402
+ //
403
+ // - By using the type CompileAssert<(bool(expr))>, we ensures that
404
+ // expr is a compile-time constant. (Template arguments must be
405
+ // determined at compile-time.)
406
+ //
407
+ // - The outter parentheses in CompileAssert<(bool(expr))> are necessary
408
+ // to work around a bug in gcc 3.4.4 and 4.0.1. If we had written
409
+ //
410
+ // CompileAssert<bool(expr)>
411
+ //
412
+ // instead, these compilers will refuse to compile
413
+ //
414
+ // COMPILE_ASSERT(5 > 0, some_message);
415
+ //
416
+ // (They seem to think the ">" in "5 > 0" marks the end of the
417
+ // template argument list.)
418
+ //
419
+ // - The array size is (bool(expr) ? 1 : -1), instead of simply
420
+ //
421
+ // ((expr) ? 1 : -1).
422
+ //
423
+ // This is to avoid running into a bug in MS VC 7.1, which
424
+ // causes ((0.0) ? 1 : -1) to incorrectly evaluate to 1.
425
+
426
+ // ===================================================================
427
+ // from google3/base/scoped_ptr.h
428
+
429
+ namespace internal {
430
+
431
+ // This is an implementation designed to match the anticipated future TR2
432
+ // implementation of the scoped_ptr class, and its closely-related brethren,
433
+ // scoped_array, scoped_ptr_malloc, and make_scoped_ptr.
434
+
435
+ template <class C> class scoped_ptr;
436
+ template <class C> class scoped_array;
437
+
438
+ // A scoped_ptr<T> is like a T*, except that the destructor of scoped_ptr<T>
439
+ // automatically deletes the pointer it holds (if any).
440
+ // That is, scoped_ptr<T> owns the T object that it points to.
441
+ // Like a T*, a scoped_ptr<T> may hold either NULL or a pointer to a T object.
442
+ //
443
+ // The size of a scoped_ptr is small:
444
+ // sizeof(scoped_ptr<C>) == sizeof(C*)
445
+ template <class C>
446
+ class scoped_ptr {
447
+ public:
448
+
449
+ // The element type
450
+ typedef C element_type;
451
+
452
+ // Constructor. Defaults to intializing with NULL.
453
+ // There is no way to create an uninitialized scoped_ptr.
454
+ // The input parameter must be allocated with new.
455
+ explicit scoped_ptr(C* p = NULL) : ptr_(p) { }
456
+
457
+ // Destructor. If there is a C object, delete it.
458
+ // We don't need to test ptr_ == NULL because C++ does that for us.
459
+ ~scoped_ptr() {
460
+ enum { type_must_be_complete = sizeof(C) };
461
+ delete ptr_;
462
+ }
463
+
464
+ // Reset. Deletes the current owned object, if any.
465
+ // Then takes ownership of a new object, if given.
466
+ // this->reset(this->get()) works.
467
+ void reset(C* p = NULL) {
468
+ if (p != ptr_) {
469
+ enum { type_must_be_complete = sizeof(C) };
470
+ delete ptr_;
471
+ ptr_ = p;
472
+ }
473
+ }
474
+
475
+ // Accessors to get the owned object.
476
+ // operator* and operator-> will assert() if there is no current object.
477
+ C& operator*() const {
478
+ assert(ptr_ != NULL);
479
+ return *ptr_;
480
+ }
481
+ C* operator->() const {
482
+ assert(ptr_ != NULL);
483
+ return ptr_;
484
+ }
485
+ C* get() const { return ptr_; }
486
+
487
+ // Comparison operators.
488
+ // These return whether two scoped_ptr refer to the same object, not just to
489
+ // two different but equal objects.
490
+ bool operator==(C* p) const { return ptr_ == p; }
491
+ bool operator!=(C* p) const { return ptr_ != p; }
492
+
493
+ // Swap two scoped pointers.
494
+ void swap(scoped_ptr& p2) {
495
+ C* tmp = ptr_;
496
+ ptr_ = p2.ptr_;
497
+ p2.ptr_ = tmp;
498
+ }
499
+
500
+ // Release a pointer.
501
+ // The return value is the current pointer held by this object.
502
+ // If this object holds a NULL pointer, the return value is NULL.
503
+ // After this operation, this object will hold a NULL pointer,
504
+ // and will not own the object any more.
505
+ C* release() {
506
+ C* retVal = ptr_;
507
+ ptr_ = NULL;
508
+ return retVal;
509
+ }
510
+
511
+ private:
512
+ C* ptr_;
513
+
514
+ // Forbid comparison of scoped_ptr types. If C2 != C, it totally doesn't
515
+ // make sense, and if C2 == C, it still doesn't make sense because you should
516
+ // never have the same object owned by two different scoped_ptrs.
517
+ template <class C2> bool operator==(scoped_ptr<C2> const& p2) const;
518
+ template <class C2> bool operator!=(scoped_ptr<C2> const& p2) const;
519
+
520
+ // Disallow evil constructors
521
+ scoped_ptr(const scoped_ptr&);
522
+ void operator=(const scoped_ptr&);
523
+ };
524
+
525
+ // scoped_array<C> is like scoped_ptr<C>, except that the caller must allocate
526
+ // with new [] and the destructor deletes objects with delete [].
527
+ //
528
+ // As with scoped_ptr<C>, a scoped_array<C> either points to an object
529
+ // or is NULL. A scoped_array<C> owns the object that it points to.
530
+ //
531
+ // Size: sizeof(scoped_array<C>) == sizeof(C*)
532
+ template <class C>
533
+ class scoped_array {
534
+ public:
535
+
536
+ // The element type
537
+ typedef C element_type;
538
+
539
+ // Constructor. Defaults to intializing with NULL.
540
+ // There is no way to create an uninitialized scoped_array.
541
+ // The input parameter must be allocated with new [].
542
+ explicit scoped_array(C* p = NULL) : array_(p) { }
543
+
544
+ // Destructor. If there is a C object, delete it.
545
+ // We don't need to test ptr_ == NULL because C++ does that for us.
546
+ ~scoped_array() {
547
+ enum { type_must_be_complete = sizeof(C) };
548
+ delete[] array_;
549
+ }
550
+
551
+ // Reset. Deletes the current owned object, if any.
552
+ // Then takes ownership of a new object, if given.
553
+ // this->reset(this->get()) works.
554
+ void reset(C* p = NULL) {
555
+ if (p != array_) {
556
+ enum { type_must_be_complete = sizeof(C) };
557
+ delete[] array_;
558
+ array_ = p;
559
+ }
560
+ }
561
+
562
+ // Get one element of the current object.
563
+ // Will assert() if there is no current object, or index i is negative.
564
+ C& operator[](std::ptrdiff_t i) const {
565
+ assert(i >= 0);
566
+ assert(array_ != NULL);
567
+ return array_[i];
568
+ }
569
+
570
+ // Get a pointer to the zeroth element of the current object.
571
+ // If there is no current object, return NULL.
572
+ C* get() const {
573
+ return array_;
574
+ }
575
+
576
+ // Comparison operators.
577
+ // These return whether two scoped_array refer to the same object, not just to
578
+ // two different but equal objects.
579
+ bool operator==(C* p) const { return array_ == p; }
580
+ bool operator!=(C* p) const { return array_ != p; }
581
+
582
+ // Swap two scoped arrays.
583
+ void swap(scoped_array& p2) {
584
+ C* tmp = array_;
585
+ array_ = p2.array_;
586
+ p2.array_ = tmp;
587
+ }
588
+
589
+ // Release an array.
590
+ // The return value is the current pointer held by this object.
591
+ // If this object holds a NULL pointer, the return value is NULL.
592
+ // After this operation, this object will hold a NULL pointer,
593
+ // and will not own the object any more.
594
+ C* release() {
595
+ C* retVal = array_;
596
+ array_ = NULL;
597
+ return retVal;
598
+ }
599
+
600
+ private:
601
+ C* array_;
602
+
603
+ // Forbid comparison of different scoped_array types.
604
+ template <class C2> bool operator==(scoped_array<C2> const& p2) const;
605
+ template <class C2> bool operator!=(scoped_array<C2> const& p2) const;
606
+
607
+ // Disallow evil constructors
608
+ scoped_array(const scoped_array&);
609
+ void operator=(const scoped_array&);
610
+ };
611
+
612
+ } // namespace internal
613
+
614
+ // We made these internal so that they would show up as such in the docs,
615
+ // but we don't want to stick "internal::" in front of them everywhere.
616
+ using internal::scoped_ptr;
617
+ using internal::scoped_array;
618
+
619
+ // ===================================================================
620
+ // emulates google3/base/logging.h
621
+
622
+ enum LogLevel {
623
+ LOGLEVEL_INFO, // Informational. This is never actually used by
624
+ // libprotobuf.
625
+ LOGLEVEL_WARNING, // Warns about issues that, although not technically a
626
+ // problem now, could cause problems in the future. For
627
+ // example, a // warning will be printed when parsing a
628
+ // message that is near the message size limit.
629
+ LOGLEVEL_ERROR, // An error occurred which should never happen during
630
+ // normal use.
631
+ LOGLEVEL_FATAL, // An error occurred from which the library cannot
632
+ // recover. This usually indicates a programming error
633
+ // in the code which calls the library, especially when
634
+ // compiled in debug mode.
635
+
636
+ #ifdef NDEBUG
637
+ LOGLEVEL_DFATAL = LOGLEVEL_ERROR
638
+ #else
639
+ LOGLEVEL_DFATAL = LOGLEVEL_FATAL
640
+ #endif
641
+ };
642
+
643
+ namespace internal {
644
+
645
+ class LogFinisher;
646
+
647
+ class LIBPROTOBUF_EXPORT LogMessage {
648
+ public:
649
+ LogMessage(LogLevel level, const char* filename, int line);
650
+ ~LogMessage();
651
+
652
+ LogMessage& operator<<(const std::string& value);
653
+ LogMessage& operator<<(const char* value);
654
+ LogMessage& operator<<(char value);
655
+ LogMessage& operator<<(int value);
656
+ LogMessage& operator<<(uint value);
657
+ LogMessage& operator<<(long value);
658
+ LogMessage& operator<<(unsigned long value);
659
+ LogMessage& operator<<(double value);
660
+
661
+ private:
662
+ friend class LogFinisher;
663
+ void Finish();
664
+
665
+ LogLevel level_;
666
+ const char* filename_;
667
+ int line_;
668
+ std::string message_;
669
+ };
670
+
671
+ // Used to make the entire "LOG(BLAH) << etc." expression have a void return
672
+ // type and print a newline after each message.
673
+ class LIBPROTOBUF_EXPORT LogFinisher {
674
+ public:
675
+ void operator=(LogMessage& other);
676
+ };
677
+
678
+ } // namespace internal
679
+
680
+ // Undef everything in case we're being mixed with some other Google library
681
+ // which already defined them itself. Presumably all Google libraries will
682
+ // support the same syntax for these so it should not be a big deal if they
683
+ // end up using our definitions instead.
684
+ #undef GOOGLE_LOG
685
+ #undef GOOGLE_LOG_IF
686
+
687
+ #undef GOOGLE_CHECK
688
+ #undef GOOGLE_CHECK_OK
689
+ #undef GOOGLE_CHECK_EQ
690
+ #undef GOOGLE_CHECK_NE
691
+ #undef GOOGLE_CHECK_LT
692
+ #undef GOOGLE_CHECK_LE
693
+ #undef GOOGLE_CHECK_GT
694
+ #undef GOOGLE_CHECK_GE
695
+ #undef GOOGLE_CHECK_NOTNULL
696
+
697
+ #undef GOOGLE_DLOG
698
+ #undef GOOGLE_DCHECK
699
+ #undef GOOGLE_DCHECK_EQ
700
+ #undef GOOGLE_DCHECK_NE
701
+ #undef GOOGLE_DCHECK_LT
702
+ #undef GOOGLE_DCHECK_LE
703
+ #undef GOOGLE_DCHECK_GT
704
+ #undef GOOGLE_DCHECK_GE
705
+
706
+ #define GOOGLE_LOG(LEVEL) \
707
+ ::google::protobuf::internal::LogFinisher() = \
708
+ ::google::protobuf::internal::LogMessage( \
709
+ ::google::protobuf::LOGLEVEL_##LEVEL, __FILE__, __LINE__)
710
+ #define GOOGLE_LOG_IF(LEVEL, CONDITION) \
711
+ !(CONDITION) ? (void)0 : GOOGLE_LOG(LEVEL)
712
+
713
+ #define GOOGLE_CHECK(EXPRESSION) \
714
+ GOOGLE_LOG_IF(FATAL, !(EXPRESSION)) << "CHECK failed: " #EXPRESSION ": "
715
+ #define GOOGLE_CHECK_OK(A) GOOGLE_CHECK(A)
716
+ #define GOOGLE_CHECK_EQ(A, B) GOOGLE_CHECK((A) == (B))
717
+ #define GOOGLE_CHECK_NE(A, B) GOOGLE_CHECK((A) != (B))
718
+ #define GOOGLE_CHECK_LT(A, B) GOOGLE_CHECK((A) < (B))
719
+ #define GOOGLE_CHECK_LE(A, B) GOOGLE_CHECK((A) <= (B))
720
+ #define GOOGLE_CHECK_GT(A, B) GOOGLE_CHECK((A) > (B))
721
+ #define GOOGLE_CHECK_GE(A, B) GOOGLE_CHECK((A) >= (B))
722
+
723
+ namespace internal {
724
+ template<typename T>
725
+ T* CheckNotNull(const char* /* file */, int /* line */,
726
+ const char* name, T* val) {
727
+ if (val == NULL) {
728
+ GOOGLE_LOG(FATAL) << name;
729
+ }
730
+ return val;
731
+ }
732
+ } // namespace internal
733
+ #define GOOGLE_CHECK_NOTNULL(A) \
734
+ internal::CheckNotNull(__FILE__, __LINE__, "'" #A "' must not be NULL", (A))
735
+
736
+ #ifdef NDEBUG
737
+
738
+ #define GOOGLE_DLOG GOOGLE_LOG_IF(INFO, false)
739
+
740
+ #define GOOGLE_DCHECK(EXPRESSION) while(false) GOOGLE_CHECK(EXPRESSION)
741
+ #define GOOGLE_DCHECK_EQ(A, B) GOOGLE_DCHECK((A) == (B))
742
+ #define GOOGLE_DCHECK_NE(A, B) GOOGLE_DCHECK((A) != (B))
743
+ #define GOOGLE_DCHECK_LT(A, B) GOOGLE_DCHECK((A) < (B))
744
+ #define GOOGLE_DCHECK_LE(A, B) GOOGLE_DCHECK((A) <= (B))
745
+ #define GOOGLE_DCHECK_GT(A, B) GOOGLE_DCHECK((A) > (B))
746
+ #define GOOGLE_DCHECK_GE(A, B) GOOGLE_DCHECK((A) >= (B))
747
+
748
+ #else // NDEBUG
749
+
750
+ #define GOOGLE_DLOG GOOGLE_LOG
751
+
752
+ #define GOOGLE_DCHECK GOOGLE_CHECK
753
+ #define GOOGLE_DCHECK_EQ GOOGLE_CHECK_EQ
754
+ #define GOOGLE_DCHECK_NE GOOGLE_CHECK_NE
755
+ #define GOOGLE_DCHECK_LT GOOGLE_CHECK_LT
756
+ #define GOOGLE_DCHECK_LE GOOGLE_CHECK_LE
757
+ #define GOOGLE_DCHECK_GT GOOGLE_CHECK_GT
758
+ #define GOOGLE_DCHECK_GE GOOGLE_CHECK_GE
759
+
760
+ #endif // !NDEBUG
761
+
762
+ typedef void LogHandler(LogLevel level, const char* filename, int line,
763
+ const std::string& message);
764
+
765
+ // The protobuf library sometimes writes warning and error messages to
766
+ // stderr. These messages are primarily useful for developers, but may
767
+ // also help end users figure out a problem. If you would prefer that
768
+ // these messages be sent somewhere other than stderr, call SetLogHandler()
769
+ // to set your own handler. This returns the old handler. Set the handler
770
+ // to NULL to ignore log messages (but see also LogSilencer, below).
771
+ //
772
+ // Obviously, SetLogHandler is not thread-safe. You should only call it
773
+ // at initialization time, and probably not from library code. If you
774
+ // simply want to suppress log messages temporarily (e.g. because you
775
+ // have some code that tends to trigger them frequently and you know
776
+ // the warnings are not important to you), use the LogSilencer class
777
+ // below.
778
+ LIBPROTOBUF_EXPORT LogHandler* SetLogHandler(LogHandler* new_func);
779
+
780
+ // Create a LogSilencer if you want to temporarily suppress all log
781
+ // messages. As long as any LogSilencer objects exist, non-fatal
782
+ // log messages will be discarded (the current LogHandler will *not*
783
+ // be called). Constructing a LogSilencer is thread-safe. You may
784
+ // accidentally suppress log messages occurring in another thread, but
785
+ // since messages are generally for debugging purposes only, this isn't
786
+ // a big deal. If you want to intercept log messages, use SetLogHandler().
787
+ class LIBPROTOBUF_EXPORT LogSilencer {
788
+ public:
789
+ LogSilencer();
790
+ ~LogSilencer();
791
+ };
792
+
793
+ // ===================================================================
794
+ // emulates google3/base/callback.h
795
+
796
+ // Abstract interface for a callback. When calling an RPC, you must provide
797
+ // a Closure to call when the procedure completes. See the Service interface
798
+ // in service.h.
799
+ //
800
+ // To automatically construct a Closure which calls a particular function or
801
+ // method with a particular set of parameters, use the NewCallback() function.
802
+ // Example:
803
+ // void FooDone(const FooResponse* response) {
804
+ // ...
805
+ // }
806
+ //
807
+ // void CallFoo() {
808
+ // ...
809
+ // // When done, call FooDone() and pass it a pointer to the response.
810
+ // Closure* callback = NewCallback(&FooDone, response);
811
+ // // Make the call.
812
+ // service->Foo(controller, request, response, callback);
813
+ // }
814
+ //
815
+ // Example that calls a method:
816
+ // class Handler {
817
+ // public:
818
+ // ...
819
+ //
820
+ // void FooDone(const FooResponse* response) {
821
+ // ...
822
+ // }
823
+ //
824
+ // void CallFoo() {
825
+ // ...
826
+ // // When done, call FooDone() and pass it a pointer to the response.
827
+ // Closure* callback = NewCallback(this, &Handler::FooDone, response);
828
+ // // Make the call.
829
+ // service->Foo(controller, request, response, callback);
830
+ // }
831
+ // };
832
+ //
833
+ // Currently NewCallback() supports binding zero, one, or two arguments.
834
+ //
835
+ // Callbacks created with NewCallback() automatically delete themselves when
836
+ // executed. They should be used when a callback is to be called exactly
837
+ // once (usually the case with RPC callbacks). If a callback may be called
838
+ // a different number of times (including zero), create it with
839
+ // NewPermanentCallback() instead. You are then responsible for deleting the
840
+ // callback (using the "delete" keyword as normal).
841
+ //
842
+ // Note that NewCallback() is a bit touchy regarding argument types. Generally,
843
+ // the values you provide for the parameter bindings must exactly match the
844
+ // types accepted by the callback function. For example:
845
+ // void Foo(string s);
846
+ // NewCallback(&Foo, "foo"); // WON'T WORK: const char* != string
847
+ // NewCallback(&Foo, string("foo")); // WORKS
848
+ // Also note that the arguments cannot be references:
849
+ // void Foo(const string& s);
850
+ // string my_str;
851
+ // NewCallback(&Foo, my_str); // WON'T WORK: Can't use referecnes.
852
+ // However, correctly-typed pointers will work just fine.
853
+ class LIBPROTOBUF_EXPORT Closure {
854
+ public:
855
+ Closure() {}
856
+ virtual ~Closure();
857
+
858
+ virtual void Run() = 0;
859
+
860
+ private:
861
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Closure);
862
+ };
863
+
864
+ namespace internal {
865
+
866
+ class LIBPROTOBUF_EXPORT FunctionClosure0 : public Closure {
867
+ public:
868
+ typedef void (*FunctionType)();
869
+
870
+ FunctionClosure0(FunctionType function, bool self_deleting)
871
+ : function_(function), self_deleting_(self_deleting) {}
872
+ ~FunctionClosure0();
873
+
874
+ void Run() {
875
+ bool needs_delete = self_deleting_; // read in case callback deletes
876
+ function_();
877
+ if (needs_delete) delete this;
878
+ }
879
+
880
+ private:
881
+ FunctionType function_;
882
+ bool self_deleting_;
883
+ };
884
+
885
+ template <typename Class>
886
+ class MethodClosure0 : public Closure {
887
+ public:
888
+ typedef void (Class::*MethodType)();
889
+
890
+ MethodClosure0(Class* object, MethodType method, bool self_deleting)
891
+ : object_(object), method_(method), self_deleting_(self_deleting) {}
892
+ ~MethodClosure0() {}
893
+
894
+ void Run() {
895
+ bool needs_delete = self_deleting_; // read in case callback deletes
896
+ (object_->*method_)();
897
+ if (needs_delete) delete this;
898
+ }
899
+
900
+ private:
901
+ Class* object_;
902
+ MethodType method_;
903
+ bool self_deleting_;
904
+ };
905
+
906
+ template <typename Arg1>
907
+ class FunctionClosure1 : public Closure {
908
+ public:
909
+ typedef void (*FunctionType)(Arg1 arg1);
910
+
911
+ FunctionClosure1(FunctionType function, bool self_deleting,
912
+ Arg1 arg1)
913
+ : function_(function), self_deleting_(self_deleting),
914
+ arg1_(arg1) {}
915
+ ~FunctionClosure1() {}
916
+
917
+ void Run() {
918
+ bool needs_delete = self_deleting_; // read in case callback deletes
919
+ function_(arg1_);
920
+ if (needs_delete) delete this;
921
+ }
922
+
923
+ private:
924
+ FunctionType function_;
925
+ bool self_deleting_;
926
+ Arg1 arg1_;
927
+ };
928
+
929
+ template <typename Class, typename Arg1>
930
+ class MethodClosure1 : public Closure {
931
+ public:
932
+ typedef void (Class::*MethodType)(Arg1 arg1);
933
+
934
+ MethodClosure1(Class* object, MethodType method, bool self_deleting,
935
+ Arg1 arg1)
936
+ : object_(object), method_(method), self_deleting_(self_deleting),
937
+ arg1_(arg1) {}
938
+ ~MethodClosure1() {}
939
+
940
+ void Run() {
941
+ bool needs_delete = self_deleting_; // read in case callback deletes
942
+ (object_->*method_)(arg1_);
943
+ if (needs_delete) delete this;
944
+ }
945
+
946
+ private:
947
+ Class* object_;
948
+ MethodType method_;
949
+ bool self_deleting_;
950
+ Arg1 arg1_;
951
+ };
952
+
953
+ template <typename Arg1, typename Arg2>
954
+ class FunctionClosure2 : public Closure {
955
+ public:
956
+ typedef void (*FunctionType)(Arg1 arg1, Arg2 arg2);
957
+
958
+ FunctionClosure2(FunctionType function, bool self_deleting,
959
+ Arg1 arg1, Arg2 arg2)
960
+ : function_(function), self_deleting_(self_deleting),
961
+ arg1_(arg1), arg2_(arg2) {}
962
+ ~FunctionClosure2() {}
963
+
964
+ void Run() {
965
+ bool needs_delete = self_deleting_; // read in case callback deletes
966
+ function_(arg1_, arg2_);
967
+ if (needs_delete) delete this;
968
+ }
969
+
970
+ private:
971
+ FunctionType function_;
972
+ bool self_deleting_;
973
+ Arg1 arg1_;
974
+ Arg2 arg2_;
975
+ };
976
+
977
+ template <typename Class, typename Arg1, typename Arg2>
978
+ class MethodClosure2 : public Closure {
979
+ public:
980
+ typedef void (Class::*MethodType)(Arg1 arg1, Arg2 arg2);
981
+
982
+ MethodClosure2(Class* object, MethodType method, bool self_deleting,
983
+ Arg1 arg1, Arg2 arg2)
984
+ : object_(object), method_(method), self_deleting_(self_deleting),
985
+ arg1_(arg1), arg2_(arg2) {}
986
+ ~MethodClosure2() {}
987
+
988
+ void Run() {
989
+ bool needs_delete = self_deleting_; // read in case callback deletes
990
+ (object_->*method_)(arg1_, arg2_);
991
+ if (needs_delete) delete this;
992
+ }
993
+
994
+ private:
995
+ Class* object_;
996
+ MethodType method_;
997
+ bool self_deleting_;
998
+ Arg1 arg1_;
999
+ Arg2 arg2_;
1000
+ };
1001
+
1002
+ } // namespace internal
1003
+
1004
+ // See Closure.
1005
+ inline Closure* NewCallback(void (*function)()) {
1006
+ return new internal::FunctionClosure0(function, true);
1007
+ }
1008
+
1009
+ // See Closure.
1010
+ inline Closure* NewPermanentCallback(void (*function)()) {
1011
+ return new internal::FunctionClosure0(function, false);
1012
+ }
1013
+
1014
+ // See Closure.
1015
+ template <typename Class>
1016
+ inline Closure* NewCallback(Class* object, void (Class::*method)()) {
1017
+ return new internal::MethodClosure0<Class>(object, method, true);
1018
+ }
1019
+
1020
+ // See Closure.
1021
+ template <typename Class>
1022
+ inline Closure* NewPermanentCallback(Class* object, void (Class::*method)()) {
1023
+ return new internal::MethodClosure0<Class>(object, method, false);
1024
+ }
1025
+
1026
+ // See Closure.
1027
+ template <typename Arg1>
1028
+ inline Closure* NewCallback(void (*function)(Arg1),
1029
+ Arg1 arg1) {
1030
+ return new internal::FunctionClosure1<Arg1>(function, true, arg1);
1031
+ }
1032
+
1033
+ // See Closure.
1034
+ template <typename Arg1>
1035
+ inline Closure* NewPermanentCallback(void (*function)(Arg1),
1036
+ Arg1 arg1) {
1037
+ return new internal::FunctionClosure1<Arg1>(function, false, arg1);
1038
+ }
1039
+
1040
+ // See Closure.
1041
+ template <typename Class, typename Arg1>
1042
+ inline Closure* NewCallback(Class* object, void (Class::*method)(Arg1),
1043
+ Arg1 arg1) {
1044
+ return new internal::MethodClosure1<Class, Arg1>(object, method, true, arg1);
1045
+ }
1046
+
1047
+ // See Closure.
1048
+ template <typename Class, typename Arg1>
1049
+ inline Closure* NewPermanentCallback(Class* object, void (Class::*method)(Arg1),
1050
+ Arg1 arg1) {
1051
+ return new internal::MethodClosure1<Class, Arg1>(object, method, false, arg1);
1052
+ }
1053
+
1054
+ // See Closure.
1055
+ template <typename Arg1, typename Arg2>
1056
+ inline Closure* NewCallback(void (*function)(Arg1, Arg2),
1057
+ Arg1 arg1, Arg2 arg2) {
1058
+ return new internal::FunctionClosure2<Arg1, Arg2>(
1059
+ function, true, arg1, arg2);
1060
+ }
1061
+
1062
+ // See Closure.
1063
+ template <typename Arg1, typename Arg2>
1064
+ inline Closure* NewPermanentCallback(void (*function)(Arg1, Arg2),
1065
+ Arg1 arg1, Arg2 arg2) {
1066
+ return new internal::FunctionClosure2<Arg1, Arg2>(
1067
+ function, false, arg1, arg2);
1068
+ }
1069
+
1070
+ // See Closure.
1071
+ template <typename Class, typename Arg1, typename Arg2>
1072
+ inline Closure* NewCallback(Class* object, void (Class::*method)(Arg1, Arg2),
1073
+ Arg1 arg1, Arg2 arg2) {
1074
+ return new internal::MethodClosure2<Class, Arg1, Arg2>(
1075
+ object, method, true, arg1, arg2);
1076
+ }
1077
+
1078
+ // See Closure.
1079
+ template <typename Class, typename Arg1, typename Arg2>
1080
+ inline Closure* NewPermanentCallback(
1081
+ Class* object, void (Class::*method)(Arg1, Arg2),
1082
+ Arg1 arg1, Arg2 arg2) {
1083
+ return new internal::MethodClosure2<Class, Arg1, Arg2>(
1084
+ object, method, false, arg1, arg2);
1085
+ }
1086
+
1087
+ // A function which does nothing. Useful for creating no-op callbacks, e.g.:
1088
+ // Closure* nothing = NewCallback(&DoNothing);
1089
+ void LIBPROTOBUF_EXPORT DoNothing();
1090
+
1091
+ // ===================================================================
1092
+ // emulates google3/base/mutex.h
1093
+
1094
+ namespace internal {
1095
+
1096
+ // A Mutex is a non-reentrant (aka non-recursive) mutex. At most one thread T
1097
+ // may hold a mutex at a given time. If T attempts to Lock() the same Mutex
1098
+ // while holding it, T will deadlock.
1099
+ class LIBPROTOBUF_EXPORT Mutex {
1100
+ public:
1101
+ // Create a Mutex that is not held by anybody.
1102
+ Mutex();
1103
+
1104
+ // Destructor
1105
+ ~Mutex();
1106
+
1107
+ // Block if necessary until this Mutex is free, then acquire it exclusively.
1108
+ void Lock();
1109
+
1110
+ // Release this Mutex. Caller must hold it exclusively.
1111
+ void Unlock();
1112
+
1113
+ // Crash if this Mutex is not held exclusively by this thread.
1114
+ // May fail to crash when it should; will never crash when it should not.
1115
+ void AssertHeld();
1116
+
1117
+ private:
1118
+ struct Internal;
1119
+ Internal* mInternal;
1120
+
1121
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Mutex);
1122
+ };
1123
+
1124
+ // MutexLock(mu) acquires mu when constructed and releases it when destroyed.
1125
+ class LIBPROTOBUF_EXPORT MutexLock {
1126
+ public:
1127
+ explicit MutexLock(Mutex *mu) : mu_(mu) { this->mu_->Lock(); }
1128
+ ~MutexLock() { this->mu_->Unlock(); }
1129
+ private:
1130
+ Mutex *const mu_;
1131
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MutexLock);
1132
+ };
1133
+
1134
+ // TODO(kenton): Implement these? Hard to implement portably.
1135
+ typedef MutexLock ReaderMutexLock;
1136
+ typedef MutexLock WriterMutexLock;
1137
+
1138
+ // MutexLockMaybe is like MutexLock, but is a no-op when mu is NULL.
1139
+ class LIBPROTOBUF_EXPORT MutexLockMaybe {
1140
+ public:
1141
+ explicit MutexLockMaybe(Mutex *mu) :
1142
+ mu_(mu) { if (this->mu_ != NULL) { this->mu_->Lock(); } }
1143
+ ~MutexLockMaybe() { if (this->mu_ != NULL) { this->mu_->Unlock(); } }
1144
+ private:
1145
+ Mutex *const mu_;
1146
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MutexLockMaybe);
1147
+ };
1148
+
1149
+ } // namespace internal
1150
+
1151
+ // We made these internal so that they would show up as such in the docs,
1152
+ // but we don't want to stick "internal::" in front of them everywhere.
1153
+ using internal::Mutex;
1154
+ using internal::MutexLock;
1155
+ using internal::ReaderMutexLock;
1156
+ using internal::WriterMutexLock;
1157
+ using internal::MutexLockMaybe;
1158
+
1159
+ // ===================================================================
1160
+ // from google3/util/utf8/public/unilib.h
1161
+
1162
+ namespace internal {
1163
+
1164
+ // Checks if the buffer contains structurally-valid UTF-8. Implemented in
1165
+ // structurally_valid.cc.
1166
+ LIBPROTOBUF_EXPORT bool IsStructurallyValidUTF8(const char* buf, int len);
1167
+
1168
+ } // namespace internal
1169
+
1170
+ // ===================================================================
1171
+ // from google3/util/endian/endian.h
1172
+ LIBPROTOBUF_EXPORT uint32 ghtonl(uint32 x);
1173
+
1174
+ // ===================================================================
1175
+ // Shutdown support.
1176
+
1177
+ // Shut down the entire protocol buffers library, deleting all static-duration
1178
+ // objects allocated by the library or by generated .pb.cc files.
1179
+ //
1180
+ // There are two reasons you might want to call this:
1181
+ // * You use a draconian definition of "memory leak" in which you expect
1182
+ // every single malloc() to have a corresponding free(), even for objects
1183
+ // which live until program exit.
1184
+ // * You are writing a dynamically-loaded library which needs to clean up
1185
+ // after itself when the library is unloaded.
1186
+ //
1187
+ // It is safe to call this multiple times. However, it is not safe to use
1188
+ // any other part of the protocol buffers library after
1189
+ // ShutdownProtobufLibrary() has been called.
1190
+ LIBPROTOBUF_EXPORT void ShutdownProtobufLibrary();
1191
+
1192
+ namespace internal {
1193
+
1194
+ // Register a function to be called when ShutdownProtocolBuffers() is called.
1195
+ LIBPROTOBUF_EXPORT void OnShutdown(void (*func)());
1196
+
1197
+ } // namespace internal
1198
+
1199
+ #if PROTOBUF_USE_EXCEPTIONS
1200
+ class FatalException : public std::exception {
1201
+ public:
1202
+ FatalException(const char* filename, int line, const std::string& message)
1203
+ : filename_(filename), line_(line), message_(message) {}
1204
+ virtual ~FatalException() throw();
1205
+
1206
+ virtual const char* what() const throw();
1207
+
1208
+ const char* filename() const { return filename_; }
1209
+ int line() const { return line_; }
1210
+ const std::string& message() const { return message_; }
1211
+
1212
+ private:
1213
+ const char* filename_;
1214
+ const int line_;
1215
+ const std::string message_;
1216
+ };
1217
+ #endif
1218
+
1219
+ // This is at the end of the file instead of the beginning to work around a bug
1220
+ // in some versions of MSVC.
1221
+ using namespace std; // Don't do this at home, kids.
1222
+
1223
+ } // namespace protobuf
1224
+ } // namespace google
1225
+
1226
+ #endif // GOOGLE_PROTOBUF_COMMON_H__