Added the field name to all CodedOutputStream.Write??? calls

Refactored 'speed' generated write of arrays to call Write???Array.  This may
have impacted speed write speeds for arrays of non-reference types due to the
use of non-generic IEnumerable and the subsequent boxing of value types.  This
could be addressed later if desired.
pull/288/head
csharptest 14 years ago committed by rogerk
parent 8a2d0f48d7
commit 90922db77a
  1. 2
      build/RunBenchmarks.bat
  2. 18
      src/AddressBook/AddressBookProtos.cs
  3. 2
      src/ProtoGen/EnumFieldGenerator.cs
  4. 2
      src/ProtoGen/MessageFieldGenerator.cs
  5. 2
      src/ProtoGen/PrimitiveFieldGenerator.cs
  6. 28
      src/ProtoGen/RepeatedEnumFieldGenerator.cs
  7. 9
      src/ProtoGen/RepeatedMessageFieldGenerator.cs
  8. 28
      src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs
  9. 6
      src/ProtocolBuffers.Test/TestProtos/UnitTestCSharpOptionsProtoFile.cs
  10. 24
      src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs
  11. 6
      src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs
  12. 252
      src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs
  13. 2
      src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs
  14. 2
      src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs
  15. 14
      src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs
  16. 2
      src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs
  17. 578
      src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs
  18. 18
      src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs
  19. 34
      src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs
  20. 4
      src/ProtocolBuffers/AbstractMessage.cs
  21. 140
      src/ProtocolBuffers/CodedOutputStream.cs
  22. 32
      src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs
  23. 176
      src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs
  24. 6
      src/ProtocolBuffers/FieldSet.cs
  25. 2
      src/ProtocolBuffers/MessageStreamWriter.cs
  26. 11
      src/ProtocolBuffers/UnknownField.cs
  27. 40
      src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs
  28. 2
      src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs
  29. 2
      src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs
  30. 2
      src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs
  31. 282
      src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs
  32. 578
      src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs

@ -1,5 +1,5 @@
@echo off
%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:RunBenchmarks /p:BuildConfiguration=Release /p:Platform="Any CPU"
%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild %~dp0\build.csproj /m /t:RunBenchmarks /p:BuildConfiguration=Release /p:Platform="Any CPU"
pause

@ -155,10 +155,10 @@ namespace Google.ProtocolBuffers.Examples.AddressBook {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasNumber) {
output.WriteString(1, Number);
output.WriteString(1, "number", Number);
}
if (HasType) {
output.WriteEnum(2, (int) Type);
output.WriteEnum(2, "type", (int) Type, Type.ToString());
}
UnknownFields.WriteTo(output);
}
@ -431,16 +431,16 @@ namespace Google.ProtocolBuffers.Examples.AddressBook {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasName) {
output.WriteString(1, Name);
output.WriteString(1, "name", Name);
}
if (HasId) {
output.WriteInt32(2, Id);
output.WriteInt32(2, "id", Id);
}
if (HasEmail) {
output.WriteString(3, Email);
output.WriteString(3, "email", Email);
}
foreach (global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber element in PhoneList) {
output.WriteMessage(4, element);
if (phone_.Count > 0) {
output.WriteMessageArray(4, "phone", phone_);
}
UnknownFields.WriteTo(output);
}
@ -774,8 +774,8 @@ namespace Google.ProtocolBuffers.Examples.AddressBook {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
foreach (global::Google.ProtocolBuffers.Examples.AddressBook.Person element in PersonList) {
output.WriteMessage(1, element);
if (person_.Count > 0) {
output.WriteMessageArray(1, "person", person_);
}
UnknownFields.WriteTo(output);
}

@ -113,7 +113,7 @@ namespace Google.ProtocolBuffers.ProtoGen
public void GenerateSerializationCode(TextGenerator writer)
{
writer.WriteLine("if (Has{0}) {{", PropertyName);
writer.WriteLine(" output.WriteEnum({0}, (int) {1});", Number, PropertyName);
writer.WriteLine(" output.WriteEnum({0}, \"{2}\", (int) {1}, {1}.ToString());", Number, PropertyName, Descriptor.Name);
writer.WriteLine("}");
}

@ -129,7 +129,7 @@ namespace Google.ProtocolBuffers.ProtoGen
public void GenerateSerializationCode(TextGenerator writer)
{
writer.WriteLine("if (Has{0}) {{", PropertyName);
writer.WriteLine(" output.Write{0}({1}, {2});", MessageOrGroup, Number, PropertyName);
writer.WriteLine(" output.Write{0}({1}, \"{3}\", {2});", MessageOrGroup, Number, PropertyName, Descriptor.Name);
writer.WriteLine("}");
}

@ -103,7 +103,7 @@ namespace Google.ProtocolBuffers.ProtoGen
public void GenerateSerializationCode(TextGenerator writer)
{
writer.WriteLine("if (Has{0}) {{", PropertyName);
writer.WriteLine(" output.Write{0}({1}, {2});", CapitalizedTypeName, Number, PropertyName);
writer.WriteLine(" output.Write{0}({1}, \"{3}\", {2});", CapitalizedTypeName, Number, PropertyName, Descriptor.Name);
writer.WriteLine("}");
}

@ -149,19 +149,23 @@ namespace Google.ProtocolBuffers.ProtoGen
writer.WriteLine("if ({0}_.Count > 0) {{", Name);
writer.Indent();
if (Descriptor.IsPacked)
{
writer.WriteLine("output.WriteRawVarint32({0});", WireFormat.MakeTag(Descriptor));
writer.WriteLine("output.WriteRawVarint32((uint) {0}MemoizedSerializedSize);", Name);
writer.WriteLine("foreach (int element in {0}_) {{", Name);
writer.WriteLine(" output.WriteEnumNoTag(element);");
writer.WriteLine("}");
}
writer.WriteLine("output.WritePackedArray(pbd::FieldType.{3}, {0}, \"{2}\", {1}MemoizedSerializedSize, {1}_);", Number, Name, Descriptor.Name, Descriptor.FieldType);
else
{
writer.WriteLine("foreach (int element in {0}_) {{", Name);
writer.WriteLine(" output.WriteEnum({0}, element);", Number);
writer.WriteLine("}");
}
writer.WriteLine("output.WriteArray(pbd::FieldType.{3}, {0}, \"{2}\", {1}_);", Number, Name, Descriptor.Name, Descriptor.FieldType);
//if (Descriptor.IsPacked)
//{
// writer.WriteLine("output.WriteRawVarint32({0});", WireFormat.MakeTag(Descriptor));
// writer.WriteLine("output.WriteRawVarint32((uint) {0}MemoizedSerializedSize);", Name);
// writer.WriteLine("foreach (int element in {0}_) {{", Name);
// writer.WriteLine(" output.WriteEnumNoTag(element);");
// writer.WriteLine("}");
//}
//else
//{
// writer.WriteLine("foreach (int element in {0}_) {{", Name);
// writer.WriteLine(" output.WriteEnum({0}, element);", Number);
// writer.WriteLine("}");
//}
writer.Outdent();
writer.WriteLine("}");
}

@ -135,8 +135,13 @@ namespace Google.ProtocolBuffers.ProtoGen
public void GenerateSerializationCode(TextGenerator writer)
{
writer.WriteLine("foreach ({0} element in {1}List) {{", TypeName, PropertyName);
writer.WriteLine(" output.Write{0}({1}, element);", MessageOrGroup, Number);
writer.WriteLine("if ({0}_.Count > 0) {{", Name);
writer.Indent();
writer.WriteLine("output.Write{0}Array({1}, \"{3}\", {2}_);", MessageOrGroup, Number, Name, Descriptor.Name);
//writer.WriteLine("foreach ({0} element in {1}List) {{", TypeName, PropertyName);
//writer.WriteLine(" output.Write{0}({1}, element);", MessageOrGroup, Number);
//writer.WriteLine("}");
writer.Outdent();
writer.WriteLine("}");
}

@ -141,19 +141,23 @@ namespace Google.ProtocolBuffers.ProtoGen
writer.WriteLine("if ({0}_.Count > 0) {{", Name);
writer.Indent();
if (Descriptor.IsPacked)
{
writer.WriteLine("output.WriteRawVarint32({0});", WireFormat.MakeTag(Descriptor));
writer.WriteLine("output.WriteRawVarint32((uint) {0}MemoizedSerializedSize);", Name);
writer.WriteLine("foreach ({0} element in {1}_) {{", TypeName, Name);
writer.WriteLine(" output.Write{0}NoTag(element);", CapitalizedTypeName);
writer.WriteLine("}");
}
writer.WriteLine("output.WritePackedArray(pbd::FieldType.{3}, {0}, \"{2}\", {1}MemoizedSerializedSize, {1}_);", Number, Name, Descriptor.Name, Descriptor.FieldType);
else
{
writer.WriteLine("foreach ({0} element in {1}_) {{", TypeName, Name);
writer.WriteLine(" output.Write{0}({1}, element);", CapitalizedTypeName, Number);
writer.WriteLine("}");
}
writer.WriteLine("output.WriteArray(pbd::FieldType.{3}, {0}, \"{2}\", {1}_);", Number, Name, Descriptor.Name, Descriptor.FieldType);
//if (Descriptor.IsPacked)
//{
// writer.WriteLine("output.WriteRawVarint32({0});", WireFormat.MakeTag(Descriptor));
// writer.WriteLine("output.WriteRawVarint32((uint) {0}MemoizedSerializedSize);", Name);
// writer.WriteLine("foreach ({0} element in {1}_) {{", TypeName, Name);
// writer.WriteLine(" output.Write{0}NoTag(element);", CapitalizedTypeName);
// writer.WriteLine("}");
//}
//else
//{
// writer.WriteLine("foreach ({0} element in {1}_) {{", TypeName, Name);
// writer.WriteLine(" output.Write{0}({1}, element);", CapitalizedTypeName, Number);
// writer.WriteLine("}");
//}
writer.Outdent();
writer.WriteLine("}");
}

@ -118,13 +118,13 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasNormal) {
output.WriteString(1, Normal);
output.WriteString(1, "normal", Normal);
}
if (HasOptionsMessage_) {
output.WriteString(2, OptionsMessage_);
output.WriteString(2, "options_message", OptionsMessage_);
}
if (HasCustomName) {
output.WriteString(3, CustomName);
output.WriteString(3, "customized", CustomName);
}
UnknownFields.WriteTo(output);
}

@ -453,7 +453,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasField1) {
output.WriteString(1, Field1);
output.WriteString(1, "field1", Field1);
}
UnknownFields.WriteTo(output);
}
@ -2332,13 +2332,13 @@ namespace Google.ProtocolBuffers.TestProtos {
int size = SerializedSize;
pb::ExtendableMessage<ComplexOptionType1, ComplexOptionType1.Builder>.ExtensionWriter extensionWriter = CreateExtensionWriter(this);
if (HasFoo) {
output.WriteInt32(1, Foo);
output.WriteInt32(1, "foo", Foo);
}
if (HasFoo2) {
output.WriteInt32(2, Foo2);
output.WriteInt32(2, "foo2", Foo2);
}
if (HasFoo3) {
output.WriteInt32(3, Foo3);
output.WriteInt32(3, "foo3", Foo3);
}
extensionWriter.WriteUntil(536870912, output);
UnknownFields.WriteTo(output);
@ -2650,7 +2650,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasWaldo) {
output.WriteInt32(1, Waldo);
output.WriteInt32(1, "waldo", Waldo);
}
UnknownFields.WriteTo(output);
}
@ -2874,13 +2874,13 @@ namespace Google.ProtocolBuffers.TestProtos {
int size = SerializedSize;
pb::ExtendableMessage<ComplexOptionType2, ComplexOptionType2.Builder>.ExtensionWriter extensionWriter = CreateExtensionWriter(this);
if (HasBar) {
output.WriteMessage(1, Bar);
output.WriteMessage(1, "bar", Bar);
}
if (HasBaz) {
output.WriteInt32(2, Baz);
output.WriteInt32(2, "baz", Baz);
}
if (HasFred) {
output.WriteMessage(3, Fred);
output.WriteMessage(3, "fred", Fred);
}
extensionWriter.WriteUntil(536870912, output);
UnknownFields.WriteTo(output);
@ -3236,7 +3236,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasPlugh) {
output.WriteInt32(3, Plugh);
output.WriteInt32(3, "plugh", Plugh);
}
UnknownFields.WriteTo(output);
}
@ -3445,10 +3445,10 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasQux) {
output.WriteInt32(1, Qux);
output.WriteInt32(1, "qux", Qux);
}
if (HasComplexOptionType5) {
output.WriteGroup(2, ComplexOptionType5);
output.WriteGroup(2, "complexoptiontype5", ComplexOptionType5);
}
UnknownFields.WriteTo(output);
}
@ -3720,7 +3720,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasXyzzy) {
output.WriteInt32(7593951, Xyzzy);
output.WriteInt32(7593951, "xyzzy", Xyzzy);
}
UnknownFields.WriteTo(output);
}

@ -120,10 +120,10 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasOptionalMessage) {
output.WriteMessage(1, OptionalMessage);
output.WriteMessage(1, "optional_message", OptionalMessage);
}
foreach (global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize element in RepeatedMessageList) {
output.WriteMessage(2, element);
if (repeatedMessage_.Count > 0) {
output.WriteMessageArray(2, "repeated_message", repeatedMessage_);
}
UnknownFields.WriteTo(output);
}

@ -582,129 +582,127 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasField1) {
output.WriteString(1, Field1);
output.WriteString(1, "field1", Field1);
}
if (HasField2) {
output.WriteInt32(2, Field2);
output.WriteInt32(2, "field2", Field2);
}
if (HasField3) {
output.WriteInt32(3, Field3);
output.WriteInt32(3, "field3", Field3);
}
if (HasField4) {
output.WriteString(4, Field4);
output.WriteString(4, "field4", Field4);
}
if (field5_.Count > 0) {
foreach (ulong element in field5_) {
output.WriteFixed64(5, element);
}
output.WriteArray(pbd::FieldType.Fixed64, 5, "field5", field5_);
}
if (HasField6) {
output.WriteInt32(6, Field6);
output.WriteInt32(6, "field6", Field6);
}
if (HasField7) {
output.WriteString(7, Field7);
output.WriteString(7, "field7", Field7);
}
if (HasField9) {
output.WriteString(9, Field9);
output.WriteString(9, "field9", Field9);
}
if (HasField12) {
output.WriteBool(12, Field12);
output.WriteBool(12, "field12", Field12);
}
if (HasField13) {
output.WriteBool(13, Field13);
output.WriteBool(13, "field13", Field13);
}
if (HasField14) {
output.WriteBool(14, Field14);
output.WriteBool(14, "field14", Field14);
}
if (HasField15) {
output.WriteMessage(15, Field15);
output.WriteMessage(15, "field15", Field15);
}
if (HasField16) {
output.WriteInt32(16, Field16);
output.WriteInt32(16, "field16", Field16);
}
if (HasField17) {
output.WriteBool(17, Field17);
output.WriteBool(17, "field17", Field17);
}
if (HasField18) {
output.WriteString(18, Field18);
output.WriteString(18, "field18", Field18);
}
if (HasField22) {
output.WriteInt64(22, Field22);
output.WriteInt64(22, "field22", Field22);
}
if (HasField23) {
output.WriteInt32(23, Field23);
output.WriteInt32(23, "field23", Field23);
}
if (HasField24) {
output.WriteBool(24, Field24);
output.WriteBool(24, "field24", Field24);
}
if (HasField25) {
output.WriteInt32(25, Field25);
output.WriteInt32(25, "field25", Field25);
}
if (HasField29) {
output.WriteInt32(29, Field29);
output.WriteInt32(29, "field29", Field29);
}
if (HasField30) {
output.WriteBool(30, Field30);
output.WriteBool(30, "field30", Field30);
}
if (HasField59) {
output.WriteBool(59, Field59);
output.WriteBool(59, "field59", Field59);
}
if (HasField60) {
output.WriteInt32(60, Field60);
output.WriteInt32(60, "field60", Field60);
}
if (HasField67) {
output.WriteInt32(67, Field67);
output.WriteInt32(67, "field67", Field67);
}
if (HasField68) {
output.WriteInt32(68, Field68);
output.WriteInt32(68, "field68", Field68);
}
if (HasField78) {
output.WriteBool(78, Field78);
output.WriteBool(78, "field78", Field78);
}
if (HasField80) {
output.WriteBool(80, Field80);
output.WriteBool(80, "field80", Field80);
}
if (HasField81) {
output.WriteBool(81, Field81);
output.WriteBool(81, "field81", Field81);
}
if (HasField100) {
output.WriteInt32(100, Field100);
output.WriteInt32(100, "field100", Field100);
}
if (HasField101) {
output.WriteInt32(101, Field101);
output.WriteInt32(101, "field101", Field101);
}
if (HasField102) {
output.WriteString(102, Field102);
output.WriteString(102, "field102", Field102);
}
if (HasField103) {
output.WriteString(103, Field103);
output.WriteString(103, "field103", Field103);
}
if (HasField104) {
output.WriteInt32(104, Field104);
output.WriteInt32(104, "field104", Field104);
}
if (HasField128) {
output.WriteInt32(128, Field128);
output.WriteInt32(128, "field128", Field128);
}
if (HasField129) {
output.WriteString(129, Field129);
output.WriteString(129, "field129", Field129);
}
if (HasField130) {
output.WriteInt32(130, Field130);
output.WriteInt32(130, "field130", Field130);
}
if (HasField131) {
output.WriteInt32(131, Field131);
output.WriteInt32(131, "field131", Field131);
}
if (HasField150) {
output.WriteInt32(150, Field150);
output.WriteInt32(150, "field150", Field150);
}
if (HasField271) {
output.WriteInt32(271, Field271);
output.WriteInt32(271, "field271", Field271);
}
if (HasField272) {
output.WriteInt32(272, Field272);
output.WriteInt32(272, "field272", Field272);
}
if (HasField280) {
output.WriteInt32(280, Field280);
output.WriteInt32(280, "field280", Field280);
}
UnknownFields.WriteTo(output);
}
@ -2287,64 +2285,64 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasField1) {
output.WriteInt32(1, Field1);
output.WriteInt32(1, "field1", Field1);
}
if (HasField2) {
output.WriteInt32(2, Field2);
output.WriteInt32(2, "field2", Field2);
}
if (HasField3) {
output.WriteInt32(3, Field3);
output.WriteInt32(3, "field3", Field3);
}
if (HasField12) {
output.WriteBool(12, Field12);
output.WriteBool(12, "field12", Field12);
}
if (HasField13) {
output.WriteInt64(13, Field13);
output.WriteInt64(13, "field13", Field13);
}
if (HasField14) {
output.WriteInt64(14, Field14);
output.WriteInt64(14, "field14", Field14);
}
if (HasField15) {
output.WriteString(15, Field15);
output.WriteString(15, "field15", Field15);
}
if (HasField16) {
output.WriteInt32(16, Field16);
output.WriteInt32(16, "field16", Field16);
}
if (HasField19) {
output.WriteInt32(19, Field19);
output.WriteInt32(19, "field19", Field19);
}
if (HasField20) {
output.WriteBool(20, Field20);
output.WriteBool(20, "field20", Field20);
}
if (HasField21) {
output.WriteFixed64(21, Field21);
output.WriteFixed64(21, "field21", Field21);
}
if (HasField22) {
output.WriteInt32(22, Field22);
output.WriteInt32(22, "field22", Field22);
}
if (HasField23) {
output.WriteBool(23, Field23);
output.WriteBool(23, "field23", Field23);
}
if (HasField28) {
output.WriteBool(28, Field28);
output.WriteBool(28, "field28", Field28);
}
if (HasField203) {
output.WriteFixed32(203, Field203);
output.WriteFixed32(203, "field203", Field203);
}
if (HasField204) {
output.WriteInt32(204, Field204);
output.WriteInt32(204, "field204", Field204);
}
if (HasField205) {
output.WriteString(205, Field205);
output.WriteString(205, "field205", Field205);
}
if (HasField206) {
output.WriteBool(206, Field206);
output.WriteBool(206, "field206", Field206);
}
if (HasField207) {
output.WriteUInt64(207, Field207);
output.WriteUInt64(207, "field207", Field207);
}
if (HasField300) {
output.WriteUInt64(300, Field300);
output.WriteUInt64(300, "field300", Field300);
}
UnknownFields.WriteTo(output);
}
@ -3296,58 +3294,52 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasField5) {
output.WriteInt32(5, Field5);
output.WriteInt32(5, "field5", Field5);
}
if (HasField11) {
output.WriteFloat(11, Field11);
output.WriteFloat(11, "field11", Field11);
}
if (HasField12) {
output.WriteString(12, Field12);
output.WriteString(12, "field12", Field12);
}
if (HasField13) {
output.WriteString(13, Field13);
output.WriteString(13, "field13", Field13);
}
if (field14_.Count > 0) {
foreach (string element in field14_) {
output.WriteString(14, element);
}
output.WriteArray(pbd::FieldType.String, 14, "field14", field14_);
}
if (HasField15) {
output.WriteUInt64(15, Field15);
output.WriteUInt64(15, "field15", Field15);
}
if (HasField16) {
output.WriteString(16, Field16);
output.WriteString(16, "field16", Field16);
}
if (HasField20) {
output.WriteInt32(20, Field20);
output.WriteInt32(20, "field20", Field20);
}
if (field22_.Count > 0) {
foreach (string element in field22_) {
output.WriteString(22, element);
}
output.WriteArray(pbd::FieldType.String, 22, "field22", field22_);
}
if (HasField24) {
output.WriteString(24, Field24);
output.WriteString(24, "field24", Field24);
}
if (HasField26) {
output.WriteFloat(26, Field26);
output.WriteFloat(26, "field26", Field26);
}
if (HasField27) {
output.WriteString(27, Field27);
output.WriteString(27, "field27", Field27);
}
if (HasField28) {
output.WriteInt32(28, Field28);
output.WriteInt32(28, "field28", Field28);
}
if (HasField29) {
output.WriteString(29, Field29);
output.WriteString(29, "field29", Field29);
}
if (HasField31) {
output.WriteMessage(31, Field31);
output.WriteMessage(31, "field31", Field31);
}
if (field73_.Count > 0) {
foreach (int element in field73_) {
output.WriteInt32(73, element);
}
output.WriteArray(pbd::FieldType.Int32, 73, "field73", field73_);
}
UnknownFields.WriteTo(output);
}
@ -4341,100 +4333,94 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasField1) {
output.WriteString(1, Field1);
output.WriteString(1, "field1", Field1);
}
if (HasField2) {
output.WriteBytes(2, Field2);
output.WriteBytes(2, "field2", Field2);
}
if (HasField3) {
output.WriteInt64(3, Field3);
output.WriteInt64(3, "field3", Field3);
}
if (HasField4) {
output.WriteInt64(4, Field4);
output.WriteInt64(4, "field4", Field4);
}
if (HasField6) {
output.WriteString(6, Field6);
output.WriteString(6, "field6", Field6);
}
foreach (global::Google.ProtocolBuffers.TestProtos.SpeedMessage2.Types.Group1 element in Group1List) {
output.WriteGroup(10, element);
if (group1_.Count > 0) {
output.WriteGroupArray(10, "group1", group1_);
}
if (HasField21) {
output.WriteInt32(21, Field21);
output.WriteInt32(21, "field21", Field21);
}
if (HasField25) {
output.WriteFloat(25, Field25);
output.WriteFloat(25, "field25", Field25);
}
if (HasField30) {
output.WriteInt64(30, Field30);
output.WriteInt64(30, "field30", Field30);
}
if (HasField63) {
output.WriteInt32(63, Field63);
output.WriteInt32(63, "field63", Field63);
}
if (HasField71) {
output.WriteInt32(71, Field71);
output.WriteInt32(71, "field71", Field71);
}
if (HasField75) {
output.WriteBool(75, Field75);
output.WriteBool(75, "field75", Field75);
}
if (HasField109) {
output.WriteInt32(109, Field109);
output.WriteInt32(109, "field109", Field109);
}
if (field127_.Count > 0) {
foreach (string element in field127_) {
output.WriteString(127, element);
}
output.WriteArray(pbd::FieldType.String, 127, "field127", field127_);
}
if (field128_.Count > 0) {
foreach (string element in field128_) {
output.WriteString(128, element);
}
output.WriteArray(pbd::FieldType.String, 128, "field128", field128_);
}
if (HasField129) {
output.WriteInt32(129, Field129);
output.WriteInt32(129, "field129", Field129);
}
if (field130_.Count > 0) {
foreach (long element in field130_) {
output.WriteInt64(130, element);
}
output.WriteArray(pbd::FieldType.Int64, 130, "field130", field130_);
}
if (HasField131) {
output.WriteInt64(131, Field131);
output.WriteInt64(131, "field131", Field131);
}
if (HasField205) {
output.WriteBool(205, Field205);
output.WriteBool(205, "field205", Field205);
}
if (HasField206) {
output.WriteBool(206, Field206);
output.WriteBool(206, "field206", Field206);
}
if (HasField210) {
output.WriteInt32(210, Field210);
output.WriteInt32(210, "field210", Field210);
}
if (HasField211) {
output.WriteInt32(211, Field211);
output.WriteInt32(211, "field211", Field211);
}
if (HasField212) {
output.WriteInt32(212, Field212);
output.WriteInt32(212, "field212", Field212);
}
if (HasField213) {
output.WriteInt32(213, Field213);
output.WriteInt32(213, "field213", Field213);
}
if (HasField216) {
output.WriteInt32(216, Field216);
output.WriteInt32(216, "field216", Field216);
}
if (HasField217) {
output.WriteInt32(217, Field217);
output.WriteInt32(217, "field217", Field217);
}
if (HasField218) {
output.WriteInt32(218, Field218);
output.WriteInt32(218, "field218", Field218);
}
if (HasField220) {
output.WriteInt32(220, Field220);
output.WriteInt32(220, "field220", Field220);
}
if (HasField221) {
output.WriteInt32(221, Field221);
output.WriteInt32(221, "field221", Field221);
}
if (HasField222) {
output.WriteFloat(222, Field222);
output.WriteFloat(222, "field222", Field222);
}
UnknownFields.WriteTo(output);
}
@ -5639,37 +5625,37 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasField1) {
output.WriteFloat(1, Field1);
output.WriteFloat(1, "field1", Field1);
}
if (HasField2) {
output.WriteFloat(2, Field2);
output.WriteFloat(2, "field2", Field2);
}
if (HasField3) {
output.WriteFloat(3, Field3);
output.WriteFloat(3, "field3", Field3);
}
if (HasField4) {
output.WriteBool(4, Field4);
output.WriteBool(4, "field4", Field4);
}
if (HasField5) {
output.WriteBool(5, Field5);
output.WriteBool(5, "field5", Field5);
}
if (HasField6) {
output.WriteBool(6, Field6);
output.WriteBool(6, "field6", Field6);
}
if (HasField7) {
output.WriteBool(7, Field7);
output.WriteBool(7, "field7", Field7);
}
if (HasField8) {
output.WriteFloat(8, Field8);
output.WriteFloat(8, "field8", Field8);
}
if (HasField9) {
output.WriteBool(9, Field9);
output.WriteBool(9, "field9", Field9);
}
if (HasField10) {
output.WriteFloat(10, Field10);
output.WriteFloat(10, "field10", Field10);
}
if (HasField11) {
output.WriteInt64(11, Field11);
output.WriteInt64(11, "field11", Field11);
}
UnknownFields.WriteTo(output);
}

@ -73,7 +73,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasD) {
output.WriteInt32(1, D);
output.WriteInt32(1, "d", D);
}
}

@ -109,7 +109,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasD) {
output.WriteInt32(1, D);
output.WriteInt32(1, "d", D);
}
UnknownFields.WriteTo(output);
}

@ -326,7 +326,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasMessageSet) {
output.WriteMessage(1, MessageSet);
output.WriteMessage(1, "message_set", MessageSet);
}
UnknownFields.WriteTo(output);
}
@ -572,7 +572,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasI) {
output.WriteInt32(15, I);
output.WriteInt32(15, "i", I);
}
UnknownFields.WriteTo(output);
}
@ -795,7 +795,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasStr) {
output.WriteString(25, Str);
output.WriteString(25, "str", Str);
}
UnknownFields.WriteTo(output);
}
@ -1059,10 +1059,10 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasTypeId) {
output.WriteInt32(2, TypeId);
output.WriteInt32(2, "type_id", TypeId);
}
if (HasMessage) {
output.WriteBytes(3, Message);
output.WriteBytes(3, "message", Message);
}
UnknownFields.WriteTo(output);
}
@ -1291,8 +1291,8 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
foreach (global::Google.ProtocolBuffers.TestProtos.RawMessageSet.Types.Item element in ItemList) {
output.WriteGroup(1, element);
if (item_.Count > 0) {
output.WriteGroupArray(1, "item", item_);
}
UnknownFields.WriteTo(output);
}

@ -121,7 +121,7 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService {
int size = SerializedSize;
pb::ExtendableMessage<TestMessage, TestMessage.Builder>.ExtensionWriter extensionWriter = CreateExtensionWriter(this);
if (HasA) {
output.WriteInt32(1, A);
output.WriteInt32(1, "a", A);
}
extensionWriter.WriteUntil(536870912, output);
UnknownFields.WriteTo(output);

File diff suppressed because it is too large Load Diff

@ -123,9 +123,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (criteria_.Count > 0) {
foreach (string element in criteria_) {
output.WriteString(1, element);
}
output.WriteArray(pbd::FieldType.String, 1, "Criteria", criteria_);
}
UnknownFields.WriteTo(output);
}
@ -403,10 +401,10 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasUrl) {
output.WriteString(1, Url);
output.WriteString(1, "url", Url);
}
if (HasName) {
output.WriteString(2, Name);
output.WriteString(2, "name", Name);
}
UnknownFields.WriteTo(output);
}
@ -639,8 +637,8 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
foreach (global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem element in ResultsList) {
output.WriteMessage(1, element);
if (results_.Count > 0) {
output.WriteMessageArray(1, "results", results_);
}
UnknownFields.WriteTo(output);
}
@ -898,12 +896,10 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (criteria_.Count > 0) {
foreach (string element in criteria_) {
output.WriteString(1, element);
}
output.WriteArray(pbd::FieldType.String, 1, "Criteria", criteria_);
}
if (HasPreviousResults) {
output.WriteMessage(2, PreviousResults);
output.WriteMessage(2, "previous_results", PreviousResults);
}
UnknownFields.WriteTo(output);
}

@ -180,12 +180,10 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (options_.Count > 0) {
foreach (int element in options_) {
output.WriteEnum(3, element);
}
output.WriteArray(pbd::FieldType.Enum, 3, "options", options_);
}
if (HasBinary) {
output.WriteBytes(4, Binary);
output.WriteBytes(4, "binary", Binary);
}
UnknownFields.WriteTo(output);
}
@ -681,12 +679,10 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (options_.Count > 0) {
foreach (int element in options_) {
output.WriteEnum(3, element);
}
output.WriteArray(pbd::FieldType.Enum, 3, "options", options_);
}
if (HasBinary) {
output.WriteBytes(4, Binary);
output.WriteBytes(4, "binary", Binary);
}
UnknownFields.WriteTo(output);
}
@ -1006,30 +1002,26 @@ namespace Google.ProtocolBuffers.TestProtos {
int size = SerializedSize;
pb::ExtendableMessage<TestXmlMessage, TestXmlMessage.Builder>.ExtensionWriter extensionWriter = CreateExtensionWriter(this);
if (HasChild) {
output.WriteMessage(1, Child);
output.WriteMessage(1, "child", Child);
}
if (numbers_.Count > 0) {
foreach (int element in numbers_) {
output.WriteInt32(2, element);
}
output.WriteArray(pbd::FieldType.Int32, 2, "numbers", numbers_);
}
if (HasText) {
output.WriteString(3, Text);
output.WriteString(3, "text", Text);
}
if (HasValid) {
output.WriteBool(5, Valid);
output.WriteBool(5, "valid", Valid);
}
if (HasNumber) {
output.WriteInt64(6, Number);
output.WriteInt64(6, "number", Number);
}
extensionWriter.WriteUntil(200, output);
foreach (global::Google.ProtocolBuffers.TestProtos.TestXmlMessage.Types.Children element in ChildrenList) {
output.WriteGroup(401, element);
if (children_.Count > 0) {
output.WriteGroupArray(401, "children", children_);
}
if (textlines_.Count > 0) {
foreach (string element in textlines_) {
output.WriteString(700, element);
}
output.WriteArray(pbd::FieldType.String, 700, "textlines", textlines_);
}
UnknownFields.WriteTo(output);
}
@ -1498,7 +1490,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasNumber) {
output.WriteInt32(1, Number);
output.WriteInt32(1, "number", Number);
}
UnknownFields.WriteTo(output);
}

@ -166,13 +166,13 @@ namespace Google.ProtocolBuffers
{
foreach (object element in valueList)
{
output.WriteField(field.FieldType, field.FieldNumber, element);
output.WriteField(field.FieldType, field.FieldNumber, field.Name, element);
}
}
}
else
{
output.WriteField(field.FieldType, field.FieldNumber, entry.Value);
output.WriteField(field.FieldType, field.FieldNumber, field.Name, entry.Value);
}
}

@ -35,6 +35,7 @@
#endregion
using System;
using System.Globalization;
using System.IO;
using System.Text;
using Google.ProtocolBuffers.Descriptors;
@ -128,7 +129,7 @@ namespace Google.ProtocolBuffers
/// <summary>
/// Writes a double field value, including tag, to the stream.
/// </summary>
public void WriteDouble(int fieldNumber, double value)
public void WriteDouble(int fieldNumber, string fieldName, double value)
{
WriteTag(fieldNumber, WireFormat.WireType.Fixed64);
WriteDoubleNoTag(value);
@ -137,7 +138,7 @@ namespace Google.ProtocolBuffers
/// <summary>
/// Writes a float field value, including tag, to the stream.
/// </summary>
public void WriteFloat(int fieldNumber, float value)
public void WriteFloat(int fieldNumber, string fieldName, float value)
{
WriteTag(fieldNumber, WireFormat.WireType.Fixed32);
WriteFloatNoTag(value);
@ -147,7 +148,7 @@ namespace Google.ProtocolBuffers
/// Writes a uint64 field value, including tag, to the stream.
/// </summary>
[CLSCompliant(false)]
public void WriteUInt64(int fieldNumber, ulong value)
public void WriteUInt64(int fieldNumber, string fieldName, ulong value)
{
WriteTag(fieldNumber, WireFormat.WireType.Varint);
WriteRawVarint64(value);
@ -156,7 +157,7 @@ namespace Google.ProtocolBuffers
/// <summary>
/// Writes an int64 field value, including tag, to the stream.
/// </summary>
public void WriteInt64(int fieldNumber, long value)
public void WriteInt64(int fieldNumber, string fieldName, long value)
{
WriteTag(fieldNumber, WireFormat.WireType.Varint);
WriteRawVarint64((ulong) value);
@ -165,7 +166,7 @@ namespace Google.ProtocolBuffers
/// <summary>
/// Writes an int32 field value, including tag, to the stream.
/// </summary>
public void WriteInt32(int fieldNumber, int value)
public void WriteInt32(int fieldNumber, string fieldName, int value)
{
WriteTag(fieldNumber, WireFormat.WireType.Varint);
if (value >= 0)
@ -183,7 +184,7 @@ namespace Google.ProtocolBuffers
/// Writes a fixed64 field value, including tag, to the stream.
/// </summary>
[CLSCompliant(false)]
public void WriteFixed64(int fieldNumber, ulong value)
public void WriteFixed64(int fieldNumber, string fieldName, ulong value)
{
WriteTag(fieldNumber, WireFormat.WireType.Fixed64);
WriteRawLittleEndian64(value);
@ -193,7 +194,7 @@ namespace Google.ProtocolBuffers
/// Writes a fixed32 field value, including tag, to the stream.
/// </summary>
[CLSCompliant(false)]
public void WriteFixed32(int fieldNumber, uint value)
public void WriteFixed32(int fieldNumber, string fieldName, uint value)
{
WriteTag(fieldNumber, WireFormat.WireType.Fixed32);
WriteRawLittleEndian32(value);
@ -202,7 +203,7 @@ namespace Google.ProtocolBuffers
/// <summary>
/// Writes a bool field value, including tag, to the stream.
/// </summary>
public void WriteBool(int fieldNumber, bool value)
public void WriteBool(int fieldNumber, string fieldName, bool value)
{
WriteTag(fieldNumber, WireFormat.WireType.Varint);
WriteRawByte(value ? (byte) 1 : (byte) 0);
@ -211,7 +212,7 @@ namespace Google.ProtocolBuffers
/// <summary>
/// Writes a string field value, including tag, to the stream.
/// </summary>
public void WriteString(int fieldNumber, string value)
public void WriteString(int fieldNumber, string fieldName, string value)
{
WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited);
// Optimise the case where we have enough space to write
@ -233,7 +234,7 @@ namespace Google.ProtocolBuffers
/// <summary>
/// Writes a group field value, including tag, to the stream.
/// </summary>
public void WriteGroup(int fieldNumber, IMessageLite value)
public void WriteGroup(int fieldNumber, string fieldName, IMessageLite value)
{
WriteTag(fieldNumber, WireFormat.WireType.StartGroup);
value.WriteTo(this);
@ -241,21 +242,21 @@ namespace Google.ProtocolBuffers
}
[Obsolete]
public void WriteUnknownGroup(int fieldNumber, IMessageLite value)
public void WriteUnknownGroup(int fieldNumber, string fieldName, IMessageLite value)
{
WriteTag(fieldNumber, WireFormat.WireType.StartGroup);
value.WriteTo(this);
WriteTag(fieldNumber, WireFormat.WireType.EndGroup);
}
public void WriteMessage(int fieldNumber, IMessageLite value)
public void WriteMessage(int fieldNumber, string fieldName, IMessageLite value)
{
WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited);
WriteRawVarint32((uint) value.SerializedSize);
value.WriteTo(this);
}
public void WriteBytes(int fieldNumber, ByteString value)
public void WriteBytes(int fieldNumber, string fieldName, ByteString value)
{
WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited);
WriteRawVarint32((uint)value.Length);
@ -263,115 +264,153 @@ namespace Google.ProtocolBuffers
}
[CLSCompliant(false)]
public void WriteUInt32(int fieldNumber, uint value)
public void WriteUInt32(int fieldNumber, string fieldName, uint value)
{
WriteTag(fieldNumber, WireFormat.WireType.Varint);
WriteRawVarint32(value);
}
public void WriteEnum(int fieldNumber, int value)
public void WriteEnum(int fieldNumber, string fieldName, int value, string textValue)
{
WriteTag(fieldNumber, WireFormat.WireType.Varint);
WriteRawVarint32((uint) value);
}
public void WriteSFixed32(int fieldNumber, int value)
public void WriteSFixed32(int fieldNumber, string fieldName, int value)
{
WriteTag(fieldNumber, WireFormat.WireType.Fixed32);
WriteRawLittleEndian32((uint) value);
}
public void WriteSFixed64(int fieldNumber, long value)
public void WriteSFixed64(int fieldNumber, string fieldName, long value)
{
WriteTag(fieldNumber, WireFormat.WireType.Fixed64);
WriteRawLittleEndian64((ulong) value);
}
public void WriteSInt32(int fieldNumber, int value)
public void WriteSInt32(int fieldNumber, string fieldName, int value)
{
WriteTag(fieldNumber, WireFormat.WireType.Varint);
WriteRawVarint32(EncodeZigZag32(value));
}
public void WriteSInt64(int fieldNumber, long value)
public void WriteSInt64(int fieldNumber, string fieldName, long value)
{
WriteTag(fieldNumber, WireFormat.WireType.Varint);
WriteRawVarint64(EncodeZigZag64(value));
}
public void WriteMessageSetExtension(int fieldNumber, IMessageLite value)
public void WriteMessageSetExtension(int fieldNumber, string fieldName, IMessageLite value)
{
WriteTag(WireFormat.MessageSetField.Item, WireFormat.WireType.StartGroup);
WriteUInt32(WireFormat.MessageSetField.TypeID, (uint) fieldNumber);
WriteMessage(WireFormat.MessageSetField.Message, value);
WriteUInt32(WireFormat.MessageSetField.TypeID, "type_id", (uint) fieldNumber);
WriteMessage(WireFormat.MessageSetField.Message, "message", value);
WriteTag(WireFormat.MessageSetField.Item, WireFormat.WireType.EndGroup);
}
public void WriteRawMessageSetExtension(int fieldNumber, ByteString value)
{
WriteTag(WireFormat.MessageSetField.Item, WireFormat.WireType.StartGroup);
WriteUInt32(WireFormat.MessageSetField.TypeID, (uint) fieldNumber);
WriteBytes(WireFormat.MessageSetField.Message, value);
WriteUInt32(WireFormat.MessageSetField.TypeID, "type_id", (uint) fieldNumber);
WriteBytes(WireFormat.MessageSetField.Message, "message", value);
WriteTag(WireFormat.MessageSetField.Item, WireFormat.WireType.EndGroup);
}
public void WriteField(FieldType fieldType, int fieldNumber, object value)
public void WriteMessageArray(int fieldNumber, string fieldName, System.Collections.IEnumerable list)
{
foreach (IMessageLite msg in list)
WriteMessage(fieldNumber, fieldName, msg);
}
public void WriteGroupArray(int fieldNumber, string fieldName, System.Collections.IEnumerable list)
{
foreach (IMessageLite msg in list)
WriteGroup(fieldNumber, fieldName, msg);
}
public void WriteArray(FieldType fieldType, int fieldNumber, string fieldName, System.Collections.IEnumerable list)
{
foreach (object element in list)
WriteField(fieldType, fieldNumber, fieldName, element);
}
public void WritePackedArray(FieldType fieldType, int fieldNumber, string fieldName, System.Collections.IEnumerable list)
{
int calculatedSize = 0;
foreach (object element in list)
calculatedSize += CodedOutputStream.ComputeFieldSizeNoTag(fieldType, element);
WritePackedArray(fieldType, fieldNumber, fieldName, calculatedSize, list);
}
public void WritePackedArray(FieldType fieldType, int fieldNumber, string fieldName, int calculatedSize, System.Collections.IEnumerable list)
{
WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited);
WriteRawVarint32((uint)calculatedSize);
foreach (object element in list)
WriteFieldNoTag(fieldType, element);
}
public void WriteField(FieldType fieldType, int fieldNumber, string fieldName, object value)
{
switch (fieldType)
{
case FieldType.Double:
WriteDouble(fieldNumber, (double) value);
WriteDouble(fieldNumber, fieldName, (double) value);
break;
case FieldType.Float:
WriteFloat(fieldNumber, (float) value);
WriteFloat(fieldNumber, fieldName, (float) value);
break;
case FieldType.Int64:
WriteInt64(fieldNumber, (long) value);
WriteInt64(fieldNumber, fieldName, (long) value);
break;
case FieldType.UInt64:
WriteUInt64(fieldNumber, (ulong) value);
WriteUInt64(fieldNumber, fieldName, (ulong) value);
break;
case FieldType.Int32:
WriteInt32(fieldNumber, (int) value);
WriteInt32(fieldNumber, fieldName, (int) value);
break;
case FieldType.Fixed64:
WriteFixed64(fieldNumber, (ulong) value);
WriteFixed64(fieldNumber, fieldName, (ulong) value);
break;
case FieldType.Fixed32:
WriteFixed32(fieldNumber, (uint) value);
WriteFixed32(fieldNumber, fieldName, (uint) value);
break;
case FieldType.Bool:
WriteBool(fieldNumber, (bool) value);
WriteBool(fieldNumber, fieldName, (bool) value);
break;
case FieldType.String:
WriteString(fieldNumber, (string) value);
WriteString(fieldNumber, fieldName, (string) value);
break;
case FieldType.Group:
WriteGroup(fieldNumber, (IMessageLite) value);
WriteGroup(fieldNumber, fieldName, (IMessageLite) value);
break;
case FieldType.Message:
WriteMessage(fieldNumber, (IMessageLite) value);
WriteMessage(fieldNumber, fieldName, (IMessageLite) value);
break;
case FieldType.Bytes:
WriteBytes(fieldNumber, (ByteString) value);
WriteBytes(fieldNumber, fieldName, (ByteString) value);
break;
case FieldType.UInt32:
WriteUInt32(fieldNumber, (uint) value);
WriteUInt32(fieldNumber, fieldName, (uint) value);
break;
case FieldType.SFixed32:
WriteSFixed32(fieldNumber, (int) value);
WriteSFixed32(fieldNumber, fieldName, (int) value);
break;
case FieldType.SFixed64:
WriteSFixed64(fieldNumber, (long) value);
WriteSFixed64(fieldNumber, fieldName, (long) value);
break;
case FieldType.SInt32:
WriteSInt32(fieldNumber, (int) value);
WriteSInt32(fieldNumber, fieldName, (int) value);
break;
case FieldType.SInt64:
WriteSInt64(fieldNumber, (long) value);
WriteSInt64(fieldNumber, fieldName, (long) value);
break;
case FieldType.Enum:
WriteEnum(fieldNumber, ((IEnumLite) value).Number);
if(value is System.Enum)
WriteEnum(fieldNumber, fieldName, ((IConvertible)value).ToInt32(CultureInfo.InvariantCulture), value.ToString());
else
WriteEnum(fieldNumber, fieldName, ((IEnumLite) value).Number, ((IEnumLite) value).Name);
break;
}
}
@ -432,7 +471,10 @@ namespace Google.ProtocolBuffers
WriteSInt64NoTag((long) value);
break;
case FieldType.Enum:
WriteEnumNoTag(((IEnumLite) value).Number);
if (value is System.Enum)
WriteEnumNoTag(((IConvertible)value).ToInt32(CultureInfo.InvariantCulture));
else
WriteEnumNoTag(((IEnumLite) value).Number);
break;
}
}
@ -1252,7 +1294,10 @@ namespace Google.ProtocolBuffers
case FieldType.SInt64:
return ComputeSInt64Size(fieldNumber, (long) value);
case FieldType.Enum:
return ComputeEnumSize(fieldNumber, ((IEnumLite) value).Number);
if (value is System.Enum)
return ComputeEnumSize(fieldNumber, ((IConvertible)value).ToInt32(CultureInfo.InvariantCulture));
else
return ComputeEnumSize(fieldNumber, ((IEnumLite) value).Number);
default:
throw new ArgumentOutOfRangeException("Invalid field type " + fieldType);
}
@ -1301,7 +1346,10 @@ namespace Google.ProtocolBuffers
case FieldType.SInt64:
return ComputeSInt64SizeNoTag((long) value);
case FieldType.Enum:
return ComputeEnumSizeNoTag(((IEnumLite) value).Number);
if (value is System.Enum)
return ComputeEnumSizeNoTag(((IConvertible)value).ToInt32(CultureInfo.InvariantCulture));
else
return ComputeEnumSizeNoTag(((IEnumLite) value).Number);
default:
throw new ArgumentOutOfRangeException("Invalid field type " + fieldType);
}

@ -283,43 +283,43 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasNamespace) {
output.WriteString(1, Namespace);
output.WriteString(1, "namespace", Namespace);
}
if (HasUmbrellaClassname) {
output.WriteString(2, UmbrellaClassname);
output.WriteString(2, "umbrella_classname", UmbrellaClassname);
}
if (HasPublicClasses) {
output.WriteBool(3, PublicClasses);
output.WriteBool(3, "public_classes", PublicClasses);
}
if (HasMultipleFiles) {
output.WriteBool(4, MultipleFiles);
output.WriteBool(4, "multiple_files", MultipleFiles);
}
if (HasNestClasses) {
output.WriteBool(5, NestClasses);
output.WriteBool(5, "nest_classes", NestClasses);
}
if (HasCodeContracts) {
output.WriteBool(6, CodeContracts);
output.WriteBool(6, "code_contracts", CodeContracts);
}
if (HasExpandNamespaceDirectories) {
output.WriteBool(7, ExpandNamespaceDirectories);
output.WriteBool(7, "expand_namespace_directories", ExpandNamespaceDirectories);
}
if (HasClsCompliance) {
output.WriteBool(8, ClsCompliance);
output.WriteBool(8, "cls_compliance", ClsCompliance);
}
if (HasFileExtension) {
output.WriteString(221, FileExtension);
output.WriteString(221, "file_extension", FileExtension);
}
if (HasUmbrellaNamespace) {
output.WriteString(222, UmbrellaNamespace);
output.WriteString(222, "umbrella_namespace", UmbrellaNamespace);
}
if (HasOutputDirectory) {
output.WriteString(223, OutputDirectory);
output.WriteString(223, "output_directory", OutputDirectory);
}
if (HasIgnoreGoogleProtobuf) {
output.WriteBool(224, IgnoreGoogleProtobuf);
output.WriteBool(224, "ignore_google_protobuf", IgnoreGoogleProtobuf);
}
if (HasServiceGeneratorType) {
output.WriteEnum(225, (int) ServiceGeneratorType);
output.WriteEnum(225, "service_generator_type", (int) ServiceGeneratorType, ServiceGeneratorType.ToString());
}
UnknownFields.WriteTo(output);
}
@ -889,7 +889,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasPropertyName) {
output.WriteString(1, PropertyName);
output.WriteString(1, "property_name", PropertyName);
}
UnknownFields.WriteTo(output);
}
@ -1111,7 +1111,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasInterfaceId) {
output.WriteString(1, InterfaceId);
output.WriteString(1, "interface_id", InterfaceId);
}
UnknownFields.WriteTo(output);
}
@ -1333,7 +1333,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasDispatchId) {
output.WriteInt32(1, DispatchId);
output.WriteInt32(1, "dispatch_id", DispatchId);
}
UnknownFields.WriteTo(output);
}

@ -275,8 +275,8 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
foreach (global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto element in FileList) {
output.WriteMessage(1, element);
if (file_.Count > 0) {
output.WriteMessageArray(1, "file", file_);
}
UnknownFields.WriteTo(output);
}
@ -615,30 +615,28 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasName) {
output.WriteString(1, Name);
output.WriteString(1, "name", Name);
}
if (HasPackage) {
output.WriteString(2, Package);
output.WriteString(2, "package", Package);
}
if (dependency_.Count > 0) {
foreach (string element in dependency_) {
output.WriteString(3, element);
}
output.WriteArray(pbd::FieldType.String, 3, "dependency", dependency_);
}
foreach (global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto element in MessageTypeList) {
output.WriteMessage(4, element);
if (messageType_.Count > 0) {
output.WriteMessageArray(4, "message_type", messageType_);
}
foreach (global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto element in EnumTypeList) {
output.WriteMessage(5, element);
if (enumType_.Count > 0) {
output.WriteMessageArray(5, "enum_type", enumType_);
}
foreach (global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto element in ServiceList) {
output.WriteMessage(6, element);
if (service_.Count > 0) {
output.WriteMessageArray(6, "service", service_);
}
foreach (global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto element in ExtensionList) {
output.WriteMessage(7, element);
if (extension_.Count > 0) {
output.WriteMessageArray(7, "extension", extension_);
}
if (HasOptions) {
output.WriteMessage(8, Options);
output.WriteMessage(8, "options", Options);
}
UnknownFields.WriteTo(output);
}
@ -1228,10 +1226,10 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasStart) {
output.WriteInt32(1, Start);
output.WriteInt32(1, "start", Start);
}
if (HasEnd) {
output.WriteInt32(2, End);
output.WriteInt32(2, "end", End);
}
UnknownFields.WriteTo(output);
}
@ -1543,25 +1541,25 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasName) {
output.WriteString(1, Name);
output.WriteString(1, "name", Name);
}
foreach (global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto element in FieldList) {
output.WriteMessage(2, element);
if (field_.Count > 0) {
output.WriteMessageArray(2, "field", field_);
}
foreach (global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto element in NestedTypeList) {
output.WriteMessage(3, element);
if (nestedType_.Count > 0) {
output.WriteMessageArray(3, "nested_type", nestedType_);
}
foreach (global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto element in EnumTypeList) {
output.WriteMessage(4, element);
if (enumType_.Count > 0) {
output.WriteMessageArray(4, "enum_type", enumType_);
}
foreach (global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange element in ExtensionRangeList) {
output.WriteMessage(5, element);
if (extensionRange_.Count > 0) {
output.WriteMessageArray(5, "extension_range", extensionRange_);
}
foreach (global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto element in ExtensionList) {
output.WriteMessage(6, element);
if (extension_.Count > 0) {
output.WriteMessageArray(6, "extension", extension_);
}
if (HasOptions) {
output.WriteMessage(7, Options);
output.WriteMessage(7, "options", Options);
}
UnknownFields.WriteTo(output);
}
@ -2201,28 +2199,28 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasName) {
output.WriteString(1, Name);
output.WriteString(1, "name", Name);
}
if (HasExtendee) {
output.WriteString(2, Extendee);
output.WriteString(2, "extendee", Extendee);
}
if (HasNumber) {
output.WriteInt32(3, Number);
output.WriteInt32(3, "number", Number);
}
if (HasLabel) {
output.WriteEnum(4, (int) Label);
output.WriteEnum(4, "label", (int) Label, Label.ToString());
}
if (HasType) {
output.WriteEnum(5, (int) Type);
output.WriteEnum(5, "type", (int) Type, Type.ToString());
}
if (HasTypeName) {
output.WriteString(6, TypeName);
output.WriteString(6, "type_name", TypeName);
}
if (HasDefaultValue) {
output.WriteString(7, DefaultValue);
output.WriteString(7, "default_value", DefaultValue);
}
if (HasOptions) {
output.WriteMessage(8, Options);
output.WriteMessage(8, "options", Options);
}
UnknownFields.WriteTo(output);
}
@ -2710,13 +2708,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasName) {
output.WriteString(1, Name);
output.WriteString(1, "name", Name);
}
foreach (global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto element in ValueList) {
output.WriteMessage(2, element);
if (value_.Count > 0) {
output.WriteMessageArray(2, "value", value_);
}
if (HasOptions) {
output.WriteMessage(3, Options);
output.WriteMessage(3, "options", Options);
}
UnknownFields.WriteTo(output);
}
@ -3063,13 +3061,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasName) {
output.WriteString(1, Name);
output.WriteString(1, "name", Name);
}
if (HasNumber) {
output.WriteInt32(2, Number);
output.WriteInt32(2, "number", Number);
}
if (HasOptions) {
output.WriteMessage(3, Options);
output.WriteMessage(3, "options", Options);
}
UnknownFields.WriteTo(output);
}
@ -3398,13 +3396,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasName) {
output.WriteString(1, Name);
output.WriteString(1, "name", Name);
}
foreach (global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto element in MethodList) {
output.WriteMessage(2, element);
if (method_.Count > 0) {
output.WriteMessageArray(2, "method", method_);
}
if (HasOptions) {
output.WriteMessage(3, Options);
output.WriteMessage(3, "options", Options);
}
UnknownFields.WriteTo(output);
}
@ -3761,16 +3759,16 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasName) {
output.WriteString(1, Name);
output.WriteString(1, "name", Name);
}
if (HasInputType) {
output.WriteString(2, InputType);
output.WriteString(2, "input_type", InputType);
}
if (HasOutputType) {
output.WriteString(3, OutputType);
output.WriteString(3, "output_type", OutputType);
}
if (HasOptions) {
output.WriteMessage(4, Options);
output.WriteMessage(4, "options", Options);
}
UnknownFields.WriteTo(output);
}
@ -4194,28 +4192,28 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
int size = SerializedSize;
pb::ExtendableMessage<FileOptions, FileOptions.Builder>.ExtensionWriter extensionWriter = CreateExtensionWriter(this);
if (HasJavaPackage) {
output.WriteString(1, JavaPackage);
output.WriteString(1, "java_package", JavaPackage);
}
if (HasJavaOuterClassname) {
output.WriteString(8, JavaOuterClassname);
output.WriteString(8, "java_outer_classname", JavaOuterClassname);
}
if (HasOptimizeFor) {
output.WriteEnum(9, (int) OptimizeFor);
output.WriteEnum(9, "optimize_for", (int) OptimizeFor, OptimizeFor.ToString());
}
if (HasJavaMultipleFiles) {
output.WriteBool(10, JavaMultipleFiles);
output.WriteBool(10, "java_multiple_files", JavaMultipleFiles);
}
if (HasCcGenericServices) {
output.WriteBool(16, CcGenericServices);
output.WriteBool(16, "cc_generic_services", CcGenericServices);
}
if (HasJavaGenericServices) {
output.WriteBool(17, JavaGenericServices);
output.WriteBool(17, "java_generic_services", JavaGenericServices);
}
if (HasPyGenericServices) {
output.WriteBool(18, PyGenericServices);
output.WriteBool(18, "py_generic_services", PyGenericServices);
}
foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) {
output.WriteMessage(999, element);
if (uninterpretedOption_.Count > 0) {
output.WriteMessageArray(999, "uninterpreted_option", uninterpretedOption_);
}
extensionWriter.WriteUntil(536870912, output);
UnknownFields.WriteTo(output);
@ -4695,13 +4693,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
int size = SerializedSize;
pb::ExtendableMessage<MessageOptions, MessageOptions.Builder>.ExtensionWriter extensionWriter = CreateExtensionWriter(this);
if (HasMessageSetWireFormat) {
output.WriteBool(1, MessageSetWireFormat);
output.WriteBool(1, "message_set_wire_format", MessageSetWireFormat);
}
if (HasNoStandardDescriptorAccessor) {
output.WriteBool(2, NoStandardDescriptorAccessor);
output.WriteBool(2, "no_standard_descriptor_accessor", NoStandardDescriptorAccessor);
}
foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) {
output.WriteMessage(999, element);
if (uninterpretedOption_.Count > 0) {
output.WriteMessageArray(999, "uninterpreted_option", uninterpretedOption_);
}
extensionWriter.WriteUntil(536870912, output);
UnknownFields.WriteTo(output);
@ -5067,19 +5065,19 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
int size = SerializedSize;
pb::ExtendableMessage<FieldOptions, FieldOptions.Builder>.ExtensionWriter extensionWriter = CreateExtensionWriter(this);
if (HasCtype) {
output.WriteEnum(1, (int) Ctype);
output.WriteEnum(1, "ctype", (int) Ctype, Ctype.ToString());
}
if (HasPacked) {
output.WriteBool(2, Packed);
output.WriteBool(2, "packed", Packed);
}
if (HasDeprecated) {
output.WriteBool(3, Deprecated);
output.WriteBool(3, "deprecated", Deprecated);
}
if (HasExperimentalMapKey) {
output.WriteString(9, ExperimentalMapKey);
output.WriteString(9, "experimental_map_key", ExperimentalMapKey);
}
foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) {
output.WriteMessage(999, element);
if (uninterpretedOption_.Count > 0) {
output.WriteMessageArray(999, "uninterpreted_option", uninterpretedOption_);
}
extensionWriter.WriteUntil(536870912, output);
UnknownFields.WriteTo(output);
@ -5453,8 +5451,8 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
pb::ExtendableMessage<EnumOptions, EnumOptions.Builder>.ExtensionWriter extensionWriter = CreateExtensionWriter(this);
foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) {
output.WriteMessage(999, element);
if (uninterpretedOption_.Count > 0) {
output.WriteMessageArray(999, "uninterpreted_option", uninterpretedOption_);
}
extensionWriter.WriteUntil(536870912, output);
UnknownFields.WriteTo(output);
@ -5707,8 +5705,8 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
pb::ExtendableMessage<EnumValueOptions, EnumValueOptions.Builder>.ExtensionWriter extensionWriter = CreateExtensionWriter(this);
foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) {
output.WriteMessage(999, element);
if (uninterpretedOption_.Count > 0) {
output.WriteMessageArray(999, "uninterpreted_option", uninterpretedOption_);
}
extensionWriter.WriteUntil(536870912, output);
UnknownFields.WriteTo(output);
@ -5961,8 +5959,8 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
pb::ExtendableMessage<ServiceOptions, ServiceOptions.Builder>.ExtensionWriter extensionWriter = CreateExtensionWriter(this);
foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) {
output.WriteMessage(999, element);
if (uninterpretedOption_.Count > 0) {
output.WriteMessageArray(999, "uninterpreted_option", uninterpretedOption_);
}
extensionWriter.WriteUntil(536870912, output);
UnknownFields.WriteTo(output);
@ -6215,8 +6213,8 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
pb::ExtendableMessage<MethodOptions, MethodOptions.Builder>.ExtensionWriter extensionWriter = CreateExtensionWriter(this);
foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) {
output.WriteMessage(999, element);
if (uninterpretedOption_.Count > 0) {
output.WriteMessageArray(999, "uninterpreted_option", uninterpretedOption_);
}
extensionWriter.WriteUntil(536870912, output);
UnknownFields.WriteTo(output);
@ -6505,10 +6503,10 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasNamePart_) {
output.WriteString(1, NamePart_);
output.WriteString(1, "name_part", NamePart_);
}
if (HasIsExtension) {
output.WriteBool(2, IsExtension);
output.WriteBool(2, "is_extension", IsExtension);
}
UnknownFields.WriteTo(output);
}
@ -6791,23 +6789,23 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Types.NamePart element in NameList) {
output.WriteMessage(2, element);
if (name_.Count > 0) {
output.WriteMessageArray(2, "name", name_);
}
if (HasIdentifierValue) {
output.WriteString(3, IdentifierValue);
output.WriteString(3, "identifier_value", IdentifierValue);
}
if (HasPositiveIntValue) {
output.WriteUInt64(4, PositiveIntValue);
output.WriteUInt64(4, "positive_int_value", PositiveIntValue);
}
if (HasNegativeIntValue) {
output.WriteInt64(5, NegativeIntValue);
output.WriteInt64(5, "negative_int_value", NegativeIntValue);
}
if (HasDoubleValue) {
output.WriteDouble(6, DoubleValue);
output.WriteDouble(6, "double_value", DoubleValue);
}
if (HasStringValue) {
output.WriteBytes(7, StringValue);
output.WriteBytes(7, "string_value", StringValue);
}
UnknownFields.WriteTo(output);
}

@ -470,7 +470,7 @@ namespace Google.ProtocolBuffers
{
if (field.IsExtension && field.MessageSetWireFormat)
{
output.WriteMessageSetExtension(field.FieldNumber, (IMessageLite) value);
output.WriteMessageSetExtension(field.FieldNumber, field.Name, (IMessageLite)value);
}
else
{
@ -497,13 +497,13 @@ namespace Google.ProtocolBuffers
{
foreach (object element in valueList)
{
output.WriteField(field.FieldType, field.FieldNumber, element);
output.WriteField(field.FieldType, field.FieldNumber, field.Name, element);
}
}
}
else
{
output.WriteField(field.FieldType, field.FieldNumber, value);
output.WriteField(field.FieldType, field.FieldNumber, field.Name, value);
}
}
}

@ -59,7 +59,7 @@ namespace Google.ProtocolBuffers
public void Write(T message)
{
codedOutput.WriteMessage(1, message);
codedOutput.WriteMessage(1, "item", message);
}
public void Flush()

@ -60,6 +60,7 @@ namespace Google.ProtocolBuffers
/// </summary>
public sealed class UnknownField
{
public const string UnknownFieldName = "unknown_field";
private static readonly UnknownField defaultInstance = CreateBuilder().Build();
private readonly ReadOnlyCollection<ulong> varintList;
private readonly ReadOnlyCollection<uint> fixed32List;
@ -177,24 +178,24 @@ namespace Google.ProtocolBuffers
{
foreach (ulong value in varintList)
{
output.WriteUInt64(fieldNumber, value);
output.WriteUInt64(fieldNumber, UnknownFieldName, value);
}
foreach (uint value in fixed32List)
{
output.WriteFixed32(fieldNumber, value);
output.WriteFixed32(fieldNumber, UnknownFieldName, value);
}
foreach (ulong value in fixed64List)
{
output.WriteFixed64(fieldNumber, value);
output.WriteFixed64(fieldNumber, UnknownFieldName, value);
}
foreach (ByteString value in lengthDelimitedList)
{
output.WriteBytes(fieldNumber, value);
output.WriteBytes(fieldNumber, UnknownFieldName, value);
}
foreach (UnknownFieldSet value in groupList)
{
#pragma warning disable 0612
output.WriteUnknownGroup(fieldNumber, value);
output.WriteUnknownGroup(fieldNumber, UnknownFieldName, value);
#pragma warning restore 0612
}
}

@ -101,10 +101,10 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasD) {
output.WriteInt32(1, D);
output.WriteInt32(1, "d", D);
}
if (HasEn) {
output.WriteEnum(2, (int) En);
output.WriteEnum(2, "en", (int) En, En.ToString());
}
}
@ -395,10 +395,10 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasNumber) {
output.WriteString(1, Number);
output.WriteString(1, "number", Number);
}
if (HasType) {
output.WriteEnum(2, (int) Type);
output.WriteEnum(2, "type", (int) Type, Type.ToString());
}
}
@ -694,19 +694,19 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasAddress) {
output.WriteString(1, Address);
output.WriteString(1, "address", Address);
}
if (HasAddress2) {
output.WriteString(2, Address2);
output.WriteString(2, "address2", Address2);
}
if (HasCity) {
output.WriteString(3, City);
output.WriteString(3, "city", City);
}
if (HasState) {
output.WriteString(4, State);
output.WriteString(4, "state", State);
}
if (HasZip) {
output.WriteFixed32(5, Zip);
output.WriteFixed32(5, "zip", Zip);
}
}
@ -1101,26 +1101,22 @@ namespace Google.ProtocolBuffers.TestProtos {
int size = SerializedSize;
pb::ExtendableMessageLite<TestInteropPersonLite, TestInteropPersonLite.Builder>.ExtensionWriter extensionWriter = CreateExtensionWriter(this);
if (HasName) {
output.WriteString(1, Name);
output.WriteString(1, "name", Name);
}
if (HasId) {
output.WriteInt32(2, Id);
output.WriteInt32(2, "id", Id);
}
if (HasEmail) {
output.WriteString(3, Email);
output.WriteString(3, "email", Email);
}
foreach (global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneNumber element in PhoneList) {
output.WriteMessage(4, element);
if (phone_.Count > 0) {
output.WriteMessageArray(4, "phone", phone_);
}
foreach (global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.Addresses element in AddressesList) {
output.WriteGroup(5, element);
if (addresses_.Count > 0) {
output.WriteGroupArray(5, "addresses", addresses_);
}
if (codes_.Count > 0) {
output.WriteRawVarint32(82);
output.WriteRawVarint32((uint) codesMemoizedSerializedSize);
foreach (int element in codes_) {
output.WriteInt32NoTag(element);
}
output.WritePackedArray(pbd::FieldType.Int32, 10, "codes", codesMemoizedSerializedSize, codes_);
}
extensionWriter.WriteUntil(200, output);
}
@ -1576,7 +1572,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasNumber) {
output.WriteString(1, Number);
output.WriteString(1, "number", Number);
}
}

@ -73,7 +73,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasD) {
output.WriteInt32(1, D);
output.WriteInt32(1, "d", D);
}
}

@ -109,7 +109,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasD) {
output.WriteInt32(1, D);
output.WriteInt32(1, "d", D);
}
UnknownFields.WriteTo(output);
}

@ -62,7 +62,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasMessage) {
output.WriteMessage(1, Message);
output.WriteMessage(1, "message", Message);
}
}

@ -1116,7 +1116,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasBb) {
output.WriteInt32(1, Bb);
output.WriteInt32(1, "bb", Bb);
}
}
@ -1331,7 +1331,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasA) {
output.WriteInt32(17, A);
output.WriteInt32(17, "a", A);
}
}
@ -1546,7 +1546,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasA) {
output.WriteInt32(47, A);
output.WriteInt32(47, "a", A);
}
}
@ -2481,248 +2481,208 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasOptionalInt32) {
output.WriteInt32(1, OptionalInt32);
output.WriteInt32(1, "optional_int32", OptionalInt32);
}
if (HasOptionalInt64) {
output.WriteInt64(2, OptionalInt64);
output.WriteInt64(2, "optional_int64", OptionalInt64);
}
if (HasOptionalUint32) {
output.WriteUInt32(3, OptionalUint32);
output.WriteUInt32(3, "optional_uint32", OptionalUint32);
}
if (HasOptionalUint64) {
output.WriteUInt64(4, OptionalUint64);
output.WriteUInt64(4, "optional_uint64", OptionalUint64);
}
if (HasOptionalSint32) {
output.WriteSInt32(5, OptionalSint32);
output.WriteSInt32(5, "optional_sint32", OptionalSint32);
}
if (HasOptionalSint64) {
output.WriteSInt64(6, OptionalSint64);
output.WriteSInt64(6, "optional_sint64", OptionalSint64);
}
if (HasOptionalFixed32) {
output.WriteFixed32(7, OptionalFixed32);
output.WriteFixed32(7, "optional_fixed32", OptionalFixed32);
}
if (HasOptionalFixed64) {
output.WriteFixed64(8, OptionalFixed64);
output.WriteFixed64(8, "optional_fixed64", OptionalFixed64);
}
if (HasOptionalSfixed32) {
output.WriteSFixed32(9, OptionalSfixed32);
output.WriteSFixed32(9, "optional_sfixed32", OptionalSfixed32);
}
if (HasOptionalSfixed64) {
output.WriteSFixed64(10, OptionalSfixed64);
output.WriteSFixed64(10, "optional_sfixed64", OptionalSfixed64);
}
if (HasOptionalFloat) {
output.WriteFloat(11, OptionalFloat);
output.WriteFloat(11, "optional_float", OptionalFloat);
}
if (HasOptionalDouble) {
output.WriteDouble(12, OptionalDouble);
output.WriteDouble(12, "optional_double", OptionalDouble);
}
if (HasOptionalBool) {
output.WriteBool(13, OptionalBool);
output.WriteBool(13, "optional_bool", OptionalBool);
}
if (HasOptionalString) {
output.WriteString(14, OptionalString);
output.WriteString(14, "optional_string", OptionalString);
}
if (HasOptionalBytes) {
output.WriteBytes(15, OptionalBytes);
output.WriteBytes(15, "optional_bytes", OptionalBytes);
}
if (HasOptionalGroup) {
output.WriteGroup(16, OptionalGroup);
output.WriteGroup(16, "optionalgroup", OptionalGroup);
}
if (HasOptionalNestedMessage) {
output.WriteMessage(18, OptionalNestedMessage);
output.WriteMessage(18, "optional_nested_message", OptionalNestedMessage);
}
if (HasOptionalForeignMessage) {
output.WriteMessage(19, OptionalForeignMessage);
output.WriteMessage(19, "optional_foreign_message", OptionalForeignMessage);
}
if (HasOptionalImportMessage) {
output.WriteMessage(20, OptionalImportMessage);
output.WriteMessage(20, "optional_import_message", OptionalImportMessage);
}
if (HasOptionalNestedEnum) {
output.WriteEnum(21, (int) OptionalNestedEnum);
output.WriteEnum(21, "optional_nested_enum", (int) OptionalNestedEnum, OptionalNestedEnum.ToString());
}
if (HasOptionalForeignEnum) {
output.WriteEnum(22, (int) OptionalForeignEnum);
output.WriteEnum(22, "optional_foreign_enum", (int) OptionalForeignEnum, OptionalForeignEnum.ToString());
}
if (HasOptionalImportEnum) {
output.WriteEnum(23, (int) OptionalImportEnum);
output.WriteEnum(23, "optional_import_enum", (int) OptionalImportEnum, OptionalImportEnum.ToString());
}
if (HasOptionalStringPiece) {
output.WriteString(24, OptionalStringPiece);
output.WriteString(24, "optional_string_piece", OptionalStringPiece);
}
if (HasOptionalCord) {
output.WriteString(25, OptionalCord);
output.WriteString(25, "optional_cord", OptionalCord);
}
if (repeatedInt32_.Count > 0) {
foreach (int element in repeatedInt32_) {
output.WriteInt32(31, element);
}
output.WriteArray(pbd::FieldType.Int32, 31, "repeated_int32", repeatedInt32_);
}
if (repeatedInt64_.Count > 0) {
foreach (long element in repeatedInt64_) {
output.WriteInt64(32, element);
}
output.WriteArray(pbd::FieldType.Int64, 32, "repeated_int64", repeatedInt64_);
}
if (repeatedUint32_.Count > 0) {
foreach (uint element in repeatedUint32_) {
output.WriteUInt32(33, element);
}
output.WriteArray(pbd::FieldType.UInt32, 33, "repeated_uint32", repeatedUint32_);
}
if (repeatedUint64_.Count > 0) {
foreach (ulong element in repeatedUint64_) {
output.WriteUInt64(34, element);
}
output.WriteArray(pbd::FieldType.UInt64, 34, "repeated_uint64", repeatedUint64_);
}
if (repeatedSint32_.Count > 0) {
foreach (int element in repeatedSint32_) {
output.WriteSInt32(35, element);
}
output.WriteArray(pbd::FieldType.SInt32, 35, "repeated_sint32", repeatedSint32_);
}
if (repeatedSint64_.Count > 0) {
foreach (long element in repeatedSint64_) {
output.WriteSInt64(36, element);
}
output.WriteArray(pbd::FieldType.SInt64, 36, "repeated_sint64", repeatedSint64_);
}
if (repeatedFixed32_.Count > 0) {
foreach (uint element in repeatedFixed32_) {
output.WriteFixed32(37, element);
}
output.WriteArray(pbd::FieldType.Fixed32, 37, "repeated_fixed32", repeatedFixed32_);
}
if (repeatedFixed64_.Count > 0) {
foreach (ulong element in repeatedFixed64_) {
output.WriteFixed64(38, element);
}
output.WriteArray(pbd::FieldType.Fixed64, 38, "repeated_fixed64", repeatedFixed64_);
}
if (repeatedSfixed32_.Count > 0) {
foreach (int element in repeatedSfixed32_) {
output.WriteSFixed32(39, element);
}
output.WriteArray(pbd::FieldType.SFixed32, 39, "repeated_sfixed32", repeatedSfixed32_);
}
if (repeatedSfixed64_.Count > 0) {
foreach (long element in repeatedSfixed64_) {
output.WriteSFixed64(40, element);
}
output.WriteArray(pbd::FieldType.SFixed64, 40, "repeated_sfixed64", repeatedSfixed64_);
}
if (repeatedFloat_.Count > 0) {
foreach (float element in repeatedFloat_) {
output.WriteFloat(41, element);
}
output.WriteArray(pbd::FieldType.Float, 41, "repeated_float", repeatedFloat_);
}
if (repeatedDouble_.Count > 0) {
foreach (double element in repeatedDouble_) {
output.WriteDouble(42, element);
}
output.WriteArray(pbd::FieldType.Double, 42, "repeated_double", repeatedDouble_);
}
if (repeatedBool_.Count > 0) {
foreach (bool element in repeatedBool_) {
output.WriteBool(43, element);
}
output.WriteArray(pbd::FieldType.Bool, 43, "repeated_bool", repeatedBool_);
}
if (repeatedString_.Count > 0) {
foreach (string element in repeatedString_) {
output.WriteString(44, element);
}
output.WriteArray(pbd::FieldType.String, 44, "repeated_string", repeatedString_);
}
if (repeatedBytes_.Count > 0) {
foreach (pb::ByteString element in repeatedBytes_) {
output.WriteBytes(45, element);
}
output.WriteArray(pbd::FieldType.Bytes, 45, "repeated_bytes", repeatedBytes_);
}
foreach (global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.RepeatedGroup element in RepeatedGroupList) {
output.WriteGroup(46, element);
if (repeatedGroup_.Count > 0) {
output.WriteGroupArray(46, "repeatedgroup", repeatedGroup_);
}
foreach (global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage element in RepeatedNestedMessageList) {
output.WriteMessage(48, element);
if (repeatedNestedMessage_.Count > 0) {
output.WriteMessageArray(48, "repeated_nested_message", repeatedNestedMessage_);
}
foreach (global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite element in RepeatedForeignMessageList) {
output.WriteMessage(49, element);
if (repeatedForeignMessage_.Count > 0) {
output.WriteMessageArray(49, "repeated_foreign_message", repeatedForeignMessage_);
}
foreach (global::Google.ProtocolBuffers.TestProtos.ImportMessageLite element in RepeatedImportMessageList) {
output.WriteMessage(50, element);
if (repeatedImportMessage_.Count > 0) {
output.WriteMessageArray(50, "repeated_import_message", repeatedImportMessage_);
}
if (repeatedNestedEnum_.Count > 0) {
foreach (int element in repeatedNestedEnum_) {
output.WriteEnum(51, element);
}
output.WriteArray(pbd::FieldType.Enum, 51, "repeated_nested_enum", repeatedNestedEnum_);
}
if (repeatedForeignEnum_.Count > 0) {
foreach (int element in repeatedForeignEnum_) {
output.WriteEnum(52, element);
}
output.WriteArray(pbd::FieldType.Enum, 52, "repeated_foreign_enum", repeatedForeignEnum_);
}
if (repeatedImportEnum_.Count > 0) {
foreach (int element in repeatedImportEnum_) {
output.WriteEnum(53, element);
}
output.WriteArray(pbd::FieldType.Enum, 53, "repeated_import_enum", repeatedImportEnum_);
}
if (repeatedStringPiece_.Count > 0) {
foreach (string element in repeatedStringPiece_) {
output.WriteString(54, element);
}
output.WriteArray(pbd::FieldType.String, 54, "repeated_string_piece", repeatedStringPiece_);
}
if (repeatedCord_.Count > 0) {
foreach (string element in repeatedCord_) {
output.WriteString(55, element);
}
output.WriteArray(pbd::FieldType.String, 55, "repeated_cord", repeatedCord_);
}
if (HasDefaultInt32) {
output.WriteInt32(61, DefaultInt32);
output.WriteInt32(61, "default_int32", DefaultInt32);
}
if (HasDefaultInt64) {
output.WriteInt64(62, DefaultInt64);
output.WriteInt64(62, "default_int64", DefaultInt64);
}
if (HasDefaultUint32) {
output.WriteUInt32(63, DefaultUint32);
output.WriteUInt32(63, "default_uint32", DefaultUint32);
}
if (HasDefaultUint64) {
output.WriteUInt64(64, DefaultUint64);
output.WriteUInt64(64, "default_uint64", DefaultUint64);
}
if (HasDefaultSint32) {
output.WriteSInt32(65, DefaultSint32);
output.WriteSInt32(65, "default_sint32", DefaultSint32);
}
if (HasDefaultSint64) {
output.WriteSInt64(66, DefaultSint64);
output.WriteSInt64(66, "default_sint64", DefaultSint64);
}
if (HasDefaultFixed32) {
output.WriteFixed32(67, DefaultFixed32);
output.WriteFixed32(67, "default_fixed32", DefaultFixed32);
}
if (HasDefaultFixed64) {
output.WriteFixed64(68, DefaultFixed64);
output.WriteFixed64(68, "default_fixed64", DefaultFixed64);
}
if (HasDefaultSfixed32) {
output.WriteSFixed32(69, DefaultSfixed32);
output.WriteSFixed32(69, "default_sfixed32", DefaultSfixed32);
}
if (HasDefaultSfixed64) {
output.WriteSFixed64(70, DefaultSfixed64);
output.WriteSFixed64(70, "default_sfixed64", DefaultSfixed64);
}
if (HasDefaultFloat) {
output.WriteFloat(71, DefaultFloat);
output.WriteFloat(71, "default_float", DefaultFloat);
}
if (HasDefaultDouble) {
output.WriteDouble(72, DefaultDouble);
output.WriteDouble(72, "default_double", DefaultDouble);
}
if (HasDefaultBool) {
output.WriteBool(73, DefaultBool);
output.WriteBool(73, "default_bool", DefaultBool);
}
if (HasDefaultString) {
output.WriteString(74, DefaultString);
output.WriteString(74, "default_string", DefaultString);
}
if (HasDefaultBytes) {
output.WriteBytes(75, DefaultBytes);
output.WriteBytes(75, "default_bytes", DefaultBytes);
}
if (HasDefaultNestedEnum) {
output.WriteEnum(81, (int) DefaultNestedEnum);
output.WriteEnum(81, "default_nested_enum", (int) DefaultNestedEnum, DefaultNestedEnum.ToString());
}
if (HasDefaultForeignEnum) {
output.WriteEnum(82, (int) DefaultForeignEnum);
output.WriteEnum(82, "default_foreign_enum", (int) DefaultForeignEnum, DefaultForeignEnum.ToString());
}
if (HasDefaultImportEnum) {
output.WriteEnum(83, (int) DefaultImportEnum);
output.WriteEnum(83, "default_import_enum", (int) DefaultImportEnum, DefaultImportEnum.ToString());
}
if (HasDefaultStringPiece) {
output.WriteString(84, DefaultStringPiece);
output.WriteString(84, "default_string_piece", DefaultStringPiece);
}
if (HasDefaultCord) {
output.WriteString(85, DefaultCord);
output.WriteString(85, "default_cord", DefaultCord);
}
}
@ -5630,7 +5590,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasC) {
output.WriteInt32(1, C);
output.WriteInt32(1, "c", C);
}
}
@ -6025,102 +5985,46 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (packedInt32_.Count > 0) {
output.WriteRawVarint32(722);
output.WriteRawVarint32((uint) packedInt32MemoizedSerializedSize);
foreach (int element in packedInt32_) {
output.WriteInt32NoTag(element);
}
output.WritePackedArray(pbd::FieldType.Int32, 90, "packed_int32", packedInt32MemoizedSerializedSize, packedInt32_);
}
if (packedInt64_.Count > 0) {
output.WriteRawVarint32(730);
output.WriteRawVarint32((uint) packedInt64MemoizedSerializedSize);
foreach (long element in packedInt64_) {
output.WriteInt64NoTag(element);
}
output.WritePackedArray(pbd::FieldType.Int64, 91, "packed_int64", packedInt64MemoizedSerializedSize, packedInt64_);
}
if (packedUint32_.Count > 0) {
output.WriteRawVarint32(738);
output.WriteRawVarint32((uint) packedUint32MemoizedSerializedSize);
foreach (uint element in packedUint32_) {
output.WriteUInt32NoTag(element);
}
output.WritePackedArray(pbd::FieldType.UInt32, 92, "packed_uint32", packedUint32MemoizedSerializedSize, packedUint32_);
}
if (packedUint64_.Count > 0) {
output.WriteRawVarint32(746);
output.WriteRawVarint32((uint) packedUint64MemoizedSerializedSize);
foreach (ulong element in packedUint64_) {
output.WriteUInt64NoTag(element);
}
output.WritePackedArray(pbd::FieldType.UInt64, 93, "packed_uint64", packedUint64MemoizedSerializedSize, packedUint64_);
}
if (packedSint32_.Count > 0) {
output.WriteRawVarint32(754);
output.WriteRawVarint32((uint) packedSint32MemoizedSerializedSize);
foreach (int element in packedSint32_) {
output.WriteSInt32NoTag(element);
}
output.WritePackedArray(pbd::FieldType.SInt32, 94, "packed_sint32", packedSint32MemoizedSerializedSize, packedSint32_);
}
if (packedSint64_.Count > 0) {
output.WriteRawVarint32(762);
output.WriteRawVarint32((uint) packedSint64MemoizedSerializedSize);
foreach (long element in packedSint64_) {
output.WriteSInt64NoTag(element);
}
output.WritePackedArray(pbd::FieldType.SInt64, 95, "packed_sint64", packedSint64MemoizedSerializedSize, packedSint64_);
}
if (packedFixed32_.Count > 0) {
output.WriteRawVarint32(770);
output.WriteRawVarint32((uint) packedFixed32MemoizedSerializedSize);
foreach (uint element in packedFixed32_) {
output.WriteFixed32NoTag(element);
}
output.WritePackedArray(pbd::FieldType.Fixed32, 96, "packed_fixed32", packedFixed32MemoizedSerializedSize, packedFixed32_);
}
if (packedFixed64_.Count > 0) {
output.WriteRawVarint32(778);
output.WriteRawVarint32((uint) packedFixed64MemoizedSerializedSize);
foreach (ulong element in packedFixed64_) {
output.WriteFixed64NoTag(element);
}
output.WritePackedArray(pbd::FieldType.Fixed64, 97, "packed_fixed64", packedFixed64MemoizedSerializedSize, packedFixed64_);
}
if (packedSfixed32_.Count > 0) {
output.WriteRawVarint32(786);
output.WriteRawVarint32((uint) packedSfixed32MemoizedSerializedSize);
foreach (int element in packedSfixed32_) {
output.WriteSFixed32NoTag(element);
}
output.WritePackedArray(pbd::FieldType.SFixed32, 98, "packed_sfixed32", packedSfixed32MemoizedSerializedSize, packedSfixed32_);
}
if (packedSfixed64_.Count > 0) {
output.WriteRawVarint32(794);
output.WriteRawVarint32((uint) packedSfixed64MemoizedSerializedSize);
foreach (long element in packedSfixed64_) {
output.WriteSFixed64NoTag(element);
}
output.WritePackedArray(pbd::FieldType.SFixed64, 99, "packed_sfixed64", packedSfixed64MemoizedSerializedSize, packedSfixed64_);
}
if (packedFloat_.Count > 0) {
output.WriteRawVarint32(802);
output.WriteRawVarint32((uint) packedFloatMemoizedSerializedSize);
foreach (float element in packedFloat_) {
output.WriteFloatNoTag(element);
}
output.WritePackedArray(pbd::FieldType.Float, 100, "packed_float", packedFloatMemoizedSerializedSize, packedFloat_);
}
if (packedDouble_.Count > 0) {
output.WriteRawVarint32(810);
output.WriteRawVarint32((uint) packedDoubleMemoizedSerializedSize);
foreach (double element in packedDouble_) {
output.WriteDoubleNoTag(element);
}
output.WritePackedArray(pbd::FieldType.Double, 101, "packed_double", packedDoubleMemoizedSerializedSize, packedDouble_);
}
if (packedBool_.Count > 0) {
output.WriteRawVarint32(818);
output.WriteRawVarint32((uint) packedBoolMemoizedSerializedSize);
foreach (bool element in packedBool_) {
output.WriteBoolNoTag(element);
}
output.WritePackedArray(pbd::FieldType.Bool, 102, "packed_bool", packedBoolMemoizedSerializedSize, packedBool_);
}
if (packedEnum_.Count > 0) {
output.WriteRawVarint32(826);
output.WriteRawVarint32((uint) packedEnumMemoizedSerializedSize);
foreach (int element in packedEnum_) {
output.WriteEnumNoTag(element);
}
output.WritePackedArray(pbd::FieldType.Enum, 103, "packed_enum", packedEnumMemoizedSerializedSize, packedEnum_);
}
}
@ -7278,7 +7182,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasA) {
output.WriteInt32(17, A);
output.WriteInt32(17, "a", A);
}
}
@ -7493,7 +7397,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasA) {
output.WriteInt32(47, A);
output.WriteInt32(47, "a", A);
}
}
@ -8060,7 +7964,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasDeprecatedField) {
output.WriteInt32(1, DeprecatedField);
output.WriteInt32(1, "deprecated_field", DeprecatedField);
}
}

Loading…
Cancel
Save