commit
1738462b7f
103 changed files with 44387 additions and 1957 deletions
Binary file not shown.
@ -0,0 +1,72 @@ |
||||
// Additional options required for C# generation. File from copyright |
||||
// line onwards is as per original distribution. |
||||
import "google/protobuf/csharp_options.proto"; |
||||
option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos"; |
||||
option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestExtrasFullProtoFile"; |
||||
|
||||
package protobuf_unittest_extra; |
||||
|
||||
option optimize_for = CODE_SIZE; |
||||
|
||||
option java_package = "com.google.protobuf"; |
||||
|
||||
message TestInteropPerson { |
||||
required string name = 1; |
||||
required int32 id = 2; |
||||
optional string email = 3; |
||||
repeated int32 codes = 10 [packed=true]; |
||||
|
||||
enum PhoneType { |
||||
MOBILE = 0; |
||||
HOME = 1; |
||||
WORK = 2; |
||||
} |
||||
|
||||
message PhoneNumber { |
||||
required string number = 1; |
||||
optional PhoneType type = 2 [default = HOME]; |
||||
} |
||||
|
||||
repeated PhoneNumber phone = 4; |
||||
|
||||
repeated group Addresses = 5 { |
||||
required string address = 1; |
||||
optional string address2 = 2; |
||||
required string city = 3; |
||||
required string state = 4; |
||||
required fixed32 zip = 5; |
||||
} |
||||
|
||||
extensions 100 to 199; |
||||
} |
||||
|
||||
message TestInteropEmployeeId { |
||||
required string number = 1; |
||||
} |
||||
|
||||
extend TestInteropPerson { |
||||
required TestInteropEmployeeId employee_id = 126; |
||||
} |
||||
|
||||
message TestMissingFieldsA { |
||||
required string name = 1; |
||||
required int32 id = 2; |
||||
optional string email = 3; |
||||
|
||||
message SubA { |
||||
required int32 count = 5; |
||||
repeated string values = 6; |
||||
} |
||||
optional SubA testA = 11; |
||||
} |
||||
|
||||
message TestMissingFieldsB { |
||||
required string name = 1; |
||||
required int32 id = 2; |
||||
optional string website = 4; |
||||
|
||||
message SubB { |
||||
repeated string values = 7; |
||||
} |
||||
optional SubB testB = 12; |
||||
} |
@ -0,0 +1,61 @@ |
||||
// Additional options required for C# generation. File from copyright |
||||
// line onwards is as per original distribution. |
||||
import "google/protobuf/csharp_options.proto"; |
||||
option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos"; |
||||
option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestExtrasLiteProtoFile"; |
||||
|
||||
package protobuf_unittest_extra; |
||||
|
||||
option optimize_for = LITE_RUNTIME; |
||||
|
||||
option java_package = "com.google.protobuf"; |
||||
|
||||
message TestRequiredLite { |
||||
required int32 d = 1; |
||||
required ExtraEnum en = 2 [default = DEFAULT]; |
||||
} |
||||
|
||||
enum ExtraEnum { |
||||
DEFAULT = 10; |
||||
EXLITE_FOO = 7; |
||||
EXLITE_BAR = 8; |
||||
EXLITE_BAZ = 9; |
||||
} |
||||
|
||||
message TestInteropPersonLite { |
||||
required string name = 1; |
||||
required int32 id = 2; |
||||
optional string email = 3; |
||||
repeated int32 codes = 10 [packed=true]; |
||||
|
||||
enum PhoneType { |
||||
MOBILE = 0; |
||||
HOME = 1; |
||||
WORK = 2; |
||||
} |
||||
|
||||
message PhoneNumber { |
||||
required string number = 1; |
||||
optional PhoneType type = 2 [default = HOME]; |
||||
} |
||||
|
||||
repeated PhoneNumber phone = 4; |
||||
|
||||
repeated group Addresses = 5 { |
||||
required string address = 1; |
||||
optional string address2 = 2; |
||||
required string city = 3; |
||||
required string state = 4; |
||||
required fixed32 zip = 5; |
||||
} |
||||
|
||||
extensions 100 to 199; |
||||
} |
||||
|
||||
message TestInteropEmployeeIdLite { |
||||
required string number = 1; |
||||
} |
||||
|
||||
extend TestInteropPersonLite { |
||||
required TestInteropEmployeeIdLite employee_id_lite = 126; |
||||
} |
@ -0,0 +1,43 @@ |
||||
// Additional options required for C# generation. File from copyright |
||||
// line onwards is as per original distribution. |
||||
import "google/protobuf/csharp_options.proto"; |
||||
option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos"; |
||||
option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestEmptyProtoFile"; |
||||
|
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// Redistribution and use in source and binary forms, with or without |
||||
// modification, are permitted provided that the following conditions are |
||||
// met: |
||||
// |
||||
// * Redistributions of source code must retain the above copyright |
||||
// notice, this list of conditions and the following disclaimer. |
||||
// * Redistributions in binary form must reproduce the above |
||||
// copyright notice, this list of conditions and the following disclaimer |
||||
// in the documentation and/or other materials provided with the |
||||
// distribution. |
||||
// * Neither the name of Google Inc. nor the names of its |
||||
// contributors may be used to endorse or promote products derived from |
||||
// this software without specific prior written permission. |
||||
// |
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
|
||||
// Author: kenton@google.com (Kenton Varda) |
||||
// Based on original Protocol Buffers design by |
||||
// Sanjay Ghemawat, Jeff Dean, and others. |
||||
// |
||||
// This file intentionally left blank. (At one point this wouldn't compile |
||||
// correctly.) |
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,55 @@ |
||||
// Additional options required for C# generation. File from copyright |
||||
// line onwards is as per original distribution. |
||||
import "google/protobuf/csharp_options.proto"; |
||||
option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos"; |
||||
option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestImportLiteProtoFile"; |
||||
|
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// Redistribution and use in source and binary forms, with or without |
||||
// modification, are permitted provided that the following conditions are |
||||
// met: |
||||
// |
||||
// * Redistributions of source code must retain the above copyright |
||||
// notice, this list of conditions and the following disclaimer. |
||||
// * Redistributions in binary form must reproduce the above |
||||
// copyright notice, this list of conditions and the following disclaimer |
||||
// in the documentation and/or other materials provided with the |
||||
// distribution. |
||||
// * Neither the name of Google Inc. nor the names of its |
||||
// contributors may be used to endorse or promote products derived from |
||||
// this software without specific prior written permission. |
||||
// |
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
|
||||
// Author: kenton@google.com (Kenton Varda) |
||||
// |
||||
// This is like unittest_import.proto but with optimize_for = LITE_RUNTIME. |
||||
|
||||
package protobuf_unittest_import; |
||||
|
||||
option optimize_for = LITE_RUNTIME; |
||||
|
||||
option java_package = "com.google.protobuf"; |
||||
|
||||
message ImportMessageLite { |
||||
optional int32 d = 1; |
||||
} |
||||
|
||||
enum ImportEnumLite { |
||||
IMPORT_LITE_FOO = 7; |
||||
IMPORT_LITE_BAR = 8; |
||||
IMPORT_LITE_BAZ = 9; |
||||
} |
@ -0,0 +1,318 @@ |
||||
// Additional options required for C# generation. File from copyright |
||||
// line onwards is as per original distribution. |
||||
import "google/protobuf/csharp_options.proto"; |
||||
option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos"; |
||||
option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestLiteProtoFile"; |
||||
|
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// Redistribution and use in source and binary forms, with or without |
||||
// modification, are permitted provided that the following conditions are |
||||
// met: |
||||
// |
||||
// * Redistributions of source code must retain the above copyright |
||||
// notice, this list of conditions and the following disclaimer. |
||||
// * Redistributions in binary form must reproduce the above |
||||
// copyright notice, this list of conditions and the following disclaimer |
||||
// in the documentation and/or other materials provided with the |
||||
// distribution. |
||||
// * Neither the name of Google Inc. nor the names of its |
||||
// contributors may be used to endorse or promote products derived from |
||||
// this software without specific prior written permission. |
||||
// |
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
|
||||
// Author: kenton@google.com (Kenton Varda) |
||||
// |
||||
// This is like unittest.proto but with optimize_for = LITE_RUNTIME. |
||||
|
||||
package protobuf_unittest; |
||||
|
||||
import "google/protobuf/unittest_import_lite.proto"; |
||||
|
||||
option optimize_for = LITE_RUNTIME; |
||||
|
||||
option java_package = "com.google.protobuf"; |
||||
|
||||
// Same as TestAllTypes but with the lite runtime. |
||||
message TestAllTypesLite { |
||||
message NestedMessage { |
||||
optional int32 bb = 1; |
||||
} |
||||
|
||||
enum NestedEnum { |
||||
FOO = 1; |
||||
BAR = 2; |
||||
BAZ = 3; |
||||
} |
||||
|
||||
// Singular |
||||
optional int32 optional_int32 = 1; |
||||
optional int64 optional_int64 = 2; |
||||
optional uint32 optional_uint32 = 3; |
||||
optional uint64 optional_uint64 = 4; |
||||
optional sint32 optional_sint32 = 5; |
||||
optional sint64 optional_sint64 = 6; |
||||
optional fixed32 optional_fixed32 = 7; |
||||
optional fixed64 optional_fixed64 = 8; |
||||
optional sfixed32 optional_sfixed32 = 9; |
||||
optional sfixed64 optional_sfixed64 = 10; |
||||
optional float optional_float = 11; |
||||
optional double optional_double = 12; |
||||
optional bool optional_bool = 13; |
||||
optional string optional_string = 14; |
||||
optional bytes optional_bytes = 15; |
||||
|
||||
optional group OptionalGroup = 16 { |
||||
optional int32 a = 17; |
||||
} |
||||
|
||||
optional NestedMessage optional_nested_message = 18; |
||||
optional ForeignMessageLite optional_foreign_message = 19; |
||||
optional protobuf_unittest_import.ImportMessageLite |
||||
optional_import_message = 20; |
||||
|
||||
optional NestedEnum optional_nested_enum = 21; |
||||
optional ForeignEnumLite optional_foreign_enum = 22; |
||||
optional protobuf_unittest_import.ImportEnumLite optional_import_enum = 23; |
||||
|
||||
optional string optional_string_piece = 24 [ctype=STRING_PIECE]; |
||||
optional string optional_cord = 25 [ctype=CORD]; |
||||
|
||||
// Repeated |
||||
repeated int32 repeated_int32 = 31; |
||||
repeated int64 repeated_int64 = 32; |
||||
repeated uint32 repeated_uint32 = 33; |
||||
repeated uint64 repeated_uint64 = 34; |
||||
repeated sint32 repeated_sint32 = 35; |
||||
repeated sint64 repeated_sint64 = 36; |
||||
repeated fixed32 repeated_fixed32 = 37; |
||||
repeated fixed64 repeated_fixed64 = 38; |
||||
repeated sfixed32 repeated_sfixed32 = 39; |
||||
repeated sfixed64 repeated_sfixed64 = 40; |
||||
repeated float repeated_float = 41; |
||||
repeated double repeated_double = 42; |
||||
repeated bool repeated_bool = 43; |
||||
repeated string repeated_string = 44; |
||||
repeated bytes repeated_bytes = 45; |
||||
|
||||
repeated group RepeatedGroup = 46 { |
||||
optional int32 a = 47; |
||||
} |
||||
|
||||
repeated NestedMessage repeated_nested_message = 48; |
||||
repeated ForeignMessageLite repeated_foreign_message = 49; |
||||
repeated protobuf_unittest_import.ImportMessageLite |
||||
repeated_import_message = 50; |
||||
|
||||
repeated NestedEnum repeated_nested_enum = 51; |
||||
repeated ForeignEnumLite repeated_foreign_enum = 52; |
||||
repeated protobuf_unittest_import.ImportEnumLite repeated_import_enum = 53; |
||||
|
||||
repeated string repeated_string_piece = 54 [ctype=STRING_PIECE]; |
||||
repeated string repeated_cord = 55 [ctype=CORD]; |
||||
|
||||
// Singular with defaults |
||||
optional int32 default_int32 = 61 [default = 41 ]; |
||||
optional int64 default_int64 = 62 [default = 42 ]; |
||||
optional uint32 default_uint32 = 63 [default = 43 ]; |
||||
optional uint64 default_uint64 = 64 [default = 44 ]; |
||||
optional sint32 default_sint32 = 65 [default = -45 ]; |
||||
optional sint64 default_sint64 = 66 [default = 46 ]; |
||||
optional fixed32 default_fixed32 = 67 [default = 47 ]; |
||||
optional fixed64 default_fixed64 = 68 [default = 48 ]; |
||||
optional sfixed32 default_sfixed32 = 69 [default = 49 ]; |
||||
optional sfixed64 default_sfixed64 = 70 [default = -50 ]; |
||||
optional float default_float = 71 [default = 51.5 ]; |
||||
optional double default_double = 72 [default = 52e3 ]; |
||||
optional bool default_bool = 73 [default = true ]; |
||||
optional string default_string = 74 [default = "hello"]; |
||||
optional bytes default_bytes = 75 [default = "world"]; |
||||
|
||||
optional NestedEnum default_nested_enum = 81 [default = BAR]; |
||||
optional ForeignEnumLite default_foreign_enum = 82 |
||||
[default = FOREIGN_LITE_BAR]; |
||||
optional protobuf_unittest_import.ImportEnumLite |
||||
default_import_enum = 83 [default = IMPORT_LITE_BAR]; |
||||
|
||||
optional string default_string_piece = 84 [ctype=STRING_PIECE,default="abc"]; |
||||
optional string default_cord = 85 [ctype=CORD,default="123"]; |
||||
} |
||||
|
||||
message ForeignMessageLite { |
||||
optional int32 c = 1; |
||||
} |
||||
|
||||
enum ForeignEnumLite { |
||||
FOREIGN_LITE_FOO = 4; |
||||
FOREIGN_LITE_BAR = 5; |
||||
FOREIGN_LITE_BAZ = 6; |
||||
} |
||||
|
||||
message TestPackedTypesLite { |
||||
repeated int32 packed_int32 = 90 [packed = true]; |
||||
repeated int64 packed_int64 = 91 [packed = true]; |
||||
repeated uint32 packed_uint32 = 92 [packed = true]; |
||||
repeated uint64 packed_uint64 = 93 [packed = true]; |
||||
repeated sint32 packed_sint32 = 94 [packed = true]; |
||||
repeated sint64 packed_sint64 = 95 [packed = true]; |
||||
repeated fixed32 packed_fixed32 = 96 [packed = true]; |
||||
repeated fixed64 packed_fixed64 = 97 [packed = true]; |
||||
repeated sfixed32 packed_sfixed32 = 98 [packed = true]; |
||||
repeated sfixed64 packed_sfixed64 = 99 [packed = true]; |
||||
repeated float packed_float = 100 [packed = true]; |
||||
repeated double packed_double = 101 [packed = true]; |
||||
repeated bool packed_bool = 102 [packed = true]; |
||||
repeated ForeignEnumLite packed_enum = 103 [packed = true]; |
||||
} |
||||
|
||||
message TestAllExtensionsLite { |
||||
extensions 1 to max; |
||||
} |
||||
|
||||
extend TestAllExtensionsLite { |
||||
// Singular |
||||
optional int32 optional_int32_extension_lite = 1; |
||||
optional int64 optional_int64_extension_lite = 2; |
||||
optional uint32 optional_uint32_extension_lite = 3; |
||||
optional uint64 optional_uint64_extension_lite = 4; |
||||
optional sint32 optional_sint32_extension_lite = 5; |
||||
optional sint64 optional_sint64_extension_lite = 6; |
||||
optional fixed32 optional_fixed32_extension_lite = 7; |
||||
optional fixed64 optional_fixed64_extension_lite = 8; |
||||
optional sfixed32 optional_sfixed32_extension_lite = 9; |
||||
optional sfixed64 optional_sfixed64_extension_lite = 10; |
||||
optional float optional_float_extension_lite = 11; |
||||
optional double optional_double_extension_lite = 12; |
||||
optional bool optional_bool_extension_lite = 13; |
||||
optional string optional_string_extension_lite = 14; |
||||
optional bytes optional_bytes_extension_lite = 15; |
||||
|
||||
optional group OptionalGroup_extension_lite = 16 { |
||||
optional int32 a = 17; |
||||
} |
||||
|
||||
optional TestAllTypesLite.NestedMessage optional_nested_message_extension_lite |
||||
= 18; |
||||
optional ForeignMessageLite optional_foreign_message_extension_lite = 19; |
||||
optional protobuf_unittest_import.ImportMessageLite |
||||
optional_import_message_extension_lite = 20; |
||||
|
||||
optional TestAllTypesLite.NestedEnum optional_nested_enum_extension_lite = 21; |
||||
optional ForeignEnumLite optional_foreign_enum_extension_lite = 22; |
||||
optional protobuf_unittest_import.ImportEnumLite |
||||
optional_import_enum_extension_lite = 23; |
||||
|
||||
optional string optional_string_piece_extension_lite = 24 |
||||
[ctype=STRING_PIECE]; |
||||
optional string optional_cord_extension_lite = 25 [ctype=CORD]; |
||||
|
||||
// Repeated |
||||
repeated int32 repeated_int32_extension_lite = 31; |
||||
repeated int64 repeated_int64_extension_lite = 32; |
||||
repeated uint32 repeated_uint32_extension_lite = 33; |
||||
repeated uint64 repeated_uint64_extension_lite = 34; |
||||
repeated sint32 repeated_sint32_extension_lite = 35; |
||||
repeated sint64 repeated_sint64_extension_lite = 36; |
||||
repeated fixed32 repeated_fixed32_extension_lite = 37; |
||||
repeated fixed64 repeated_fixed64_extension_lite = 38; |
||||
repeated sfixed32 repeated_sfixed32_extension_lite = 39; |
||||
repeated sfixed64 repeated_sfixed64_extension_lite = 40; |
||||
repeated float repeated_float_extension_lite = 41; |
||||
repeated double repeated_double_extension_lite = 42; |
||||
repeated bool repeated_bool_extension_lite = 43; |
||||
repeated string repeated_string_extension_lite = 44; |
||||
repeated bytes repeated_bytes_extension_lite = 45; |
||||
|
||||
repeated group RepeatedGroup_extension_lite = 46 { |
||||
optional int32 a = 47; |
||||
} |
||||
|
||||
repeated TestAllTypesLite.NestedMessage repeated_nested_message_extension_lite |
||||
= 48; |
||||
repeated ForeignMessageLite repeated_foreign_message_extension_lite = 49; |
||||
repeated protobuf_unittest_import.ImportMessageLite |
||||
repeated_import_message_extension_lite = 50; |
||||
|
||||
repeated TestAllTypesLite.NestedEnum repeated_nested_enum_extension_lite = 51; |
||||
repeated ForeignEnumLite repeated_foreign_enum_extension_lite = 52; |
||||
repeated protobuf_unittest_import.ImportEnumLite |
||||
repeated_import_enum_extension_lite = 53; |
||||
|
||||
repeated string repeated_string_piece_extension_lite = 54 |
||||
[ctype=STRING_PIECE]; |
||||
repeated string repeated_cord_extension_lite = 55 [ctype=CORD]; |
||||
|
||||
// Singular with defaults |
||||
optional int32 default_int32_extension_lite = 61 [default = 41 ]; |
||||
optional int64 default_int64_extension_lite = 62 [default = 42 ]; |
||||
optional uint32 default_uint32_extension_lite = 63 [default = 43 ]; |
||||
optional uint64 default_uint64_extension_lite = 64 [default = 44 ]; |
||||
optional sint32 default_sint32_extension_lite = 65 [default = -45 ]; |
||||
optional sint64 default_sint64_extension_lite = 66 [default = 46 ]; |
||||
optional fixed32 default_fixed32_extension_lite = 67 [default = 47 ]; |
||||
optional fixed64 default_fixed64_extension_lite = 68 [default = 48 ]; |
||||
optional sfixed32 default_sfixed32_extension_lite = 69 [default = 49 ]; |
||||
optional sfixed64 default_sfixed64_extension_lite = 70 [default = -50 ]; |
||||
optional float default_float_extension_lite = 71 [default = 51.5 ]; |
||||
optional double default_double_extension_lite = 72 [default = 52e3 ]; |
||||
optional bool default_bool_extension_lite = 73 [default = true ]; |
||||
optional string default_string_extension_lite = 74 [default = "hello"]; |
||||
optional bytes default_bytes_extension_lite = 75 [default = "world"]; |
||||
|
||||
optional TestAllTypesLite.NestedEnum |
||||
default_nested_enum_extension_lite = 81 [default = BAR]; |
||||
optional ForeignEnumLite |
||||
default_foreign_enum_extension_lite = 82 [default = FOREIGN_LITE_BAR]; |
||||
optional protobuf_unittest_import.ImportEnumLite |
||||
default_import_enum_extension_lite = 83 [default = IMPORT_LITE_BAR]; |
||||
|
||||
optional string default_string_piece_extension_lite = 84 [ctype=STRING_PIECE, |
||||
default="abc"]; |
||||
optional string default_cord_extension_lite = 85 [ctype=CORD, default="123"]; |
||||
} |
||||
|
||||
message TestPackedExtensionsLite { |
||||
extensions 1 to max; |
||||
} |
||||
|
||||
extend TestPackedExtensionsLite { |
||||
repeated int32 packed_int32_extension_lite = 90 [packed = true]; |
||||
repeated int64 packed_int64_extension_lite = 91 [packed = true]; |
||||
repeated uint32 packed_uint32_extension_lite = 92 [packed = true]; |
||||
repeated uint64 packed_uint64_extension_lite = 93 [packed = true]; |
||||
repeated sint32 packed_sint32_extension_lite = 94 [packed = true]; |
||||
repeated sint64 packed_sint64_extension_lite = 95 [packed = true]; |
||||
repeated fixed32 packed_fixed32_extension_lite = 96 [packed = true]; |
||||
repeated fixed64 packed_fixed64_extension_lite = 97 [packed = true]; |
||||
repeated sfixed32 packed_sfixed32_extension_lite = 98 [packed = true]; |
||||
repeated sfixed64 packed_sfixed64_extension_lite = 99 [packed = true]; |
||||
repeated float packed_float_extension_lite = 100 [packed = true]; |
||||
repeated double packed_double_extension_lite = 101 [packed = true]; |
||||
repeated bool packed_bool_extension_lite = 102 [packed = true]; |
||||
repeated ForeignEnumLite packed_enum_extension_lite = 103 [packed = true]; |
||||
} |
||||
|
||||
message TestNestedExtensionLite { |
||||
extend TestAllExtensionsLite { |
||||
optional int32 nested_extension = 12345; |
||||
} |
||||
} |
||||
|
||||
// Test that deprecated fields work. We only verify that they compile (at one |
||||
// point this failed). |
||||
message TestDeprecatedLite { |
||||
optional int32 deprecated_field = 1 [deprecated = true]; |
||||
} |
@ -0,0 +1,49 @@ |
||||
// Additional options required for C# generation. File from copyright |
||||
// line onwards is as per original distribution. |
||||
import "google/protobuf/csharp_options.proto"; |
||||
option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos"; |
||||
option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestLiteImportNonLiteProtoFile"; |
||||
|
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// Redistribution and use in source and binary forms, with or without |
||||
// modification, are permitted provided that the following conditions are |
||||
// met: |
||||
// |
||||
// * Redistributions of source code must retain the above copyright |
||||
// notice, this list of conditions and the following disclaimer. |
||||
// * Redistributions in binary form must reproduce the above |
||||
// copyright notice, this list of conditions and the following disclaimer |
||||
// in the documentation and/or other materials provided with the |
||||
// distribution. |
||||
// * Neither the name of Google Inc. nor the names of its |
||||
// contributors may be used to endorse or promote products derived from |
||||
// this software without specific prior written permission. |
||||
// |
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
|
||||
// Author: kenton@google.com (Kenton Varda) |
||||
// |
||||
// Tests that a "lite" message can import a regular message. |
||||
|
||||
package protobuf_unittest; |
||||
|
||||
import "google/protobuf/unittest.proto"; |
||||
|
||||
option optimize_for = LITE_RUNTIME; |
||||
|
||||
message TestLiteImportsNonlite { |
||||
optional TestAllTypes message = 1; |
||||
} |
@ -0,0 +1,60 @@ |
||||
// Additional options required for C# generation. File from copyright |
||||
// line onwards is as per original distribution. |
||||
import "google/protobuf/csharp_options.proto"; |
||||
option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos.NoGenericService"; |
||||
option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestNoGenericServicesProtoFile"; |
||||
|
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// Redistribution and use in source and binary forms, with or without |
||||
// modification, are permitted provided that the following conditions are |
||||
// met: |
||||
// |
||||
// * Redistributions of source code must retain the above copyright |
||||
// notice, this list of conditions and the following disclaimer. |
||||
// * Redistributions in binary form must reproduce the above |
||||
// copyright notice, this list of conditions and the following disclaimer |
||||
// in the documentation and/or other materials provided with the |
||||
// distribution. |
||||
// * Neither the name of Google Inc. nor the names of its |
||||
// contributors may be used to endorse or promote products derived from |
||||
// this software without specific prior written permission. |
||||
// |
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
|
||||
// Author: kenton@google.com (Kenton Varda) |
||||
|
||||
package google.protobuf.no_generic_services_test; |
||||
|
||||
option cc_generic_services = false; |
||||
option java_generic_services = false; |
||||
option py_generic_services = false; |
||||
|
||||
message TestMessage { |
||||
optional int32 a = 1; |
||||
extensions 1000 to max; |
||||
} |
||||
|
||||
enum TestEnum { |
||||
FOO = 1; |
||||
} |
||||
|
||||
extend TestMessage { |
||||
optional int32 test_extension = 1000; |
||||
} |
||||
|
||||
service TestService { |
||||
rpc Foo(TestMessage) returns(TestMessage); |
||||
} |
@ -0,0 +1,44 @@ |
||||
// Generated by ProtoGen, Version=0.9.0.0, Culture=neutral, PublicKeyToken=8fd7408b07f8d2cd. DO NOT EDIT! |
||||
|
||||
using pb = global::Google.ProtocolBuffers; |
||||
using pbc = global::Google.ProtocolBuffers.Collections; |
||||
using pbd = global::Google.ProtocolBuffers.Descriptors; |
||||
using scg = global::System.Collections.Generic; |
||||
namespace Google.ProtocolBuffers.TestProtos { |
||||
|
||||
public static partial class UnitTestEmptyProtoFile { |
||||
|
||||
#region Extension registration |
||||
public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { |
||||
} |
||||
#endregion |
||||
#region Static variables |
||||
#endregion |
||||
#region Descriptor |
||||
public static pbd::FileDescriptor Descriptor { |
||||
get { return descriptor; } |
||||
} |
||||
private static pbd::FileDescriptor descriptor; |
||||
|
||||
static UnitTestEmptyProtoFile() { |
||||
byte[] descriptorData = global::System.Convert.FromBase64String( |
||||
"CiRnb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfZW1wdHkucHJvdG8aJGdvb2ds" + |
||||
"ZS9wcm90b2J1Zi9jc2hhcnBfb3B0aW9ucy5wcm90b0I+wj47CiFHb29nbGUu" + |
||||
"UHJvdG9jb2xCdWZmZXJzLlRlc3RQcm90b3MSFlVuaXRUZXN0RW1wdHlQcm90" + |
||||
"b0ZpbGU="); |
||||
pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { |
||||
descriptor = root; |
||||
pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); |
||||
RegisterAllExtensions(registry); |
||||
global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry); |
||||
return registry; |
||||
}; |
||||
pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, |
||||
new pbd::FileDescriptor[] { |
||||
global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, |
||||
}, assigner); |
||||
} |
||||
#endregion |
||||
|
||||
} |
||||
} |
@ -0,0 +1,196 @@ |
||||
// Generated by the protocol buffer compiler. DO NOT EDIT! |
||||
|
||||
using pb = global::Google.ProtocolBuffers; |
||||
using pbc = global::Google.ProtocolBuffers.Collections; |
||||
using pbd = global::Google.ProtocolBuffers.Descriptors; |
||||
using scg = global::System.Collections.Generic; |
||||
namespace Google.ProtocolBuffers.TestProtos { |
||||
|
||||
public static partial class UnitTestImportLiteProtoFile { |
||||
|
||||
#region Extension registration |
||||
public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { |
||||
} |
||||
#endregion |
||||
#region Static variables |
||||
internal static pbd::MessageDescriptor internal__static_protobuf_unittest_import_ImportMessageLite__Descriptor; |
||||
internal static pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.TestProtos.ImportMessageLite, global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.Builder> internal__static_protobuf_unittest_import_ImportMessageLite__FieldAccessorTable; |
||||
#endregion |
||||
#region Descriptor |
||||
public static pbd::FileDescriptor Descriptor { |
||||
get { return descriptor; } |
||||
} |
||||
private static pbd::FileDescriptor descriptor; |
||||
|
||||
static UnitTestImportLiteProtoFile() { |
||||
byte[] descriptorData = global::System.Convert.FromBase64String( |
||||
"Cipnb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfaW1wb3J0X2xpdGUucHJvdG8S" + |
||||
"GHByb3RvYnVmX3VuaXR0ZXN0X2ltcG9ydBokZ29vZ2xlL3Byb3RvYnVmL2Nz" + |
||||
"aGFycF9vcHRpb25zLnByb3RvIh4KEUltcG9ydE1lc3NhZ2VMaXRlEgkKAWQY" + |
||||
"ASABKAUqTwoOSW1wb3J0RW51bUxpdGUSEwoPSU1QT1JUX0xJVEVfRk9PEAcS" + |
||||
"EwoPSU1QT1JUX0xJVEVfQkFSEAgSEwoPSU1QT1JUX0xJVEVfQkFaEAlCWgoT" + |
||||
"Y29tLmdvb2dsZS5wcm90b2J1ZkgDwj5ACiFHb29nbGUuUHJvdG9jb2xCdWZm" + |
||||
"ZXJzLlRlc3RQcm90b3MSG1VuaXRUZXN0SW1wb3J0TGl0ZVByb3RvRmlsZQ=="); |
||||
pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { |
||||
descriptor = root; |
||||
internal__static_protobuf_unittest_import_ImportMessageLite__Descriptor = Descriptor.MessageTypes[0]; |
||||
internal__static_protobuf_unittest_import_ImportMessageLite__FieldAccessorTable = |
||||
new pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.TestProtos.ImportMessageLite, global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.Builder>(internal__static_protobuf_unittest_import_ImportMessageLite__Descriptor, |
||||
new string[] { "D", }); |
||||
pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); |
||||
RegisterAllExtensions(registry); |
||||
global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry); |
||||
return registry; |
||||
}; |
||||
pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, |
||||
new pbd::FileDescriptor[] { |
||||
global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, |
||||
}, assigner); |
||||
} |
||||
#endregion |
||||
|
||||
} |
||||
#region Enums |
||||
public enum ImportEnumLite { |
||||
IMPORT_LITE_FOO = 7, |
||||
IMPORT_LITE_BAR = 8, |
||||
IMPORT_LITE_BAZ = 9, |
||||
} |
||||
|
||||
#endregion |
||||
|
||||
#region Messages |
||||
public sealed partial class ImportMessageLite : pb::GeneratedMessage<ImportMessageLite, ImportMessageLite.Builder> { |
||||
private static readonly ImportMessageLite defaultInstance = new Builder().BuildPartial(); |
||||
public static ImportMessageLite DefaultInstance { |
||||
get { return defaultInstance; } |
||||
} |
||||
|
||||
public override ImportMessageLite DefaultInstanceForType { |
||||
get { return defaultInstance; } |
||||
} |
||||
|
||||
protected override ImportMessageLite ThisMessage { |
||||
get { return this; } |
||||
} |
||||
|
||||
public static pbd::MessageDescriptor Descriptor { |
||||
get { return global::Google.ProtocolBuffers.TestProtos.UnitTestImportLiteProtoFile.internal__static_protobuf_unittest_import_ImportMessageLite__Descriptor; } |
||||
} |
||||
|
||||
protected override pb::FieldAccess.FieldAccessorTable<ImportMessageLite, ImportMessageLite.Builder> InternalFieldAccessors { |
||||
get { return global::Google.ProtocolBuffers.TestProtos.UnitTestImportLiteProtoFile.internal__static_protobuf_unittest_import_ImportMessageLite__FieldAccessorTable; } |
||||
} |
||||
|
||||
public const int DFieldNumber = 1; |
||||
private bool hasD; |
||||
private int d_ = 0; |
||||
public bool HasD { |
||||
get { return hasD; } |
||||
} |
||||
public int D { |
||||
get { return d_; } |
||||
} |
||||
|
||||
public static ImportMessageLite ParseFrom(pb::ByteString data) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); |
||||
} |
||||
public static ImportMessageLite ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static ImportMessageLite ParseFrom(byte[] data) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); |
||||
} |
||||
public static ImportMessageLite ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static ImportMessageLite ParseFrom(global::System.IO.Stream input) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); |
||||
} |
||||
public static ImportMessageLite ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static ImportMessageLite ParseDelimitedFrom(global::System.IO.Stream input) { |
||||
return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); |
||||
} |
||||
public static ImportMessageLite ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { |
||||
return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); |
||||
} |
||||
public static ImportMessageLite ParseFrom(pb::CodedInputStream input) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); |
||||
} |
||||
public static ImportMessageLite ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static Builder CreateBuilder() { return new Builder(); } |
||||
public override Builder ToBuilder() { return CreateBuilder(this); } |
||||
public override Builder CreateBuilderForType() { return new Builder(); } |
||||
public static Builder CreateBuilder(ImportMessageLite prototype) { |
||||
return (Builder) new Builder().MergeFrom(prototype); |
||||
} |
||||
|
||||
public sealed partial class Builder : pb::GeneratedBuilder<ImportMessageLite, Builder> { |
||||
protected override Builder ThisBuilder { |
||||
get { return this; } |
||||
} |
||||
public Builder() {} |
||||
|
||||
ImportMessageLite result = new ImportMessageLite(); |
||||
|
||||
protected override ImportMessageLite MessageBeingBuilt { |
||||
get { return result; } |
||||
} |
||||
|
||||
public override Builder Clear() { |
||||
result = new ImportMessageLite(); |
||||
return this; |
||||
} |
||||
|
||||
public override Builder Clone() { |
||||
return new Builder().MergeFrom(result); |
||||
} |
||||
|
||||
public override pbd::MessageDescriptor DescriptorForType { |
||||
get { return global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.Descriptor; } |
||||
} |
||||
|
||||
public override ImportMessageLite DefaultInstanceForType { |
||||
get { return global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.DefaultInstance; } |
||||
} |
||||
|
||||
public override ImportMessageLite BuildPartial() { |
||||
if (result == null) { |
||||
throw new global::System.InvalidOperationException("build() has already been called on this Builder"); |
||||
} |
||||
ImportMessageLite returnMe = result; |
||||
result = null; |
||||
return returnMe; |
||||
} |
||||
|
||||
|
||||
public bool HasD { |
||||
get { return result.HasD; } |
||||
} |
||||
public int D { |
||||
get { return result.D; } |
||||
set { SetD(value); } |
||||
} |
||||
public Builder SetD(int value) { |
||||
result.hasD = true; |
||||
result.d_ = value; |
||||
return this; |
||||
} |
||||
public Builder ClearD() { |
||||
result.hasD = false; |
||||
result.d_ = 0; |
||||
return this; |
||||
} |
||||
} |
||||
static ImportMessageLite() { |
||||
object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestImportLiteProtoFile.Descriptor, null); |
||||
} |
||||
} |
||||
|
||||
#endregion |
||||
|
||||
} |
@ -0,0 +1,382 @@ |
||||
// Generated by ProtoGen, Version=0.9.0.0, Culture=neutral, PublicKeyToken=8fd7408b07f8d2cd. DO NOT EDIT! |
||||
|
||||
using pb = global::Google.ProtocolBuffers; |
||||
using pbc = global::Google.ProtocolBuffers.Collections; |
||||
using pbd = global::Google.ProtocolBuffers.Descriptors; |
||||
using scg = global::System.Collections.Generic; |
||||
namespace Google.ProtocolBuffers.TestProtos.NoGenericService { |
||||
|
||||
public static partial class UnitTestNoGenericServicesProtoFile { |
||||
|
||||
#region Extension registration |
||||
public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { |
||||
registry.Add(global::Google.ProtocolBuffers.TestProtos.NoGenericService.UnitTestNoGenericServicesProtoFile.TestExtension); |
||||
} |
||||
#endregion |
||||
#region Extensions |
||||
public const int TestExtensionFieldNumber = 1000; |
||||
public static pb::GeneratedExtensionBase<int> TestExtension; |
||||
#endregion |
||||
|
||||
#region Static variables |
||||
internal static pbd::MessageDescriptor internal__static_google_protobuf_no_generic_services_test_TestMessage__Descriptor; |
||||
internal static pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage, global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage.Builder> internal__static_google_protobuf_no_generic_services_test_TestMessage__FieldAccessorTable; |
||||
#endregion |
||||
#region Descriptor |
||||
public static pbd::FileDescriptor Descriptor { |
||||
get { return descriptor; } |
||||
} |
||||
private static pbd::FileDescriptor descriptor; |
||||
|
||||
static UnitTestNoGenericServicesProtoFile() { |
||||
byte[] descriptorData = global::System.Convert.FromBase64String( |
||||
"CjJnb29nbGUvcHJvdG9idWYvdW5pdHRlc3Rfbm9fZ2VuZXJpY19zZXJ2aWNl" + |
||||
"cy5wcm90bxIoZ29vZ2xlLnByb3RvYnVmLm5vX2dlbmVyaWNfc2VydmljZXNf" + |
||||
"dGVzdBokZ29vZ2xlL3Byb3RvYnVmL2NzaGFycF9vcHRpb25zLnByb3RvIiMK" + |
||||
"C1Rlc3RNZXNzYWdlEgkKAWEYASABKAUqCQjoBxCAgICAAioTCghUZXN0RW51" + |
||||
"bRIHCgNGT08QATKCAQoLVGVzdFNlcnZpY2UScwoDRm9vEjUuZ29vZ2xlLnBy" + |
||||
"b3RvYnVmLm5vX2dlbmVyaWNfc2VydmljZXNfdGVzdC5UZXN0TWVzc2FnZRo1" + |
||||
"Lmdvb2dsZS5wcm90b2J1Zi5ub19nZW5lcmljX3NlcnZpY2VzX3Rlc3QuVGVz" + |
||||
"dE1lc3NhZ2U6TgoOdGVzdF9leHRlbnNpb24SNS5nb29nbGUucHJvdG9idWYu" + |
||||
"bm9fZ2VuZXJpY19zZXJ2aWNlc190ZXN0LlRlc3RNZXNzYWdlGOgHIAEoBUJk" + |
||||
"gAEAiAEAkAEAwj5YCjJHb29nbGUuUHJvdG9jb2xCdWZmZXJzLlRlc3RQcm90" + |
||||
"b3MuTm9HZW5lcmljU2VydmljZRIiVW5pdFRlc3ROb0dlbmVyaWNTZXJ2aWNl" + |
||||
"c1Byb3RvRmlsZQ=="); |
||||
pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { |
||||
descriptor = root; |
||||
internal__static_google_protobuf_no_generic_services_test_TestMessage__Descriptor = Descriptor.MessageTypes[0]; |
||||
internal__static_google_protobuf_no_generic_services_test_TestMessage__FieldAccessorTable = |
||||
new pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage, global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage.Builder>(internal__static_google_protobuf_no_generic_services_test_TestMessage__Descriptor, |
||||
new string[] { "A", }); |
||||
global::Google.ProtocolBuffers.TestProtos.NoGenericService.UnitTestNoGenericServicesProtoFile.TestExtension = pb::GeneratedSingleExtension<int>.CreateInstance(global::Google.ProtocolBuffers.TestProtos.NoGenericService.UnitTestNoGenericServicesProtoFile.Descriptor.Extensions[0]); |
||||
pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); |
||||
RegisterAllExtensions(registry); |
||||
global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry); |
||||
return registry; |
||||
}; |
||||
pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, |
||||
new pbd::FileDescriptor[] { |
||||
global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, |
||||
}, assigner); |
||||
} |
||||
#endregion |
||||
|
||||
} |
||||
#region Enums |
||||
public enum TestEnum { |
||||
FOO = 1, |
||||
} |
||||
|
||||
#endregion |
||||
|
||||
#region Messages |
||||
public sealed partial class TestMessage : pb::ExtendableMessage<TestMessage, TestMessage.Builder> { |
||||
private static readonly TestMessage defaultInstance = new Builder().BuildPartial(); |
||||
public static TestMessage DefaultInstance { |
||||
get { return defaultInstance; } |
||||
} |
||||
|
||||
public override TestMessage DefaultInstanceForType { |
||||
get { return defaultInstance; } |
||||
} |
||||
|
||||
protected override TestMessage ThisMessage { |
||||
get { return this; } |
||||
} |
||||
|
||||
public static pbd::MessageDescriptor Descriptor { |
||||
get { return global::Google.ProtocolBuffers.TestProtos.NoGenericService.UnitTestNoGenericServicesProtoFile.internal__static_google_protobuf_no_generic_services_test_TestMessage__Descriptor; } |
||||
} |
||||
|
||||
protected override pb::FieldAccess.FieldAccessorTable<TestMessage, TestMessage.Builder> InternalFieldAccessors { |
||||
get { return global::Google.ProtocolBuffers.TestProtos.NoGenericService.UnitTestNoGenericServicesProtoFile.internal__static_google_protobuf_no_generic_services_test_TestMessage__FieldAccessorTable; } |
||||
} |
||||
|
||||
public const int AFieldNumber = 1; |
||||
private bool hasA; |
||||
private int a_ = 0; |
||||
public bool HasA { |
||||
get { return hasA; } |
||||
} |
||||
public int A { |
||||
get { return a_; } |
||||
} |
||||
|
||||
public override bool IsInitialized { |
||||
get { |
||||
if (!ExtensionsAreInitialized) return false; |
||||
return true; |
||||
} |
||||
} |
||||
|
||||
public override void WriteTo(pb::CodedOutputStream output) { |
||||
int size = SerializedSize; |
||||
pb::ExtendableMessage<TestMessage, TestMessage.Builder>.ExtensionWriter extensionWriter = CreateExtensionWriter(this); |
||||
if (HasA) { |
||||
output.WriteInt32(1, A); |
||||
} |
||||
extensionWriter.WriteUntil(536870912, output); |
||||
UnknownFields.WriteTo(output); |
||||
} |
||||
|
||||
private int memoizedSerializedSize = -1; |
||||
public override int SerializedSize { |
||||
get { |
||||
int size = memoizedSerializedSize; |
||||
if (size != -1) return size; |
||||
|
||||
size = 0; |
||||
if (HasA) { |
||||
size += pb::CodedOutputStream.ComputeInt32Size(1, A); |
||||
} |
||||
size += ExtensionsSerializedSize; |
||||
size += UnknownFields.SerializedSize; |
||||
memoizedSerializedSize = size; |
||||
return size; |
||||
} |
||||
} |
||||
|
||||
public static TestMessage ParseFrom(pb::ByteString data) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); |
||||
} |
||||
public static TestMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static TestMessage ParseFrom(byte[] data) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); |
||||
} |
||||
public static TestMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static TestMessage ParseFrom(global::System.IO.Stream input) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); |
||||
} |
||||
public static TestMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static TestMessage ParseDelimitedFrom(global::System.IO.Stream input) { |
||||
return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); |
||||
} |
||||
public static TestMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { |
||||
return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); |
||||
} |
||||
public static TestMessage ParseFrom(pb::CodedInputStream input) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); |
||||
} |
||||
public static TestMessage ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static Builder CreateBuilder() { return new Builder(); } |
||||
public override Builder ToBuilder() { return CreateBuilder(this); } |
||||
public override Builder CreateBuilderForType() { return new Builder(); } |
||||
public static Builder CreateBuilder(TestMessage prototype) { |
||||
return (Builder) new Builder().MergeFrom(prototype); |
||||
} |
||||
|
||||
public sealed partial class Builder : pb::ExtendableBuilder<TestMessage, Builder> { |
||||
protected override Builder ThisBuilder { |
||||
get { return this; } |
||||
} |
||||
public Builder() {} |
||||
|
||||
TestMessage result = new TestMessage(); |
||||
|
||||
protected override TestMessage MessageBeingBuilt { |
||||
get { return result; } |
||||
} |
||||
|
||||
public override Builder Clear() { |
||||
result = new TestMessage(); |
||||
return this; |
||||
} |
||||
|
||||
public override Builder Clone() { |
||||
return new Builder().MergeFrom(result); |
||||
} |
||||
|
||||
public override pbd::MessageDescriptor DescriptorForType { |
||||
get { return global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage.Descriptor; } |
||||
} |
||||
|
||||
public override TestMessage DefaultInstanceForType { |
||||
get { return global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage.DefaultInstance; } |
||||
} |
||||
|
||||
public override TestMessage BuildPartial() { |
||||
if (result == null) { |
||||
throw new global::System.InvalidOperationException("build() has already been called on this Builder"); |
||||
} |
||||
TestMessage returnMe = result; |
||||
result = null; |
||||
return returnMe; |
||||
} |
||||
|
||||
public override Builder MergeFrom(pb::IMessage other) { |
||||
if (other is TestMessage) { |
||||
return MergeFrom((TestMessage) other); |
||||
} else { |
||||
base.MergeFrom(other); |
||||
return this; |
||||
} |
||||
} |
||||
|
||||
public override Builder MergeFrom(TestMessage other) { |
||||
if (other == global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage.DefaultInstance) return this; |
||||
if (other.HasA) { |
||||
A = other.A; |
||||
} |
||||
this.MergeExtensionFields(other); |
||||
this.MergeUnknownFields(other.UnknownFields); |
||||
return this; |
||||
} |
||||
|
||||
public override Builder MergeFrom(pb::CodedInputStream input) { |
||||
return MergeFrom(input, pb::ExtensionRegistry.Empty); |
||||
} |
||||
|
||||
public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { |
||||
pb::UnknownFieldSet.Builder unknownFields = null; |
||||
while (true) { |
||||
uint tag = input.ReadTag(); |
||||
switch (tag) { |
||||
case 0: { |
||||
if (unknownFields != null) { |
||||
this.UnknownFields = unknownFields.Build(); |
||||
} |
||||
return this; |
||||
} |
||||
default: { |
||||
if (pb::WireFormat.IsEndGroupTag(tag)) { |
||||
if (unknownFields != null) { |
||||
this.UnknownFields = unknownFields.Build(); |
||||
} |
||||
return this; |
||||
} |
||||
if (unknownFields == null) { |
||||
unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); |
||||
} |
||||
ParseUnknownField(input, unknownFields, extensionRegistry, tag); |
||||
break; |
||||
} |
||||
case 8: { |
||||
A = input.ReadInt32(); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
public bool HasA { |
||||
get { return result.HasA; } |
||||
} |
||||
public int A { |
||||
get { return result.A; } |
||||
set { SetA(value); } |
||||
} |
||||
public Builder SetA(int value) { |
||||
result.hasA = true; |
||||
result.a_ = value; |
||||
return this; |
||||
} |
||||
public Builder ClearA() { |
||||
result.hasA = false; |
||||
result.a_ = 0; |
||||
return this; |
||||
} |
||||
} |
||||
static TestMessage() { |
||||
object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.NoGenericService.UnitTestNoGenericServicesProtoFile.Descriptor, null); |
||||
} |
||||
} |
||||
|
||||
#endregion |
||||
|
||||
#region Services |
||||
public abstract class TestService : pb::IService { |
||||
public abstract void Foo( |
||||
pb::IRpcController controller, |
||||
global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage request, |
||||
global::System.Action<global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage> done); |
||||
|
||||
public static pbd::ServiceDescriptor Descriptor { |
||||
get { return UnitTestNoGenericServicesProtoFile.Descriptor.Services[0]; } |
||||
} |
||||
public pbd::ServiceDescriptor DescriptorForType { |
||||
get { return Descriptor; } |
||||
} |
||||
|
||||
public void CallMethod( |
||||
pbd::MethodDescriptor method, |
||||
pb::IRpcController controller, |
||||
pb::IMessage request, |
||||
global::System.Action<pb::IMessage> done) { |
||||
if (method.Service != Descriptor) { |
||||
throw new global::System.ArgumentException( |
||||
"Service.CallMethod() given method descriptor for wrong service type."); |
||||
} |
||||
switch(method.Index) { |
||||
case 0: |
||||
this.Foo(controller, (global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage) request, |
||||
pb::RpcUtil.SpecializeCallback<global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage>( |
||||
done)); |
||||
return; |
||||
default: |
||||
throw new global::System.InvalidOperationException("Can't get here."); |
||||
} |
||||
} |
||||
|
||||
public pb::IMessage GetRequestPrototype(pbd::MethodDescriptor method) { |
||||
if (method.Service != Descriptor) { |
||||
throw new global::System.ArgumentException( |
||||
"Service.GetRequestPrototype() given method descriptor for wrong service type."); |
||||
} |
||||
switch(method.Index) { |
||||
case 0: |
||||
return global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage.DefaultInstance; |
||||
default: |
||||
throw new global::System.InvalidOperationException("Can't get here."); |
||||
} |
||||
} |
||||
|
||||
public pb::IMessage GetResponsePrototype(pbd::MethodDescriptor method) { |
||||
if (method.Service != Descriptor) { |
||||
throw new global::System.ArgumentException( |
||||
"Service.GetResponsePrototype() given method descriptor for wrong service type."); |
||||
} |
||||
switch(method.Index) { |
||||
case 0: |
||||
return global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage.DefaultInstance; |
||||
default: |
||||
throw new global::System.InvalidOperationException("Can't get here."); |
||||
} |
||||
} |
||||
|
||||
public static Stub CreateStub(pb::IRpcChannel channel) { |
||||
return new Stub(channel); |
||||
} |
||||
|
||||
public class Stub : global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestService { |
||||
internal Stub(pb::IRpcChannel channel) { |
||||
this.channel = channel; |
||||
} |
||||
|
||||
private readonly pb::IRpcChannel channel; |
||||
|
||||
public pb::IRpcChannel Channel { |
||||
get { return channel; } |
||||
} |
||||
|
||||
public override void Foo( |
||||
pb::IRpcController controller, |
||||
global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage request, |
||||
global::System.Action<global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage> done) { |
||||
channel.CallMethod(Descriptor.Methods[0], |
||||
controller, request, global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage.DefaultInstance, |
||||
pb::RpcUtil.GeneralizeCallback<global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage, global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage.Builder>(done, global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage.DefaultInstance)); |
||||
} |
||||
} |
||||
} |
||||
#endregion |
||||
|
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,179 @@ |
||||
#region Copyright notice and license |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://github.com/jskeet/dotnet-protobufs/ |
||||
// Original C++/Java/Python code: |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// Redistribution and use in source and binary forms, with or without |
||||
// modification, are permitted provided that the following conditions are |
||||
// met: |
||||
// |
||||
// * Redistributions of source code must retain the above copyright |
||||
// notice, this list of conditions and the following disclaimer. |
||||
// * Redistributions in binary form must reproduce the above |
||||
// copyright notice, this list of conditions and the following disclaimer |
||||
// in the documentation and/or other materials provided with the |
||||
// distribution. |
||||
// * Neither the name of Google Inc. nor the names of its |
||||
// contributors may be used to endorse or promote products derived from |
||||
// this software without specific prior written permission. |
||||
// |
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
#endregion |
||||
|
||||
using System.Collections.Generic; |
||||
using System; |
||||
|
||||
namespace Google.ProtocolBuffers { |
||||
|
||||
/// <summary> |
||||
/// A table of known extensions, searchable by name or field number. When |
||||
/// parsing a protocol message that might have extensions, you must provide |
||||
/// an <see cref="ExtensionRegistry"/> in which you have registered any extensions |
||||
/// that you want to be able to parse. Otherwise, those extensions will just |
||||
/// be treated like unknown fields. |
||||
/// </summary> |
||||
/// <example> |
||||
/// For example, if you had the <c>.proto</c> file: |
||||
/// <code> |
||||
/// option java_class = "MyProto"; |
||||
/// |
||||
/// message Foo { |
||||
/// extensions 1000 to max; |
||||
/// } |
||||
/// |
||||
/// extend Foo { |
||||
/// optional int32 bar; |
||||
/// } |
||||
/// </code> |
||||
/// |
||||
/// Then you might write code like: |
||||
/// |
||||
/// <code> |
||||
/// extensionRegistry registry = extensionRegistry.CreateInstance(); |
||||
/// registry.Add(MyProto.Bar); |
||||
/// MyProto.Foo message = MyProto.Foo.ParseFrom(input, registry); |
||||
/// </code> |
||||
/// </example> |
||||
/// |
||||
/// <remarks> |
||||
/// <para>You might wonder why this is necessary. Two alternatives might come to |
||||
/// mind. First, you might imagine a system where generated extensions are |
||||
/// automatically registered when their containing classes are loaded. This |
||||
/// is a popular technique, but is bad design; among other things, it creates a |
||||
/// situation where behavior can change depending on what classes happen to be |
||||
/// loaded. It also introduces a security vulnerability, because an |
||||
/// unprivileged class could cause its code to be called unexpectedly from a |
||||
/// privileged class by registering itself as an extension of the right type. |
||||
/// </para> |
||||
/// <para>Another option you might consider is lazy parsing: do not parse an |
||||
/// extension until it is first requested, at which point the caller must |
||||
/// provide a type to use. This introduces a different set of problems. First, |
||||
/// it would require a mutex lock any time an extension was accessed, which |
||||
/// would be slow. Second, corrupt data would not be detected until first |
||||
/// access, at which point it would be much harder to deal with it. Third, it |
||||
/// could violate the expectation that message objects are immutable, since the |
||||
/// type provided could be any arbitrary message class. An unprivileged user |
||||
/// could take advantage of this to inject a mutable object into a message |
||||
/// belonging to privileged code and create mischief.</para> |
||||
/// </remarks> |
||||
public sealed partial class ExtensionRegistry { |
||||
private readonly IDictionary<ExtensionIntPair, IGeneratedExtensionLite> extensionsByNumber; |
||||
private readonly bool readOnly; |
||||
|
||||
private ExtensionRegistry(IDictionary<ExtensionIntPair, IGeneratedExtensionLite> extensionsByNumber, |
||||
bool readOnly) { |
||||
this.extensionsByNumber = extensionsByNumber; |
||||
this.readOnly = readOnly; |
||||
} |
||||
|
||||
#if LITE |
||||
private static readonly ExtensionRegistry empty = new ExtensionRegistry( |
||||
new Dictionary<ExtensionIntPair, IGeneratedExtensionLite>(), |
||||
true); |
||||
|
||||
/// <summary> |
||||
/// Construct a new, empty instance. |
||||
/// </summary> |
||||
public static ExtensionRegistry CreateInstance() { |
||||
return new ExtensionRegistry( |
||||
new Dictionary<ExtensionIntPair, IGeneratedExtensionLite>(), false); |
||||
} |
||||
public ExtensionRegistry AsReadOnly() { |
||||
return new ExtensionRegistry(extensionsByNumber, true); |
||||
} |
||||
|
||||
#endif |
||||
|
||||
/// <summary> |
||||
/// Get the unmodifiable singleton empty instance. |
||||
/// </summary> |
||||
public static ExtensionRegistry Empty { |
||||
get { return empty; } |
||||
} |
||||
|
||||
/// <summary> |
||||
/// Finds an extension by containing type and field number. |
||||
/// A null reference is returned if the extension can't be found. |
||||
/// </summary> |
||||
public IGeneratedExtensionLite this[IMessageLite containingType, int fieldNumber] { |
||||
get { |
||||
IGeneratedExtensionLite ret; |
||||
extensionsByNumber.TryGetValue(new ExtensionIntPair(containingType, fieldNumber), out ret); |
||||
return ret; |
||||
} |
||||
} |
||||
|
||||
/// <summary> |
||||
/// Add an extension from a generated file to the registry. |
||||
/// </summary> |
||||
public void Add(IGeneratedExtensionLite extension) { |
||||
if (readOnly) { |
||||
throw new InvalidOperationException("Cannot add entries to a read-only extension registry"); |
||||
} |
||||
extensionsByNumber.Add( |
||||
new ExtensionIntPair(extension.ContainingType, extension.Number), |
||||
extension); |
||||
} |
||||
|
||||
/// <summary> |
||||
/// Nested type just used to represent a pair of MessageDescriptor and int, as |
||||
/// the key into the "by number" map. |
||||
/// </summary> |
||||
private struct ExtensionIntPair : IEquatable<ExtensionIntPair> { |
||||
readonly object msgType; |
||||
readonly int number; |
||||
|
||||
internal ExtensionIntPair(object msgType, int number) { |
||||
this.msgType = msgType; |
||||
this.number = number; |
||||
} |
||||
|
||||
public override int GetHashCode() { |
||||
return msgType.GetHashCode() * ((1 << 16) - 1) + number; |
||||
} |
||||
|
||||
public override bool Equals(object obj) { |
||||
if (!(obj is ExtensionIntPair)) { |
||||
return false; |
||||
} |
||||
return Equals((ExtensionIntPair)obj); |
||||
} |
||||
|
||||
public bool Equals(ExtensionIntPair other) { |
||||
return msgType.Equals(other.msgType) && number == other.number; |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,210 @@ |
||||
#region Copyright notice and license |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://github.com/jskeet/dotnet-protobufs/ |
||||
// Original C++/Java/Python code: |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// Redistribution and use in source and binary forms, with or without |
||||
// modification, are permitted provided that the following conditions are |
||||
// met: |
||||
// |
||||
// * Redistributions of source code must retain the above copyright |
||||
// notice, this list of conditions and the following disclaimer. |
||||
// * Redistributions in binary form must reproduce the above |
||||
// copyright notice, this list of conditions and the following disclaimer |
||||
// in the documentation and/or other materials provided with the |
||||
// distribution. |
||||
// * Neither the name of Google Inc. nor the names of its |
||||
// contributors may be used to endorse or promote products derived from |
||||
// this software without specific prior written permission. |
||||
// |
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
#endregion |
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.IO; |
||||
|
||||
namespace Google.ProtocolBuffers { |
||||
|
||||
/// <summary> |
||||
/// Non-generic interface for all members whose signatures don't require knowledge of |
||||
/// the type being built. The generic interface extends this one. Some methods return |
||||
/// either an IBuilder or an IMessage; in these cases the generic interface redeclares |
||||
/// the same method with a type-specific signature. Implementations are encouraged to |
||||
/// use explicit interface implemenation for the non-generic form. This mirrors |
||||
/// how IEnumerable and IEnumerable<T> work. |
||||
/// </summary> |
||||
public interface IBuilderLite { |
||||
/// <summary> |
||||
/// Returns true iff all required fields in the message and all |
||||
/// embedded messages are set. |
||||
/// </summary> |
||||
bool IsInitialized { get; } |
||||
|
||||
IBuilderLite WeakClear(); |
||||
IBuilderLite WeakMergeFrom(IMessageLite message); |
||||
IBuilderLite WeakMergeFrom(ByteString data); |
||||
IBuilderLite WeakMergeFrom(ByteString data, ExtensionRegistry registry); |
||||
IBuilderLite WeakMergeFrom(CodedInputStream input); |
||||
IBuilderLite WeakMergeFrom(CodedInputStream input, ExtensionRegistry registry); |
||||
IMessageLite WeakBuild(); |
||||
IMessageLite WeakBuildPartial(); |
||||
IBuilderLite WeakClone(); |
||||
IMessageLite WeakDefaultInstanceForType { get; } |
||||
} |
||||
|
||||
/// <summary> |
||||
/// Interface implemented by Protocol Message builders. |
||||
/// TODO(jonskeet): Consider "SetXXX" methods returning the builder, as well as the properties. |
||||
/// </summary> |
||||
/// <typeparam name="TMessage">Type of message</typeparam> |
||||
/// <typeparam name="TBuilder">Type of builder</typeparam> |
||||
public interface IBuilderLite<TMessage, TBuilder> : IBuilderLite |
||||
where TMessage : IMessageLite<TMessage, TBuilder> |
||||
where TBuilder : IBuilderLite<TMessage, TBuilder> { |
||||
|
||||
/// <summary> |
||||
/// Resets all fields to their default values. |
||||
/// </summary> |
||||
TBuilder Clear(); |
||||
|
||||
/// <summary> |
||||
/// Merge the specified other message which may be a different implementation of |
||||
/// the same message descriptor. |
||||
/// </summary> |
||||
TBuilder MergeFrom(IMessageLite other); |
||||
|
||||
/// <summary> |
||||
/// Constructs the final message. Once this is called, this Builder instance |
||||
/// is no longer valid, and calling any other method may throw a |
||||
/// NullReferenceException. If you need to continue working with the builder |
||||
/// after calling Build, call Clone first. |
||||
/// </summary> |
||||
/// <exception cref="UninitializedMessageException">the message |
||||
/// is missing one or more required fields; use BuildPartial to bypass |
||||
/// this check</exception> |
||||
TMessage Build(); |
||||
|
||||
/// <summary> |
||||
/// Like Build(), but does not throw an exception if the message is missing |
||||
/// required fields. Instead, a partial message is returned. |
||||
/// </summary> |
||||
TMessage BuildPartial(); |
||||
|
||||
/// <summary> |
||||
/// Clones this builder. |
||||
/// TODO(jonskeet): Explain depth of clone. |
||||
/// </summary> |
||||
TBuilder Clone(); |
||||
|
||||
/// <summary> |
||||
/// Parses a message of this type from the input and merges it with this |
||||
/// message, as if using MergeFrom(IMessage<T>). |
||||
/// </summary> |
||||
/// <remarks> |
||||
/// Warning: This does not verify that all required fields are present |
||||
/// in the input message. If you call Build() without setting all |
||||
/// required fields, it will throw an UninitializedMessageException. |
||||
/// There are a few good ways to deal with this: |
||||
/// <list> |
||||
/// <item>Call IsInitialized to verify to verify that all required fields are |
||||
/// set before building.</item> |
||||
/// <item>Parse the message separately using one of the static ParseFrom |
||||
/// methods, then use MergeFrom(IMessage<T>) to merge it with |
||||
/// this one. ParseFrom will throw an InvalidProtocolBufferException |
||||
/// (an IOException) if some required fields are missing. |
||||
/// Use BuildPartial to build, which ignores missing required fields. |
||||
/// </list> |
||||
/// </remarks> |
||||
TBuilder MergeFrom(CodedInputStream input); |
||||
|
||||
/// <summary> |
||||
/// Like MergeFrom(CodedInputStream), but also parses extensions. |
||||
/// The extensions that you want to be able to parse must be registered |
||||
/// in <paramref name="extensionRegistry"/>. Extensions not in the registry |
||||
/// will be treated as unknown fields. |
||||
/// </summary> |
||||
TBuilder MergeFrom(CodedInputStream input, ExtensionRegistry extensionRegistry); |
||||
|
||||
/// <summary> |
||||
/// Get's the message's type's default instance. |
||||
/// <see cref="IMessageLite{TMessage}.DefaultInstanceForType" /> |
||||
/// </summary> |
||||
TMessage DefaultInstanceForType { get; } |
||||
|
||||
/// <summary> |
||||
/// Like MergeFrom(Stream), but does not read until the end of the file. |
||||
/// Instead, the size of the message (encoded as a varint) is read first, |
||||
/// then the message data. Use Message.WriteDelimitedTo(Stream) to |
||||
/// write messages in this format. |
||||
/// </summary> |
||||
/// <param name="input"></param> |
||||
TBuilder MergeDelimitedFrom(Stream input); |
||||
|
||||
/// <summary> |
||||
/// Like MergeDelimitedFrom(Stream) but supporting extensions. |
||||
/// </summary> |
||||
TBuilder MergeDelimitedFrom(Stream input, ExtensionRegistry extensionRegistry); |
||||
|
||||
#region Convenience methods |
||||
/// <summary> |
||||
/// Parse <paramref name="data"/> as a message of this type and merge |
||||
/// it with the message being built. This is just a small wrapper around |
||||
/// MergeFrom(CodedInputStream). |
||||
/// </summary> |
||||
TBuilder MergeFrom(ByteString data); |
||||
|
||||
/// <summary> |
||||
/// Parse <paramref name="data"/> as a message of this type and merge |
||||
/// it with the message being built. This is just a small wrapper around |
||||
/// MergeFrom(CodedInputStream, ExtensionRegistry). |
||||
/// </summary> |
||||
TBuilder MergeFrom(ByteString data, ExtensionRegistry extensionRegistry); |
||||
|
||||
/// <summary> |
||||
/// Parse <paramref name="data"/> as a message of this type and merge |
||||
/// it with the message being built. This is just a small wrapper around |
||||
/// MergeFrom(CodedInputStream). |
||||
/// </summary> |
||||
TBuilder MergeFrom(byte[] data); |
||||
|
||||
/// <summary> |
||||
/// Parse <paramref name="data"/> as a message of this type and merge |
||||
/// it with the message being built. This is just a small wrapper around |
||||
/// MergeFrom(CodedInputStream, ExtensionRegistry). |
||||
/// </summary> |
||||
TBuilder MergeFrom(byte[] data, ExtensionRegistry extensionRegistry); |
||||
|
||||
/// <summary> |
||||
/// Parse <paramref name="input"/> as a message of this type and merge |
||||
/// it with the message being built. This is just a small wrapper around |
||||
/// MergeFrom(CodedInputStream). Note that this method always reads |
||||
/// the entire input (unless it throws an exception). If you want it to |
||||
/// stop earlier, you will need to wrap the input in a wrapper |
||||
/// stream which limits reading. Or, use IMessage.WriteDelimitedTo(Stream) |
||||
/// to write your message and MmergeDelimitedFrom(Stream) to read it. |
||||
/// Despite usually reading the entire stream, this method never closes the stream. |
||||
/// </summary> |
||||
TBuilder MergeFrom(Stream input); |
||||
|
||||
/// <summary> |
||||
/// Parse <paramref name="input"/> as a message of this type and merge |
||||
/// it with the message being built. This is just a small wrapper around |
||||
/// MergeFrom(CodedInputStream, ExtensionRegistry). |
||||
/// </summary> |
||||
TBuilder MergeFrom(Stream input, ExtensionRegistry extensionRegistry); |
||||
#endregion |
||||
} |
||||
} |
@ -0,0 +1,179 @@ |
||||
#region Copyright notice and license |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// http://github.com/jskeet/dotnet-protobufs/ |
||||
// Original C++/Java/Python code: |
||||
// http://code.google.com/p/protobuf/ |
||||
// |
||||
// Redistribution and use in source and binary forms, with or without |
||||
// modification, are permitted provided that the following conditions are |
||||
// met: |
||||
// |
||||
// * Redistributions of source code must retain the above copyright |
||||
// notice, this list of conditions and the following disclaimer. |
||||
// * Redistributions in binary form must reproduce the above |
||||
// copyright notice, this list of conditions and the following disclaimer |
||||
// in the documentation and/or other materials provided with the |
||||
// distribution. |
||||
// * Neither the name of Google Inc. nor the names of its |
||||
// contributors may be used to endorse or promote products derived from |
||||
// this software without specific prior written permission. |
||||
// |
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
#endregion |
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.IO; |
||||
|
||||
namespace Google.ProtocolBuffers { |
||||
|
||||
/// <summary> |
||||
/// Non-generic interface used for all parts of the API which don't require |
||||
/// any type knowledge. |
||||
/// </summary> |
||||
public interface IMessageLite { |
||||
|
||||
/// <summary> |
||||
/// Returns true iff all required fields in the message and all embedded |
||||
/// messages are set. |
||||
/// </summary> |
||||
bool IsInitialized { get; } |
||||
|
||||
/// <summary> |
||||
/// Serializes the message and writes it to the given output stream. |
||||
/// This does not flush or close the stream. |
||||
/// </summary> |
||||
/// <remarks> |
||||
/// Protocol Buffers are not self-delimiting. Therefore, if you write |
||||
/// any more data to the stream after the message, you must somehow ensure |
||||
/// that the parser on the receiving end does not interpret this as being |
||||
/// part of the protocol message. One way of doing this is by writing the size |
||||
/// of the message before the data, then making sure you limit the input to |
||||
/// that size when receiving the data. Alternatively, use WriteDelimitedTo(Stream). |
||||
/// </remarks> |
||||
void WriteTo(CodedOutputStream output); |
||||
|
||||
/// <summary> |
||||
/// Like WriteTo(Stream) but writes the size of the message as a varint before |
||||
/// writing the data. This allows more data to be written to the stream after the |
||||
/// message without the need to delimit the message data yourself. Use |
||||
/// IBuilder.MergeDelimitedFrom(Stream) or the static method |
||||
/// YourMessageType.ParseDelimitedFrom(Stream) to parse messages written by this method. |
||||
/// </summary> |
||||
/// <param name="output"></param> |
||||
void WriteDelimitedTo(Stream output); |
||||
|
||||
/// <summary> |
||||
/// Returns the number of bytes required to encode this message. |
||||
/// The result is only computed on the first call and memoized after that. |
||||
/// </summary> |
||||
int SerializedSize { get; } |
||||
|
||||
#region Comparison and hashing |
||||
/// <summary> |
||||
/// Compares the specified object with this message for equality. |
||||
/// Returns true iff the given object is a message of the same type |
||||
/// (as defined by DescriptorForType) and has identical values |
||||
/// for all its fields. |
||||
/// </summary> |
||||
bool Equals(object other); |
||||
|
||||
/// <summary> |
||||
/// Returns the hash code value for this message. |
||||
/// TODO(jonskeet): Specify the hash algorithm, but better than the Java one! |
||||
/// </summary> |
||||
int GetHashCode(); |
||||
#endregion |
||||
|
||||
#region Convenience methods |
||||
/// <summary> |
||||
/// Converts the message to a string in protocol buffer text format. |
||||
/// This is just a trivial wrapper around TextFormat.PrintToString. |
||||
/// </summary> |
||||
string ToString(); |
||||
|
||||
/// <summary> |
||||
/// Converts the message to a string. |
||||
/// </summary> |
||||
void PrintTo(TextWriter writer); |
||||
|
||||
/// <summary> |
||||
/// Serializes the message to a ByteString. This is a trivial wrapper |
||||
/// around WriteTo(CodedOutputStream). |
||||
/// </summary> |
||||
ByteString ToByteString(); |
||||
|
||||
/// <summary> |
||||
/// Serializes the message to a byte array. This is a trivial wrapper |
||||
/// around WriteTo(CodedOutputStream). |
||||
/// </summary> |
||||
byte[] ToByteArray(); |
||||
|
||||
/// <summary> |
||||
/// Serializes the message and writes it to the given stream. |
||||
/// This is just a wrapper around WriteTo(CodedOutputStream). This |
||||
/// does not flush or close the stream. |
||||
/// </summary> |
||||
/// <param name="output"></param> |
||||
void WriteTo(Stream output); |
||||
#endregion |
||||
|
||||
/// <summary> |
||||
/// Creates a builder for the type, but in a weakly typed manner. This |
||||
/// is typically implemented by strongly typed messages by just returning |
||||
/// the result of CreateBuilderForType. |
||||
/// </summary> |
||||
IBuilderLite WeakCreateBuilderForType(); |
||||
|
||||
/// <summary> |
||||
/// Creates a builder with the same contents as this message. This |
||||
/// is typically implemented by strongly typed messages by just returning |
||||
/// the result of ToBuilder. |
||||
/// </summary> |
||||
IBuilderLite WeakToBuilder(); |
||||
|
||||
IMessageLite WeakDefaultInstanceForType { get; } |
||||
} |
||||
|
||||
public interface IMessageLite<TMessage> : IMessageLite { |
||||
/// <summary> |
||||
/// Returns an instance of this message type with all fields set to |
||||
/// their default values. This may or may not be a singleton. This differs |
||||
/// from the DefaultInstance property of each generated message class in that this |
||||
/// method is an abstract method of IMessage whereas DefaultInstance is |
||||
/// a static property of a specific class. They return the same thing. |
||||
/// </summary> |
||||
TMessage DefaultInstanceForType { get; } |
||||
} |
||||
|
||||
/// <summary> |
||||
/// Type-safe interface for all generated messages to implement. |
||||
/// </summary> |
||||
public interface IMessageLite<TMessage, TBuilder> : IMessageLite<TMessage> |
||||
where TMessage : IMessageLite<TMessage, TBuilder> |
||||
where TBuilder : IBuilderLite<TMessage, TBuilder> { |
||||
#region Builders |
||||
/// <summary> |
||||
/// Constructs a new builder for a message of the same type as this message. |
||||
/// </summary> |
||||
TBuilder CreateBuilderForType(); |
||||
/// <summary> |
||||
/// Creates a builder with the same contents as this current instance. |
||||
/// This is typically implemented by strongly typed messages by just |
||||
/// returning the result of ToBuilder(). |
||||
/// </summary> |
||||
TBuilder ToBuilder(); |
||||
#endregion |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,246 @@ |
||||
// Generated by ProtoGen, Version=0.9.0.0, Culture=neutral, PublicKeyToken=8fd7408b07f8d2cd. DO NOT EDIT! |
||||
|
||||
using pb = global::Google.ProtocolBuffers; |
||||
using pbc = global::Google.ProtocolBuffers.Collections; |
||||
using pbd = global::Google.ProtocolBuffers.Descriptors; |
||||
using scg = global::System.Collections.Generic; |
||||
namespace Google.ProtocolBuffers.TestProtos { |
||||
|
||||
public static partial class UnitTestImportLiteProtoFile { |
||||
|
||||
#region Extension registration |
||||
public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { |
||||
} |
||||
#endregion |
||||
#region Static variables |
||||
#endregion |
||||
#region Extensions |
||||
internal static readonly object Descriptor; |
||||
static UnitTestImportLiteProtoFile() { |
||||
Descriptor = null; |
||||
} |
||||
#endregion |
||||
|
||||
} |
||||
#region Enums |
||||
public enum ImportEnumLite { |
||||
IMPORT_LITE_FOO = 7, |
||||
IMPORT_LITE_BAR = 8, |
||||
IMPORT_LITE_BAZ = 9, |
||||
} |
||||
|
||||
#endregion |
||||
|
||||
#region Messages |
||||
public sealed partial class ImportMessageLite : pb::GeneratedMessageLite<ImportMessageLite, ImportMessageLite.Builder> { |
||||
private static readonly ImportMessageLite defaultInstance = new Builder().BuildPartial(); |
||||
public static ImportMessageLite DefaultInstance { |
||||
get { return defaultInstance; } |
||||
} |
||||
|
||||
public override ImportMessageLite DefaultInstanceForType { |
||||
get { return defaultInstance; } |
||||
} |
||||
|
||||
protected override ImportMessageLite ThisMessage { |
||||
get { return this; } |
||||
} |
||||
|
||||
public const int DFieldNumber = 1; |
||||
private bool hasD; |
||||
private int d_ = 0; |
||||
public bool HasD { |
||||
get { return hasD; } |
||||
} |
||||
public int D { |
||||
get { return d_; } |
||||
} |
||||
|
||||
public override bool IsInitialized { |
||||
get { |
||||
return true; |
||||
} |
||||
} |
||||
|
||||
public override void WriteTo(pb::CodedOutputStream output) { |
||||
int size = SerializedSize; |
||||
if (HasD) { |
||||
output.WriteInt32(1, D); |
||||
} |
||||
} |
||||
|
||||
private int memoizedSerializedSize = -1; |
||||
public override int SerializedSize { |
||||
get { |
||||
int size = memoizedSerializedSize; |
||||
if (size != -1) return size; |
||||
|
||||
size = 0; |
||||
if (HasD) { |
||||
size += pb::CodedOutputStream.ComputeInt32Size(1, D); |
||||
} |
||||
memoizedSerializedSize = size; |
||||
return size; |
||||
} |
||||
} |
||||
|
||||
#region Lite runtime methods |
||||
public override int GetHashCode() { |
||||
int hash = GetType().GetHashCode(); |
||||
if (hasD) hash ^= d_.GetHashCode(); |
||||
return hash; |
||||
} |
||||
|
||||
public override bool Equals(object obj) { |
||||
ImportMessageLite other = obj as ImportMessageLite; |
||||
if (other == null) return false; |
||||
if (hasD != other.hasD || (hasD && !d_.Equals(other.d_))) return false; |
||||
return true; |
||||
} |
||||
|
||||
public override void PrintTo(global::System.IO.TextWriter writer) { |
||||
PrintField("d", hasD, d_, writer); |
||||
} |
||||
#endregion |
||||
|
||||
public static ImportMessageLite ParseFrom(pb::ByteString data) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); |
||||
} |
||||
public static ImportMessageLite ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static ImportMessageLite ParseFrom(byte[] data) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); |
||||
} |
||||
public static ImportMessageLite ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static ImportMessageLite ParseFrom(global::System.IO.Stream input) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); |
||||
} |
||||
public static ImportMessageLite ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static ImportMessageLite ParseDelimitedFrom(global::System.IO.Stream input) { |
||||
return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); |
||||
} |
||||
public static ImportMessageLite ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { |
||||
return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); |
||||
} |
||||
public static ImportMessageLite ParseFrom(pb::CodedInputStream input) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); |
||||
} |
||||
public static ImportMessageLite ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static Builder CreateBuilder() { return new Builder(); } |
||||
public override Builder ToBuilder() { return CreateBuilder(this); } |
||||
public override Builder CreateBuilderForType() { return new Builder(); } |
||||
public static Builder CreateBuilder(ImportMessageLite prototype) { |
||||
return (Builder) new Builder().MergeFrom(prototype); |
||||
} |
||||
|
||||
public sealed partial class Builder : pb::GeneratedBuilderLite<ImportMessageLite, Builder> { |
||||
protected override Builder ThisBuilder { |
||||
get { return this; } |
||||
} |
||||
public Builder() {} |
||||
|
||||
ImportMessageLite result = new ImportMessageLite(); |
||||
|
||||
protected override ImportMessageLite MessageBeingBuilt { |
||||
get { return result; } |
||||
} |
||||
|
||||
public override Builder Clear() { |
||||
result = new ImportMessageLite(); |
||||
return this; |
||||
} |
||||
|
||||
public override Builder Clone() { |
||||
return new Builder().MergeFrom(result); |
||||
} |
||||
|
||||
public override ImportMessageLite DefaultInstanceForType { |
||||
get { return global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.DefaultInstance; } |
||||
} |
||||
|
||||
public override ImportMessageLite BuildPartial() { |
||||
if (result == null) { |
||||
throw new global::System.InvalidOperationException("build() has already been called on this Builder"); |
||||
} |
||||
ImportMessageLite returnMe = result; |
||||
result = null; |
||||
return returnMe; |
||||
} |
||||
|
||||
public override Builder MergeFrom(pb::IMessageLite other) { |
||||
if (other is ImportMessageLite) { |
||||
return MergeFrom((ImportMessageLite) other); |
||||
} else { |
||||
base.MergeFrom(other); |
||||
return this; |
||||
} |
||||
} |
||||
|
||||
public override Builder MergeFrom(ImportMessageLite other) { |
||||
if (other == global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.DefaultInstance) return this; |
||||
if (other.HasD) { |
||||
D = other.D; |
||||
} |
||||
return this; |
||||
} |
||||
|
||||
public override Builder MergeFrom(pb::CodedInputStream input) { |
||||
return MergeFrom(input, pb::ExtensionRegistry.Empty); |
||||
} |
||||
|
||||
public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { |
||||
while (true) { |
||||
uint tag = input.ReadTag(); |
||||
switch (tag) { |
||||
case 0: { |
||||
return this; |
||||
} |
||||
default: { |
||||
if (pb::WireFormat.IsEndGroupTag(tag)) { |
||||
return this; |
||||
} |
||||
ParseUnknownField(input, extensionRegistry, tag); |
||||
break; |
||||
} |
||||
case 8: { |
||||
D = input.ReadInt32(); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
public bool HasD { |
||||
get { return result.HasD; } |
||||
} |
||||
public int D { |
||||
get { return result.D; } |
||||
set { SetD(value); } |
||||
} |
||||
public Builder SetD(int value) { |
||||
result.hasD = true; |
||||
result.d_ = value; |
||||
return this; |
||||
} |
||||
public Builder ClearD() { |
||||
result.hasD = false; |
||||
result.d_ = 0; |
||||
return this; |
||||
} |
||||
} |
||||
static ImportMessageLite() { |
||||
object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestImportLiteProtoFile.Descriptor, null); |
||||
} |
||||
} |
||||
|
||||
#endregion |
||||
|
||||
} |
@ -0,0 +1,280 @@ |
||||
// Generated by ProtoGen, Version=0.9.0.0, Culture=neutral, PublicKeyToken=8fd7408b07f8d2cd. DO NOT EDIT! |
||||
|
||||
using pb = global::Google.ProtocolBuffers; |
||||
using pbc = global::Google.ProtocolBuffers.Collections; |
||||
using pbd = global::Google.ProtocolBuffers.Descriptors; |
||||
using scg = global::System.Collections.Generic; |
||||
namespace Google.ProtocolBuffers.TestProtos { |
||||
|
||||
public static partial class UnitTestImportProtoFile { |
||||
|
||||
#region Extension registration |
||||
public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { |
||||
} |
||||
#endregion |
||||
#region Static variables |
||||
internal static pbd::MessageDescriptor internal__static_protobuf_unittest_import_ImportMessage__Descriptor; |
||||
internal static pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.TestProtos.ImportMessage, global::Google.ProtocolBuffers.TestProtos.ImportMessage.Builder> internal__static_protobuf_unittest_import_ImportMessage__FieldAccessorTable; |
||||
#endregion |
||||
#region Descriptor |
||||
public static pbd::FileDescriptor Descriptor { |
||||
get { return descriptor; } |
||||
} |
||||
private static pbd::FileDescriptor descriptor; |
||||
|
||||
static UnitTestImportProtoFile() { |
||||
byte[] descriptorData = global::System.Convert.FromBase64String( |
||||
"CiVnb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfaW1wb3J0LnByb3RvEhhwcm90" + |
||||
"b2J1Zl91bml0dGVzdF9pbXBvcnQaJGdvb2dsZS9wcm90b2J1Zi9jc2hhcnBf" + |
||||
"b3B0aW9ucy5wcm90byIaCg1JbXBvcnRNZXNzYWdlEgkKAWQYASABKAUqPAoK" + |
||||
"SW1wb3J0RW51bRIOCgpJTVBPUlRfRk9PEAcSDgoKSU1QT1JUX0JBUhAIEg4K" + |
||||
"CklNUE9SVF9CQVoQCUJbChhjb20uZ29vZ2xlLnByb3RvYnVmLnRlc3RIAcI+" + |
||||
"PAohR29vZ2xlLlByb3RvY29sQnVmZmVycy5UZXN0UHJvdG9zEhdVbml0VGVz" + |
||||
"dEltcG9ydFByb3RvRmlsZQ=="); |
||||
pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { |
||||
descriptor = root; |
||||
internal__static_protobuf_unittest_import_ImportMessage__Descriptor = Descriptor.MessageTypes[0]; |
||||
internal__static_protobuf_unittest_import_ImportMessage__FieldAccessorTable = |
||||
new pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.TestProtos.ImportMessage, global::Google.ProtocolBuffers.TestProtos.ImportMessage.Builder>(internal__static_protobuf_unittest_import_ImportMessage__Descriptor, |
||||
new string[] { "D", }); |
||||
pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); |
||||
RegisterAllExtensions(registry); |
||||
global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry); |
||||
return registry; |
||||
}; |
||||
pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, |
||||
new pbd::FileDescriptor[] { |
||||
global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, |
||||
}, assigner); |
||||
} |
||||
#endregion |
||||
|
||||
} |
||||
#region Enums |
||||
public enum ImportEnum { |
||||
IMPORT_FOO = 7, |
||||
IMPORT_BAR = 8, |
||||
IMPORT_BAZ = 9, |
||||
} |
||||
|
||||
#endregion |
||||
|
||||
#region Messages |
||||
public sealed partial class ImportMessage : pb::GeneratedMessage<ImportMessage, ImportMessage.Builder> { |
||||
private static readonly ImportMessage defaultInstance = new Builder().BuildPartial(); |
||||
public static ImportMessage DefaultInstance { |
||||
get { return defaultInstance; } |
||||
} |
||||
|
||||
public override ImportMessage DefaultInstanceForType { |
||||
get { return defaultInstance; } |
||||
} |
||||
|
||||
protected override ImportMessage ThisMessage { |
||||
get { return this; } |
||||
} |
||||
|
||||
public static pbd::MessageDescriptor Descriptor { |
||||
get { return global::Google.ProtocolBuffers.TestProtos.UnitTestImportProtoFile.internal__static_protobuf_unittest_import_ImportMessage__Descriptor; } |
||||
} |
||||
|
||||
protected override pb::FieldAccess.FieldAccessorTable<ImportMessage, ImportMessage.Builder> InternalFieldAccessors { |
||||
get { return global::Google.ProtocolBuffers.TestProtos.UnitTestImportProtoFile.internal__static_protobuf_unittest_import_ImportMessage__FieldAccessorTable; } |
||||
} |
||||
|
||||
public const int DFieldNumber = 1; |
||||
private bool hasD; |
||||
private int d_ = 0; |
||||
public bool HasD { |
||||
get { return hasD; } |
||||
} |
||||
public int D { |
||||
get { return d_; } |
||||
} |
||||
|
||||
public override bool IsInitialized { |
||||
get { |
||||
return true; |
||||
} |
||||
} |
||||
|
||||
public override void WriteTo(pb::CodedOutputStream output) { |
||||
int size = SerializedSize; |
||||
if (HasD) { |
||||
output.WriteInt32(1, D); |
||||
} |
||||
UnknownFields.WriteTo(output); |
||||
} |
||||
|
||||
private int memoizedSerializedSize = -1; |
||||
public override int SerializedSize { |
||||
get { |
||||
int size = memoizedSerializedSize; |
||||
if (size != -1) return size; |
||||
|
||||
size = 0; |
||||
if (HasD) { |
||||
size += pb::CodedOutputStream.ComputeInt32Size(1, D); |
||||
} |
||||
size += UnknownFields.SerializedSize; |
||||
memoizedSerializedSize = size; |
||||
return size; |
||||
} |
||||
} |
||||
|
||||
public static ImportMessage ParseFrom(pb::ByteString data) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); |
||||
} |
||||
public static ImportMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static ImportMessage ParseFrom(byte[] data) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); |
||||
} |
||||
public static ImportMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static ImportMessage ParseFrom(global::System.IO.Stream input) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); |
||||
} |
||||
public static ImportMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static ImportMessage ParseDelimitedFrom(global::System.IO.Stream input) { |
||||
return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); |
||||
} |
||||
public static ImportMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { |
||||
return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); |
||||
} |
||||
public static ImportMessage ParseFrom(pb::CodedInputStream input) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); |
||||
} |
||||
public static ImportMessage ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { |
||||
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); |
||||
} |
||||
public static Builder CreateBuilder() { return new Builder(); } |
||||
public override Builder ToBuilder() { return CreateBuilder(this); } |
||||
public override Builder CreateBuilderForType() { return new Builder(); } |
||||
public static Builder CreateBuilder(ImportMessage prototype) { |
||||
return (Builder) new Builder().MergeFrom(prototype); |
||||
} |
||||
|
||||
public sealed partial class Builder : pb::GeneratedBuilder<ImportMessage, Builder> { |
||||
protected override Builder ThisBuilder { |
||||
get { return this; } |
||||
} |
||||
public Builder() {} |
||||
|
||||
ImportMessage result = new ImportMessage(); |
||||
|
||||
protected override ImportMessage MessageBeingBuilt { |
||||
get { return result; } |
||||
} |
||||
|
||||
public override Builder Clear() { |
||||
result = new ImportMessage(); |
||||
return this; |
||||
} |
||||
|
||||
public override Builder Clone() { |
||||
return new Builder().MergeFrom(result); |
||||
} |
||||
|
||||
public override pbd::MessageDescriptor DescriptorForType { |
||||
get { return global::Google.ProtocolBuffers.TestProtos.ImportMessage.Descriptor; } |
||||
} |
||||
|
||||
public override ImportMessage DefaultInstanceForType { |
||||
get { return global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance; } |
||||
} |
||||
|
||||
public override ImportMessage BuildPartial() { |
||||
if (result == null) { |
||||
throw new global::System.InvalidOperationException("build() has already been called on this Builder"); |
||||
} |
||||
ImportMessage returnMe = result; |
||||
result = null; |
||||
return returnMe; |
||||
} |
||||
|
||||
public override Builder MergeFrom(pb::IMessage other) { |
||||
if (other is ImportMessage) { |
||||
return MergeFrom((ImportMessage) other); |
||||
} else { |
||||
base.MergeFrom(other); |
||||
return this; |
||||
} |
||||
} |
||||
|
||||
public override Builder MergeFrom(ImportMessage other) { |
||||
if (other == global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance) return this; |
||||
if (other.HasD) { |
||||
D = other.D; |
||||
} |
||||
this.MergeUnknownFields(other.UnknownFields); |
||||
return this; |
||||
} |
||||
|
||||
public override Builder MergeFrom(pb::CodedInputStream input) { |
||||
return MergeFrom(input, pb::ExtensionRegistry.Empty); |
||||
} |
||||
|
||||
public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { |
||||
pb::UnknownFieldSet.Builder unknownFields = null; |
||||
while (true) { |
||||
uint tag = input.ReadTag(); |
||||
switch (tag) { |
||||
case 0: { |
||||
if (unknownFields != null) { |
||||
this.UnknownFields = unknownFields.Build(); |
||||
} |
||||
return this; |
||||
} |
||||
default: { |
||||
if (pb::WireFormat.IsEndGroupTag(tag)) { |
||||
if (unknownFields != null) { |
||||
this.UnknownFields = unknownFields.Build(); |
||||
} |
||||
return this; |
||||
} |
||||
if (unknownFields == null) { |
||||
unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); |
||||
} |
||||
ParseUnknownField(input, unknownFields, extensionRegistry, tag); |
||||
break; |
||||
} |
||||
case 8: { |
||||
D = input.ReadInt32(); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
public bool HasD { |
||||
get { return result.HasD; } |
||||
} |
||||
public int D { |
||||
get { return result.D; } |
||||
set { SetD(value); } |
||||
} |
||||
public Builder SetD(int value) { |
||||
result.hasD = true; |
||||
result.d_ = value; |
||||
return this; |
||||
} |
||||
public Builder ClearD() { |
||||
result.hasD = false; |
||||
result.d_ = 0; |
||||
return this; |
||||
} |
||||
} |
||||
static ImportMessage() { |
||||
object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestImportProtoFile.Descriptor, null); |
||||
} |
||||
} |
||||
|
||||
#endregion |
||||
|
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue