protobuf 2.8.0.beta9 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +0 -1
  3. data/{UPGRADING.md → CHANGES.md} +20 -12
  4. data/LICENSE.txt +14 -0
  5. data/README.md +60 -74
  6. data/bin/protoc-gen-ruby +26 -0
  7. data/bin/rprotoc +4 -58
  8. data/lib/protobuf.rb +15 -13
  9. data/lib/protobuf/code_generator.rb +41 -0
  10. data/lib/protobuf/descriptors/google/protobuf/compiler/plugin.pb.rb +51 -0
  11. data/lib/protobuf/descriptors/google/protobuf/descriptor.pb.rb +248 -0
  12. data/lib/protobuf/field/base_field.rb +0 -1
  13. data/lib/protobuf/field/bytes_field.rb +1 -1
  14. data/lib/protobuf/field/message_field.rb +2 -4
  15. data/lib/protobuf/field/varint_field.rb +4 -7
  16. data/lib/protobuf/generators/base.rb +71 -0
  17. data/lib/protobuf/generators/enum_generator.rb +31 -0
  18. data/lib/protobuf/generators/extension_generator.rb +28 -0
  19. data/lib/protobuf/generators/field_generator.rb +132 -0
  20. data/lib/protobuf/generators/file_generator.rb +140 -0
  21. data/lib/protobuf/generators/group_generator.rb +113 -0
  22. data/lib/protobuf/generators/message_generator.rb +99 -0
  23. data/lib/protobuf/generators/printable.rb +161 -0
  24. data/lib/protobuf/generators/service_generator.rb +27 -0
  25. data/lib/protobuf/lifecycle.rb +7 -3
  26. data/lib/protobuf/message.rb +51 -34
  27. data/lib/protobuf/rpc/connectors/common.rb +4 -6
  28. data/lib/protobuf/rpc/server.rb +1 -1
  29. data/lib/protobuf/rpc/servers/zmq/server.rb +2 -2
  30. data/lib/protobuf/rpc/servers/zmq/worker.rb +2 -2
  31. data/lib/protobuf/rpc/service.rb +3 -3
  32. data/lib/protobuf/rpc/service_directory.rb +24 -12
  33. data/lib/protobuf/version.rb +1 -1
  34. data/proto/google/protobuf/compiler/plugin.proto +147 -0
  35. data/proto/google/protobuf/descriptor.proto +620 -0
  36. data/protobuf.gemspec +12 -21
  37. data/spec/bin/protoc-gen-ruby_spec.rb +18 -0
  38. data/spec/data/data.bin +3 -0
  39. data/{test/data/unk.png → spec/data/types.bin} +0 -0
  40. data/spec/encoding/all_types_spec.rb +91 -0
  41. data/spec/encoding/extreme_values_spec.rb +0 -0
  42. data/spec/lib/protobuf/code_generator_spec.rb +60 -0
  43. data/spec/lib/protobuf/generators/base_spec.rb +87 -0
  44. data/spec/lib/protobuf/generators/enum_generator_spec.rb +45 -0
  45. data/spec/lib/protobuf/generators/extension_generator_spec.rb +43 -0
  46. data/spec/lib/protobuf/generators/field_generator_spec.rb +99 -0
  47. data/spec/lib/protobuf/generators/file_generator_spec.rb +29 -0
  48. data/spec/lib/protobuf/generators/message_generator_spec.rb +0 -0
  49. data/spec/lib/protobuf/generators/service_generator_spec.rb +43 -0
  50. data/spec/lib/protobuf/lifecycle_spec.rb +31 -1
  51. data/spec/lib/protobuf/logger_spec.rb +5 -0
  52. data/spec/lib/protobuf/message_spec.rb +22 -8
  53. data/spec/lib/protobuf/rpc/connectors/common_spec.rb +1 -1
  54. data/spec/lib/protobuf/rpc/service_directory_spec.rb +45 -7
  55. data/spec/lib/protobuf/rpc/service_spec.rb +3 -3
  56. data/spec/spec_helper.rb +15 -16
  57. data/spec/support/test/all_types.data.bin +0 -0
  58. data/spec/support/test/all_types.data.txt +119 -0
  59. data/spec/support/test/defaults.pb.rb +25 -0
  60. data/spec/support/test/defaults.proto +9 -0
  61. data/spec/support/test/enum.pb.rb +10 -8
  62. data/spec/support/test/extended.pb.rb +5 -3
  63. data/spec/support/test/extreme_values.data.bin +0 -0
  64. data/spec/support/test/google_unittest.pb.rb +543 -0
  65. data/spec/support/test/google_unittest.proto +713 -0
  66. data/spec/support/test/google_unittest_import.pb.rb +37 -0
  67. data/{ext/protobuf-2.4.1/src/google/protobuf/io/package_info.h → spec/support/test/google_unittest_import.proto} +27 -17
  68. data/spec/support/test/google_unittest_import_public.pb.rb +8 -0
  69. data/{ext/protobuf-2.4.1/src/google/protobuf/io/coded_stream_inl.h → spec/support/test/google_unittest_import_public.proto} +5 -31
  70. data/spec/support/test/multi_field_extensions.pb.rb +29 -7
  71. data/spec/support/test/multi_field_extensions.proto +12 -2
  72. data/spec/support/test/resource.pb.rb +20 -16
  73. metadata +149 -236
  74. data/examples/addressbook.pb.rb +0 -55
  75. data/examples/addressbook.proto +0 -24
  76. data/examples/reading_a_message.rb +0 -32
  77. data/examples/writing_a_message.rb +0 -46
  78. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/code_generator.h +0 -142
  79. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/command_line_interface.h +0 -318
  80. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/cpp/cpp_enum.h +0 -99
  81. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/cpp/cpp_enum_field.h +0 -103
  82. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/cpp/cpp_extension.h +0 -85
  83. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/cpp/cpp_field.h +0 -167
  84. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/cpp/cpp_file.h +0 -98
  85. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/cpp/cpp_generator.h +0 -72
  86. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/cpp/cpp_helpers.h +0 -159
  87. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/cpp/cpp_message.h +0 -170
  88. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/cpp/cpp_message_field.h +0 -102
  89. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/cpp/cpp_primitive_field.h +0 -103
  90. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/cpp/cpp_service.h +0 -118
  91. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/cpp/cpp_string_field.h +0 -104
  92. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/cpp/cpp_test_bad_identifiers.pb.h +0 -2721
  93. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/importer.h +0 -303
  94. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/java/java_enum.h +0 -84
  95. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/java/java_enum_field.h +0 -121
  96. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/java/java_extension.h +0 -77
  97. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/java/java_field.h +0 -108
  98. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/java/java_file.h +0 -101
  99. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/java/java_generator.h +0 -72
  100. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/java/java_helpers.h +0 -213
  101. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/java/java_message.h +0 -109
  102. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/java/java_message_field.h +0 -134
  103. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/java/java_primitive_field.h +0 -121
  104. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/java/java_service.h +0 -113
  105. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/java/java_string_field.h +0 -120
  106. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/mock_code_generator.h +0 -113
  107. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/package_info.h +0 -64
  108. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/parser.h +0 -434
  109. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/plugin.h +0 -73
  110. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/plugin.pb.h +0 -790
  111. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/python/python_generator.h +0 -156
  112. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/subprocess.h +0 -108
  113. data/ext/protobuf-2.4.1/src/google/protobuf/compiler/zip_writer.h +0 -93
  114. data/ext/protobuf-2.4.1/src/google/protobuf/descriptor.h +0 -1367
  115. data/ext/protobuf-2.4.1/src/google/protobuf/descriptor.pb.h +0 -5223
  116. data/ext/protobuf-2.4.1/src/google/protobuf/descriptor_database.h +0 -366
  117. data/ext/protobuf-2.4.1/src/google/protobuf/dynamic_message.h +0 -136
  118. data/ext/protobuf-2.4.1/src/google/protobuf/extension_set.h +0 -904
  119. data/ext/protobuf-2.4.1/src/google/protobuf/generated_message_reflection.h +0 -424
  120. data/ext/protobuf-2.4.1/src/google/protobuf/generated_message_util.h +0 -82
  121. data/ext/protobuf-2.4.1/src/google/protobuf/io/coded_stream.h +0 -1102
  122. data/ext/protobuf-2.4.1/src/google/protobuf/io/gzip_stream.h +0 -207
  123. data/ext/protobuf-2.4.1/src/google/protobuf/io/printer.h +0 -136
  124. data/ext/protobuf-2.4.1/src/google/protobuf/io/tokenizer.h +0 -313
  125. data/ext/protobuf-2.4.1/src/google/protobuf/io/zero_copy_stream.h +0 -238
  126. data/ext/protobuf-2.4.1/src/google/protobuf/io/zero_copy_stream_impl.h +0 -357
  127. data/ext/protobuf-2.4.1/src/google/protobuf/io/zero_copy_stream_impl_lite.h +0 -340
  128. data/ext/protobuf-2.4.1/src/google/protobuf/message.h +0 -692
  129. data/ext/protobuf-2.4.1/src/google/protobuf/message_lite.h +0 -239
  130. data/ext/protobuf-2.4.1/src/google/protobuf/package_info.h +0 -64
  131. data/ext/protobuf-2.4.1/src/google/protobuf/reflection_ops.h +0 -80
  132. data/ext/protobuf-2.4.1/src/google/protobuf/repeated_field.h +0 -1295
  133. data/ext/protobuf-2.4.1/src/google/protobuf/service.h +0 -291
  134. data/ext/protobuf-2.4.1/src/google/protobuf/stubs/common.h +0 -1211
  135. data/ext/protobuf-2.4.1/src/google/protobuf/stubs/hash.h +0 -220
  136. data/ext/protobuf-2.4.1/src/google/protobuf/stubs/map-util.h +0 -119
  137. data/ext/protobuf-2.4.1/src/google/protobuf/stubs/once.h +0 -123
  138. data/ext/protobuf-2.4.1/src/google/protobuf/stubs/stl_util-inl.h +0 -121
  139. data/ext/protobuf-2.4.1/src/google/protobuf/stubs/strutil.h +0 -457
  140. data/ext/protobuf-2.4.1/src/google/protobuf/stubs/substitute.h +0 -170
  141. data/ext/protobuf-2.4.1/src/google/protobuf/test_util.h +0 -174
  142. data/ext/protobuf-2.4.1/src/google/protobuf/test_util_lite.h +0 -101
  143. data/ext/protobuf-2.4.1/src/google/protobuf/testing/file.h +0 -83
  144. data/ext/protobuf-2.4.1/src/google/protobuf/testing/googletest.h +0 -98
  145. data/ext/protobuf-2.4.1/src/google/protobuf/text_format.h +0 -285
  146. data/ext/protobuf-2.4.1/src/google/protobuf/unittest.pb.h +0 -11915
  147. data/ext/protobuf-2.4.1/src/google/protobuf/unittest_custom_options.pb.h +0 -2895
  148. data/ext/protobuf-2.4.1/src/google/protobuf/unittest_embed_optimize_for.pb.h +0 -211
  149. data/ext/protobuf-2.4.1/src/google/protobuf/unittest_empty.pb.h +0 -56
  150. data/ext/protobuf-2.4.1/src/google/protobuf/unittest_import.pb.h +0 -188
  151. data/ext/protobuf-2.4.1/src/google/protobuf/unittest_import_lite.pb.h +0 -151
  152. data/ext/protobuf-2.4.1/src/google/protobuf/unittest_lite.pb.h +0 -4752
  153. data/ext/protobuf-2.4.1/src/google/protobuf/unittest_lite_imports_nonlite.pb.h +0 -150
  154. data/ext/protobuf-2.4.1/src/google/protobuf/unittest_mset.pb.h +0 -816
  155. data/ext/protobuf-2.4.1/src/google/protobuf/unittest_no_generic_services.pb.h +0 -197
  156. data/ext/protobuf-2.4.1/src/google/protobuf/unittest_optimize_for.pb.h +0 -403
  157. data/ext/protobuf-2.4.1/src/google/protobuf/unknown_field_set.h +0 -268
  158. data/ext/protobuf-2.4.1/src/google/protobuf/wire_format.h +0 -304
  159. data/ext/protobuf-2.4.1/src/google/protobuf/wire_format_lite.h +0 -620
  160. data/ext/protobuf-2.4.1/src/google/protobuf/wire_format_lite_inl.h +0 -774
  161. data/ext/ruby_generator/Makefile +0 -10
  162. data/ext/ruby_generator/RubyGenerator.cpp +0 -544
  163. data/ext/ruby_generator/RubyGenerator.h +0 -206
  164. data/ext/ruby_generator/extconf.rb +0 -35
  165. data/test/data/data_source.py +0 -14
  166. data/test/data/types_source.py +0 -22
  167. data/test/proto/addressbook.pb.rb +0 -66
  168. data/test/proto/addressbook.proto +0 -33
  169. data/test/proto/addressbook_base.pb.rb +0 -58
  170. data/test/proto/addressbook_base.proto +0 -26
  171. data/test/proto/addressbook_ext.pb.rb +0 -20
  172. data/test/proto/addressbook_ext.proto +0 -6
  173. data/test/proto/collision.pb.rb +0 -17
  174. data/test/proto/collision.proto +0 -5
  175. data/test/proto/ext_collision.pb.rb +0 -24
  176. data/test/proto/ext_collision.proto +0 -8
  177. data/test/proto/ext_range.pb.rb +0 -22
  178. data/test/proto/ext_range.proto +0 -7
  179. data/test/proto/float_default.proto +0 -10
  180. data/test/proto/lowercase.pb.rb +0 -30
  181. data/test/proto/lowercase.proto +0 -9
  182. data/test/proto/merge.pb.rb +0 -39
  183. data/test/proto/merge.proto +0 -15
  184. data/test/proto/nested.pb.rb +0 -30
  185. data/test/proto/nested.proto +0 -9
  186. data/test/proto/optional_field.pb.rb +0 -35
  187. data/test/proto/optional_field.proto +0 -12
  188. data/test/proto/packed.pb.rb +0 -22
  189. data/test/proto/packed.proto +0 -6
  190. data/test/proto/rpc.proto +0 -6
  191. data/test/proto/types.pb.rb +0 -84
  192. data/test/proto/types.proto +0 -37
  193. data/test/test_addressbook.rb +0 -56
  194. data/test/test_enum_value.rb +0 -41
  195. data/test/test_extension.rb +0 -36
  196. data/test/test_lowercase.rb +0 -11
  197. data/test/test_message.rb +0 -128
  198. data/test/test_optional_field.rb +0 -103
  199. data/test/test_packed_field.rb +0 -40
  200. data/test/test_parse.rb +0 -15
  201. data/test/test_repeated_types.rb +0 -132
  202. data/test/test_serialize.rb +0 -61
  203. data/test/test_standard_message.rb +0 -96
  204. data/test/test_types.rb +0 -226
@@ -0,0 +1,25 @@
1
+ ##
2
+ # This file is auto-generated. DO NOT EDIT!
3
+ #
4
+ require 'protobuf/message'
5
+
6
+ module Test
7
+
8
+ ##
9
+ # Message Classes
10
+ #
11
+ class Defaults < ::Protobuf::Message; end
12
+
13
+
14
+ ##
15
+ # Message Fields
16
+ #
17
+ class Defaults
18
+ optional ::Protobuf::Field::BytesField, :escaped_bytes, 1, :default => "\000\001\007\010\014\n\r\t\013\\\\'\"\376"
19
+ optional ::Protobuf::Field::DoubleField, :infinity_default, 2, :default => ::Float::INFINITY
20
+ optional ::Protobuf::Field::FloatField, :neg_infinity_default, 3, :default => -::Float::INFINITY
21
+ optional ::Protobuf::Field::DoubleField, :nan_default, 4, :default => ::Float::NAN
22
+ end
23
+
24
+ end
25
+
@@ -0,0 +1,9 @@
1
+ package test;
2
+
3
+ message Defaults {
4
+ optional bytes escaped_bytes = 1 [default = "\0\001\a\b\f\n\r\t\v\\\'\"\xfe"];
5
+ optional double infinity_default = 2 [default = inf];
6
+ optional float neg_infinity_default = 3 [default = -inf];
7
+ optional double nan_default = 4 [default = nan];
8
+ }
9
+
@@ -3,6 +3,7 @@
3
3
  #
4
4
  require 'protobuf/message'
5
5
 
6
+
6
7
  ##
7
8
  # Imports
8
9
  #
@@ -17,13 +18,14 @@ module Test
17
18
  define :ONE, 1
18
19
  define :TWO, 2
19
20
  end
20
-
21
-
21
+
22
+
22
23
  ##
23
24
  # Message Classes
24
25
  #
25
26
  class EnumTestMessage < ::Protobuf::Message; end
26
-
27
+
28
+
27
29
  ##
28
30
  # Message Fields
29
31
  #
@@ -32,14 +34,14 @@ module Test
32
34
  optional ::Test::EnumTestType, :default_enum, 2, :default => ::Test::EnumTestType::ONE
33
35
  repeated ::Test::EnumTestType, :repeated_enums, 3
34
36
  end
35
-
36
-
37
+
38
+
37
39
  ##
38
- # Extended Messages
40
+ # Extended Message Fields
39
41
  #
40
- class ::Test::Resource
42
+ class ::Test::Resource < ::Protobuf::Message
41
43
  optional ::Protobuf::Field::Int32Field, :ext_other_file_defined_field, 200, :extension => true
42
44
  end
43
-
45
+
44
46
  end
45
47
 
@@ -1,6 +1,8 @@
1
1
  ##
2
2
  # This file is auto-generated. DO NOT EDIT!
3
3
  #
4
+ require 'protobuf/message'
5
+
4
6
 
5
7
  ##
6
8
  # Imports
@@ -10,11 +12,11 @@ require 'test/resource.pb'
10
12
  module Test
11
13
 
12
14
  ##
13
- # Extended Messages
15
+ # Extended Message Fields
14
16
  #
15
- class ::Test::Resource
17
+ class ::Test::Resource < ::Protobuf::Message
16
18
  optional ::Protobuf::Field::Int64Field, :deleted_at, 300, :extension => true
17
19
  end
18
-
20
+
19
21
  end
20
22
 
@@ -0,0 +1,543 @@
1
+ # encoding: utf-8
2
+
3
+ ##
4
+ # This file is auto-generated. DO NOT EDIT!
5
+ #
6
+ require 'protobuf/message'
7
+ require 'protobuf/rpc/service'
8
+
9
+
10
+ ##
11
+ # Imports
12
+ #
13
+ require 'test/google_unittest_import.pb'
14
+
15
+ module GoogleUnittest
16
+
17
+ ##
18
+ # Enum Classes
19
+ #
20
+ class ForeignEnum < ::Protobuf::Enum
21
+ define :FOREIGN_FOO, 4
22
+ define :FOREIGN_BAR, 5
23
+ define :FOREIGN_BAZ, 6
24
+ end
25
+
26
+ class TestSparseEnum < ::Protobuf::Enum
27
+ define :SPARSE_A, 123
28
+ define :SPARSE_B, 62374
29
+ define :SPARSE_C, 12589234
30
+ define :SPARSE_D, -15
31
+ define :SPARSE_E, -53452
32
+ define :SPARSE_F, 0
33
+ define :SPARSE_G, 2
34
+ end
35
+
36
+
37
+ ##
38
+ # Message Classes
39
+ #
40
+ class TestAllTypes < ::Protobuf::Message
41
+ class NestedEnum < ::Protobuf::Enum
42
+ define :FOO, 1
43
+ define :BAR, 2
44
+ define :BAZ, 3
45
+ end
46
+
47
+ class NestedMessage < ::Protobuf::Message; end
48
+
49
+ end
50
+
51
+ class TestDeprecatedFields < ::Protobuf::Message; end
52
+ class ForeignMessage < ::Protobuf::Message; end
53
+ class TestAllExtensions < ::Protobuf::Message; end
54
+ class TestNestedExtension < ::Protobuf::Message; end
55
+ class TestRequired < ::Protobuf::Message; end
56
+ class TestRequiredForeign < ::Protobuf::Message; end
57
+ class TestForeignNested < ::Protobuf::Message; end
58
+ class TestEmptyMessage < ::Protobuf::Message; end
59
+ class TestEmptyMessageWithExtensions < ::Protobuf::Message; end
60
+ class TestMultipleExtensionRanges < ::Protobuf::Message; end
61
+ class TestReallyLargeTagNumber < ::Protobuf::Message; end
62
+ class TestRecursiveMessage < ::Protobuf::Message; end
63
+ class TestMutualRecursionA < ::Protobuf::Message; end
64
+ class TestMutualRecursionB < ::Protobuf::Message; end
65
+ class TestDupFieldNumber < ::Protobuf::Message; end
66
+ class TestEagerMessage < ::Protobuf::Message; end
67
+ class TestLazyMessage < ::Protobuf::Message; end
68
+ class TestNestedMessageHasBits < ::Protobuf::Message
69
+ class NestedMessage < ::Protobuf::Message; end
70
+
71
+ end
72
+
73
+ class TestCamelCaseFieldNames < ::Protobuf::Message; end
74
+ class TestFieldOrderings < ::Protobuf::Message; end
75
+ class TestExtremeDefaultValues < ::Protobuf::Message; end
76
+ class SparseEnumMessage < ::Protobuf::Message; end
77
+ class OneString < ::Protobuf::Message; end
78
+ class MoreString < ::Protobuf::Message; end
79
+ class OneBytes < ::Protobuf::Message; end
80
+ class MoreBytes < ::Protobuf::Message; end
81
+ class TestPackedTypes < ::Protobuf::Message; end
82
+ class TestUnpackedTypes < ::Protobuf::Message; end
83
+ class TestPackedExtensions < ::Protobuf::Message; end
84
+ class TestDynamicExtensions < ::Protobuf::Message
85
+ class DynamicEnumType < ::Protobuf::Enum
86
+ define :DYNAMIC_FOO, 2200
87
+ define :DYNAMIC_BAR, 2201
88
+ define :DYNAMIC_BAZ, 2202
89
+ end
90
+
91
+ class DynamicMessageType < ::Protobuf::Message; end
92
+
93
+ end
94
+
95
+ class TestRepeatedScalarDifferentTagSizes < ::Protobuf::Message; end
96
+ class TestParsingMerge < ::Protobuf::Message
97
+ class RepeatedFieldsGenerator < ::Protobuf::Message; end
98
+
99
+ end
100
+
101
+ class TestCommentInjectionMessage < ::Protobuf::Message; end
102
+ class FooRequest < ::Protobuf::Message; end
103
+ class FooResponse < ::Protobuf::Message; end
104
+ class FooClientMessage < ::Protobuf::Message; end
105
+ class FooServerMessage < ::Protobuf::Message; end
106
+ class BarRequest < ::Protobuf::Message; end
107
+ class BarResponse < ::Protobuf::Message; end
108
+
109
+
110
+ ##
111
+ # Message Fields
112
+ #
113
+ class TestAllTypes
114
+ class NestedMessage
115
+ optional ::Protobuf::Field::Int32Field, :bb, 1
116
+ end
117
+
118
+ optional ::Protobuf::Field::Int32Field, :optional_int32, 1
119
+ optional ::Protobuf::Field::Int64Field, :optional_int64, 2
120
+ optional ::Protobuf::Field::Uint32Field, :optional_uint32, 3
121
+ optional ::Protobuf::Field::Uint64Field, :optional_uint64, 4
122
+ optional ::Protobuf::Field::Sint32Field, :optional_sint32, 5
123
+ optional ::Protobuf::Field::Sint64Field, :optional_sint64, 6
124
+ optional ::Protobuf::Field::Fixed32Field, :optional_fixed32, 7
125
+ optional ::Protobuf::Field::Fixed64Field, :optional_fixed64, 8
126
+ optional ::Protobuf::Field::Sfixed32Field, :optional_sfixed32, 9
127
+ optional ::Protobuf::Field::Sfixed64Field, :optional_sfixed64, 10
128
+ optional ::Protobuf::Field::FloatField, :optional_float, 11
129
+ optional ::Protobuf::Field::DoubleField, :optional_double, 12
130
+ optional ::Protobuf::Field::BoolField, :optional_bool, 13
131
+ optional ::Protobuf::Field::StringField, :optional_string, 14
132
+ optional ::Protobuf::Field::BytesField, :optional_bytes, 15
133
+ optional ::GoogleUnittest::TestAllTypes::NestedMessage, :optional_nested_message, 18
134
+ optional ::GoogleUnittest::ForeignMessage, :optional_foreign_message, 19
135
+ optional ::GoogleUnittestImport::ImportMessage, :optional_import_message, 20
136
+ optional ::GoogleUnittest::TestAllTypes::NestedEnum, :optional_nested_enum, 21
137
+ optional ::GoogleUnittest::ForeignEnum, :optional_foreign_enum, 22
138
+ optional ::GoogleUnittestImport::ImportEnum, :optional_import_enum, 23
139
+ optional ::Protobuf::Field::StringField, :optional_string_piece, 24
140
+ optional ::Protobuf::Field::StringField, :optional_cord, 25
141
+ optional ::GoogleUnittestImport::PublicImportMessage, :optional_public_import_message, 26
142
+ optional ::GoogleUnittest::TestAllTypes::NestedMessage, :optional_lazy_message, 27
143
+ repeated ::Protobuf::Field::Int32Field, :repeated_int32, 31
144
+ repeated ::Protobuf::Field::Int64Field, :repeated_int64, 32
145
+ repeated ::Protobuf::Field::Uint32Field, :repeated_uint32, 33
146
+ repeated ::Protobuf::Field::Uint64Field, :repeated_uint64, 34
147
+ repeated ::Protobuf::Field::Sint32Field, :repeated_sint32, 35
148
+ repeated ::Protobuf::Field::Sint64Field, :repeated_sint64, 36
149
+ repeated ::Protobuf::Field::Fixed32Field, :repeated_fixed32, 37
150
+ repeated ::Protobuf::Field::Fixed64Field, :repeated_fixed64, 38
151
+ repeated ::Protobuf::Field::Sfixed32Field, :repeated_sfixed32, 39
152
+ repeated ::Protobuf::Field::Sfixed64Field, :repeated_sfixed64, 40
153
+ repeated ::Protobuf::Field::FloatField, :repeated_float, 41
154
+ repeated ::Protobuf::Field::DoubleField, :repeated_double, 42
155
+ repeated ::Protobuf::Field::BoolField, :repeated_bool, 43
156
+ repeated ::Protobuf::Field::StringField, :repeated_string, 44
157
+ repeated ::Protobuf::Field::BytesField, :repeated_bytes, 45
158
+ repeated ::GoogleUnittest::TestAllTypes::NestedMessage, :repeated_nested_message, 48
159
+ repeated ::GoogleUnittest::ForeignMessage, :repeated_foreign_message, 49
160
+ repeated ::GoogleUnittestImport::ImportMessage, :repeated_import_message, 50
161
+ repeated ::GoogleUnittest::TestAllTypes::NestedEnum, :repeated_nested_enum, 51
162
+ repeated ::GoogleUnittest::ForeignEnum, :repeated_foreign_enum, 52
163
+ repeated ::GoogleUnittestImport::ImportEnum, :repeated_import_enum, 53
164
+ repeated ::Protobuf::Field::StringField, :repeated_string_piece, 54
165
+ repeated ::Protobuf::Field::StringField, :repeated_cord, 55
166
+ repeated ::GoogleUnittest::TestAllTypes::NestedMessage, :repeated_lazy_message, 57
167
+ optional ::Protobuf::Field::Int32Field, :default_int32, 61, :default => 41
168
+ optional ::Protobuf::Field::Int64Field, :default_int64, 62, :default => 42
169
+ optional ::Protobuf::Field::Uint32Field, :default_uint32, 63, :default => 43
170
+ optional ::Protobuf::Field::Uint64Field, :default_uint64, 64, :default => 44
171
+ optional ::Protobuf::Field::Sint32Field, :default_sint32, 65, :default => -45
172
+ optional ::Protobuf::Field::Sint64Field, :default_sint64, 66, :default => 46
173
+ optional ::Protobuf::Field::Fixed32Field, :default_fixed32, 67, :default => 47
174
+ optional ::Protobuf::Field::Fixed64Field, :default_fixed64, 68, :default => 48
175
+ optional ::Protobuf::Field::Sfixed32Field, :default_sfixed32, 69, :default => 49
176
+ optional ::Protobuf::Field::Sfixed64Field, :default_sfixed64, 70, :default => -50
177
+ optional ::Protobuf::Field::FloatField, :default_float, 71, :default => 51.5
178
+ optional ::Protobuf::Field::DoubleField, :default_double, 72, :default => 52000
179
+ optional ::Protobuf::Field::BoolField, :default_bool, 73, :default => true
180
+ optional ::Protobuf::Field::StringField, :default_string, 74, :default => "hello"
181
+ optional ::Protobuf::Field::BytesField, :default_bytes, 75, :default => "world"
182
+ optional ::GoogleUnittest::TestAllTypes::NestedEnum, :default_nested_enum, 81, :default => ::GoogleUnittest::TestAllTypes::NestedEnum::BAR
183
+ optional ::GoogleUnittest::ForeignEnum, :default_foreign_enum, 82, :default => ::GoogleUnittest::ForeignEnum::FOREIGN_BAR
184
+ optional ::GoogleUnittestImport::ImportEnum, :default_import_enum, 83, :default => ::GoogleUnittestImport::ImportEnum::IMPORT_BAR
185
+ optional ::Protobuf::Field::StringField, :default_string_piece, 84, :default => "abc"
186
+ optional ::Protobuf::Field::StringField, :default_cord, 85, :default => "123"
187
+ end
188
+
189
+ class TestDeprecatedFields
190
+ optional ::Protobuf::Field::Int32Field, :deprecated_int32, 1, :deprecated => true
191
+ end
192
+
193
+ class ForeignMessage
194
+ optional ::Protobuf::Field::Int32Field, :c, 1
195
+ end
196
+
197
+ class TestAllExtensions
198
+ # Extension Fields
199
+ extensions 1...536870912
200
+ optional ::Protobuf::Field::Int32Field, :optional_int32_extension, 1, :extension => true
201
+ optional ::Protobuf::Field::Int64Field, :optional_int64_extension, 2, :extension => true
202
+ optional ::Protobuf::Field::Uint32Field, :optional_uint32_extension, 3, :extension => true
203
+ optional ::Protobuf::Field::Uint64Field, :optional_uint64_extension, 4, :extension => true
204
+ optional ::Protobuf::Field::Sint32Field, :optional_sint32_extension, 5, :extension => true
205
+ optional ::Protobuf::Field::Sint64Field, :optional_sint64_extension, 6, :extension => true
206
+ optional ::Protobuf::Field::Fixed32Field, :optional_fixed32_extension, 7, :extension => true
207
+ optional ::Protobuf::Field::Fixed64Field, :optional_fixed64_extension, 8, :extension => true
208
+ optional ::Protobuf::Field::Sfixed32Field, :optional_sfixed32_extension, 9, :extension => true
209
+ optional ::Protobuf::Field::Sfixed64Field, :optional_sfixed64_extension, 10, :extension => true
210
+ optional ::Protobuf::Field::FloatField, :optional_float_extension, 11, :extension => true
211
+ optional ::Protobuf::Field::DoubleField, :optional_double_extension, 12, :extension => true
212
+ optional ::Protobuf::Field::BoolField, :optional_bool_extension, 13, :extension => true
213
+ optional ::Protobuf::Field::StringField, :optional_string_extension, 14, :extension => true
214
+ optional ::Protobuf::Field::BytesField, :optional_bytes_extension, 15, :extension => true
215
+ optional ::GoogleUnittest::TestAllTypes::NestedMessage, :optional_nested_message_extension, 18, :extension => true
216
+ optional ::GoogleUnittest::ForeignMessage, :optional_foreign_message_extension, 19, :extension => true
217
+ optional ::GoogleUnittestImport::ImportMessage, :optional_import_message_extension, 20, :extension => true
218
+ optional ::GoogleUnittest::TestAllTypes::NestedEnum, :optional_nested_enum_extension, 21, :extension => true
219
+ optional ::GoogleUnittest::ForeignEnum, :optional_foreign_enum_extension, 22, :extension => true
220
+ optional ::GoogleUnittestImport::ImportEnum, :optional_import_enum_extension, 23, :extension => true
221
+ optional ::Protobuf::Field::StringField, :optional_string_piece_extension, 24, :extension => true
222
+ optional ::Protobuf::Field::StringField, :optional_cord_extension, 25, :extension => true
223
+ optional ::GoogleUnittestImport::PublicImportMessage, :optional_public_import_message_extension, 26, :extension => true
224
+ optional ::GoogleUnittest::TestAllTypes::NestedMessage, :optional_lazy_message_extension, 27, :extension => true
225
+ repeated ::Protobuf::Field::Int32Field, :repeated_int32_extension, 31, :extension => true
226
+ repeated ::Protobuf::Field::Int64Field, :repeated_int64_extension, 32, :extension => true
227
+ repeated ::Protobuf::Field::Uint32Field, :repeated_uint32_extension, 33, :extension => true
228
+ repeated ::Protobuf::Field::Uint64Field, :repeated_uint64_extension, 34, :extension => true
229
+ repeated ::Protobuf::Field::Sint32Field, :repeated_sint32_extension, 35, :extension => true
230
+ repeated ::Protobuf::Field::Sint64Field, :repeated_sint64_extension, 36, :extension => true
231
+ repeated ::Protobuf::Field::Fixed32Field, :repeated_fixed32_extension, 37, :extension => true
232
+ repeated ::Protobuf::Field::Fixed64Field, :repeated_fixed64_extension, 38, :extension => true
233
+ repeated ::Protobuf::Field::Sfixed32Field, :repeated_sfixed32_extension, 39, :extension => true
234
+ repeated ::Protobuf::Field::Sfixed64Field, :repeated_sfixed64_extension, 40, :extension => true
235
+ repeated ::Protobuf::Field::FloatField, :repeated_float_extension, 41, :extension => true
236
+ repeated ::Protobuf::Field::DoubleField, :repeated_double_extension, 42, :extension => true
237
+ repeated ::Protobuf::Field::BoolField, :repeated_bool_extension, 43, :extension => true
238
+ repeated ::Protobuf::Field::StringField, :repeated_string_extension, 44, :extension => true
239
+ repeated ::Protobuf::Field::BytesField, :repeated_bytes_extension, 45, :extension => true
240
+ repeated ::GoogleUnittest::TestAllTypes::NestedMessage, :repeated_nested_message_extension, 48, :extension => true
241
+ repeated ::GoogleUnittest::ForeignMessage, :repeated_foreign_message_extension, 49, :extension => true
242
+ repeated ::GoogleUnittestImport::ImportMessage, :repeated_import_message_extension, 50, :extension => true
243
+ repeated ::GoogleUnittest::TestAllTypes::NestedEnum, :repeated_nested_enum_extension, 51, :extension => true
244
+ repeated ::GoogleUnittest::ForeignEnum, :repeated_foreign_enum_extension, 52, :extension => true
245
+ repeated ::GoogleUnittestImport::ImportEnum, :repeated_import_enum_extension, 53, :extension => true
246
+ repeated ::Protobuf::Field::StringField, :repeated_string_piece_extension, 54, :extension => true
247
+ repeated ::Protobuf::Field::StringField, :repeated_cord_extension, 55, :extension => true
248
+ repeated ::GoogleUnittest::TestAllTypes::NestedMessage, :repeated_lazy_message_extension, 57, :extension => true
249
+ optional ::Protobuf::Field::Int32Field, :default_int32_extension, 61, :default => 41, :extension => true
250
+ optional ::Protobuf::Field::Int64Field, :default_int64_extension, 62, :default => 42, :extension => true
251
+ optional ::Protobuf::Field::Uint32Field, :default_uint32_extension, 63, :default => 43, :extension => true
252
+ optional ::Protobuf::Field::Uint64Field, :default_uint64_extension, 64, :default => 44, :extension => true
253
+ optional ::Protobuf::Field::Sint32Field, :default_sint32_extension, 65, :default => -45, :extension => true
254
+ optional ::Protobuf::Field::Sint64Field, :default_sint64_extension, 66, :default => 46, :extension => true
255
+ optional ::Protobuf::Field::Fixed32Field, :default_fixed32_extension, 67, :default => 47, :extension => true
256
+ optional ::Protobuf::Field::Fixed64Field, :default_fixed64_extension, 68, :default => 48, :extension => true
257
+ optional ::Protobuf::Field::Sfixed32Field, :default_sfixed32_extension, 69, :default => 49, :extension => true
258
+ optional ::Protobuf::Field::Sfixed64Field, :default_sfixed64_extension, 70, :default => -50, :extension => true
259
+ optional ::Protobuf::Field::FloatField, :default_float_extension, 71, :default => 51.5, :extension => true
260
+ optional ::Protobuf::Field::DoubleField, :default_double_extension, 72, :default => 52000, :extension => true
261
+ optional ::Protobuf::Field::BoolField, :default_bool_extension, 73, :default => true, :extension => true
262
+ optional ::Protobuf::Field::StringField, :default_string_extension, 74, :default => "hello", :extension => true
263
+ optional ::Protobuf::Field::BytesField, :default_bytes_extension, 75, :default => "world", :extension => true
264
+ optional ::GoogleUnittest::TestAllTypes::NestedEnum, :default_nested_enum_extension, 81, :default => ::GoogleUnittest::TestAllTypes::NestedEnum::BAR, :extension => true
265
+ optional ::GoogleUnittest::ForeignEnum, :default_foreign_enum_extension, 82, :default => ::GoogleUnittest::ForeignEnum::FOREIGN_BAR, :extension => true
266
+ optional ::GoogleUnittestImport::ImportEnum, :default_import_enum_extension, 83, :default => ::GoogleUnittestImport::ImportEnum::IMPORT_BAR, :extension => true
267
+ optional ::Protobuf::Field::StringField, :default_string_piece_extension, 84, :default => "abc", :extension => true
268
+ optional ::Protobuf::Field::StringField, :default_cord_extension, 85, :default => "123", :extension => true
269
+ optional ::Protobuf::Field::StringField, :test, 1002, :default => "test", :extension => true
270
+ optional ::GoogleUnittest::TestRequired, :single, 1000, :extension => true
271
+ repeated ::GoogleUnittest::TestRequired, :multi, 1001, :extension => true
272
+ end
273
+
274
+ class TestRequired
275
+ required ::Protobuf::Field::Int32Field, :a, 1
276
+ optional ::Protobuf::Field::Int32Field, :dummy2, 2
277
+ required ::Protobuf::Field::Int32Field, :b, 3
278
+ optional ::Protobuf::Field::Int32Field, :dummy4, 4
279
+ optional ::Protobuf::Field::Int32Field, :dummy5, 5
280
+ optional ::Protobuf::Field::Int32Field, :dummy6, 6
281
+ optional ::Protobuf::Field::Int32Field, :dummy7, 7
282
+ optional ::Protobuf::Field::Int32Field, :dummy8, 8
283
+ optional ::Protobuf::Field::Int32Field, :dummy9, 9
284
+ optional ::Protobuf::Field::Int32Field, :dummy10, 10
285
+ optional ::Protobuf::Field::Int32Field, :dummy11, 11
286
+ optional ::Protobuf::Field::Int32Field, :dummy12, 12
287
+ optional ::Protobuf::Field::Int32Field, :dummy13, 13
288
+ optional ::Protobuf::Field::Int32Field, :dummy14, 14
289
+ optional ::Protobuf::Field::Int32Field, :dummy15, 15
290
+ optional ::Protobuf::Field::Int32Field, :dummy16, 16
291
+ optional ::Protobuf::Field::Int32Field, :dummy17, 17
292
+ optional ::Protobuf::Field::Int32Field, :dummy18, 18
293
+ optional ::Protobuf::Field::Int32Field, :dummy19, 19
294
+ optional ::Protobuf::Field::Int32Field, :dummy20, 20
295
+ optional ::Protobuf::Field::Int32Field, :dummy21, 21
296
+ optional ::Protobuf::Field::Int32Field, :dummy22, 22
297
+ optional ::Protobuf::Field::Int32Field, :dummy23, 23
298
+ optional ::Protobuf::Field::Int32Field, :dummy24, 24
299
+ optional ::Protobuf::Field::Int32Field, :dummy25, 25
300
+ optional ::Protobuf::Field::Int32Field, :dummy26, 26
301
+ optional ::Protobuf::Field::Int32Field, :dummy27, 27
302
+ optional ::Protobuf::Field::Int32Field, :dummy28, 28
303
+ optional ::Protobuf::Field::Int32Field, :dummy29, 29
304
+ optional ::Protobuf::Field::Int32Field, :dummy30, 30
305
+ optional ::Protobuf::Field::Int32Field, :dummy31, 31
306
+ optional ::Protobuf::Field::Int32Field, :dummy32, 32
307
+ required ::Protobuf::Field::Int32Field, :c, 33
308
+ end
309
+
310
+ class TestRequiredForeign
311
+ optional ::GoogleUnittest::TestRequired, :optional_message, 1
312
+ repeated ::GoogleUnittest::TestRequired, :repeated_message, 2
313
+ optional ::Protobuf::Field::Int32Field, :dummy, 3
314
+ end
315
+
316
+ class TestForeignNested
317
+ optional ::GoogleUnittest::TestAllTypes::NestedMessage, :foreign_nested, 1
318
+ end
319
+
320
+ class TestReallyLargeTagNumber
321
+ optional ::Protobuf::Field::Int32Field, :a, 1
322
+ optional ::Protobuf::Field::Int32Field, :bb, 268435455
323
+ end
324
+
325
+ class TestRecursiveMessage
326
+ optional ::GoogleUnittest::TestRecursiveMessage, :a, 1
327
+ optional ::Protobuf::Field::Int32Field, :i, 2
328
+ end
329
+
330
+ class TestMutualRecursionA
331
+ optional ::GoogleUnittest::TestMutualRecursionB, :bb, 1
332
+ end
333
+
334
+ class TestMutualRecursionB
335
+ optional ::GoogleUnittest::TestMutualRecursionA, :a, 1
336
+ optional ::Protobuf::Field::Int32Field, :optional_int32, 2
337
+ end
338
+
339
+ class TestDupFieldNumber
340
+ optional ::Protobuf::Field::Int32Field, :a, 1
341
+ end
342
+
343
+ class TestEagerMessage
344
+ optional ::GoogleUnittest::TestAllTypes, :sub_message, 1
345
+ end
346
+
347
+ class TestLazyMessage
348
+ optional ::GoogleUnittest::TestAllTypes, :sub_message, 1
349
+ end
350
+
351
+ class TestNestedMessageHasBits
352
+ class NestedMessage
353
+ repeated ::Protobuf::Field::Int32Field, :nestedmessage_repeated_int32, 1
354
+ repeated ::GoogleUnittest::ForeignMessage, :nestedmessage_repeated_foreignmessage, 2
355
+ end
356
+
357
+ optional ::GoogleUnittest::TestNestedMessageHasBits::NestedMessage, :optional_nested_message, 1
358
+ end
359
+
360
+ class TestCamelCaseFieldNames
361
+ optional ::Protobuf::Field::Int32Field, :PrimitiveField, 1
362
+ optional ::Protobuf::Field::StringField, :StringField, 2
363
+ optional ::GoogleUnittest::ForeignEnum, :EnumField, 3
364
+ optional ::GoogleUnittest::ForeignMessage, :MessageField, 4
365
+ optional ::Protobuf::Field::StringField, :StringPieceField, 5
366
+ optional ::Protobuf::Field::StringField, :CordField, 6
367
+ repeated ::Protobuf::Field::Int32Field, :RepeatedPrimitiveField, 7
368
+ repeated ::Protobuf::Field::StringField, :RepeatedStringField, 8
369
+ repeated ::GoogleUnittest::ForeignEnum, :RepeatedEnumField, 9
370
+ repeated ::GoogleUnittest::ForeignMessage, :RepeatedMessageField, 10
371
+ repeated ::Protobuf::Field::StringField, :RepeatedStringPieceField, 11
372
+ repeated ::Protobuf::Field::StringField, :RepeatedCordField, 12
373
+ end
374
+
375
+ class TestFieldOrderings
376
+ optional ::Protobuf::Field::StringField, :my_string, 11
377
+ optional ::Protobuf::Field::Int64Field, :my_int, 1
378
+ optional ::Protobuf::Field::FloatField, :my_float, 101
379
+ # Extension Fields
380
+ extensions 2...11
381
+ extensions 12...101
382
+ optional ::Protobuf::Field::StringField, :my_extension_string, 50, :extension => true
383
+ optional ::Protobuf::Field::Int32Field, :my_extension_int, 5, :extension => true
384
+ end
385
+
386
+ class TestExtremeDefaultValues
387
+ optional ::Protobuf::Field::BytesField, :escaped_bytes, 1, :default => "\000\001\007\010\014\n\r\t\013\\\\'\"\376"
388
+ optional ::Protobuf::Field::Uint32Field, :large_uint32, 2, :default => 4294967295
389
+ optional ::Protobuf::Field::Uint64Field, :large_uint64, 3, :default => 18446744073709551615
390
+ optional ::Protobuf::Field::Int32Field, :small_int32, 4, :default => -2147483647
391
+ optional ::Protobuf::Field::Int64Field, :small_int64, 5, :default => -9223372036854775807
392
+ optional ::Protobuf::Field::Int32Field, :really_small_int32, 21, :default => -2147483648
393
+ optional ::Protobuf::Field::Int64Field, :really_small_int64, 22, :default => -9223372036854775808
394
+ optional ::Protobuf::Field::StringField, :utf8_string, 6, :default => "ሴ"
395
+ optional ::Protobuf::Field::FloatField, :zero_float, 7, :default => 0
396
+ optional ::Protobuf::Field::FloatField, :one_float, 8, :default => 1
397
+ optional ::Protobuf::Field::FloatField, :small_float, 9, :default => 1.5
398
+ optional ::Protobuf::Field::FloatField, :negative_one_float, 10, :default => -1
399
+ optional ::Protobuf::Field::FloatField, :negative_float, 11, :default => -1.5
400
+ optional ::Protobuf::Field::FloatField, :large_float, 12, :default => 2e+08
401
+ optional ::Protobuf::Field::FloatField, :small_negative_float, 13, :default => -8e-28
402
+ optional ::Protobuf::Field::DoubleField, :inf_double, 14, :default => ::Float::INFINITY
403
+ optional ::Protobuf::Field::DoubleField, :neg_inf_double, 15, :default => -::Float::INFINITY
404
+ optional ::Protobuf::Field::DoubleField, :nan_double, 16, :default => ::Float::NAN
405
+ optional ::Protobuf::Field::FloatField, :inf_float, 17, :default => ::Float::INFINITY
406
+ optional ::Protobuf::Field::FloatField, :neg_inf_float, 18, :default => -::Float::INFINITY
407
+ optional ::Protobuf::Field::FloatField, :nan_float, 19, :default => ::Float::NAN
408
+ optional ::Protobuf::Field::StringField, :cpp_trigraph, 20, :default => "? ? ?? ?? ??? ??/ ??-"
409
+ optional ::Protobuf::Field::StringField, :string_with_zero, 23, :default => "hello"
410
+ optional ::Protobuf::Field::BytesField, :bytes_with_zero, 24, :default => "wor\000ld"
411
+ optional ::Protobuf::Field::StringField, :string_piece_with_zero, 25, :default => "abc"
412
+ optional ::Protobuf::Field::StringField, :cord_with_zero, 26, :default => "123"
413
+ end
414
+
415
+ class SparseEnumMessage
416
+ optional ::GoogleUnittest::TestSparseEnum, :sparse_enum, 1
417
+ end
418
+
419
+ class OneString
420
+ optional ::Protobuf::Field::StringField, :data, 1
421
+ end
422
+
423
+ class MoreString
424
+ repeated ::Protobuf::Field::StringField, :data, 1
425
+ end
426
+
427
+ class OneBytes
428
+ optional ::Protobuf::Field::BytesField, :data, 1
429
+ end
430
+
431
+ class MoreBytes
432
+ repeated ::Protobuf::Field::BytesField, :data, 1
433
+ end
434
+
435
+ class TestPackedTypes
436
+ repeated ::Protobuf::Field::Int32Field, :packed_int32, 90, :packed => true
437
+ repeated ::Protobuf::Field::Int64Field, :packed_int64, 91, :packed => true
438
+ repeated ::Protobuf::Field::Uint32Field, :packed_uint32, 92, :packed => true
439
+ repeated ::Protobuf::Field::Uint64Field, :packed_uint64, 93, :packed => true
440
+ repeated ::Protobuf::Field::Sint32Field, :packed_sint32, 94, :packed => true
441
+ repeated ::Protobuf::Field::Sint64Field, :packed_sint64, 95, :packed => true
442
+ repeated ::Protobuf::Field::Fixed32Field, :packed_fixed32, 96, :packed => true
443
+ repeated ::Protobuf::Field::Fixed64Field, :packed_fixed64, 97, :packed => true
444
+ repeated ::Protobuf::Field::Sfixed32Field, :packed_sfixed32, 98, :packed => true
445
+ repeated ::Protobuf::Field::Sfixed64Field, :packed_sfixed64, 99, :packed => true
446
+ repeated ::Protobuf::Field::FloatField, :packed_float, 100, :packed => true
447
+ repeated ::Protobuf::Field::DoubleField, :packed_double, 101, :packed => true
448
+ repeated ::Protobuf::Field::BoolField, :packed_bool, 102, :packed => true
449
+ repeated ::GoogleUnittest::ForeignEnum, :packed_enum, 103, :packed => true
450
+ end
451
+
452
+ class TestUnpackedTypes
453
+ repeated ::Protobuf::Field::Int32Field, :unpacked_int32, 90
454
+ repeated ::Protobuf::Field::Int64Field, :unpacked_int64, 91
455
+ repeated ::Protobuf::Field::Uint32Field, :unpacked_uint32, 92
456
+ repeated ::Protobuf::Field::Uint64Field, :unpacked_uint64, 93
457
+ repeated ::Protobuf::Field::Sint32Field, :unpacked_sint32, 94
458
+ repeated ::Protobuf::Field::Sint64Field, :unpacked_sint64, 95
459
+ repeated ::Protobuf::Field::Fixed32Field, :unpacked_fixed32, 96
460
+ repeated ::Protobuf::Field::Fixed64Field, :unpacked_fixed64, 97
461
+ repeated ::Protobuf::Field::Sfixed32Field, :unpacked_sfixed32, 98
462
+ repeated ::Protobuf::Field::Sfixed64Field, :unpacked_sfixed64, 99
463
+ repeated ::Protobuf::Field::FloatField, :unpacked_float, 100
464
+ repeated ::Protobuf::Field::DoubleField, :unpacked_double, 101
465
+ repeated ::Protobuf::Field::BoolField, :unpacked_bool, 102
466
+ repeated ::GoogleUnittest::ForeignEnum, :unpacked_enum, 103
467
+ end
468
+
469
+ class TestPackedExtensions
470
+ # Extension Fields
471
+ extensions 1...536870912
472
+ repeated ::Protobuf::Field::Int32Field, :packed_int32_extension, 90, :packed => true, :extension => true
473
+ repeated ::Protobuf::Field::Int64Field, :packed_int64_extension, 91, :packed => true, :extension => true
474
+ repeated ::Protobuf::Field::Uint32Field, :packed_uint32_extension, 92, :packed => true, :extension => true
475
+ repeated ::Protobuf::Field::Uint64Field, :packed_uint64_extension, 93, :packed => true, :extension => true
476
+ repeated ::Protobuf::Field::Sint32Field, :packed_sint32_extension, 94, :packed => true, :extension => true
477
+ repeated ::Protobuf::Field::Sint64Field, :packed_sint64_extension, 95, :packed => true, :extension => true
478
+ repeated ::Protobuf::Field::Fixed32Field, :packed_fixed32_extension, 96, :packed => true, :extension => true
479
+ repeated ::Protobuf::Field::Fixed64Field, :packed_fixed64_extension, 97, :packed => true, :extension => true
480
+ repeated ::Protobuf::Field::Sfixed32Field, :packed_sfixed32_extension, 98, :packed => true, :extension => true
481
+ repeated ::Protobuf::Field::Sfixed64Field, :packed_sfixed64_extension, 99, :packed => true, :extension => true
482
+ repeated ::Protobuf::Field::FloatField, :packed_float_extension, 100, :packed => true, :extension => true
483
+ repeated ::Protobuf::Field::DoubleField, :packed_double_extension, 101, :packed => true, :extension => true
484
+ repeated ::Protobuf::Field::BoolField, :packed_bool_extension, 102, :packed => true, :extension => true
485
+ repeated ::GoogleUnittest::ForeignEnum, :packed_enum_extension, 103, :packed => true, :extension => true
486
+ end
487
+
488
+ class TestDynamicExtensions
489
+ class DynamicMessageType
490
+ optional ::Protobuf::Field::Int32Field, :dynamic_field, 2100
491
+ end
492
+
493
+ optional ::Protobuf::Field::Fixed32Field, :scalar_extension, 2000
494
+ optional ::GoogleUnittest::ForeignEnum, :enum_extension, 2001
495
+ optional ::GoogleUnittest::TestDynamicExtensions::DynamicEnumType, :dynamic_enum_extension, 2002
496
+ optional ::GoogleUnittest::ForeignMessage, :message_extension, 2003
497
+ optional ::GoogleUnittest::TestDynamicExtensions::DynamicMessageType, :dynamic_message_extension, 2004
498
+ repeated ::Protobuf::Field::StringField, :repeated_extension, 2005
499
+ repeated ::Protobuf::Field::Sint32Field, :packed_extension, 2006, :packed => true
500
+ end
501
+
502
+ class TestRepeatedScalarDifferentTagSizes
503
+ repeated ::Protobuf::Field::Fixed32Field, :repeated_fixed32, 12
504
+ repeated ::Protobuf::Field::Int32Field, :repeated_int32, 13
505
+ repeated ::Protobuf::Field::Fixed64Field, :repeated_fixed64, 2046
506
+ repeated ::Protobuf::Field::Int64Field, :repeated_int64, 2047
507
+ repeated ::Protobuf::Field::FloatField, :repeated_float, 262142
508
+ repeated ::Protobuf::Field::Uint64Field, :repeated_uint64, 262143
509
+ end
510
+
511
+ class TestParsingMerge
512
+ class RepeatedFieldsGenerator
513
+ repeated ::GoogleUnittest::TestAllTypes, :field1, 1
514
+ repeated ::GoogleUnittest::TestAllTypes, :field2, 2
515
+ repeated ::GoogleUnittest::TestAllTypes, :field3, 3
516
+ repeated ::GoogleUnittest::TestAllTypes, :ext1, 1000
517
+ repeated ::GoogleUnittest::TestAllTypes, :ext2, 1001
518
+ end
519
+
520
+ required ::GoogleUnittest::TestAllTypes, :required_all_types, 1
521
+ optional ::GoogleUnittest::TestAllTypes, :optional_all_types, 2
522
+ repeated ::GoogleUnittest::TestAllTypes, :repeated_all_types, 3
523
+ # Extension Fields
524
+ extensions 1000...536870912
525
+ optional ::GoogleUnittest::TestAllTypes, :optional_ext, 1000, :extension => true
526
+ repeated ::GoogleUnittest::TestAllTypes, :repeated_ext, 1001, :extension => true
527
+ end
528
+
529
+ class TestCommentInjectionMessage
530
+ optional ::Protobuf::Field::StringField, :a, 1, :default => "*/ <- Neither should this."
531
+ end
532
+
533
+
534
+ ##
535
+ # Service Classes
536
+ #
537
+ class TestService < ::Protobuf::Rpc::Service
538
+ rpc :foo, ::GoogleUnittest::FooRequest, ::GoogleUnittest::FooResponse
539
+ rpc :bar, ::GoogleUnittest::BarRequest, ::GoogleUnittest::BarResponse
540
+ end
541
+
542
+ end
543
+