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,1691 @@
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)
32
+ // Based on original Protocol Buffers design by
33
+ // Sanjay Ghemawat, Jeff Dean, and others.
34
+ //
35
+ // This file contains classes which describe a type of protocol message.
36
+ // You can use a message's descriptor to learn at runtime what fields
37
+ // it contains and what the types of those fields are. The Message
38
+ // interface also allows you to dynamically access and modify individual
39
+ // fields by passing the FieldDescriptor of the field you are interested
40
+ // in.
41
+ //
42
+ // Most users will not care about descriptors, because they will write
43
+ // code specific to certain protocol types and will simply use the classes
44
+ // generated by the protocol compiler directly. Advanced users who want
45
+ // to operate on arbitrary types (not known at compile time) may want to
46
+ // read descriptors in order to learn about the contents of a message.
47
+ // A very small number of users will want to construct their own
48
+ // Descriptors, either because they are implementing Message manually or
49
+ // because they are writing something like the protocol compiler.
50
+ //
51
+ // For an example of how you might use descriptors, see the code example
52
+ // at the top of message.h.
53
+
54
+ #ifndef GOOGLE_PROTOBUF_DESCRIPTOR_H__
55
+ #define GOOGLE_PROTOBUF_DESCRIPTOR_H__
56
+
57
+ #include <set>
58
+ #include <string>
59
+ #include <vector>
60
+ #include <google/protobuf/stubs/common.h>
61
+
62
+
63
+ namespace google {
64
+ namespace protobuf {
65
+
66
+ // Defined in this file.
67
+ class Descriptor;
68
+ class FieldDescriptor;
69
+ class OneofDescriptor;
70
+ class EnumDescriptor;
71
+ class EnumValueDescriptor;
72
+ class ServiceDescriptor;
73
+ class MethodDescriptor;
74
+ class FileDescriptor;
75
+ class DescriptorDatabase;
76
+ class DescriptorPool;
77
+
78
+ // Defined in descriptor.proto
79
+ class DescriptorProto;
80
+ class FieldDescriptorProto;
81
+ class OneofDescriptorProto;
82
+ class EnumDescriptorProto;
83
+ class EnumValueDescriptorProto;
84
+ class ServiceDescriptorProto;
85
+ class MethodDescriptorProto;
86
+ class FileDescriptorProto;
87
+ class MessageOptions;
88
+ class FieldOptions;
89
+ class EnumOptions;
90
+ class EnumValueOptions;
91
+ class ServiceOptions;
92
+ class MethodOptions;
93
+ class FileOptions;
94
+ class UninterpretedOption;
95
+ class SourceCodeInfo;
96
+
97
+ // Defined in message.h
98
+ class Message;
99
+
100
+ // Defined in descriptor.cc
101
+ class DescriptorBuilder;
102
+ class FileDescriptorTables;
103
+
104
+ // Defined in unknown_field_set.h.
105
+ class UnknownField;
106
+
107
+ // NB, all indices are zero-based.
108
+ struct SourceLocation {
109
+ int start_line;
110
+ int end_line;
111
+ int start_column;
112
+ int end_column;
113
+
114
+ // Doc comments found at the source location.
115
+ // TODO(kenton): Maybe this struct should have been named SourceInfo or
116
+ // something instead. Oh well.
117
+ string leading_comments;
118
+ string trailing_comments;
119
+ };
120
+
121
+ // Describes a type of protocol message, or a particular group within a
122
+ // message. To obtain the Descriptor for a given message object, call
123
+ // Message::GetDescriptor(). Generated message classes also have a
124
+ // static method called descriptor() which returns the type's descriptor.
125
+ // Use DescriptorPool to construct your own descriptors.
126
+ class LIBPROTOBUF_EXPORT Descriptor {
127
+ public:
128
+ // The name of the message type, not including its scope.
129
+ const string& name() const;
130
+
131
+ // The fully-qualified name of the message type, scope delimited by
132
+ // periods. For example, message type "Foo" which is declared in package
133
+ // "bar" has full name "bar.Foo". If a type "Baz" is nested within
134
+ // Foo, Baz's full_name is "bar.Foo.Baz". To get only the part that
135
+ // comes after the last '.', use name().
136
+ const string& full_name() const;
137
+
138
+ // Index of this descriptor within the file or containing type's message
139
+ // type array.
140
+ int index() const;
141
+
142
+ // The .proto file in which this message type was defined. Never NULL.
143
+ const FileDescriptor* file() const;
144
+
145
+ // If this Descriptor describes a nested type, this returns the type
146
+ // in which it is nested. Otherwise, returns NULL.
147
+ const Descriptor* containing_type() const;
148
+
149
+ // Get options for this message type. These are specified in the .proto file
150
+ // by placing lines like "option foo = 1234;" in the message definition.
151
+ // Allowed options are defined by MessageOptions in
152
+ // google/protobuf/descriptor.proto, and any available extensions of that
153
+ // message.
154
+ const MessageOptions& options() const;
155
+
156
+ // Write the contents of this Descriptor into the given DescriptorProto.
157
+ // The target DescriptorProto must be clear before calling this; if it
158
+ // isn't, the result may be garbage.
159
+ void CopyTo(DescriptorProto* proto) const;
160
+
161
+ // Write the contents of this decriptor in a human-readable form. Output
162
+ // will be suitable for re-parsing.
163
+ string DebugString() const;
164
+
165
+ // Returns true if this is a placeholder for an unknown type. This will
166
+ // only be the case if this descriptor comes from a DescriptorPool
167
+ // with AllowUnknownDependencies() set.
168
+ bool is_placeholder() const;
169
+
170
+ // Field stuff -----------------------------------------------------
171
+
172
+ // The number of fields in this message type.
173
+ int field_count() const;
174
+ // Gets a field by index, where 0 <= index < field_count().
175
+ // These are returned in the order they were defined in the .proto file.
176
+ const FieldDescriptor* field(int index) const;
177
+
178
+ // Looks up a field by declared tag number. Returns NULL if no such field
179
+ // exists.
180
+ const FieldDescriptor* FindFieldByNumber(int number) const;
181
+ // Looks up a field by name. Returns NULL if no such field exists.
182
+ const FieldDescriptor* FindFieldByName(const string& name) const;
183
+
184
+ // Looks up a field by lowercased name (as returned by lowercase_name()).
185
+ // This lookup may be ambiguous if multiple field names differ only by case,
186
+ // in which case the field returned is chosen arbitrarily from the matches.
187
+ const FieldDescriptor* FindFieldByLowercaseName(
188
+ const string& lowercase_name) const;
189
+
190
+ // Looks up a field by camel-case name (as returned by camelcase_name()).
191
+ // This lookup may be ambiguous if multiple field names differ in a way that
192
+ // leads them to have identical camel-case names, in which case the field
193
+ // returned is chosen arbitrarily from the matches.
194
+ const FieldDescriptor* FindFieldByCamelcaseName(
195
+ const string& camelcase_name) const;
196
+
197
+ // The number of oneofs in this message type.
198
+ int oneof_decl_count() const;
199
+ // Get a oneof by index, where 0 <= index < oneof_decl_count().
200
+ // These are returned in the order they were defined in the .proto file.
201
+ const OneofDescriptor* oneof_decl(int index) const;
202
+
203
+ // Looks up a oneof by name. Returns NULL if no such oneof exists.
204
+ const OneofDescriptor* FindOneofByName(const string& name) const;
205
+
206
+ // Nested type stuff -----------------------------------------------
207
+
208
+ // The number of nested types in this message type.
209
+ int nested_type_count() const;
210
+ // Gets a nested type by index, where 0 <= index < nested_type_count().
211
+ // These are returned in the order they were defined in the .proto file.
212
+ const Descriptor* nested_type(int index) const;
213
+
214
+ // Looks up a nested type by name. Returns NULL if no such nested type
215
+ // exists.
216
+ const Descriptor* FindNestedTypeByName(const string& name) const;
217
+
218
+ // Enum stuff ------------------------------------------------------
219
+
220
+ // The number of enum types in this message type.
221
+ int enum_type_count() const;
222
+ // Gets an enum type by index, where 0 <= index < enum_type_count().
223
+ // These are returned in the order they were defined in the .proto file.
224
+ const EnumDescriptor* enum_type(int index) const;
225
+
226
+ // Looks up an enum type by name. Returns NULL if no such enum type exists.
227
+ const EnumDescriptor* FindEnumTypeByName(const string& name) const;
228
+
229
+ // Looks up an enum value by name, among all enum types in this message.
230
+ // Returns NULL if no such value exists.
231
+ const EnumValueDescriptor* FindEnumValueByName(const string& name) const;
232
+
233
+ // Extensions ------------------------------------------------------
234
+
235
+ // A range of field numbers which are designated for third-party
236
+ // extensions.
237
+ struct ExtensionRange {
238
+ int start; // inclusive
239
+ int end; // exclusive
240
+ };
241
+
242
+ // The number of extension ranges in this message type.
243
+ int extension_range_count() const;
244
+ // Gets an extension range by index, where 0 <= index <
245
+ // extension_range_count(). These are returned in the order they were defined
246
+ // in the .proto file.
247
+ const ExtensionRange* extension_range(int index) const;
248
+
249
+ // Returns true if the number is in one of the extension ranges.
250
+ bool IsExtensionNumber(int number) const;
251
+
252
+ // Returns NULL if no extension range contains the given number.
253
+ const ExtensionRange* FindExtensionRangeContainingNumber(int number) const;
254
+
255
+ // The number of extensions -- extending *other* messages -- that were
256
+ // defined nested within this message type's scope.
257
+ int extension_count() const;
258
+ // Get an extension by index, where 0 <= index < extension_count().
259
+ // These are returned in the order they were defined in the .proto file.
260
+ const FieldDescriptor* extension(int index) const;
261
+
262
+ // Looks up a named extension (which extends some *other* message type)
263
+ // defined within this message type's scope.
264
+ const FieldDescriptor* FindExtensionByName(const string& name) const;
265
+
266
+ // Similar to FindFieldByLowercaseName(), but finds extensions defined within
267
+ // this message type's scope.
268
+ const FieldDescriptor* FindExtensionByLowercaseName(const string& name) const;
269
+
270
+ // Similar to FindFieldByCamelcaseName(), but finds extensions defined within
271
+ // this message type's scope.
272
+ const FieldDescriptor* FindExtensionByCamelcaseName(const string& name) const;
273
+
274
+ // Source Location ---------------------------------------------------
275
+
276
+ // Updates |*out_location| to the source location of the complete
277
+ // extent of this message declaration. Returns false and leaves
278
+ // |*out_location| unchanged iff location information was not available.
279
+ bool GetSourceLocation(SourceLocation* out_location) const;
280
+
281
+ private:
282
+ typedef MessageOptions OptionsType;
283
+
284
+ // Internal version of DebugString; controls the level of indenting for
285
+ // correct depth
286
+ void DebugString(int depth, string *contents) const;
287
+
288
+ // Walks up the descriptor tree to generate the source location path
289
+ // to this descriptor from the file root.
290
+ void GetLocationPath(vector<int>* output) const;
291
+
292
+ const string* name_;
293
+ const string* full_name_;
294
+ const FileDescriptor* file_;
295
+ const Descriptor* containing_type_;
296
+ const MessageOptions* options_;
297
+
298
+ // True if this is a placeholder for an unknown type.
299
+ bool is_placeholder_;
300
+ // True if this is a placeholder and the type name wasn't fully-qualified.
301
+ bool is_unqualified_placeholder_;
302
+
303
+ int field_count_;
304
+ FieldDescriptor* fields_;
305
+ int oneof_decl_count_;
306
+ OneofDescriptor* oneof_decls_;
307
+ int nested_type_count_;
308
+ Descriptor* nested_types_;
309
+ int enum_type_count_;
310
+ EnumDescriptor* enum_types_;
311
+ int extension_range_count_;
312
+ ExtensionRange* extension_ranges_;
313
+ int extension_count_;
314
+ FieldDescriptor* extensions_;
315
+ // IMPORTANT: If you add a new field, make sure to search for all instances
316
+ // of Allocate<Descriptor>() and AllocateArray<Descriptor>() in descriptor.cc
317
+ // and update them to initialize the field.
318
+
319
+ // Must be constructed using DescriptorPool.
320
+ Descriptor() {}
321
+ friend class DescriptorBuilder;
322
+ friend class EnumDescriptor;
323
+ friend class FieldDescriptor;
324
+ friend class OneofDescriptor;
325
+ friend class MethodDescriptor;
326
+ friend class FileDescriptor;
327
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Descriptor);
328
+ };
329
+
330
+ // Describes a single field of a message. To get the descriptor for a given
331
+ // field, first get the Descriptor for the message in which it is defined,
332
+ // then call Descriptor::FindFieldByName(). To get a FieldDescriptor for
333
+ // an extension, do one of the following:
334
+ // - Get the Descriptor or FileDescriptor for its containing scope, then
335
+ // call Descriptor::FindExtensionByName() or
336
+ // FileDescriptor::FindExtensionByName().
337
+ // - Given a DescriptorPool, call DescriptorPool::FindExtensionByNumber().
338
+ // - Given a Reflection for a message object, call
339
+ // Reflection::FindKnownExtensionByName() or
340
+ // Reflection::FindKnownExtensionByNumber().
341
+ // Use DescriptorPool to construct your own descriptors.
342
+ class LIBPROTOBUF_EXPORT FieldDescriptor {
343
+ public:
344
+ // Identifies a field type. 0 is reserved for errors. The order is weird
345
+ // for historical reasons. Types 12 and up are new in proto2.
346
+ enum Type {
347
+ TYPE_DOUBLE = 1, // double, exactly eight bytes on the wire.
348
+ TYPE_FLOAT = 2, // float, exactly four bytes on the wire.
349
+ TYPE_INT64 = 3, // int64, varint on the wire. Negative numbers
350
+ // take 10 bytes. Use TYPE_SINT64 if negative
351
+ // values are likely.
352
+ TYPE_UINT64 = 4, // uint64, varint on the wire.
353
+ TYPE_INT32 = 5, // int32, varint on the wire. Negative numbers
354
+ // take 10 bytes. Use TYPE_SINT32 if negative
355
+ // values are likely.
356
+ TYPE_FIXED64 = 6, // uint64, exactly eight bytes on the wire.
357
+ TYPE_FIXED32 = 7, // uint32, exactly four bytes on the wire.
358
+ TYPE_BOOL = 8, // bool, varint on the wire.
359
+ TYPE_STRING = 9, // UTF-8 text.
360
+ TYPE_GROUP = 10, // Tag-delimited message. Deprecated.
361
+ TYPE_MESSAGE = 11, // Length-delimited message.
362
+
363
+ TYPE_BYTES = 12, // Arbitrary byte array.
364
+ TYPE_UINT32 = 13, // uint32, varint on the wire
365
+ TYPE_ENUM = 14, // Enum, varint on the wire
366
+ TYPE_SFIXED32 = 15, // int32, exactly four bytes on the wire
367
+ TYPE_SFIXED64 = 16, // int64, exactly eight bytes on the wire
368
+ TYPE_SINT32 = 17, // int32, ZigZag-encoded varint on the wire
369
+ TYPE_SINT64 = 18, // int64, ZigZag-encoded varint on the wire
370
+
371
+ MAX_TYPE = 18, // Constant useful for defining lookup tables
372
+ // indexed by Type.
373
+ };
374
+
375
+ // Specifies the C++ data type used to represent the field. There is a
376
+ // fixed mapping from Type to CppType where each Type maps to exactly one
377
+ // CppType. 0 is reserved for errors.
378
+ enum CppType {
379
+ CPPTYPE_INT32 = 1, // TYPE_INT32, TYPE_SINT32, TYPE_SFIXED32
380
+ CPPTYPE_INT64 = 2, // TYPE_INT64, TYPE_SINT64, TYPE_SFIXED64
381
+ CPPTYPE_UINT32 = 3, // TYPE_UINT32, TYPE_FIXED32
382
+ CPPTYPE_UINT64 = 4, // TYPE_UINT64, TYPE_FIXED64
383
+ CPPTYPE_DOUBLE = 5, // TYPE_DOUBLE
384
+ CPPTYPE_FLOAT = 6, // TYPE_FLOAT
385
+ CPPTYPE_BOOL = 7, // TYPE_BOOL
386
+ CPPTYPE_ENUM = 8, // TYPE_ENUM
387
+ CPPTYPE_STRING = 9, // TYPE_STRING, TYPE_BYTES
388
+ CPPTYPE_MESSAGE = 10, // TYPE_MESSAGE, TYPE_GROUP
389
+
390
+ MAX_CPPTYPE = 10, // Constant useful for defining lookup tables
391
+ // indexed by CppType.
392
+ };
393
+
394
+ // Identifies whether the field is optional, required, or repeated. 0 is
395
+ // reserved for errors.
396
+ enum Label {
397
+ LABEL_OPTIONAL = 1, // optional
398
+ LABEL_REQUIRED = 2, // required
399
+ LABEL_REPEATED = 3, // repeated
400
+
401
+ MAX_LABEL = 3, // Constant useful for defining lookup tables
402
+ // indexed by Label.
403
+ };
404
+
405
+ // Valid field numbers are positive integers up to kMaxNumber.
406
+ static const int kMaxNumber = (1 << 29) - 1;
407
+
408
+ // First field number reserved for the protocol buffer library implementation.
409
+ // Users may not declare fields that use reserved numbers.
410
+ static const int kFirstReservedNumber = 19000;
411
+ // Last field number reserved for the protocol buffer library implementation.
412
+ // Users may not declare fields that use reserved numbers.
413
+ static const int kLastReservedNumber = 19999;
414
+
415
+ const string& name() const; // Name of this field within the message.
416
+ const string& full_name() const; // Fully-qualified name of the field.
417
+ const FileDescriptor* file() const;// File in which this field was defined.
418
+ bool is_extension() const; // Is this an extension field?
419
+ int number() const; // Declared tag number.
420
+
421
+ // Same as name() except converted to lower-case. This (and especially the
422
+ // FindFieldByLowercaseName() method) can be useful when parsing formats
423
+ // which prefer to use lowercase naming style. (Although, technically
424
+ // field names should be lowercased anyway according to the protobuf style
425
+ // guide, so this only makes a difference when dealing with old .proto files
426
+ // which do not follow the guide.)
427
+ const string& lowercase_name() const;
428
+
429
+ // Same as name() except converted to camel-case. In this conversion, any
430
+ // time an underscore appears in the name, it is removed and the next
431
+ // letter is capitalized. Furthermore, the first letter of the name is
432
+ // lower-cased. Examples:
433
+ // FooBar -> fooBar
434
+ // foo_bar -> fooBar
435
+ // fooBar -> fooBar
436
+ // This (and especially the FindFieldByCamelcaseName() method) can be useful
437
+ // when parsing formats which prefer to use camel-case naming style.
438
+ const string& camelcase_name() const;
439
+
440
+ Type type() const; // Declared type of this field.
441
+ const char* type_name() const; // Name of the declared type.
442
+ CppType cpp_type() const; // C++ type of this field.
443
+ const char* cpp_type_name() const; // Name of the C++ type.
444
+ Label label() const; // optional/required/repeated
445
+
446
+ bool is_required() const; // shorthand for label() == LABEL_REQUIRED
447
+ bool is_optional() const; // shorthand for label() == LABEL_OPTIONAL
448
+ bool is_repeated() const; // shorthand for label() == LABEL_REPEATED
449
+ bool is_packable() const; // shorthand for is_repeated() &&
450
+ // IsTypePackable(type())
451
+ bool is_packed() const; // shorthand for is_packable() &&
452
+ // options().packed()
453
+
454
+ // Index of this field within the message's field array, or the file or
455
+ // extension scope's extensions array.
456
+ int index() const;
457
+
458
+ // Does this field have an explicitly-declared default value?
459
+ bool has_default_value() const;
460
+
461
+ // Get the field default value if cpp_type() == CPPTYPE_INT32. If no
462
+ // explicit default was defined, the default is 0.
463
+ int32 default_value_int32() const;
464
+ // Get the field default value if cpp_type() == CPPTYPE_INT64. If no
465
+ // explicit default was defined, the default is 0.
466
+ int64 default_value_int64() const;
467
+ // Get the field default value if cpp_type() == CPPTYPE_UINT32. If no
468
+ // explicit default was defined, the default is 0.
469
+ uint32 default_value_uint32() const;
470
+ // Get the field default value if cpp_type() == CPPTYPE_UINT64. If no
471
+ // explicit default was defined, the default is 0.
472
+ uint64 default_value_uint64() const;
473
+ // Get the field default value if cpp_type() == CPPTYPE_FLOAT. If no
474
+ // explicit default was defined, the default is 0.0.
475
+ float default_value_float() const;
476
+ // Get the field default value if cpp_type() == CPPTYPE_DOUBLE. If no
477
+ // explicit default was defined, the default is 0.0.
478
+ double default_value_double() const;
479
+ // Get the field default value if cpp_type() == CPPTYPE_BOOL. If no
480
+ // explicit default was defined, the default is false.
481
+ bool default_value_bool() const;
482
+ // Get the field default value if cpp_type() == CPPTYPE_ENUM. If no
483
+ // explicit default was defined, the default is the first value defined
484
+ // in the enum type (all enum types are required to have at least one value).
485
+ // This never returns NULL.
486
+ const EnumValueDescriptor* default_value_enum() const;
487
+ // Get the field default value if cpp_type() == CPPTYPE_STRING. If no
488
+ // explicit default was defined, the default is the empty string.
489
+ const string& default_value_string() const;
490
+
491
+ // The Descriptor for the message of which this is a field. For extensions,
492
+ // this is the extended type. Never NULL.
493
+ const Descriptor* containing_type() const;
494
+
495
+ // If the field is a member of a oneof, this is the one, otherwise this is
496
+ // NULL.
497
+ const OneofDescriptor* containing_oneof() const;
498
+
499
+ // If the field is a member of a oneof, returns the index in that oneof.
500
+ int index_in_oneof() const;
501
+
502
+ // An extension may be declared within the scope of another message. If this
503
+ // field is an extension (is_extension() is true), then extension_scope()
504
+ // returns that message, or NULL if the extension was declared at global
505
+ // scope. If this is not an extension, extension_scope() is undefined (may
506
+ // assert-fail).
507
+ const Descriptor* extension_scope() const;
508
+
509
+ // If type is TYPE_MESSAGE or TYPE_GROUP, returns a descriptor for the
510
+ // message or the group type. Otherwise, returns null.
511
+ const Descriptor* message_type() const;
512
+ // If type is TYPE_ENUM, returns a descriptor for the enum. Otherwise,
513
+ // returns null.
514
+ const EnumDescriptor* enum_type() const;
515
+
516
+ // EXPERIMENTAL; DO NOT USE.
517
+ // If this field is a map field, experimental_map_key() is the field
518
+ // that is the key for this map.
519
+ // experimental_map_key()->containing_type() is the same as message_type().
520
+ const FieldDescriptor* experimental_map_key() const;
521
+
522
+ // Get the FieldOptions for this field. This includes things listed in
523
+ // square brackets after the field definition. E.g., the field:
524
+ // optional string text = 1 [ctype=CORD];
525
+ // has the "ctype" option set. Allowed options are defined by FieldOptions
526
+ // in google/protobuf/descriptor.proto, and any available extensions of that
527
+ // message.
528
+ const FieldOptions& options() const;
529
+
530
+ // See Descriptor::CopyTo().
531
+ void CopyTo(FieldDescriptorProto* proto) const;
532
+
533
+ // See Descriptor::DebugString().
534
+ string DebugString() const;
535
+
536
+ // Helper method to get the CppType for a particular Type.
537
+ static CppType TypeToCppType(Type type);
538
+
539
+ // Helper method to get the name of a Type.
540
+ static const char* TypeName(Type type);
541
+
542
+ // Helper method to get the name of a CppType.
543
+ static const char* CppTypeName(CppType cpp_type);
544
+
545
+ // Return true iff [packed = true] is valid for fields of this type.
546
+ static inline bool IsTypePackable(Type field_type);
547
+
548
+ // Source Location ---------------------------------------------------
549
+
550
+ // Updates |*out_location| to the source location of the complete
551
+ // extent of this field declaration. Returns false and leaves
552
+ // |*out_location| unchanged iff location information was not available.
553
+ bool GetSourceLocation(SourceLocation* out_location) const;
554
+
555
+ private:
556
+ typedef FieldOptions OptionsType;
557
+
558
+ // See Descriptor::DebugString().
559
+ enum PrintLabelFlag { PRINT_LABEL, OMIT_LABEL };
560
+ void DebugString(int depth, PrintLabelFlag print_label_flag,
561
+ string* contents) const;
562
+
563
+ // formats the default value appropriately and returns it as a string.
564
+ // Must have a default value to call this. If quote_string_type is true, then
565
+ // types of CPPTYPE_STRING whill be surrounded by quotes and CEscaped.
566
+ string DefaultValueAsString(bool quote_string_type) const;
567
+
568
+ // Walks up the descriptor tree to generate the source location path
569
+ // to this descriptor from the file root.
570
+ void GetLocationPath(vector<int>* output) const;
571
+
572
+ const string* name_;
573
+ const string* full_name_;
574
+ const string* lowercase_name_;
575
+ const string* camelcase_name_;
576
+ const FileDescriptor* file_;
577
+ int number_;
578
+ Type type_;
579
+ Label label_;
580
+ bool is_extension_;
581
+ int index_in_oneof_;
582
+ const Descriptor* containing_type_;
583
+ const OneofDescriptor* containing_oneof_;
584
+ const Descriptor* extension_scope_;
585
+ const Descriptor* message_type_;
586
+ const EnumDescriptor* enum_type_;
587
+ const FieldDescriptor* experimental_map_key_;
588
+ const FieldOptions* options_;
589
+ // IMPORTANT: If you add a new field, make sure to search for all instances
590
+ // of Allocate<FieldDescriptor>() and AllocateArray<FieldDescriptor>() in
591
+ // descriptor.cc and update them to initialize the field.
592
+
593
+ bool has_default_value_;
594
+ union {
595
+ int32 default_value_int32_;
596
+ int64 default_value_int64_;
597
+ uint32 default_value_uint32_;
598
+ uint64 default_value_uint64_;
599
+ float default_value_float_;
600
+ double default_value_double_;
601
+ bool default_value_bool_;
602
+
603
+ const EnumValueDescriptor* default_value_enum_;
604
+ const string* default_value_string_;
605
+ };
606
+
607
+ static const CppType kTypeToCppTypeMap[MAX_TYPE + 1];
608
+
609
+ static const char * const kTypeToName[MAX_TYPE + 1];
610
+
611
+ static const char * const kCppTypeToName[MAX_CPPTYPE + 1];
612
+
613
+ static const char * const kLabelToName[MAX_LABEL + 1];
614
+
615
+ // Must be constructed using DescriptorPool.
616
+ FieldDescriptor() {}
617
+ friend class DescriptorBuilder;
618
+ friend class FileDescriptor;
619
+ friend class Descriptor;
620
+ friend class OneofDescriptor;
621
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldDescriptor);
622
+ };
623
+
624
+ // Describes a oneof defined in a message type.
625
+ class LIBPROTOBUF_EXPORT OneofDescriptor {
626
+ public:
627
+ const string& name() const; // Name of this oneof.
628
+ const string& full_name() const; // Fully-qualified name of the oneof.
629
+
630
+ // Index of this oneof within the message's oneof array.
631
+ int index() const;
632
+
633
+ // The Descriptor for the message containing this oneof.
634
+ const Descriptor* containing_type() const;
635
+
636
+ // The number of (non-extension) fields which are members of this oneof.
637
+ int field_count() const;
638
+ // Get a member of this oneof, in the order in which they were declared in the
639
+ // .proto file. Does not include extensions.
640
+ const FieldDescriptor* field(int index) const;
641
+
642
+ // See Descriptor::CopyTo().
643
+ void CopyTo(OneofDescriptorProto* proto) const;
644
+
645
+ // See Descriptor::DebugString().
646
+ string DebugString() const;
647
+
648
+ // Source Location ---------------------------------------------------
649
+
650
+ // Updates |*out_location| to the source location of the complete
651
+ // extent of this oneof declaration. Returns false and leaves
652
+ // |*out_location| unchanged iff location information was not available.
653
+ bool GetSourceLocation(SourceLocation* out_location) const;
654
+
655
+ private:
656
+ // See Descriptor::DebugString().
657
+ void DebugString(int depth, string* contents) const;
658
+
659
+ // Walks up the descriptor tree to generate the source location path
660
+ // to this descriptor from the file root.
661
+ void GetLocationPath(vector<int>* output) const;
662
+
663
+ const string* name_;
664
+ const string* full_name_;
665
+ const Descriptor* containing_type_;
666
+ bool is_extendable_;
667
+ int field_count_;
668
+ const FieldDescriptor** fields_;
669
+ // IMPORTANT: If you add a new field, make sure to search for all instances
670
+ // of Allocate<OneofDescriptor>() and AllocateArray<OneofDescriptor>()
671
+ // in descriptor.cc and update them to initialize the field.
672
+
673
+ // Must be constructed using DescriptorPool.
674
+ OneofDescriptor() {}
675
+ friend class DescriptorBuilder;
676
+ friend class Descriptor;
677
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(OneofDescriptor);
678
+ };
679
+
680
+ // Describes an enum type defined in a .proto file. To get the EnumDescriptor
681
+ // for a generated enum type, call TypeName_descriptor(). Use DescriptorPool
682
+ // to construct your own descriptors.
683
+ class LIBPROTOBUF_EXPORT EnumDescriptor {
684
+ public:
685
+ // The name of this enum type in the containing scope.
686
+ const string& name() const;
687
+
688
+ // The fully-qualified name of the enum type, scope delimited by periods.
689
+ const string& full_name() const;
690
+
691
+ // Index of this enum within the file or containing message's enum array.
692
+ int index() const;
693
+
694
+ // The .proto file in which this enum type was defined. Never NULL.
695
+ const FileDescriptor* file() const;
696
+
697
+ // The number of values for this EnumDescriptor. Guaranteed to be greater
698
+ // than zero.
699
+ int value_count() const;
700
+ // Gets a value by index, where 0 <= index < value_count().
701
+ // These are returned in the order they were defined in the .proto file.
702
+ const EnumValueDescriptor* value(int index) const;
703
+
704
+ // Looks up a value by name. Returns NULL if no such value exists.
705
+ const EnumValueDescriptor* FindValueByName(const string& name) const;
706
+ // Looks up a value by number. Returns NULL if no such value exists. If
707
+ // multiple values have this number, the first one defined is returned.
708
+ const EnumValueDescriptor* FindValueByNumber(int number) const;
709
+
710
+ // If this enum type is nested in a message type, this is that message type.
711
+ // Otherwise, NULL.
712
+ const Descriptor* containing_type() const;
713
+
714
+ // Get options for this enum type. These are specified in the .proto file by
715
+ // placing lines like "option foo = 1234;" in the enum definition. Allowed
716
+ // options are defined by EnumOptions in google/protobuf/descriptor.proto,
717
+ // and any available extensions of that message.
718
+ const EnumOptions& options() const;
719
+
720
+ // See Descriptor::CopyTo().
721
+ void CopyTo(EnumDescriptorProto* proto) const;
722
+
723
+ // See Descriptor::DebugString().
724
+ string DebugString() const;
725
+
726
+ // Returns true if this is a placeholder for an unknown enum. This will
727
+ // only be the case if this descriptor comes from a DescriptorPool
728
+ // with AllowUnknownDependencies() set.
729
+ bool is_placeholder() const;
730
+
731
+ // Source Location ---------------------------------------------------
732
+
733
+ // Updates |*out_location| to the source location of the complete
734
+ // extent of this enum declaration. Returns false and leaves
735
+ // |*out_location| unchanged iff location information was not available.
736
+ bool GetSourceLocation(SourceLocation* out_location) const;
737
+
738
+ private:
739
+ typedef EnumOptions OptionsType;
740
+
741
+ // See Descriptor::DebugString().
742
+ void DebugString(int depth, string *contents) const;
743
+
744
+ // Walks up the descriptor tree to generate the source location path
745
+ // to this descriptor from the file root.
746
+ void GetLocationPath(vector<int>* output) const;
747
+
748
+ const string* name_;
749
+ const string* full_name_;
750
+ const FileDescriptor* file_;
751
+ const Descriptor* containing_type_;
752
+ const EnumOptions* options_;
753
+
754
+ // True if this is a placeholder for an unknown type.
755
+ bool is_placeholder_;
756
+ // True if this is a placeholder and the type name wasn't fully-qualified.
757
+ bool is_unqualified_placeholder_;
758
+
759
+ int value_count_;
760
+ EnumValueDescriptor* values_;
761
+ // IMPORTANT: If you add a new field, make sure to search for all instances
762
+ // of Allocate<EnumDescriptor>() and AllocateArray<EnumDescriptor>() in
763
+ // descriptor.cc and update them to initialize the field.
764
+
765
+ // Must be constructed using DescriptorPool.
766
+ EnumDescriptor() {}
767
+ friend class DescriptorBuilder;
768
+ friend class Descriptor;
769
+ friend class FieldDescriptor;
770
+ friend class EnumValueDescriptor;
771
+ friend class FileDescriptor;
772
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumDescriptor);
773
+ };
774
+
775
+ // Describes an individual enum constant of a particular type. To get the
776
+ // EnumValueDescriptor for a given enum value, first get the EnumDescriptor
777
+ // for its type, then use EnumDescriptor::FindValueByName() or
778
+ // EnumDescriptor::FindValueByNumber(). Use DescriptorPool to construct
779
+ // your own descriptors.
780
+ class LIBPROTOBUF_EXPORT EnumValueDescriptor {
781
+ public:
782
+ const string& name() const; // Name of this enum constant.
783
+ int index() const; // Index within the enums's Descriptor.
784
+ int number() const; // Numeric value of this enum constant.
785
+
786
+ // The full_name of an enum value is a sibling symbol of the enum type.
787
+ // e.g. the full name of FieldDescriptorProto::TYPE_INT32 is actually
788
+ // "google.protobuf.FieldDescriptorProto.TYPE_INT32", NOT
789
+ // "google.protobuf.FieldDescriptorProto.Type.TYPE_INT32". This is to conform
790
+ // with C++ scoping rules for enums.
791
+ const string& full_name() const;
792
+
793
+ // The type of this value. Never NULL.
794
+ const EnumDescriptor* type() const;
795
+
796
+ // Get options for this enum value. These are specified in the .proto file
797
+ // by adding text like "[foo = 1234]" after an enum value definition.
798
+ // Allowed options are defined by EnumValueOptions in
799
+ // google/protobuf/descriptor.proto, and any available extensions of that
800
+ // message.
801
+ const EnumValueOptions& options() const;
802
+
803
+ // See Descriptor::CopyTo().
804
+ void CopyTo(EnumValueDescriptorProto* proto) const;
805
+
806
+ // See Descriptor::DebugString().
807
+ string DebugString() const;
808
+
809
+ // Source Location ---------------------------------------------------
810
+
811
+ // Updates |*out_location| to the source location of the complete
812
+ // extent of this enum value declaration. Returns false and leaves
813
+ // |*out_location| unchanged iff location information was not available.
814
+ bool GetSourceLocation(SourceLocation* out_location) const;
815
+
816
+ private:
817
+ typedef EnumValueOptions OptionsType;
818
+
819
+ // See Descriptor::DebugString().
820
+ void DebugString(int depth, string *contents) const;
821
+
822
+ // Walks up the descriptor tree to generate the source location path
823
+ // to this descriptor from the file root.
824
+ void GetLocationPath(vector<int>* output) const;
825
+
826
+ const string* name_;
827
+ const string* full_name_;
828
+ int number_;
829
+ const EnumDescriptor* type_;
830
+ const EnumValueOptions* options_;
831
+ // IMPORTANT: If you add a new field, make sure to search for all instances
832
+ // of Allocate<EnumValueDescriptor>() and AllocateArray<EnumValueDescriptor>()
833
+ // in descriptor.cc and update them to initialize the field.
834
+
835
+ // Must be constructed using DescriptorPool.
836
+ EnumValueDescriptor() {}
837
+ friend class DescriptorBuilder;
838
+ friend class EnumDescriptor;
839
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumValueDescriptor);
840
+ };
841
+
842
+ // Describes an RPC service. To get the ServiceDescriptor for a service,
843
+ // call Service::GetDescriptor(). Generated service classes also have a
844
+ // static method called descriptor() which returns the type's
845
+ // ServiceDescriptor. Use DescriptorPool to construct your own descriptors.
846
+ class LIBPROTOBUF_EXPORT ServiceDescriptor {
847
+ public:
848
+ // The name of the service, not including its containing scope.
849
+ const string& name() const;
850
+ // The fully-qualified name of the service, scope delimited by periods.
851
+ const string& full_name() const;
852
+ // Index of this service within the file's services array.
853
+ int index() const;
854
+
855
+ // The .proto file in which this service was defined. Never NULL.
856
+ const FileDescriptor* file() const;
857
+
858
+ // Get options for this service type. These are specified in the .proto file
859
+ // by placing lines like "option foo = 1234;" in the service definition.
860
+ // Allowed options are defined by ServiceOptions in
861
+ // google/protobuf/descriptor.proto, and any available extensions of that
862
+ // message.
863
+ const ServiceOptions& options() const;
864
+
865
+ // The number of methods this service defines.
866
+ int method_count() const;
867
+ // Gets a MethodDescriptor by index, where 0 <= index < method_count().
868
+ // These are returned in the order they were defined in the .proto file.
869
+ const MethodDescriptor* method(int index) const;
870
+
871
+ // Look up a MethodDescriptor by name.
872
+ const MethodDescriptor* FindMethodByName(const string& name) const;
873
+ // See Descriptor::CopyTo().
874
+ void CopyTo(ServiceDescriptorProto* proto) const;
875
+
876
+ // See Descriptor::DebugString().
877
+ string DebugString() const;
878
+
879
+ // Source Location ---------------------------------------------------
880
+
881
+ // Updates |*out_location| to the source location of the complete
882
+ // extent of this service declaration. Returns false and leaves
883
+ // |*out_location| unchanged iff location information was not available.
884
+ bool GetSourceLocation(SourceLocation* out_location) const;
885
+
886
+ private:
887
+ typedef ServiceOptions OptionsType;
888
+
889
+ // See Descriptor::DebugString().
890
+ void DebugString(string *contents) const;
891
+
892
+ // Walks up the descriptor tree to generate the source location path
893
+ // to this descriptor from the file root.
894
+ void GetLocationPath(vector<int>* output) const;
895
+
896
+ const string* name_;
897
+ const string* full_name_;
898
+ const FileDescriptor* file_;
899
+ const ServiceOptions* options_;
900
+ int method_count_;
901
+ MethodDescriptor* methods_;
902
+ // IMPORTANT: If you add a new field, make sure to search for all instances
903
+ // of Allocate<ServiceDescriptor>() and AllocateArray<ServiceDescriptor>() in
904
+ // descriptor.cc and update them to initialize the field.
905
+
906
+ // Must be constructed using DescriptorPool.
907
+ ServiceDescriptor() {}
908
+ friend class DescriptorBuilder;
909
+ friend class FileDescriptor;
910
+ friend class MethodDescriptor;
911
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ServiceDescriptor);
912
+ };
913
+
914
+ // Describes an individual service method. To obtain a MethodDescriptor given
915
+ // a service, first get its ServiceDescriptor, then call
916
+ // ServiceDescriptor::FindMethodByName(). Use DescriptorPool to construct your
917
+ // own descriptors.
918
+ class LIBPROTOBUF_EXPORT MethodDescriptor {
919
+ public:
920
+ // Name of this method, not including containing scope.
921
+ const string& name() const;
922
+ // The fully-qualified name of the method, scope delimited by periods.
923
+ const string& full_name() const;
924
+ // Index within the service's Descriptor.
925
+ int index() const;
926
+
927
+ // Gets the service to which this method belongs. Never NULL.
928
+ const ServiceDescriptor* service() const;
929
+
930
+ // Gets the type of protocol message which this method accepts as input.
931
+ const Descriptor* input_type() const;
932
+ // Gets the type of protocol message which this message produces as output.
933
+ const Descriptor* output_type() const;
934
+
935
+ // Get options for this method. These are specified in the .proto file by
936
+ // placing lines like "option foo = 1234;" in curly-braces after a method
937
+ // declaration. Allowed options are defined by MethodOptions in
938
+ // google/protobuf/descriptor.proto, and any available extensions of that
939
+ // message.
940
+ const MethodOptions& options() const;
941
+
942
+ // See Descriptor::CopyTo().
943
+ void CopyTo(MethodDescriptorProto* proto) const;
944
+
945
+ // See Descriptor::DebugString().
946
+ string DebugString() const;
947
+
948
+ // Source Location ---------------------------------------------------
949
+
950
+ // Updates |*out_location| to the source location of the complete
951
+ // extent of this method declaration. Returns false and leaves
952
+ // |*out_location| unchanged iff location information was not available.
953
+ bool GetSourceLocation(SourceLocation* out_location) const;
954
+
955
+ private:
956
+ typedef MethodOptions OptionsType;
957
+
958
+ // See Descriptor::DebugString().
959
+ void DebugString(int depth, string *contents) const;
960
+
961
+ // Walks up the descriptor tree to generate the source location path
962
+ // to this descriptor from the file root.
963
+ void GetLocationPath(vector<int>* output) const;
964
+
965
+ const string* name_;
966
+ const string* full_name_;
967
+ const ServiceDescriptor* service_;
968
+ const Descriptor* input_type_;
969
+ const Descriptor* output_type_;
970
+ const MethodOptions* options_;
971
+ // IMPORTANT: If you add a new field, make sure to search for all instances
972
+ // of Allocate<MethodDescriptor>() and AllocateArray<MethodDescriptor>() in
973
+ // descriptor.cc and update them to initialize the field.
974
+
975
+ // Must be constructed using DescriptorPool.
976
+ MethodDescriptor() {}
977
+ friend class DescriptorBuilder;
978
+ friend class ServiceDescriptor;
979
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MethodDescriptor);
980
+ };
981
+
982
+
983
+ // Describes a whole .proto file. To get the FileDescriptor for a compiled-in
984
+ // file, get the descriptor for something defined in that file and call
985
+ // descriptor->file(). Use DescriptorPool to construct your own descriptors.
986
+ class LIBPROTOBUF_EXPORT FileDescriptor {
987
+ public:
988
+ // The filename, relative to the source tree.
989
+ // e.g. "google/protobuf/descriptor.proto"
990
+ const string& name() const;
991
+
992
+ // The package, e.g. "google.protobuf.compiler".
993
+ const string& package() const;
994
+
995
+ // The DescriptorPool in which this FileDescriptor and all its contents were
996
+ // allocated. Never NULL.
997
+ const DescriptorPool* pool() const;
998
+
999
+ // The number of files imported by this one.
1000
+ int dependency_count() const;
1001
+ // Gets an imported file by index, where 0 <= index < dependency_count().
1002
+ // These are returned in the order they were defined in the .proto file.
1003
+ const FileDescriptor* dependency(int index) const;
1004
+
1005
+ // The number of files public imported by this one.
1006
+ // The public dependency list is a subset of the dependency list.
1007
+ int public_dependency_count() const;
1008
+ // Gets a public imported file by index, where 0 <= index <
1009
+ // public_dependency_count().
1010
+ // These are returned in the order they were defined in the .proto file.
1011
+ const FileDescriptor* public_dependency(int index) const;
1012
+
1013
+ // The number of files that are imported for weak fields.
1014
+ // The weak dependency list is a subset of the dependency list.
1015
+ int weak_dependency_count() const;
1016
+ // Gets a weak imported file by index, where 0 <= index <
1017
+ // weak_dependency_count().
1018
+ // These are returned in the order they were defined in the .proto file.
1019
+ const FileDescriptor* weak_dependency(int index) const;
1020
+
1021
+ // Number of top-level message types defined in this file. (This does not
1022
+ // include nested types.)
1023
+ int message_type_count() const;
1024
+ // Gets a top-level message type, where 0 <= index < message_type_count().
1025
+ // These are returned in the order they were defined in the .proto file.
1026
+ const Descriptor* message_type(int index) const;
1027
+
1028
+ // Number of top-level enum types defined in this file. (This does not
1029
+ // include nested types.)
1030
+ int enum_type_count() const;
1031
+ // Gets a top-level enum type, where 0 <= index < enum_type_count().
1032
+ // These are returned in the order they were defined in the .proto file.
1033
+ const EnumDescriptor* enum_type(int index) const;
1034
+
1035
+ // Number of services defined in this file.
1036
+ int service_count() const;
1037
+ // Gets a service, where 0 <= index < service_count().
1038
+ // These are returned in the order they were defined in the .proto file.
1039
+ const ServiceDescriptor* service(int index) const;
1040
+
1041
+ // Number of extensions defined at file scope. (This does not include
1042
+ // extensions nested within message types.)
1043
+ int extension_count() const;
1044
+ // Gets an extension's descriptor, where 0 <= index < extension_count().
1045
+ // These are returned in the order they were defined in the .proto file.
1046
+ const FieldDescriptor* extension(int index) const;
1047
+
1048
+ // Get options for this file. These are specified in the .proto file by
1049
+ // placing lines like "option foo = 1234;" at the top level, outside of any
1050
+ // other definitions. Allowed options are defined by FileOptions in
1051
+ // google/protobuf/descriptor.proto, and any available extensions of that
1052
+ // message.
1053
+ const FileOptions& options() const;
1054
+
1055
+ // Find a top-level message type by name. Returns NULL if not found.
1056
+ const Descriptor* FindMessageTypeByName(const string& name) const;
1057
+ // Find a top-level enum type by name. Returns NULL if not found.
1058
+ const EnumDescriptor* FindEnumTypeByName(const string& name) const;
1059
+ // Find an enum value defined in any top-level enum by name. Returns NULL if
1060
+ // not found.
1061
+ const EnumValueDescriptor* FindEnumValueByName(const string& name) const;
1062
+ // Find a service definition by name. Returns NULL if not found.
1063
+ const ServiceDescriptor* FindServiceByName(const string& name) const;
1064
+ // Find a top-level extension definition by name. Returns NULL if not found.
1065
+ const FieldDescriptor* FindExtensionByName(const string& name) const;
1066
+ // Similar to FindExtensionByName(), but searches by lowercased-name. See
1067
+ // Descriptor::FindFieldByLowercaseName().
1068
+ const FieldDescriptor* FindExtensionByLowercaseName(const string& name) const;
1069
+ // Similar to FindExtensionByName(), but searches by camelcased-name. See
1070
+ // Descriptor::FindFieldByCamelcaseName().
1071
+ const FieldDescriptor* FindExtensionByCamelcaseName(const string& name) const;
1072
+
1073
+ // See Descriptor::CopyTo().
1074
+ // Notes:
1075
+ // - This method does NOT copy source code information since it is relatively
1076
+ // large and rarely needed. See CopySourceCodeInfoTo() below.
1077
+ void CopyTo(FileDescriptorProto* proto) const;
1078
+ // Write the source code information of this FileDescriptor into the given
1079
+ // FileDescriptorProto. See CopyTo() above.
1080
+ void CopySourceCodeInfoTo(FileDescriptorProto* proto) const;
1081
+
1082
+ // See Descriptor::DebugString().
1083
+ string DebugString() const;
1084
+
1085
+ // Returns true if this is a placeholder for an unknown file. This will
1086
+ // only be the case if this descriptor comes from a DescriptorPool
1087
+ // with AllowUnknownDependencies() set.
1088
+ bool is_placeholder() const;
1089
+
1090
+ private:
1091
+ // Source Location ---------------------------------------------------
1092
+
1093
+ // Updates |*out_location| to the source location of the complete
1094
+ // extent of the declaration or declaration-part denoted by |path|.
1095
+ // Returns false and leaves |*out_location| unchanged iff location
1096
+ // information was not available. (See SourceCodeInfo for
1097
+ // description of path encoding.)
1098
+ bool GetSourceLocation(const vector<int>& path,
1099
+ SourceLocation* out_location) const;
1100
+
1101
+ typedef FileOptions OptionsType;
1102
+
1103
+ const string* name_;
1104
+ const string* package_;
1105
+ const DescriptorPool* pool_;
1106
+ int dependency_count_;
1107
+ const FileDescriptor** dependencies_;
1108
+ int public_dependency_count_;
1109
+ int* public_dependencies_;
1110
+ int weak_dependency_count_;
1111
+ int* weak_dependencies_;
1112
+ int message_type_count_;
1113
+ Descriptor* message_types_;
1114
+ int enum_type_count_;
1115
+ EnumDescriptor* enum_types_;
1116
+ int service_count_;
1117
+ ServiceDescriptor* services_;
1118
+ int extension_count_;
1119
+ bool is_placeholder_;
1120
+ FieldDescriptor* extensions_;
1121
+ const FileOptions* options_;
1122
+
1123
+ const FileDescriptorTables* tables_;
1124
+ const SourceCodeInfo* source_code_info_;
1125
+ // IMPORTANT: If you add a new field, make sure to search for all instances
1126
+ // of Allocate<FileDescriptor>() and AllocateArray<FileDescriptor>() in
1127
+ // descriptor.cc and update them to initialize the field.
1128
+
1129
+ FileDescriptor() {}
1130
+ friend class DescriptorBuilder;
1131
+ friend class Descriptor;
1132
+ friend class FieldDescriptor;
1133
+ friend class OneofDescriptor;
1134
+ friend class EnumDescriptor;
1135
+ friend class EnumValueDescriptor;
1136
+ friend class MethodDescriptor;
1137
+ friend class ServiceDescriptor;
1138
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileDescriptor);
1139
+ };
1140
+
1141
+ // ===================================================================
1142
+
1143
+ // Used to construct descriptors.
1144
+ //
1145
+ // Normally you won't want to build your own descriptors. Message classes
1146
+ // constructed by the protocol compiler will provide them for you. However,
1147
+ // if you are implementing Message on your own, or if you are writing a
1148
+ // program which can operate on totally arbitrary types and needs to load
1149
+ // them from some sort of database, you might need to.
1150
+ //
1151
+ // Since Descriptors are composed of a whole lot of cross-linked bits of
1152
+ // data that would be a pain to put together manually, the
1153
+ // DescriptorPool class is provided to make the process easier. It can
1154
+ // take a FileDescriptorProto (defined in descriptor.proto), validate it,
1155
+ // and convert it to a set of nicely cross-linked Descriptors.
1156
+ //
1157
+ // DescriptorPool also helps with memory management. Descriptors are
1158
+ // composed of many objects containing static data and pointers to each
1159
+ // other. In all likelihood, when it comes time to delete this data,
1160
+ // you'll want to delete it all at once. In fact, it is not uncommon to
1161
+ // have a whole pool of descriptors all cross-linked with each other which
1162
+ // you wish to delete all at once. This class represents such a pool, and
1163
+ // handles the memory management for you.
1164
+ //
1165
+ // You can also search for descriptors within a DescriptorPool by name, and
1166
+ // extensions by number.
1167
+ class LIBPROTOBUF_EXPORT DescriptorPool {
1168
+ public:
1169
+ // Create a normal, empty DescriptorPool.
1170
+ DescriptorPool();
1171
+
1172
+ // Constructs a DescriptorPool that, when it can't find something among the
1173
+ // descriptors already in the pool, looks for it in the given
1174
+ // DescriptorDatabase.
1175
+ // Notes:
1176
+ // - If a DescriptorPool is constructed this way, its BuildFile*() methods
1177
+ // must not be called (they will assert-fail). The only way to populate
1178
+ // the pool with descriptors is to call the Find*By*() methods.
1179
+ // - The Find*By*() methods may block the calling thread if the
1180
+ // DescriptorDatabase blocks. This in turn means that parsing messages
1181
+ // may block if they need to look up extensions.
1182
+ // - The Find*By*() methods will use mutexes for thread-safety, thus making
1183
+ // them slower even when they don't have to fall back to the database.
1184
+ // In fact, even the Find*By*() methods of descriptor objects owned by
1185
+ // this pool will be slower, since they will have to obtain locks too.
1186
+ // - An ErrorCollector may optionally be given to collect validation errors
1187
+ // in files loaded from the database. If not given, errors will be printed
1188
+ // to GOOGLE_LOG(ERROR). Remember that files are built on-demand, so this
1189
+ // ErrorCollector may be called from any thread that calls one of the
1190
+ // Find*By*() methods.
1191
+ // - The DescriptorDatabase must not be mutated during the lifetime of
1192
+ // the DescriptorPool. Even if the client takes care to avoid data races,
1193
+ // changes to the content of the DescriptorDatabase may not be reflected
1194
+ // in subsequent lookups in the DescriptorPool.
1195
+ class ErrorCollector;
1196
+ explicit DescriptorPool(DescriptorDatabase* fallback_database,
1197
+ ErrorCollector* error_collector = NULL);
1198
+
1199
+ ~DescriptorPool();
1200
+
1201
+ // Get a pointer to the generated pool. Generated protocol message classes
1202
+ // which are compiled into the binary will allocate their descriptors in
1203
+ // this pool. Do not add your own descriptors to this pool.
1204
+ static const DescriptorPool* generated_pool();
1205
+
1206
+ // Find a FileDescriptor in the pool by file name. Returns NULL if not
1207
+ // found.
1208
+ const FileDescriptor* FindFileByName(const string& name) const;
1209
+
1210
+ // Find the FileDescriptor in the pool which defines the given symbol.
1211
+ // If any of the Find*ByName() methods below would succeed, then this is
1212
+ // equivalent to calling that method and calling the result's file() method.
1213
+ // Otherwise this returns NULL.
1214
+ const FileDescriptor* FindFileContainingSymbol(
1215
+ const string& symbol_name) const;
1216
+
1217
+ // Looking up descriptors ------------------------------------------
1218
+ // These find descriptors by fully-qualified name. These will find both
1219
+ // top-level descriptors and nested descriptors. They return NULL if not
1220
+ // found.
1221
+
1222
+ const Descriptor* FindMessageTypeByName(const string& name) const;
1223
+ const FieldDescriptor* FindFieldByName(const string& name) const;
1224
+ const FieldDescriptor* FindExtensionByName(const string& name) const;
1225
+ const OneofDescriptor* FindOneofByName(const string& name) const;
1226
+ const EnumDescriptor* FindEnumTypeByName(const string& name) const;
1227
+ const EnumValueDescriptor* FindEnumValueByName(const string& name) const;
1228
+ const ServiceDescriptor* FindServiceByName(const string& name) const;
1229
+ const MethodDescriptor* FindMethodByName(const string& name) const;
1230
+
1231
+ // Finds an extension of the given type by number. The extendee must be
1232
+ // a member of this DescriptorPool or one of its underlays.
1233
+ const FieldDescriptor* FindExtensionByNumber(const Descriptor* extendee,
1234
+ int number) const;
1235
+
1236
+ // Finds extensions of extendee. The extensions will be appended to
1237
+ // out in an undefined order. Only extensions defined directly in
1238
+ // this DescriptorPool or one of its underlays are guaranteed to be
1239
+ // found: extensions defined in the fallback database might not be found
1240
+ // depending on the database implementation.
1241
+ void FindAllExtensions(const Descriptor* extendee,
1242
+ vector<const FieldDescriptor*>* out) const;
1243
+
1244
+ // Building descriptors --------------------------------------------
1245
+
1246
+ // When converting a FileDescriptorProto to a FileDescriptor, various
1247
+ // errors might be detected in the input. The caller may handle these
1248
+ // programmatically by implementing an ErrorCollector.
1249
+ class LIBPROTOBUF_EXPORT ErrorCollector {
1250
+ public:
1251
+ inline ErrorCollector() {}
1252
+ virtual ~ErrorCollector();
1253
+
1254
+ // These constants specify what exact part of the construct is broken.
1255
+ // This is useful e.g. for mapping the error back to an exact location
1256
+ // in a .proto file.
1257
+ enum ErrorLocation {
1258
+ NAME, // the symbol name, or the package name for files
1259
+ NUMBER, // field or extension range number
1260
+ TYPE, // field type
1261
+ EXTENDEE, // field extendee
1262
+ DEFAULT_VALUE, // field default value
1263
+ INPUT_TYPE, // method input type
1264
+ OUTPUT_TYPE, // method output type
1265
+ OPTION_NAME, // name in assignment
1266
+ OPTION_VALUE, // value in option assignment
1267
+ OTHER // some other problem
1268
+ };
1269
+
1270
+ // Reports an error in the FileDescriptorProto. Use this function if the
1271
+ // problem occured should interrupt building the FileDescriptorProto.
1272
+ virtual void AddError(
1273
+ const string& filename, // File name in which the error occurred.
1274
+ const string& element_name, // Full name of the erroneous element.
1275
+ const Message* descriptor, // Descriptor of the erroneous element.
1276
+ ErrorLocation location, // One of the location constants, above.
1277
+ const string& message // Human-readable error message.
1278
+ ) = 0;
1279
+
1280
+ // Reports a warning in the FileDescriptorProto. Use this function if the
1281
+ // problem occured should NOT interrupt building the FileDescriptorProto.
1282
+ virtual void AddWarning(
1283
+ const string& filename, // File name in which the error occurred.
1284
+ const string& element_name, // Full name of the erroneous element.
1285
+ const Message* descriptor, // Descriptor of the erroneous element.
1286
+ ErrorLocation location, // One of the location constants, above.
1287
+ const string& message // Human-readable error message.
1288
+ ) {}
1289
+
1290
+ private:
1291
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ErrorCollector);
1292
+ };
1293
+
1294
+ // Convert the FileDescriptorProto to real descriptors and place them in
1295
+ // this DescriptorPool. All dependencies of the file must already be in
1296
+ // the pool. Returns the resulting FileDescriptor, or NULL if there were
1297
+ // problems with the input (e.g. the message was invalid, or dependencies
1298
+ // were missing). Details about the errors are written to GOOGLE_LOG(ERROR).
1299
+ const FileDescriptor* BuildFile(const FileDescriptorProto& proto);
1300
+
1301
+ // Same as BuildFile() except errors are sent to the given ErrorCollector.
1302
+ const FileDescriptor* BuildFileCollectingErrors(
1303
+ const FileDescriptorProto& proto,
1304
+ ErrorCollector* error_collector);
1305
+
1306
+ // By default, it is an error if a FileDescriptorProto contains references
1307
+ // to types or other files that are not found in the DescriptorPool (or its
1308
+ // backing DescriptorDatabase, if any). If you call
1309
+ // AllowUnknownDependencies(), however, then unknown types and files
1310
+ // will be replaced by placeholder descriptors (which can be identified by
1311
+ // the is_placeholder() method). This can allow you to
1312
+ // perform some useful operations with a .proto file even if you do not
1313
+ // have access to other .proto files on which it depends. However, some
1314
+ // heuristics must be used to fill in the gaps in information, and these
1315
+ // can lead to descriptors which are inaccurate. For example, the
1316
+ // DescriptorPool may be forced to guess whether an unknown type is a message
1317
+ // or an enum, as well as what package it resides in. Furthermore,
1318
+ // placeholder types will not be discoverable via FindMessageTypeByName()
1319
+ // and similar methods, which could confuse some descriptor-based algorithms.
1320
+ // Generally, the results of this option should be handled with extreme care.
1321
+ void AllowUnknownDependencies() { allow_unknown_ = true; }
1322
+
1323
+ // By default, weak imports are allowed to be missing, in which case we will
1324
+ // use a placeholder for the dependency and convert the field to be an Empty
1325
+ // message field. If you call EnforceWeakDependencies(true), however, the
1326
+ // DescriptorPool will report a import not found error.
1327
+ void EnforceWeakDependencies(bool enforce) { enforce_weak_ = enforce; }
1328
+
1329
+ // Internal stuff --------------------------------------------------
1330
+ // These methods MUST NOT be called from outside the proto2 library.
1331
+ // These methods may contain hidden pitfalls and may be removed in a
1332
+ // future library version.
1333
+
1334
+ // Create a DescriptorPool which is overlaid on top of some other pool.
1335
+ // If you search for a descriptor in the overlay and it is not found, the
1336
+ // underlay will be searched as a backup. If the underlay has its own
1337
+ // underlay, that will be searched next, and so on. This also means that
1338
+ // files built in the overlay will be cross-linked with the underlay's
1339
+ // descriptors if necessary. The underlay remains property of the caller;
1340
+ // it must remain valid for the lifetime of the newly-constructed pool.
1341
+ //
1342
+ // Example: Say you want to parse a .proto file at runtime in order to use
1343
+ // its type with a DynamicMessage. Say this .proto file has dependencies,
1344
+ // but you know that all the dependencies will be things that are already
1345
+ // compiled into the binary. For ease of use, you'd like to load the types
1346
+ // right out of generated_pool() rather than have to parse redundant copies
1347
+ // of all these .protos and runtime. But, you don't want to add the parsed
1348
+ // types directly into generated_pool(): this is not allowed, and would be
1349
+ // bad design anyway. So, instead, you could use generated_pool() as an
1350
+ // underlay for a new DescriptorPool in which you add only the new file.
1351
+ //
1352
+ // WARNING: Use of underlays can lead to many subtle gotchas. Instead,
1353
+ // try to formulate what you want to do in terms of DescriptorDatabases.
1354
+ explicit DescriptorPool(const DescriptorPool* underlay);
1355
+
1356
+ // Called by generated classes at init time to add their descriptors to
1357
+ // generated_pool. Do NOT call this in your own code! filename must be a
1358
+ // permanent string (e.g. a string literal).
1359
+ static void InternalAddGeneratedFile(
1360
+ const void* encoded_file_descriptor, int size);
1361
+
1362
+
1363
+ // For internal use only: Gets a non-const pointer to the generated pool.
1364
+ // This is called at static-initialization time only, so thread-safety is
1365
+ // not a concern. If both an underlay and a fallback database are present,
1366
+ // the underlay takes precedence.
1367
+ static DescriptorPool* internal_generated_pool();
1368
+
1369
+ // For internal use only: Changes the behavior of BuildFile() such that it
1370
+ // allows the file to make reference to message types declared in other files
1371
+ // which it did not officially declare as dependencies.
1372
+ void InternalDontEnforceDependencies();
1373
+
1374
+ // For internal use only.
1375
+ void internal_set_underlay(const DescriptorPool* underlay) {
1376
+ underlay_ = underlay;
1377
+ }
1378
+
1379
+ // For internal (unit test) use only: Returns true if a FileDescriptor has
1380
+ // been constructed for the given file, false otherwise. Useful for testing
1381
+ // lazy descriptor initialization behavior.
1382
+ bool InternalIsFileLoaded(const string& filename) const;
1383
+
1384
+
1385
+ // Add a file to unused_import_track_files_. DescriptorBuilder will log
1386
+ // warnings for those files if there is any unused import.
1387
+ void AddUnusedImportTrackFile(const string& file_name);
1388
+ void ClearUnusedImportTrackFiles();
1389
+
1390
+ private:
1391
+ friend class Descriptor;
1392
+ friend class FieldDescriptor;
1393
+ friend class EnumDescriptor;
1394
+ friend class ServiceDescriptor;
1395
+ friend class FileDescriptor;
1396
+ friend class DescriptorBuilder;
1397
+
1398
+ // Return true if the given name is a sub-symbol of any non-package
1399
+ // descriptor that already exists in the descriptor pool. (The full
1400
+ // definition of such types is already known.)
1401
+ bool IsSubSymbolOfBuiltType(const string& name) const;
1402
+
1403
+ // Tries to find something in the fallback database and link in the
1404
+ // corresponding proto file. Returns true if successful, in which case
1405
+ // the caller should search for the thing again. These are declared
1406
+ // const because they are called by (semantically) const methods.
1407
+ bool TryFindFileInFallbackDatabase(const string& name) const;
1408
+ bool TryFindSymbolInFallbackDatabase(const string& name) const;
1409
+ bool TryFindExtensionInFallbackDatabase(const Descriptor* containing_type,
1410
+ int field_number) const;
1411
+
1412
+ // Like BuildFile() but called internally when the file has been loaded from
1413
+ // fallback_database_. Declared const because it is called by (semantically)
1414
+ // const methods.
1415
+ const FileDescriptor* BuildFileFromDatabase(
1416
+ const FileDescriptorProto& proto) const;
1417
+
1418
+ // If fallback_database_ is NULL, this is NULL. Otherwise, this is a mutex
1419
+ // which must be locked while accessing tables_.
1420
+ Mutex* mutex_;
1421
+
1422
+ // See constructor.
1423
+ DescriptorDatabase* fallback_database_;
1424
+ ErrorCollector* default_error_collector_;
1425
+ const DescriptorPool* underlay_;
1426
+
1427
+ // This class contains a lot of hash maps with complicated types that
1428
+ // we'd like to keep out of the header.
1429
+ class Tables;
1430
+ scoped_ptr<Tables> tables_;
1431
+
1432
+ bool enforce_dependencies_;
1433
+ bool allow_unknown_;
1434
+ bool enforce_weak_;
1435
+ std::set<string> unused_import_track_files_;
1436
+
1437
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(DescriptorPool);
1438
+ };
1439
+
1440
+ // inline methods ====================================================
1441
+
1442
+ // These macros makes this repetitive code more readable.
1443
+ #define PROTOBUF_DEFINE_ACCESSOR(CLASS, FIELD, TYPE) \
1444
+ inline TYPE CLASS::FIELD() const { return FIELD##_; }
1445
+
1446
+ // Strings fields are stored as pointers but returned as const references.
1447
+ #define PROTOBUF_DEFINE_STRING_ACCESSOR(CLASS, FIELD) \
1448
+ inline const string& CLASS::FIELD() const { return *FIELD##_; }
1449
+
1450
+ // Arrays take an index parameter, obviously.
1451
+ #define PROTOBUF_DEFINE_ARRAY_ACCESSOR(CLASS, FIELD, TYPE) \
1452
+ inline TYPE CLASS::FIELD(int index) const { return FIELD##s_ + index; }
1453
+
1454
+ #define PROTOBUF_DEFINE_OPTIONS_ACCESSOR(CLASS, TYPE) \
1455
+ inline const TYPE& CLASS::options() const { return *options_; }
1456
+
1457
+ PROTOBUF_DEFINE_STRING_ACCESSOR(Descriptor, name)
1458
+ PROTOBUF_DEFINE_STRING_ACCESSOR(Descriptor, full_name)
1459
+ PROTOBUF_DEFINE_ACCESSOR(Descriptor, file, const FileDescriptor*)
1460
+ PROTOBUF_DEFINE_ACCESSOR(Descriptor, containing_type, const Descriptor*)
1461
+
1462
+ PROTOBUF_DEFINE_ACCESSOR(Descriptor, field_count, int)
1463
+ PROTOBUF_DEFINE_ACCESSOR(Descriptor, oneof_decl_count, int)
1464
+ PROTOBUF_DEFINE_ACCESSOR(Descriptor, nested_type_count, int)
1465
+ PROTOBUF_DEFINE_ACCESSOR(Descriptor, enum_type_count, int)
1466
+
1467
+ PROTOBUF_DEFINE_ARRAY_ACCESSOR(Descriptor, field, const FieldDescriptor*)
1468
+ PROTOBUF_DEFINE_ARRAY_ACCESSOR(Descriptor, oneof_decl, const OneofDescriptor*)
1469
+ PROTOBUF_DEFINE_ARRAY_ACCESSOR(Descriptor, nested_type, const Descriptor*)
1470
+ PROTOBUF_DEFINE_ARRAY_ACCESSOR(Descriptor, enum_type, const EnumDescriptor*)
1471
+
1472
+ PROTOBUF_DEFINE_ACCESSOR(Descriptor, extension_range_count, int)
1473
+ PROTOBUF_DEFINE_ACCESSOR(Descriptor, extension_count, int)
1474
+ PROTOBUF_DEFINE_ARRAY_ACCESSOR(Descriptor, extension_range,
1475
+ const Descriptor::ExtensionRange*)
1476
+ PROTOBUF_DEFINE_ARRAY_ACCESSOR(Descriptor, extension,
1477
+ const FieldDescriptor*)
1478
+ PROTOBUF_DEFINE_OPTIONS_ACCESSOR(Descriptor, MessageOptions);
1479
+ PROTOBUF_DEFINE_ACCESSOR(Descriptor, is_placeholder, bool)
1480
+
1481
+ PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, name)
1482
+ PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, full_name)
1483
+ PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, lowercase_name)
1484
+ PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, camelcase_name)
1485
+ PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, file, const FileDescriptor*)
1486
+ PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, number, int)
1487
+ PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, is_extension, bool)
1488
+ PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, type, FieldDescriptor::Type)
1489
+ PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, label, FieldDescriptor::Label)
1490
+ PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, containing_type, const Descriptor*)
1491
+ PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, containing_oneof,
1492
+ const OneofDescriptor*)
1493
+ PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, index_in_oneof, int)
1494
+ PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, extension_scope, const Descriptor*)
1495
+ PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, message_type, const Descriptor*)
1496
+ PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, enum_type, const EnumDescriptor*)
1497
+ PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, experimental_map_key,
1498
+ const FieldDescriptor*)
1499
+ PROTOBUF_DEFINE_OPTIONS_ACCESSOR(FieldDescriptor, FieldOptions)
1500
+ PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, has_default_value, bool)
1501
+ PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_int32 , int32 )
1502
+ PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_int64 , int64 )
1503
+ PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_uint32, uint32)
1504
+ PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_uint64, uint64)
1505
+ PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_float , float )
1506
+ PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_double, double)
1507
+ PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_bool , bool )
1508
+ PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_enum,
1509
+ const EnumValueDescriptor*)
1510
+ PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, default_value_string)
1511
+
1512
+ PROTOBUF_DEFINE_STRING_ACCESSOR(OneofDescriptor, name)
1513
+ PROTOBUF_DEFINE_STRING_ACCESSOR(OneofDescriptor, full_name)
1514
+ PROTOBUF_DEFINE_ACCESSOR(OneofDescriptor, containing_type, const Descriptor*)
1515
+ PROTOBUF_DEFINE_ACCESSOR(OneofDescriptor, field_count, int)
1516
+
1517
+ PROTOBUF_DEFINE_STRING_ACCESSOR(EnumDescriptor, name)
1518
+ PROTOBUF_DEFINE_STRING_ACCESSOR(EnumDescriptor, full_name)
1519
+ PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, file, const FileDescriptor*)
1520
+ PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, containing_type, const Descriptor*)
1521
+ PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, value_count, int)
1522
+ PROTOBUF_DEFINE_ARRAY_ACCESSOR(EnumDescriptor, value,
1523
+ const EnumValueDescriptor*)
1524
+ PROTOBUF_DEFINE_OPTIONS_ACCESSOR(EnumDescriptor, EnumOptions);
1525
+ PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, is_placeholder, bool)
1526
+
1527
+ PROTOBUF_DEFINE_STRING_ACCESSOR(EnumValueDescriptor, name)
1528
+ PROTOBUF_DEFINE_STRING_ACCESSOR(EnumValueDescriptor, full_name)
1529
+ PROTOBUF_DEFINE_ACCESSOR(EnumValueDescriptor, number, int)
1530
+ PROTOBUF_DEFINE_ACCESSOR(EnumValueDescriptor, type, const EnumDescriptor*)
1531
+ PROTOBUF_DEFINE_OPTIONS_ACCESSOR(EnumValueDescriptor, EnumValueOptions)
1532
+
1533
+ PROTOBUF_DEFINE_STRING_ACCESSOR(ServiceDescriptor, name)
1534
+ PROTOBUF_DEFINE_STRING_ACCESSOR(ServiceDescriptor, full_name)
1535
+ PROTOBUF_DEFINE_ACCESSOR(ServiceDescriptor, file, const FileDescriptor*)
1536
+ PROTOBUF_DEFINE_ACCESSOR(ServiceDescriptor, method_count, int)
1537
+ PROTOBUF_DEFINE_ARRAY_ACCESSOR(ServiceDescriptor, method,
1538
+ const MethodDescriptor*)
1539
+ PROTOBUF_DEFINE_OPTIONS_ACCESSOR(ServiceDescriptor, ServiceOptions);
1540
+
1541
+ PROTOBUF_DEFINE_STRING_ACCESSOR(MethodDescriptor, name)
1542
+ PROTOBUF_DEFINE_STRING_ACCESSOR(MethodDescriptor, full_name)
1543
+ PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, service, const ServiceDescriptor*)
1544
+ PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, input_type, const Descriptor*)
1545
+ PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, output_type, const Descriptor*)
1546
+ PROTOBUF_DEFINE_OPTIONS_ACCESSOR(MethodDescriptor, MethodOptions);
1547
+ PROTOBUF_DEFINE_STRING_ACCESSOR(FileDescriptor, name)
1548
+ PROTOBUF_DEFINE_STRING_ACCESSOR(FileDescriptor, package)
1549
+ PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, pool, const DescriptorPool*)
1550
+ PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, dependency_count, int)
1551
+ PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, public_dependency_count, int)
1552
+ PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, weak_dependency_count, int)
1553
+ PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, message_type_count, int)
1554
+ PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, enum_type_count, int)
1555
+ PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, service_count, int)
1556
+ PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, extension_count, int)
1557
+ PROTOBUF_DEFINE_OPTIONS_ACCESSOR(FileDescriptor, FileOptions);
1558
+ PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, is_placeholder, bool)
1559
+
1560
+ PROTOBUF_DEFINE_ARRAY_ACCESSOR(FileDescriptor, message_type, const Descriptor*)
1561
+ PROTOBUF_DEFINE_ARRAY_ACCESSOR(FileDescriptor, enum_type, const EnumDescriptor*)
1562
+ PROTOBUF_DEFINE_ARRAY_ACCESSOR(FileDescriptor, service,
1563
+ const ServiceDescriptor*)
1564
+ PROTOBUF_DEFINE_ARRAY_ACCESSOR(FileDescriptor, extension,
1565
+ const FieldDescriptor*)
1566
+
1567
+ #undef PROTOBUF_DEFINE_ACCESSOR
1568
+ #undef PROTOBUF_DEFINE_STRING_ACCESSOR
1569
+ #undef PROTOBUF_DEFINE_ARRAY_ACCESSOR
1570
+
1571
+ // A few accessors differ from the macros...
1572
+
1573
+ inline bool Descriptor::IsExtensionNumber(int number) const {
1574
+ return FindExtensionRangeContainingNumber(number) != NULL;
1575
+ }
1576
+
1577
+ inline bool FieldDescriptor::is_required() const {
1578
+ return label() == LABEL_REQUIRED;
1579
+ }
1580
+
1581
+ inline bool FieldDescriptor::is_optional() const {
1582
+ return label() == LABEL_OPTIONAL;
1583
+ }
1584
+
1585
+ inline bool FieldDescriptor::is_repeated() const {
1586
+ return label() == LABEL_REPEATED;
1587
+ }
1588
+
1589
+ inline bool FieldDescriptor::is_packable() const {
1590
+ return is_repeated() && IsTypePackable(type());
1591
+ }
1592
+
1593
+ // To save space, index() is computed by looking at the descriptor's position
1594
+ // in the parent's array of children.
1595
+ inline int FieldDescriptor::index() const {
1596
+ if (!is_extension_) {
1597
+ return static_cast<int>(this - containing_type_->fields_);
1598
+ } else if (extension_scope_ != NULL) {
1599
+ return static_cast<int>(this - extension_scope_->extensions_);
1600
+ } else {
1601
+ return static_cast<int>(this - file_->extensions_);
1602
+ }
1603
+ }
1604
+
1605
+ inline int Descriptor::index() const {
1606
+ if (containing_type_ == NULL) {
1607
+ return static_cast<int>(this - file_->message_types_);
1608
+ } else {
1609
+ return static_cast<int>(this - containing_type_->nested_types_);
1610
+ }
1611
+ }
1612
+
1613
+ inline int OneofDescriptor::index() const {
1614
+ return static_cast<int>(this - containing_type_->oneof_decls_);
1615
+ }
1616
+
1617
+ inline int EnumDescriptor::index() const {
1618
+ if (containing_type_ == NULL) {
1619
+ return static_cast<int>(this - file_->enum_types_);
1620
+ } else {
1621
+ return static_cast<int>(this - containing_type_->enum_types_);
1622
+ }
1623
+ }
1624
+
1625
+ inline int EnumValueDescriptor::index() const {
1626
+ return static_cast<int>(this - type_->values_);
1627
+ }
1628
+
1629
+ inline int ServiceDescriptor::index() const {
1630
+ return static_cast<int>(this - file_->services_);
1631
+ }
1632
+
1633
+ inline int MethodDescriptor::index() const {
1634
+ return static_cast<int>(this - service_->methods_);
1635
+ }
1636
+
1637
+ inline const char* FieldDescriptor::type_name() const {
1638
+ return kTypeToName[type_];
1639
+ }
1640
+
1641
+ inline FieldDescriptor::CppType FieldDescriptor::cpp_type() const {
1642
+ return kTypeToCppTypeMap[type_];
1643
+ }
1644
+
1645
+ inline const char* FieldDescriptor::cpp_type_name() const {
1646
+ return kCppTypeToName[kTypeToCppTypeMap[type_]];
1647
+ }
1648
+
1649
+ inline FieldDescriptor::CppType FieldDescriptor::TypeToCppType(Type type) {
1650
+ return kTypeToCppTypeMap[type];
1651
+ }
1652
+
1653
+ inline const char* FieldDescriptor::TypeName(Type type) {
1654
+ return kTypeToName[type];
1655
+ }
1656
+
1657
+ inline const char* FieldDescriptor::CppTypeName(CppType cpp_type) {
1658
+ return kCppTypeToName[cpp_type];
1659
+ }
1660
+
1661
+ inline bool FieldDescriptor::IsTypePackable(Type field_type) {
1662
+ return (field_type != FieldDescriptor::TYPE_STRING &&
1663
+ field_type != FieldDescriptor::TYPE_GROUP &&
1664
+ field_type != FieldDescriptor::TYPE_MESSAGE &&
1665
+ field_type != FieldDescriptor::TYPE_BYTES);
1666
+ }
1667
+
1668
+ inline const FileDescriptor* FileDescriptor::dependency(int index) const {
1669
+ return dependencies_[index];
1670
+ }
1671
+
1672
+ inline const FileDescriptor* FileDescriptor::public_dependency(
1673
+ int index) const {
1674
+ return dependencies_[public_dependencies_[index]];
1675
+ }
1676
+
1677
+ inline const FileDescriptor* FileDescriptor::weak_dependency(
1678
+ int index) const {
1679
+ return dependencies_[weak_dependencies_[index]];
1680
+ }
1681
+
1682
+ // Can't use PROTOBUF_DEFINE_ARRAY_ACCESSOR because fields_ is actually an array
1683
+ // of pointers rather than the usual array of objects.
1684
+ inline const FieldDescriptor* OneofDescriptor::field(int index) const {
1685
+ return fields_[index];
1686
+ }
1687
+
1688
+ } // namespace protobuf
1689
+
1690
+ } // namespace google
1691
+ #endif // GOOGLE_PROTOBUF_DESCRIPTOR_H__