| OLD | NEW |
| 1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
| 2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
| 3 // https://developers.google.com/protocol-buffers/ | 3 // http://code.google.com/p/protobuf/ |
| 4 // | 4 // |
| 5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
| 6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
| 7 // met: | 7 // met: |
| 8 // | 8 // |
| 9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
| 10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
| 11 // * Redistributions in binary form must reproduce the above | 11 // * Redistributions in binary form must reproduce the above |
| 12 // copyright notice, this list of conditions and the following disclaimer | 12 // copyright notice, this list of conditions and the following disclaimer |
| 13 // in the documentation and/or other materials provided with the | 13 // in the documentation and/or other materials provided with the |
| (...skipping 11 matching lines...) Expand all Loading... |
| 25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | 30 |
| 31 // Author: kenton@google.com (Kenton Varda) | 31 // Author: kenton@google.com (Kenton Varda) |
| 32 // | 32 // |
| 33 // This is like unittest.proto but with optimize_for = LITE_RUNTIME. | 33 // This is like unittest.proto but with optimize_for = LITE_RUNTIME. |
| 34 | 34 |
| 35 syntax = "proto2"; | |
| 36 package protobuf_unittest; | 35 package protobuf_unittest; |
| 37 | 36 |
| 38 import "google/protobuf/unittest_import_lite.proto"; | 37 import "google/protobuf/unittest_import_lite.proto"; |
| 39 | 38 |
| 40 option optimize_for = LITE_RUNTIME; | 39 option optimize_for = LITE_RUNTIME; |
| 41 | 40 |
| 42 option java_package = "com.google.protobuf"; | 41 option java_package = "com.google.protobuf"; |
| 43 | 42 |
| 44 // Same as TestAllTypes but with the lite runtime. | 43 // Same as TestAllTypes but with the lite runtime. |
| 45 message TestAllTypesLite { | 44 message TestAllTypesLite { |
| 46 | |
| 47 message NestedMessage { | 45 message NestedMessage { |
| 48 optional int32 bb = 1; | 46 optional int32 bb = 1; |
| 49 optional int64 cc = 2; | |
| 50 } | 47 } |
| 51 | 48 |
| 52 enum NestedEnum { | 49 enum NestedEnum { |
| 53 FOO = 1; | 50 FOO = 1; |
| 54 BAR = 2; | 51 BAR = 2; |
| 55 BAZ = 3; | 52 BAZ = 3; |
| 56 } | 53 } |
| 57 | 54 |
| 58 // Singular | 55 // Singular |
| 59 optional int32 optional_int32 = 1; | 56 optional int32 optional_int32 = 1; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 optional bytes default_bytes = 75 [default = "world"]; | 144 optional bytes default_bytes = 75 [default = "world"]; |
| 148 | 145 |
| 149 optional NestedEnum default_nested_enum = 81 [default = BAR]; | 146 optional NestedEnum default_nested_enum = 81 [default = BAR]; |
| 150 optional ForeignEnumLite default_foreign_enum = 82 | 147 optional ForeignEnumLite default_foreign_enum = 82 |
| 151 [default = FOREIGN_LITE_BAR]; | 148 [default = FOREIGN_LITE_BAR]; |
| 152 optional protobuf_unittest_import.ImportEnumLite | 149 optional protobuf_unittest_import.ImportEnumLite |
| 153 default_import_enum = 83 [default = IMPORT_LITE_BAR]; | 150 default_import_enum = 83 [default = IMPORT_LITE_BAR]; |
| 154 | 151 |
| 155 optional string default_string_piece = 84 [ctype=STRING_PIECE,default="abc"]; | 152 optional string default_string_piece = 84 [ctype=STRING_PIECE,default="abc"]; |
| 156 optional string default_cord = 85 [ctype=CORD,default="123"]; | 153 optional string default_cord = 85 [ctype=CORD,default="123"]; |
| 157 | |
| 158 // For oneof test | |
| 159 oneof oneof_field { | |
| 160 uint32 oneof_uint32 = 111; | |
| 161 NestedMessage oneof_nested_message = 112; | |
| 162 string oneof_string = 113; | |
| 163 bytes oneof_bytes = 114; | |
| 164 NestedMessage oneof_lazy_nested_message = 115 [lazy = true]; | |
| 165 } | |
| 166 } | 154 } |
| 167 | 155 |
| 168 message ForeignMessageLite { | 156 message ForeignMessageLite { |
| 169 optional int32 c = 1; | 157 optional int32 c = 1; |
| 170 } | 158 } |
| 171 | 159 |
| 172 enum ForeignEnumLite { | 160 enum ForeignEnumLite { |
| 173 FOREIGN_LITE_FOO = 4; | 161 FOREIGN_LITE_FOO = 4; |
| 174 FOREIGN_LITE_BAR = 5; | 162 FOREIGN_LITE_BAR = 5; |
| 175 FOREIGN_LITE_BAZ = 6; | 163 FOREIGN_LITE_BAZ = 6; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 optional TestAllTypesLite.NestedEnum | 286 optional TestAllTypesLite.NestedEnum |
| 299 default_nested_enum_extension_lite = 81 [default = BAR]; | 287 default_nested_enum_extension_lite = 81 [default = BAR]; |
| 300 optional ForeignEnumLite | 288 optional ForeignEnumLite |
| 301 default_foreign_enum_extension_lite = 82 [default = FOREIGN_LITE_BAR]; | 289 default_foreign_enum_extension_lite = 82 [default = FOREIGN_LITE_BAR]; |
| 302 optional protobuf_unittest_import.ImportEnumLite | 290 optional protobuf_unittest_import.ImportEnumLite |
| 303 default_import_enum_extension_lite = 83 [default = IMPORT_LITE_BAR]; | 291 default_import_enum_extension_lite = 83 [default = IMPORT_LITE_BAR]; |
| 304 | 292 |
| 305 optional string default_string_piece_extension_lite = 84 [ctype=STRING_PIECE, | 293 optional string default_string_piece_extension_lite = 84 [ctype=STRING_PIECE, |
| 306 default="abc"]; | 294 default="abc"]; |
| 307 optional string default_cord_extension_lite = 85 [ctype=CORD, default="123"]; | 295 optional string default_cord_extension_lite = 85 [ctype=CORD, default="123"]; |
| 308 | |
| 309 // For oneof test | |
| 310 optional uint32 oneof_uint32_extension_lite = 111; | |
| 311 optional TestAllTypesLite.NestedMessage oneof_nested_message_extension_lite =
112; | |
| 312 optional string oneof_string_extension_lite = 113; | |
| 313 optional bytes oneof_bytes_extension_lite = 114; | |
| 314 } | 296 } |
| 315 | 297 |
| 316 message TestPackedExtensionsLite { | 298 message TestPackedExtensionsLite { |
| 317 extensions 1 to max; | 299 extensions 1 to max; |
| 318 } | 300 } |
| 319 | 301 |
| 320 extend TestPackedExtensionsLite { | 302 extend TestPackedExtensionsLite { |
| 321 repeated int32 packed_int32_extension_lite = 90 [packed = true]; | 303 repeated int32 packed_int32_extension_lite = 90 [packed = true]; |
| 322 repeated int64 packed_int64_extension_lite = 91 [packed = true]; | 304 repeated int64 packed_int64_extension_lite = 91 [packed = true]; |
| 323 repeated uint32 packed_uint32_extension_lite = 92 [packed = true]; | 305 repeated uint32 packed_uint32_extension_lite = 92 [packed = true]; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 } | 351 } |
| 370 repeated group RepeatedGroup = 20 { | 352 repeated group RepeatedGroup = 20 { |
| 371 optional TestAllTypesLite repeated_group_all_types = 21; | 353 optional TestAllTypesLite repeated_group_all_types = 21; |
| 372 } | 354 } |
| 373 extensions 1000 to max; | 355 extensions 1000 to max; |
| 374 extend TestParsingMergeLite { | 356 extend TestParsingMergeLite { |
| 375 optional TestAllTypesLite optional_ext = 1000; | 357 optional TestAllTypesLite optional_ext = 1000; |
| 376 repeated TestAllTypesLite repeated_ext = 1001; | 358 repeated TestAllTypesLite repeated_ext = 1001; |
| 377 } | 359 } |
| 378 } | 360 } |
| 379 | |
| 380 // TestEmptyMessageLite is used to test unknown fields support in lite mode. | |
| 381 message TestEmptyMessageLite{ | |
| 382 } | |
| 383 | |
| 384 // Like above, but declare all field numbers as potential extensions. No | |
| 385 // actual extensions should ever be defined for this type. | |
| 386 message TestEmptyMessageWithExtensionsLite { | |
| 387 extensions 1 to max; | |
| 388 } | |
| 389 | |
| 390 enum V1EnumLite { | |
| 391 V1_FIRST = 1; | |
| 392 } | |
| 393 | |
| 394 enum V2EnumLite { | |
| 395 V2_FIRST = 1; | |
| 396 V2_SECOND = 2; | |
| 397 } | |
| 398 | |
| 399 message V1MessageLite { | |
| 400 required int32 int_field = 1; | |
| 401 optional V1EnumLite enum_field = 2 [ default = V1_FIRST ]; | |
| 402 } | |
| 403 | |
| 404 message V2MessageLite { | |
| 405 required int32 int_field = 1; | |
| 406 optional V2EnumLite enum_field = 2 [ default = V2_FIRST ]; | |
| 407 } | |
| OLD | NEW |