protobufjs 5.0.1 → 5.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/.travis.yml +2 -1
  2. package/README.md +144 -22
  3. package/bin/pbjs +2 -2
  4. package/bower.json +2 -2
  5. package/cli/pbjs/targets/amd.js +1 -1
  6. package/cli/pbjs/targets/json.js +8 -0
  7. package/cli/pbjs/util.js +1 -1
  8. package/cli/pbjs.js +1 -1
  9. package/dist/protobuf-light.js +166 -128
  10. package/dist/protobuf-light.min.js +88 -81
  11. package/dist/protobuf-light.min.js.gz +0 -0
  12. package/dist/protobuf-light.min.map +4 -4
  13. package/dist/protobuf.js +171 -129
  14. package/dist/protobuf.min.js +106 -98
  15. package/dist/protobuf.min.js.gz +0 -0
  16. package/dist/protobuf.min.map +4 -4
  17. package/docs/ProtoBuf.Builder.Message.html +1408 -971
  18. package/docs/ProtoBuf.Builder.Service.html +266 -197
  19. package/docs/ProtoBuf.Builder.html +758 -542
  20. package/docs/ProtoBuf.DotProto.Parser.html +223 -161
  21. package/docs/ProtoBuf.DotProto.Tokenizer.html +344 -248
  22. package/docs/ProtoBuf.DotProto.html +20 -12
  23. package/docs/ProtoBuf.Element.html +554 -554
  24. package/docs/ProtoBuf.Map.html +158 -123
  25. package/docs/ProtoBuf.Reflect.Element.html +286 -143
  26. package/docs/ProtoBuf.Reflect.Enum.Value.html +329 -228
  27. package/docs/ProtoBuf.Reflect.Enum.html +757 -537
  28. package/docs/ProtoBuf.Reflect.Extension.html +73 -56
  29. package/docs/ProtoBuf.Reflect.Message.ExtensionField.html +1013 -740
  30. package/docs/ProtoBuf.Reflect.Message.Field.html +926 -649
  31. package/docs/ProtoBuf.Reflect.Message.OneOf.html +327 -245
  32. package/docs/ProtoBuf.Reflect.Message.html +915 -651
  33. package/docs/ProtoBuf.Reflect.Namespace.html +648 -447
  34. package/docs/ProtoBuf.Reflect.Service.Method.html +363 -251
  35. package/docs/ProtoBuf.Reflect.Service.RPCMethod.html +545 -397
  36. package/docs/ProtoBuf.Reflect.Service.html +721 -511
  37. package/docs/ProtoBuf.Reflect.T.html +268 -197
  38. package/docs/ProtoBuf.Reflect.html +20 -12
  39. package/docs/ProtoBuf.Util.html +169 -118
  40. package/docs/ProtoBuf.html +840 -628
  41. package/docs/ProtoBuf.js.html +177 -134
  42. package/docs/fonts/OpenSans-Bold-webfont.eot +0 -0
  43. package/docs/fonts/OpenSans-Bold-webfont.svg +1830 -0
  44. package/docs/fonts/OpenSans-Bold-webfont.woff +0 -0
  45. package/docs/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  46. package/docs/fonts/OpenSans-BoldItalic-webfont.svg +1830 -0
  47. package/docs/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  48. package/docs/fonts/OpenSans-Italic-webfont.eot +0 -0
  49. package/docs/fonts/OpenSans-Italic-webfont.svg +1830 -0
  50. package/docs/fonts/OpenSans-Italic-webfont.woff +0 -0
  51. package/docs/fonts/OpenSans-Light-webfont.eot +0 -0
  52. package/docs/fonts/OpenSans-Light-webfont.svg +1831 -0
  53. package/docs/fonts/OpenSans-Light-webfont.woff +0 -0
  54. package/docs/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  55. package/docs/fonts/OpenSans-LightItalic-webfont.svg +1835 -0
  56. package/docs/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  57. package/docs/fonts/OpenSans-Regular-webfont.eot +0 -0
  58. package/docs/fonts/OpenSans-Regular-webfont.svg +1831 -0
  59. package/docs/fonts/OpenSans-Regular-webfont.woff +0 -0
  60. package/docs/index.html +7 -5
  61. package/docs/styles/jsdoc-default.css +95 -75
  62. package/docs/styles/prettify-tomorrow.css +1 -1
  63. package/examples/protoify/json.js +123 -123
  64. package/examples/protoify/json.json +123 -123
  65. package/examples/websocket/server.js +4 -4
  66. package/externs/protobuf.js +1 -1
  67. package/jsdoc.json +1 -1
  68. package/package.json +2 -2
  69. package/scripts/build.js +53 -53
  70. package/src/ProtoBuf/Builder/Message.js +9 -5
  71. package/src/ProtoBuf/Builder.js +19 -2
  72. package/src/ProtoBuf/DotProto/Parser.js +5 -1
  73. package/src/ProtoBuf/Reflect/Element.js +13 -1
  74. package/src/ProtoBuf/Reflect/Message/Field.js +2 -2
  75. package/src/ProtoBuf/Reflect/Message.js +6 -1
  76. package/src/ProtoBuf/Util.js +116 -116
  77. package/src/bower.json +1 -1
  78. package/src/google/protobuf/descriptor.json +27 -1
  79. package/tests/bench.txt +373 -373
  80. package/tests/complex.json +8 -1
  81. package/tests/custom-options.json +169 -169
  82. package/tests/extend.json +71 -71
  83. package/tests/imports.json +83 -83
  84. package/tests/nodeunit-browser/nodeunit.css +70 -70
  85. package/tests/nodeunit-browser/nodeunit.js +2108 -2108
  86. package/tests/options.json +32 -32
  87. package/tests/proto2js/Bar.json +46 -46
  88. package/tests/suite.js +43 -1
  89. package/sandbox/gapi/googleapis/google/api/annotations.proto +0 -29
  90. package/sandbox/gapi/googleapis/google/api/http.proto +0 -245
  91. package/sandbox/gapi/googleapis/google/datastore/v1beta3/datastore.proto +0 -281
  92. package/sandbox/gapi/googleapis/google/datastore/v1beta3/entity.proto +0 -189
  93. package/sandbox/gapi/googleapis/google/datastore/v1beta3/query.proto +0 -281
  94. package/sandbox/gapi/googleapis/google/longrunning/operations.proto +0 -144
  95. package/sandbox/gapi/googleapis/google/protobuf/any.proto +0 -98
  96. package/sandbox/gapi/googleapis/google/protobuf/any_test.proto +0 -41
  97. package/sandbox/gapi/googleapis/google/protobuf/api.proto +0 -201
  98. package/sandbox/gapi/googleapis/google/protobuf/descriptor.proto +0 -773
  99. package/sandbox/gapi/googleapis/google/protobuf/duration.proto +0 -95
  100. package/sandbox/gapi/googleapis/google/protobuf/empty.proto +0 -50
  101. package/sandbox/gapi/googleapis/google/protobuf/field_mask.proto +0 -167
  102. package/sandbox/gapi/googleapis/google/protobuf/map_lite_unittest.proto +0 -130
  103. package/sandbox/gapi/googleapis/google/protobuf/map_proto2_unittest.proto +0 -60
  104. package/sandbox/gapi/googleapis/google/protobuf/map_unittest.proto +0 -129
  105. package/sandbox/gapi/googleapis/google/protobuf/map_unittest_proto3.proto +0 -120
  106. package/sandbox/gapi/googleapis/google/protobuf/source_context.proto +0 -47
  107. package/sandbox/gapi/googleapis/google/protobuf/struct.proto +0 -94
  108. package/sandbox/gapi/googleapis/google/protobuf/timestamp.proto +0 -107
  109. package/sandbox/gapi/googleapis/google/protobuf/type.proto +0 -176
  110. package/sandbox/gapi/googleapis/google/protobuf/unittest.proto +0 -878
  111. package/sandbox/gapi/googleapis/google/protobuf/unittest_arena.proto +0 -46
  112. package/sandbox/gapi/googleapis/google/protobuf/unittest_custom_options.proto +0 -394
  113. package/sandbox/gapi/googleapis/google/protobuf/unittest_drop_unknown_fields.proto +0 -58
  114. package/sandbox/gapi/googleapis/google/protobuf/unittest_embed_optimize_for.proto +0 -51
  115. package/sandbox/gapi/googleapis/google/protobuf/unittest_empty.proto +0 -38
  116. package/sandbox/gapi/googleapis/google/protobuf/unittest_enormous_descriptor.proto +0 -1048
  117. package/sandbox/gapi/googleapis/google/protobuf/unittest_import.proto +0 -66
  118. package/sandbox/gapi/googleapis/google/protobuf/unittest_import_lite.proto +0 -52
  119. package/sandbox/gapi/googleapis/google/protobuf/unittest_import_proto3.proto +0 -68
  120. package/sandbox/gapi/googleapis/google/protobuf/unittest_import_public.proto +0 -41
  121. package/sandbox/gapi/googleapis/google/protobuf/unittest_import_public_lite.proto +0 -43
  122. package/sandbox/gapi/googleapis/google/protobuf/unittest_import_public_proto3.proto +0 -42
  123. package/sandbox/gapi/googleapis/google/protobuf/unittest_lite.proto +0 -385
  124. package/sandbox/gapi/googleapis/google/protobuf/unittest_lite_imports_nonlite.proto +0 -44
  125. package/sandbox/gapi/googleapis/google/protobuf/unittest_mset.proto +0 -82
  126. package/sandbox/gapi/googleapis/google/protobuf/unittest_mset_wire_format.proto +0 -52
  127. package/sandbox/gapi/googleapis/google/protobuf/unittest_no_arena.proto +0 -202
  128. package/sandbox/gapi/googleapis/google/protobuf/unittest_no_arena_import.proto +0 -37
  129. package/sandbox/gapi/googleapis/google/protobuf/unittest_no_arena_lite.proto +0 -42
  130. package/sandbox/gapi/googleapis/google/protobuf/unittest_no_field_presence.proto +0 -138
  131. package/sandbox/gapi/googleapis/google/protobuf/unittest_no_generic_services.proto +0 -54
  132. package/sandbox/gapi/googleapis/google/protobuf/unittest_optimize_for.proto +0 -67
  133. package/sandbox/gapi/googleapis/google/protobuf/unittest_preserve_unknown_enum.proto +0 -71
  134. package/sandbox/gapi/googleapis/google/protobuf/unittest_preserve_unknown_enum2.proto +0 -50
  135. package/sandbox/gapi/googleapis/google/protobuf/unittest_proto3.proto +0 -388
  136. package/sandbox/gapi/googleapis/google/protobuf/unittest_proto3_arena.proto +0 -206
  137. package/sandbox/gapi/googleapis/google/protobuf/unittest_well_known_types.proto +0 -112
  138. package/sandbox/gapi/googleapis/google/protobuf/unknown_enum_test.proto +0 -62
  139. package/sandbox/gapi/googleapis/google/protobuf/wrappers.proto +0 -117
  140. package/sandbox/gapi/googleapis/google/rpc/code.proto +0 -190
  141. package/sandbox/gapi/googleapis/google/rpc/error_details.proto +0 -157
  142. package/sandbox/gapi/googleapis/google/rpc/status.proto +0 -90
  143. package/sandbox/gapi/googleapis/google/type/color.proto +0 -163
  144. package/sandbox/gapi/googleapis/google/type/date.proto +0 -43
  145. package/sandbox/gapi/googleapis/google/type/dayofweek.proto +0 -50
  146. package/sandbox/gapi/googleapis/google/type/latlng.proto +0 -36
  147. package/sandbox/gapi/googleapis/google/type/money.proto +0 -40
  148. package/sandbox/gapi/googleapis/google/type/timeofday.proto +0 -42
  149. package/sandbox/gapi/test.js +0 -17
  150. package/sandbox/gapi/test.proto +0 -12
  151. package/sandbox/issue146/MyOptions.proto +0 -28
  152. package/sandbox/issue146/Sample.proto +0 -21
  153. package/sandbox/issue146/main.js +0 -3
  154. package/sandbox/issue147/enum.proto +0 -8
  155. package/sandbox/issue147/main.js +0 -3
  156. package/sandbox/issue182/commands.proto +0 -10
  157. package/sandbox/issue182/execute.js +0 -22
  158. package/sandbox/issue182/session_commands.proto +0 -14
  159. package/sandbox/issue289/A.proto +0 -8
  160. package/sandbox/issue289/B.proto +0 -8
  161. package/sandbox/issue289/common.proto +0 -5
  162. package/sandbox/issue289/main.js +0 -7
  163. package/sandbox/issue300/IAuth.proto +0 -14
  164. package/sandbox/issue300/Request.proto +0 -14
  165. package/sandbox/issue300/main.js +0 -26
  166. package/sandbox/issue347/index.js +0 -27
  167. package/sandbox/issue355/main.proto +0 -15
  168. package/sandbox/issue42/innerextend.proto +0 -18
  169. package/sandbox/issue42/main.js +0 -8
  170. package/sandbox/issue42/outerextend.proto +0 -17
@@ -1,46 +0,0 @@
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
- syntax = "proto2";
32
-
33
- import "google/protobuf/unittest_no_arena_import.proto";
34
-
35
- package proto2_arena_unittest;
36
-
37
- option cc_enable_arenas = true;
38
-
39
- message NestedMessage {
40
- optional int32 d = 1;
41
- }
42
-
43
- message ArenaMessage {
44
- repeated NestedMessage repeated_nested_message = 1;
45
- repeated ImportNoArenaNestedMessage repeated_import_no_arena_message = 2;
46
- };
@@ -1,394 +0,0 @@
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: benjy@google.com (Benjy Weinberger)
32
- // Based on original Protocol Buffers design by
33
- // Sanjay Ghemawat, Jeff Dean, and others.
34
- //
35
- // A proto file used to test the "custom options" feature of google.protobuf.
36
-
37
- syntax = "proto2";
38
-
39
- // Some generic_services option(s) added automatically.
40
- // See: http://go/proto2-generic-services-default
41
- option cc_generic_services = true; // auto-added
42
- option java_generic_services = true; // auto-added
43
- option py_generic_services = true;
44
-
45
- // A custom file option (defined below).
46
- option (file_opt1) = 9876543210;
47
-
48
- import "google/protobuf/descriptor.proto";
49
-
50
- // We don't put this in a package within proto2 because we need to make sure
51
- // that the generated code doesn't depend on being in the proto2 namespace.
52
- package protobuf_unittest;
53
-
54
-
55
- // Some simple test custom options of various types.
56
-
57
- extend google.protobuf.FileOptions {
58
- optional uint64 file_opt1 = 7736974;
59
- }
60
-
61
- extend google.protobuf.MessageOptions {
62
- optional int32 message_opt1 = 7739036;
63
- }
64
-
65
- extend google.protobuf.FieldOptions {
66
- optional fixed64 field_opt1 = 7740936;
67
- // This is useful for testing that we correctly register default values for
68
- // extension options.
69
- optional int32 field_opt2 = 7753913 [default=42];
70
- }
71
-
72
- extend google.protobuf.EnumOptions {
73
- optional sfixed32 enum_opt1 = 7753576;
74
- }
75
-
76
- extend google.protobuf.EnumValueOptions {
77
- optional int32 enum_value_opt1 = 1560678;
78
- }
79
-
80
- extend google.protobuf.ServiceOptions {
81
- optional sint64 service_opt1 = 7887650;
82
- }
83
-
84
- enum MethodOpt1 {
85
- METHODOPT1_VAL1 = 1;
86
- METHODOPT1_VAL2 = 2;
87
- }
88
-
89
- extend google.protobuf.MethodOptions {
90
- optional MethodOpt1 method_opt1 = 7890860;
91
- }
92
-
93
- // A test message with custom options at all possible locations (and also some
94
- // regular options, to make sure they interact nicely).
95
- message TestMessageWithCustomOptions {
96
- option message_set_wire_format = false;
97
-
98
- option (message_opt1) = -56;
99
-
100
- optional string field1 = 1 [ctype=CORD,
101
- (field_opt1)=8765432109];
102
-
103
- enum AnEnum {
104
- option (enum_opt1) = -789;
105
-
106
- ANENUM_VAL1 = 1;
107
- ANENUM_VAL2 = 2 [(enum_value_opt1) = 123];
108
- }
109
- }
110
-
111
-
112
- // A test RPC service with custom options at all possible locations (and also
113
- // some regular options, to make sure they interact nicely).
114
- message CustomOptionFooRequest {
115
- }
116
-
117
- message CustomOptionFooResponse {
118
- }
119
-
120
- message CustomOptionFooClientMessage {
121
- }
122
-
123
- message CustomOptionFooServerMessage {
124
- }
125
-
126
- service TestServiceWithCustomOptions {
127
- option (service_opt1) = -9876543210;
128
-
129
- rpc Foo(CustomOptionFooRequest) returns (CustomOptionFooResponse) {
130
- option (method_opt1) = METHODOPT1_VAL2;
131
- }
132
- }
133
-
134
-
135
-
136
- // Options of every possible field type, so we can test them all exhaustively.
137
-
138
- message DummyMessageContainingEnum {
139
- enum TestEnumType {
140
- TEST_OPTION_ENUM_TYPE1 = 22;
141
- TEST_OPTION_ENUM_TYPE2 = -23;
142
- }
143
- }
144
-
145
- message DummyMessageInvalidAsOptionType {
146
- }
147
-
148
- extend google.protobuf.MessageOptions {
149
- optional bool bool_opt = 7706090;
150
- optional int32 int32_opt = 7705709;
151
- optional int64 int64_opt = 7705542;
152
- optional uint32 uint32_opt = 7704880;
153
- optional uint64 uint64_opt = 7702367;
154
- optional sint32 sint32_opt = 7701568;
155
- optional sint64 sint64_opt = 7700863;
156
- optional fixed32 fixed32_opt = 7700307;
157
- optional fixed64 fixed64_opt = 7700194;
158
- optional sfixed32 sfixed32_opt = 7698645;
159
- optional sfixed64 sfixed64_opt = 7685475;
160
- optional float float_opt = 7675390;
161
- optional double double_opt = 7673293;
162
- optional string string_opt = 7673285;
163
- optional bytes bytes_opt = 7673238;
164
- optional DummyMessageContainingEnum.TestEnumType enum_opt = 7673233;
165
- optional DummyMessageInvalidAsOptionType message_type_opt = 7665967;
166
- }
167
-
168
- message CustomOptionMinIntegerValues {
169
- option (bool_opt) = false;
170
- option (int32_opt) = -0x80000000;
171
- option (int64_opt) = -0x8000000000000000;
172
- option (uint32_opt) = 0;
173
- option (uint64_opt) = 0;
174
- option (sint32_opt) = -0x80000000;
175
- option (sint64_opt) = -0x8000000000000000;
176
- option (fixed32_opt) = 0;
177
- option (fixed64_opt) = 0;
178
- option (sfixed32_opt) = -0x80000000;
179
- option (sfixed64_opt) = -0x8000000000000000;
180
- }
181
-
182
- message CustomOptionMaxIntegerValues {
183
- option (bool_opt) = true;
184
- option (int32_opt) = 0x7FFFFFFF;
185
- option (int64_opt) = 0x7FFFFFFFFFFFFFFF;
186
- option (uint32_opt) = 0xFFFFFFFF;
187
- option (uint64_opt) = 0xFFFFFFFFFFFFFFFF;
188
- option (sint32_opt) = 0x7FFFFFFF;
189
- option (sint64_opt) = 0x7FFFFFFFFFFFFFFF;
190
- option (fixed32_opt) = 0xFFFFFFFF;
191
- option (fixed64_opt) = 0xFFFFFFFFFFFFFFFF;
192
- option (sfixed32_opt) = 0x7FFFFFFF;
193
- option (sfixed64_opt) = 0x7FFFFFFFFFFFFFFF;
194
- }
195
-
196
- message CustomOptionOtherValues {
197
- option (int32_opt) = -100; // To test sign-extension.
198
- option (float_opt) = 12.3456789;
199
- option (double_opt) = 1.234567890123456789;
200
- option (string_opt) = "Hello, \"World\"";
201
- option (bytes_opt) = "Hello\0World";
202
- option (enum_opt) = TEST_OPTION_ENUM_TYPE2;
203
- }
204
-
205
- message SettingRealsFromPositiveInts {
206
- option (float_opt) = 12;
207
- option (double_opt) = 154;
208
- }
209
-
210
- message SettingRealsFromNegativeInts {
211
- option (float_opt) = -12;
212
- option (double_opt) = -154;
213
- }
214
-
215
- // Options of complex message types, themselves combined and extended in
216
- // various ways.
217
-
218
- message ComplexOptionType1 {
219
- optional int32 foo = 1;
220
- optional int32 foo2 = 2;
221
- optional int32 foo3 = 3;
222
- repeated int32 foo4 = 4;
223
-
224
- extensions 100 to max;
225
- }
226
-
227
- message ComplexOptionType2 {
228
- optional ComplexOptionType1 bar = 1;
229
- optional int32 baz = 2;
230
-
231
- message ComplexOptionType4 {
232
- optional int32 waldo = 1;
233
-
234
- extend google.protobuf.MessageOptions {
235
- optional ComplexOptionType4 complex_opt4 = 7633546;
236
- }
237
- }
238
-
239
- optional ComplexOptionType4 fred = 3;
240
- repeated ComplexOptionType4 barney = 4;
241
-
242
- extensions 100 to max;
243
- }
244
-
245
- message ComplexOptionType3 {
246
- optional int32 qux = 1;
247
-
248
- optional group ComplexOptionType5 = 2 {
249
- optional int32 plugh = 3;
250
- }
251
- }
252
-
253
- extend ComplexOptionType1 {
254
- optional int32 quux = 7663707;
255
- optional ComplexOptionType3 corge = 7663442;
256
- }
257
-
258
- extend ComplexOptionType2 {
259
- optional int32 grault = 7650927;
260
- optional ComplexOptionType1 garply = 7649992;
261
- }
262
-
263
- extend google.protobuf.MessageOptions {
264
- optional protobuf_unittest.ComplexOptionType1 complex_opt1 = 7646756;
265
- optional ComplexOptionType2 complex_opt2 = 7636949;
266
- optional ComplexOptionType3 complex_opt3 = 7636463;
267
- optional group ComplexOpt6 = 7595468 {
268
- optional int32 xyzzy = 7593951;
269
- }
270
- }
271
-
272
- // Note that we try various different ways of naming the same extension.
273
- message VariousComplexOptions {
274
- option (.protobuf_unittest.complex_opt1).foo = 42;
275
- option (protobuf_unittest.complex_opt1).(.protobuf_unittest.quux) = 324;
276
- option (.protobuf_unittest.complex_opt1).(protobuf_unittest.corge).qux = 876;
277
- option (protobuf_unittest.complex_opt1).foo4 = 99;
278
- option (protobuf_unittest.complex_opt1).foo4 = 88;
279
- option (complex_opt2).baz = 987;
280
- option (complex_opt2).(grault) = 654;
281
- option (complex_opt2).bar.foo = 743;
282
- option (complex_opt2).bar.(quux) = 1999;
283
- option (complex_opt2).bar.(protobuf_unittest.corge).qux = 2008;
284
- option (complex_opt2).(garply).foo = 741;
285
- option (complex_opt2).(garply).(.protobuf_unittest.quux) = 1998;
286
- option (complex_opt2).(protobuf_unittest.garply).(corge).qux = 2121;
287
- option (ComplexOptionType2.ComplexOptionType4.complex_opt4).waldo = 1971;
288
- option (complex_opt2).fred.waldo = 321;
289
- option (complex_opt2).barney = { waldo: 101 };
290
- option (complex_opt2).barney = { waldo: 212 };
291
- option (protobuf_unittest.complex_opt3).qux = 9;
292
- option (complex_opt3).complexoptiontype5.plugh = 22;
293
- option (complexopt6).xyzzy = 24;
294
- }
295
-
296
- // ------------------------------------------------------
297
- // Definitions for testing aggregate option parsing.
298
- // See descriptor_unittest.cc.
299
-
300
- message AggregateMessageSet {
301
- option message_set_wire_format = true;
302
- extensions 4 to max;
303
- }
304
-
305
- message AggregateMessageSetElement {
306
- extend AggregateMessageSet {
307
- optional AggregateMessageSetElement message_set_extension = 15447542;
308
- }
309
- optional string s = 1;
310
- }
311
-
312
- // A helper type used to test aggregate option parsing
313
- message Aggregate {
314
- optional int32 i = 1;
315
- optional string s = 2;
316
-
317
- // A nested object
318
- optional Aggregate sub = 3;
319
-
320
- // To test the parsing of extensions inside aggregate values
321
- optional google.protobuf.FileOptions file = 4;
322
- extend google.protobuf.FileOptions {
323
- optional Aggregate nested = 15476903;
324
- }
325
-
326
- // An embedded message set
327
- optional AggregateMessageSet mset = 5;
328
- }
329
-
330
- // Allow Aggregate to be used as an option at all possible locations
331
- // in the .proto grammer.
332
- extend google.protobuf.FileOptions { optional Aggregate fileopt = 15478479; }
333
- extend google.protobuf.MessageOptions { optional Aggregate msgopt = 15480088; }
334
- extend google.protobuf.FieldOptions { optional Aggregate fieldopt = 15481374; }
335
- extend google.protobuf.EnumOptions { optional Aggregate enumopt = 15483218; }
336
- extend google.protobuf.EnumValueOptions { optional Aggregate enumvalopt = 15486921; }
337
- extend google.protobuf.ServiceOptions { optional Aggregate serviceopt = 15497145; }
338
- extend google.protobuf.MethodOptions { optional Aggregate methodopt = 15512713; }
339
-
340
- // Try using AggregateOption at different points in the proto grammar
341
- option (fileopt) = {
342
- s: 'FileAnnotation'
343
- // Also test the handling of comments
344
- /* of both types */ i: 100
345
-
346
- sub { s: 'NestedFileAnnotation' }
347
-
348
- // Include a google.protobuf.FileOptions and recursively extend it with
349
- // another fileopt.
350
- file {
351
- [protobuf_unittest.fileopt] {
352
- s:'FileExtensionAnnotation'
353
- }
354
- }
355
-
356
- // A message set inside an option value
357
- mset {
358
- [protobuf_unittest.AggregateMessageSetElement.message_set_extension] {
359
- s: 'EmbeddedMessageSetElement'
360
- }
361
- }
362
- };
363
-
364
- message AggregateMessage {
365
- option (msgopt) = { i:101 s:'MessageAnnotation' };
366
- optional int32 fieldname = 1 [(fieldopt) = { s:'FieldAnnotation' }];
367
- }
368
-
369
- service AggregateService {
370
- option (serviceopt) = { s:'ServiceAnnotation' };
371
- rpc Method (AggregateMessage) returns (AggregateMessage) {
372
- option (methodopt) = { s:'MethodAnnotation' };
373
- }
374
- }
375
-
376
- enum AggregateEnum {
377
- option (enumopt) = { s:'EnumAnnotation' };
378
- VALUE = 1 [(enumvalopt) = { s:'EnumValueAnnotation' }];
379
- }
380
-
381
- // Test custom options for nested type.
382
- message NestedOptionType {
383
- message NestedMessage {
384
- option (message_opt1) = 1001;
385
- optional int32 nested_field = 1 [(field_opt1) = 1002];
386
- }
387
- enum NestedEnum {
388
- option (enum_opt1) = 1003;
389
- NESTED_ENUM_VALUE = 1 [(enum_value_opt1) = 1004];
390
- }
391
- extend google.protobuf.FileOptions {
392
- optional int32 nested_extension = 7912573 [(field_opt2) = 1005];
393
- }
394
- }
@@ -1,58 +0,0 @@
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
- syntax = "proto3";
32
-
33
- package unittest_drop_unknown_fields;
34
- option objc_class_prefix = "DropUnknowns";
35
-
36
- option csharp_namespace = "Google.Protobuf.TestProtos";
37
-
38
- message Foo {
39
- enum NestedEnum {
40
- FOO = 0;
41
- BAR = 1;
42
- BAZ = 2;
43
- }
44
- int32 int32_value = 1;
45
- NestedEnum enum_value = 2;
46
- }
47
-
48
- message FooWithExtraFields {
49
- enum NestedEnum {
50
- FOO = 0;
51
- BAR = 1;
52
- BAZ = 2;
53
- QUX = 3;
54
- }
55
- int32 int32_value = 1;
56
- NestedEnum enum_value = 2;
57
- int32 extra_int32_value = 3;
58
- }
@@ -1,51 +0,0 @@
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
- // A proto file which imports a proto file that uses optimize_for = CODE_SIZE.
36
-
37
- syntax = "proto2";
38
- import "google/protobuf/unittest_optimize_for.proto";
39
-
40
- package protobuf_unittest;
41
-
42
- // We optimize for speed here, but we are importing a proto that is optimized
43
- // for code size.
44
- option optimize_for = SPEED;
45
-
46
- message TestEmbedOptimizedForSize {
47
- // Test that embedding a message which has optimize_for = CODE_SIZE into
48
- // one optimized for speed works.
49
- optional TestOptimizedForSize optional_message = 1;
50
- repeated TestOptimizedForSize repeated_message = 2;
51
- }
@@ -1,38 +0,0 @@
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 intentionally left blank. (At one point this wouldn't compile
36
- // correctly.)
37
-
38
- syntax = "proto2";