Skip to content

Commit

Permalink
C# Proto2 feature : Groups (#5183)
Browse files Browse the repository at this point in the history
Add group support for proto2
  • Loading branch information
ObsidianMinor authored and anandolee committed Nov 5, 2018
1 parent 29f27bf commit 6f73c50
Show file tree
Hide file tree
Showing 30 changed files with 619 additions and 173 deletions.
12 changes: 9 additions & 3 deletions csharp/src/AddressBook/Addressbook.cs
Expand Up @@ -260,7 +260,9 @@ public sealed partial class Person : pb::IMessage<Person> {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
case 10: {
Name = input.ReadString();
Expand Down Expand Up @@ -440,7 +442,9 @@ public sealed partial class PhoneNumber : pb::IMessage<PhoneNumber> {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
case 10: {
Number = input.ReadString();
Expand Down Expand Up @@ -573,7 +577,9 @@ public sealed partial class AddressBook : pb::IMessage<AddressBook> {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
case 10: {
people_.AddEntriesFrom(input, _repeated_people_codec);
Expand Down
8 changes: 6 additions & 2 deletions csharp/src/Google.Protobuf.Conformance/Conformance.cs
Expand Up @@ -343,7 +343,9 @@ public enum PayloadOneofCase {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
case 10: {
ProtobufPayload = input.ReadBytes();
Expand Down Expand Up @@ -683,7 +685,9 @@ public enum ResultOneofCase {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
case 10: {
ParseError = input.ReadString();
Expand Down
28 changes: 21 additions & 7 deletions csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs
Expand Up @@ -541,7 +541,9 @@ public sealed partial class TestMap : pb::IMessage<TestMap> {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
case 10: {
mapInt32Int32_.AddEntriesFrom(input, _map_mapInt32Int32_codec);
Expand Down Expand Up @@ -737,7 +739,9 @@ public sealed partial class TestMapSubmessage : pb::IMessage<TestMapSubmessage>
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
case 10: {
if (testMap_ == null) {
Expand Down Expand Up @@ -861,7 +865,9 @@ public sealed partial class TestMessageMap : pb::IMessage<TestMessageMap> {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
case 10: {
mapInt32Message_.AddEntriesFrom(input, _map_mapInt32Message_codec);
Expand Down Expand Up @@ -1001,7 +1007,9 @@ public sealed partial class TestSameTypeMap : pb::IMessage<TestSameTypeMap> {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
case 10: {
map1_.AddEntriesFrom(input, _map_map1_codec);
Expand Down Expand Up @@ -1350,7 +1358,9 @@ public sealed partial class TestArenaMap : pb::IMessage<TestArenaMap> {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
case 10: {
mapInt32Int32_.AddEntriesFrom(input, _map_mapInt32Int32_codec);
Expand Down Expand Up @@ -1531,7 +1541,9 @@ public sealed partial class MessageContainingEnumCalledType : pb::IMessage<Messa
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
case 10: {
type_.AddEntriesFrom(input, _map_type_codec);
Expand Down Expand Up @@ -1666,7 +1678,9 @@ public sealed partial class MessageContainingMapCalledEntry : pb::IMessage<Messa
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
case 10: {
entry_.AddEntriesFrom(input, _map_entry_codec);
Expand Down
12 changes: 9 additions & 3 deletions csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs
Expand Up @@ -2867,7 +2867,9 @@ public enum OneofFieldOneofCase {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
case 8: {
OptionalInt32 = input.ReadInt32();
Expand Down Expand Up @@ -3582,7 +3584,9 @@ public sealed partial class NestedMessage : pb::IMessage<NestedMessage> {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
case 8: {
A = input.ReadInt32();
Expand Down Expand Up @@ -3723,7 +3727,9 @@ public sealed partial class ForeignMessage : pb::IMessage<ForeignMessage> {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
case 8: {
C = input.ReadInt32();
Expand Down
Expand Up @@ -352,7 +352,9 @@ public enum AnOneofOneofCase {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
case 10: {
Field1 = input.ReadString();
Expand Down Expand Up @@ -478,7 +480,9 @@ public sealed partial class CustomOptionFooRequest : pb::IMessage<CustomOptionFo
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
}
}
Expand Down Expand Up @@ -579,7 +583,9 @@ public sealed partial class CustomOptionFooResponse : pb::IMessage<CustomOptionF
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
}
}
Expand Down Expand Up @@ -680,7 +686,9 @@ public sealed partial class CustomOptionFooClientMessage : pb::IMessage<CustomOp
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
}
}
Expand Down Expand Up @@ -781,7 +789,9 @@ public sealed partial class CustomOptionFooServerMessage : pb::IMessage<CustomOp
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
}
}
Expand Down Expand Up @@ -882,7 +892,9 @@ public sealed partial class DummyMessageContainingEnum : pb::IMessage<DummyMessa
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
}
}
Expand Down Expand Up @@ -996,7 +1008,9 @@ public sealed partial class DummyMessageInvalidAsOptionType : pb::IMessage<Dummy
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
}
}
Expand Down Expand Up @@ -1097,7 +1111,9 @@ public sealed partial class CustomOptionMinIntegerValues : pb::IMessage<CustomOp
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
}
}
Expand Down Expand Up @@ -1198,7 +1214,9 @@ public sealed partial class CustomOptionMaxIntegerValues : pb::IMessage<CustomOp
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
}
}
Expand Down Expand Up @@ -1299,7 +1317,9 @@ public sealed partial class CustomOptionOtherValues : pb::IMessage<CustomOptionO
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
}
}
Expand Down Expand Up @@ -1400,7 +1420,9 @@ public sealed partial class SettingRealsFromPositiveInts : pb::IMessage<SettingR
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
}
}
Expand Down Expand Up @@ -1501,7 +1523,9 @@ public sealed partial class SettingRealsFromNegativeInts : pb::IMessage<SettingR
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
}
}
Expand Down Expand Up @@ -1690,7 +1714,9 @@ public sealed partial class ComplexOptionType1 : pb::IMessage<ComplexOptionType1
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
case 8: {
Foo = input.ReadInt32();
Expand Down Expand Up @@ -1902,7 +1928,9 @@ public sealed partial class ComplexOptionType2 : pb::IMessage<ComplexOptionType2
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
case 10: {
if (bar_ == null) {
Expand Down Expand Up @@ -2051,7 +2079,9 @@ public sealed partial class ComplexOptionType4 : pb::IMessage<ComplexOptionType4
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
case 8: {
Waldo = input.ReadInt32();
Expand Down Expand Up @@ -2185,7 +2215,9 @@ public sealed partial class ComplexOptionType3 : pb::IMessage<ComplexOptionType3
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
case 8: {
Qux = input.ReadInt32();
Expand Down Expand Up @@ -2293,7 +2325,9 @@ public sealed partial class VariousComplexOptions : pb::IMessage<VariousComplexO
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
}
}
Expand Down Expand Up @@ -2475,7 +2509,9 @@ public sealed partial class Aggregate : pb::IMessage<Aggregate> {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
case 8: {
I = input.ReadInt32();
Expand Down Expand Up @@ -2615,7 +2651,9 @@ public sealed partial class AggregateMessage : pb::IMessage<AggregateMessage> {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
case 8: {
Fieldname = input.ReadInt32();
Expand Down Expand Up @@ -2723,7 +2761,9 @@ public sealed partial class NestedOptionType : pb::IMessage<NestedOptionType> {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
}
}
Expand Down Expand Up @@ -2855,7 +2895,9 @@ public sealed partial class NestedMessage : pb::IMessage<NestedMessage> {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
case 8: {
NestedField = input.ReadInt32();
Expand Down

0 comments on commit 6f73c50

Please sign in to comment.