diff options
author | Jan Tattermusch <jtattermusch@users.noreply.github.com> | 2015-06-23 12:09:21 -0700 |
---|---|---|
committer | Jan Tattermusch <jtattermusch@users.noreply.github.com> | 2015-06-23 12:09:21 -0700 |
commit | 659a43b5935f4afc9d00e1dd742e4210e000ab53 (patch) | |
tree | 8cc30b648793795d3eb72df7130c241d094df318 /csharp/src/ProtocolBuffers.Test | |
parent | 45b70328f218dc2b3e20191c2cfa92872ef10d04 (diff) | |
parent | 785e13e3c002ccd0a1174839f47041ef81a33640 (diff) | |
download | protobuf-659a43b5935f4afc9d00e1dd742e4210e000ab53.tar.gz protobuf-659a43b5935f4afc9d00e1dd742e4210e000ab53.tar.bz2 protobuf-659a43b5935f4afc9d00e1dd742e4210e000ab53.zip |
Merge pull request #532 from jskeet/proto3-clone
Implement Clone.
Diffstat (limited to 'csharp/src/ProtocolBuffers.Test')
5 files changed, 559 insertions, 90 deletions
diff --git a/csharp/src/ProtocolBuffers.Test/GeneratedMessageTest.cs b/csharp/src/ProtocolBuffers.Test/GeneratedMessageTest.cs index c5564060..e21d904d 100644 --- a/csharp/src/ProtocolBuffers.Test/GeneratedMessageTest.cs +++ b/csharp/src/ProtocolBuffers.Test/GeneratedMessageTest.cs @@ -1,9 +1,4 @@ -using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Google.Protobuf.TestProtos;
+using Google.Protobuf.TestProtos;
using NUnit.Framework;
namespace Google.Protobuf
@@ -88,7 +83,7 @@ namespace Google.Protobuf var message = new TestAllTypes
{
SingleBool = true,
- SingleBytes = ByteString.CopyFrom(new byte[] { 1, 2, 3, 4 }),
+ SingleBytes = ByteString.CopyFrom(1, 2, 3, 4),
SingleDouble = 23.5,
SingleFixed32 = 23,
SingleFixed64 = 1234567890123,
@@ -122,7 +117,7 @@ namespace Google.Protobuf var message = new TestAllTypes
{
RepeatedBool = { true, false },
- RepeatedBytes = { ByteString.CopyFrom(new byte[] { 1, 2, 3, 4 }), ByteString.CopyFrom(new byte[] { 5, 6 }) },
+ RepeatedBytes = { ByteString.CopyFrom(1, 2, 3, 4), ByteString.CopyFrom(5, 6) },
RepeatedDouble = { -12.25, 23.5 },
RepeatedFixed32 = { uint.MaxValue, 23 },
RepeatedFixed64 = { ulong.MaxValue, 1234567890123 },
@@ -149,5 +144,118 @@ namespace Google.Protobuf TestAllTypes parsed = TestAllTypes.Parser.ParseFrom(bytes);
Assert.AreEqual(message, parsed);
}
+
+ [Test]
+ public void CloneSingleNonMessageValues()
+ {
+ var original = new TestAllTypes
+ {
+ SingleBool = true,
+ SingleBytes = ByteString.CopyFrom(1, 2, 3, 4),
+ SingleDouble = 23.5,
+ SingleFixed32 = 23,
+ SingleFixed64 = 1234567890123,
+ SingleFloat = 12.25f,
+ SingleInt32 = 100,
+ SingleInt64 = 3210987654321,
+ SingleNestedEnum = TestAllTypes.Types.NestedEnum.FOO,
+ SingleSfixed32 = -123,
+ SingleSfixed64 = -12345678901234,
+ SingleSint32 = -456,
+ SingleSint64 = -12345678901235,
+ SingleString = "test",
+ SingleUint32 = uint.MaxValue,
+ SingleUint64 = ulong.MaxValue
+ };
+ var clone = original.Clone();
+ Assert.AreNotSame(original, clone);
+ Assert.AreEqual(original, clone);
+ // Just as a single example
+ clone.SingleInt32 = 150;
+ Assert.AreNotEqual(original, clone);
+ }
+
+ [Test]
+ public void CloneRepeatedNonMessageValues()
+ {
+ var original = new TestAllTypes
+ {
+ RepeatedBool = { true, false },
+ RepeatedBytes = { ByteString.CopyFrom(1, 2, 3, 4), ByteString.CopyFrom(5, 6) },
+ RepeatedDouble = { -12.25, 23.5 },
+ RepeatedFixed32 = { uint.MaxValue, 23 },
+ RepeatedFixed64 = { ulong.MaxValue, 1234567890123 },
+ RepeatedFloat = { 100f, 12.25f },
+ RepeatedInt32 = { 100, 200 },
+ RepeatedInt64 = { 3210987654321, long.MaxValue },
+ RepeatedNestedEnum = { TestAllTypes.Types.NestedEnum.FOO, TestAllTypes.Types.NestedEnum.NEG },
+ RepeatedSfixed32 = { -123, 123 },
+ RepeatedSfixed64 = { -12345678901234, 12345678901234 },
+ RepeatedSint32 = { -456, 100 },
+ RepeatedSint64 = { -12345678901235, 123 },
+ RepeatedString = { "foo", "bar" },
+ RepeatedUint32 = { uint.MaxValue, uint.MinValue },
+ RepeatedUint64 = { ulong.MaxValue, uint.MinValue }
+ };
+
+ var clone = original.Clone();
+ Assert.AreNotSame(original, clone);
+ Assert.AreEqual(original, clone);
+ // Just as a single example
+ clone.RepeatedDouble.Add(25.5);
+ Assert.AreNotEqual(original, clone);
+ }
+
+ [Test]
+ public void CloneSingleMessageField()
+ {
+ var original = new TestAllTypes
+ {
+ SingleNestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 20 }
+ };
+
+ var clone = original.Clone();
+ Assert.AreNotSame(original, clone);
+ Assert.AreNotSame(original.SingleNestedMessage, clone.SingleNestedMessage);
+ Assert.AreEqual(original, clone);
+
+ clone.SingleNestedMessage.Bb = 30;
+ Assert.AreNotEqual(original, clone);
+ }
+
+ [Test]
+ public void CloneRepeatedMessageField()
+ {
+ var original = new TestAllTypes
+ {
+ RepeatedNestedMessage = { new TestAllTypes.Types.NestedMessage { Bb = 20 } }
+ };
+
+ var clone = original.Clone();
+ Assert.AreNotSame(original, clone);
+ Assert.AreNotSame(original.RepeatedNestedMessage, clone.RepeatedNestedMessage);
+ Assert.AreNotSame(original.RepeatedNestedMessage[0], clone.RepeatedNestedMessage[0]);
+ Assert.AreEqual(original, clone);
+
+ clone.RepeatedNestedMessage[0].Bb = 30;
+ Assert.AreNotEqual(original, clone);
+ }
+
+ [Test]
+ public void CloneOneofField()
+ {
+ var original = new TestAllTypes
+ {
+ OneofNestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 20 }
+ };
+
+ var clone = original.Clone();
+ Assert.AreNotSame(original, clone);
+ Assert.AreEqual(original, clone);
+
+ // We should have cloned the message
+ original.OneofNestedMessage.Bb = 30;
+ Assert.AreNotEqual(original, clone);
+ }
}
}
diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportProto3.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportProto3.cs index e048f65c..30256972 100644 --- a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportProto3.cs +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportProto3.cs @@ -60,7 +60,7 @@ namespace Google.Protobuf.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class ImportMessage : pb::IMessage<ImportMessage>, global::System.IEquatable<ImportMessage> { + public sealed partial class ImportMessage : pb::IMessage<ImportMessage> { private static readonly pb::MessageParser<ImportMessage> _parser = new pb::MessageParser<ImportMessage>(() => new ImportMessage()); public static pb::MessageParser<ImportMessage> Parser { get { return _parser; } } @@ -75,9 +75,15 @@ namespace Google.Protobuf.TestProtos { } public ImportMessage() { } + public ImportMessage(ImportMessage other) { - MergeFrom(other); + d_ = other.d_; + } + + public ImportMessage Clone() { + return new ImportMessage(this); } + public const int DFieldNumber = 1; private int d_; public int D { diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportPublicProto3.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportPublicProto3.cs index 5d9f0b7a..cb7292f3 100644 --- a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportPublicProto3.cs +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportPublicProto3.cs @@ -45,7 +45,7 @@ namespace Google.Protobuf.TestProtos { } #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class PublicImportMessage : pb::IMessage<PublicImportMessage>, global::System.IEquatable<PublicImportMessage> { + public sealed partial class PublicImportMessage : pb::IMessage<PublicImportMessage> { private static readonly pb::MessageParser<PublicImportMessage> _parser = new pb::MessageParser<PublicImportMessage>(() => new PublicImportMessage()); public static pb::MessageParser<PublicImportMessage> Parser { get { return _parser; } } @@ -60,9 +60,15 @@ namespace Google.Protobuf.TestProtos { } public PublicImportMessage() { } + public PublicImportMessage(PublicImportMessage other) { - MergeFrom(other); + e_ = other.e_; + } + + public PublicImportMessage Clone() { + return new PublicImportMessage(this); } + public const int EFieldNumber = 1; private int e_; public int E { diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestIssues.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestIssues.cs index 959b3866..d32718d5 100644 --- a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestIssues.cs +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestIssues.cs @@ -90,7 +90,7 @@ namespace UnitTest.Issues.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class NegativeEnumMessage : pb::IMessage<NegativeEnumMessage>, global::System.IEquatable<NegativeEnumMessage> { + public sealed partial class NegativeEnumMessage : pb::IMessage<NegativeEnumMessage> { private static readonly pb::MessageParser<NegativeEnumMessage> _parser = new pb::MessageParser<NegativeEnumMessage>(() => new NegativeEnumMessage()); public static pb::MessageParser<NegativeEnumMessage> Parser { get { return _parser; } } @@ -105,9 +105,17 @@ namespace UnitTest.Issues.TestProtos { } public NegativeEnumMessage() { } + public NegativeEnumMessage(NegativeEnumMessage other) { - MergeFrom(other); + value_ = other.value_; + values_ = other.values_.Clone(); + packedValues_ = other.packedValues_.Clone(); + } + + public NegativeEnumMessage Clone() { + return new NegativeEnumMessage(this); } + public const int ValueFieldNumber = 1; private global::UnitTest.Issues.TestProtos.NegativeEnum value_ = global::UnitTest.Issues.TestProtos.NegativeEnum.NEGATIVE_ENUM_ZERO; public global::UnitTest.Issues.TestProtos.NegativeEnum Value { @@ -233,7 +241,7 @@ namespace UnitTest.Issues.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class DeprecatedChild : pb::IMessage<DeprecatedChild>, global::System.IEquatable<DeprecatedChild> { + public sealed partial class DeprecatedChild : pb::IMessage<DeprecatedChild> { private static readonly pb::MessageParser<DeprecatedChild> _parser = new pb::MessageParser<DeprecatedChild>(() => new DeprecatedChild()); public static pb::MessageParser<DeprecatedChild> Parser { get { return _parser; } } @@ -248,9 +256,14 @@ namespace UnitTest.Issues.TestProtos { } public DeprecatedChild() { } + public DeprecatedChild(DeprecatedChild other) { - MergeFrom(other); } + + public DeprecatedChild Clone() { + return new DeprecatedChild(this); + } + public override bool Equals(object other) { return Equals(other as DeprecatedChild); } @@ -301,7 +314,7 @@ namespace UnitTest.Issues.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class DeprecatedFieldsMessage : pb::IMessage<DeprecatedFieldsMessage>, global::System.IEquatable<DeprecatedFieldsMessage> { + public sealed partial class DeprecatedFieldsMessage : pb::IMessage<DeprecatedFieldsMessage> { private static readonly pb::MessageParser<DeprecatedFieldsMessage> _parser = new pb::MessageParser<DeprecatedFieldsMessage>(() => new DeprecatedFieldsMessage()); public static pb::MessageParser<DeprecatedFieldsMessage> Parser { get { return _parser; } } @@ -316,9 +329,20 @@ namespace UnitTest.Issues.TestProtos { } public DeprecatedFieldsMessage() { } + public DeprecatedFieldsMessage(DeprecatedFieldsMessage other) { - MergeFrom(other); + primitiveValue_ = other.primitiveValue_; + primitiveArray_ = other.primitiveArray_.Clone(); + MessageValue = other.messageValue_ != null ? other.MessageValue.Clone() : null; + messageArray_ = other.messageArray_.Clone(); + enumValue_ = other.enumValue_; + enumArray_ = other.enumArray_.Clone(); + } + + public DeprecatedFieldsMessage Clone() { + return new DeprecatedFieldsMessage(this); } + public const int PrimitiveValueFieldNumber = 1; private int primitiveValue_; [global::System.ObsoleteAttribute()] @@ -525,7 +549,7 @@ namespace UnitTest.Issues.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class ItemField : pb::IMessage<ItemField>, global::System.IEquatable<ItemField> { + public sealed partial class ItemField : pb::IMessage<ItemField> { private static readonly pb::MessageParser<ItemField> _parser = new pb::MessageParser<ItemField>(() => new ItemField()); public static pb::MessageParser<ItemField> Parser { get { return _parser; } } @@ -540,9 +564,15 @@ namespace UnitTest.Issues.TestProtos { } public ItemField() { } + public ItemField(ItemField other) { - MergeFrom(other); + item_ = other.item_; + } + + public ItemField Clone() { + return new ItemField(this); } + public const int ItemFieldNumber = 1; private int item_; public int Item { diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestProto3.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestProto3.cs index bbfa8c3e..d9d33b10 100644 --- a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestProto3.cs +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestProto3.cs @@ -402,7 +402,7 @@ namespace Google.Protobuf.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class TestAllTypes : pb::IMessage<TestAllTypes>, global::System.IEquatable<TestAllTypes> { + public sealed partial class TestAllTypes : pb::IMessage<TestAllTypes> { private static readonly pb::MessageParser<TestAllTypes> _parser = new pb::MessageParser<TestAllTypes>(() => new TestAllTypes()); public static pb::MessageParser<TestAllTypes> Parser { get { return _parser; } } @@ -417,9 +417,73 @@ namespace Google.Protobuf.TestProtos { } public TestAllTypes() { } + public TestAllTypes(TestAllTypes other) { - MergeFrom(other); + singleInt32_ = other.singleInt32_; + singleInt64_ = other.singleInt64_; + singleUint32_ = other.singleUint32_; + singleUint64_ = other.singleUint64_; + singleSint32_ = other.singleSint32_; + singleSint64_ = other.singleSint64_; + singleFixed32_ = other.singleFixed32_; + singleFixed64_ = other.singleFixed64_; + singleSfixed32_ = other.singleSfixed32_; + singleSfixed64_ = other.singleSfixed64_; + singleFloat_ = other.singleFloat_; + singleDouble_ = other.singleDouble_; + singleBool_ = other.singleBool_; + singleString_ = other.singleString_; + singleBytes_ = other.singleBytes_; + SingleNestedMessage = other.singleNestedMessage_ != null ? other.SingleNestedMessage.Clone() : null; + SingleForeignMessage = other.singleForeignMessage_ != null ? other.SingleForeignMessage.Clone() : null; + SingleImportMessage = other.singleImportMessage_ != null ? other.SingleImportMessage.Clone() : null; + singleNestedEnum_ = other.singleNestedEnum_; + singleForeignEnum_ = other.singleForeignEnum_; + singleImportEnum_ = other.singleImportEnum_; + SinglePublicImportMessage = other.singlePublicImportMessage_ != null ? other.SinglePublicImportMessage.Clone() : null; + repeatedInt32_ = other.repeatedInt32_.Clone(); + repeatedInt64_ = other.repeatedInt64_.Clone(); + repeatedUint32_ = other.repeatedUint32_.Clone(); + repeatedUint64_ = other.repeatedUint64_.Clone(); + repeatedSint32_ = other.repeatedSint32_.Clone(); + repeatedSint64_ = other.repeatedSint64_.Clone(); + repeatedFixed32_ = other.repeatedFixed32_.Clone(); + repeatedFixed64_ = other.repeatedFixed64_.Clone(); + repeatedSfixed32_ = other.repeatedSfixed32_.Clone(); + repeatedSfixed64_ = other.repeatedSfixed64_.Clone(); + repeatedFloat_ = other.repeatedFloat_.Clone(); + repeatedDouble_ = other.repeatedDouble_.Clone(); + repeatedBool_ = other.repeatedBool_.Clone(); + repeatedString_ = other.repeatedString_.Clone(); + repeatedBytes_ = other.repeatedBytes_.Clone(); + repeatedNestedMessage_ = other.repeatedNestedMessage_.Clone(); + repeatedForeignMessage_ = other.repeatedForeignMessage_.Clone(); + repeatedImportMessage_ = other.repeatedImportMessage_.Clone(); + repeatedNestedEnum_ = other.repeatedNestedEnum_.Clone(); + repeatedForeignEnum_ = other.repeatedForeignEnum_.Clone(); + repeatedImportEnum_ = other.repeatedImportEnum_.Clone(); + repeatedPublicImportMessage_ = other.repeatedPublicImportMessage_.Clone(); + switch (other.OneofFieldCase) { + case OneofFieldOneofCase.OneofUint32: + OneofUint32 = other.OneofUint32; + break; + case OneofFieldOneofCase.OneofNestedMessage: + OneofNestedMessage = other.OneofNestedMessage.Clone(); + break; + case OneofFieldOneofCase.OneofString: + OneofString = other.OneofString; + break; + case OneofFieldOneofCase.OneofBytes: + OneofBytes = other.OneofBytes; + break; + } + + } + + public TestAllTypes Clone() { + return new TestAllTypes(this); } + public const int SingleInt32FieldNumber = 1; private int singleInt32_; public int SingleInt32 { @@ -1686,7 +1750,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class NestedMessage : pb::IMessage<NestedMessage>, global::System.IEquatable<NestedMessage> { + public sealed partial class NestedMessage : pb::IMessage<NestedMessage> { private static readonly pb::MessageParser<NestedMessage> _parser = new pb::MessageParser<NestedMessage>(() => new NestedMessage()); public static pb::MessageParser<NestedMessage> Parser { get { return _parser; } } @@ -1701,9 +1765,15 @@ namespace Google.Protobuf.TestProtos { } public NestedMessage() { } + public NestedMessage(NestedMessage other) { - MergeFrom(other); + bb_ = other.bb_; + } + + public NestedMessage Clone() { + return new NestedMessage(this); } + public const int BbFieldNumber = 1; private int bb_; public int Bb { @@ -1783,7 +1853,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class NestedTestAllTypes : pb::IMessage<NestedTestAllTypes>, global::System.IEquatable<NestedTestAllTypes> { + public sealed partial class NestedTestAllTypes : pb::IMessage<NestedTestAllTypes> { private static readonly pb::MessageParser<NestedTestAllTypes> _parser = new pb::MessageParser<NestedTestAllTypes>(() => new NestedTestAllTypes()); public static pb::MessageParser<NestedTestAllTypes> Parser { get { return _parser; } } @@ -1798,9 +1868,17 @@ namespace Google.Protobuf.TestProtos { } public NestedTestAllTypes() { } + public NestedTestAllTypes(NestedTestAllTypes other) { - MergeFrom(other); + Child = other.child_ != null ? other.Child.Clone() : null; + Payload = other.payload_ != null ? other.Payload.Clone() : null; + repeatedChild_ = other.repeatedChild_.Clone(); } + + public NestedTestAllTypes Clone() { + return new NestedTestAllTypes(this); + } + public const int ChildFieldNumber = 1; private global::Google.Protobuf.TestProtos.NestedTestAllTypes child_; public global::Google.Protobuf.TestProtos.NestedTestAllTypes Child { @@ -1929,7 +2007,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class TestDeprecatedFields : pb::IMessage<TestDeprecatedFields>, global::System.IEquatable<TestDeprecatedFields> { + public sealed partial class TestDeprecatedFields : pb::IMessage<TestDeprecatedFields> { private static readonly pb::MessageParser<TestDeprecatedFields> _parser = new pb::MessageParser<TestDeprecatedFields>(() => new TestDeprecatedFields()); public static pb::MessageParser<TestDeprecatedFields> Parser { get { return _parser; } } @@ -1944,9 +2022,15 @@ namespace Google.Protobuf.TestProtos { } public TestDeprecatedFields() { } + public TestDeprecatedFields(TestDeprecatedFields other) { - MergeFrom(other); + deprecatedInt32_ = other.deprecatedInt32_; + } + + public TestDeprecatedFields Clone() { + return new TestDeprecatedFields(this); } + public const int DeprecatedInt32FieldNumber = 1; private int deprecatedInt32_; [global::System.ObsoleteAttribute()] @@ -2022,7 +2106,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class ForeignMessage : pb::IMessage<ForeignMessage>, global::System.IEquatable<ForeignMessage> { + public sealed partial class ForeignMessage : pb::IMessage<ForeignMessage> { private static readonly pb::MessageParser<ForeignMessage> _parser = new pb::MessageParser<ForeignMessage>(() => new ForeignMessage()); public static pb::MessageParser<ForeignMessage> Parser { get { return _parser; } } @@ -2037,9 +2121,15 @@ namespace Google.Protobuf.TestProtos { } public ForeignMessage() { } + public ForeignMessage(ForeignMessage other) { - MergeFrom(other); + c_ = other.c_; } + + public ForeignMessage Clone() { + return new ForeignMessage(this); + } + public const int CFieldNumber = 1; private int c_; public int C { @@ -2114,7 +2204,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class TestReservedFields : pb::IMessage<TestReservedFields>, global::System.IEquatable<TestReservedFields> { + public sealed partial class TestReservedFields : pb::IMessage<TestReservedFields> { private static readonly pb::MessageParser<TestReservedFields> _parser = new pb::MessageParser<TestReservedFields>(() => new TestReservedFields()); public static pb::MessageParser<TestReservedFields> Parser { get { return _parser; } } @@ -2129,9 +2219,14 @@ namespace Google.Protobuf.TestProtos { } public TestReservedFields() { } + public TestReservedFields(TestReservedFields other) { - MergeFrom(other); } + + public TestReservedFields Clone() { + return new TestReservedFields(this); + } + public override bool Equals(object other) { return Equals(other as TestReservedFields); } @@ -2182,7 +2277,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class TestForeignNested : pb::IMessage<TestForeignNested>, global::System.IEquatable<TestForeignNested> { + public sealed partial class TestForeignNested : pb::IMessage<TestForeignNested> { private static readonly pb::MessageParser<TestForeignNested> _parser = new pb::MessageParser<TestForeignNested>(() => new TestForeignNested()); public static pb::MessageParser<TestForeignNested> Parser { get { return _parser; } } @@ -2197,9 +2292,15 @@ namespace Google.Protobuf.TestProtos { } public TestForeignNested() { } + public TestForeignNested(TestForeignNested other) { - MergeFrom(other); + ForeignNested = other.foreignNested_ != null ? other.ForeignNested.Clone() : null; + } + + public TestForeignNested Clone() { + return new TestForeignNested(this); } + public const int ForeignNestedFieldNumber = 1; private global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage foreignNested_; public global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage ForeignNested { @@ -2278,7 +2379,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class TestReallyLargeTagNumber : pb::IMessage<TestReallyLargeTagNumber>, global::System.IEquatable<TestReallyLargeTagNumber> { + public sealed partial class TestReallyLargeTagNumber : pb::IMessage<TestReallyLargeTagNumber> { private static readonly pb::MessageParser<TestReallyLargeTagNumber> _parser = new pb::MessageParser<TestReallyLargeTagNumber>(() => new TestReallyLargeTagNumber()); public static pb::MessageParser<TestReallyLargeTagNumber> Parser { get { return _parser; } } @@ -2293,9 +2394,16 @@ namespace Google.Protobuf.TestProtos { } public TestReallyLargeTagNumber() { } + public TestReallyLargeTagNumber(TestReallyLargeTagNumber other) { - MergeFrom(other); + a_ = other.a_; + bb_ = other.bb_; } + + public TestReallyLargeTagNumber Clone() { + return new TestReallyLargeTagNumber(this); + } + public const int AFieldNumber = 1; private int a_; public int A { @@ -2394,7 +2502,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class TestRecursiveMessage : pb::IMessage<TestRecursiveMessage>, global::System.IEquatable<TestRecursiveMessage> { + public sealed partial class TestRecursiveMessage : pb::IMessage<TestRecursiveMessage> { private static readonly pb::MessageParser<TestRecursiveMessage> _parser = new pb::MessageParser<TestRecursiveMessage>(() => new TestRecursiveMessage()); public static pb::MessageParser<TestRecursiveMessage> Parser { get { return _parser; } } @@ -2409,9 +2517,16 @@ namespace Google.Protobuf.TestProtos { } public TestRecursiveMessage() { } + public TestRecursiveMessage(TestRecursiveMessage other) { - MergeFrom(other); + A = other.a_ != null ? other.A.Clone() : null; + i_ = other.i_; + } + + public TestRecursiveMessage Clone() { + return new TestRecursiveMessage(this); } + public const int AFieldNumber = 1; private global::Google.Protobuf.TestProtos.TestRecursiveMessage a_; public global::Google.Protobuf.TestProtos.TestRecursiveMessage A { @@ -2514,7 +2629,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class TestMutualRecursionA : pb::IMessage<TestMutualRecursionA>, global::System.IEquatable<TestMutualRecursionA> { + public sealed partial class TestMutualRecursionA : pb::IMessage<TestMutualRecursionA> { private static readonly pb::MessageParser<TestMutualRecursionA> _parser = new pb::MessageParser<TestMutualRecursionA>(() => new TestMutualRecursionA()); public static pb::MessageParser<TestMutualRecursionA> Parser { get { return _parser; } } @@ -2529,9 +2644,15 @@ namespace Google.Protobuf.TestProtos { } public TestMutualRecursionA() { } + public TestMutualRecursionA(TestMutualRecursionA other) { - MergeFrom(other); + Bb = other.bb_ != null ? other.Bb.Clone() : null; } + + public TestMutualRecursionA Clone() { + return new TestMutualRecursionA(this); + } + public const int BbFieldNumber = 1; private global::Google.Protobuf.TestProtos.TestMutualRecursionB bb_; public global::Google.Protobuf.TestProtos.TestMutualRecursionB Bb { @@ -2610,7 +2731,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class TestMutualRecursionB : pb::IMessage<TestMutualRecursionB>, global::System.IEquatable<TestMutualRecursionB> { + public sealed partial class TestMutualRecursionB : pb::IMessage<TestMutualRecursionB> { private static readonly pb::MessageParser<TestMutualRecursionB> _parser = new pb::MessageParser<TestMutualRecursionB>(() => new TestMutualRecursionB()); public static pb::MessageParser<TestMutualRecursionB> Parser { get { return _parser; } } @@ -2625,9 +2746,16 @@ namespace Google.Protobuf.TestProtos { } public TestMutualRecursionB() { } + public TestMutualRecursionB(TestMutualRecursionB other) { - MergeFrom(other); + A = other.a_ != null ? other.A.Clone() : null; + optionalInt32_ = other.optionalInt32_; + } + + public TestMutualRecursionB Clone() { + return new TestMutualRecursionB(this); } + public const int AFieldNumber = 1; private global::Google.Protobuf.TestProtos.TestMutualRecursionA a_; public global::Google.Protobuf.TestProtos.TestMutualRecursionA A { @@ -2730,7 +2858,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class TestCamelCaseFieldNames : pb::IMessage<TestCamelCaseFieldNames>, global::System.IEquatable<TestCamelCaseFieldNames> { + public sealed partial class TestCamelCaseFieldNames : pb::IMessage<TestCamelCaseFieldNames> { private static readonly pb::MessageParser<TestCamelCaseFieldNames> _parser = new pb::MessageParser<TestCamelCaseFieldNames>(() => new TestCamelCaseFieldNames()); public static pb::MessageParser<TestCamelCaseFieldNames> Parser { get { return _parser; } } @@ -2745,9 +2873,22 @@ namespace Google.Protobuf.TestProtos { } public TestCamelCaseFieldNames() { } + public TestCamelCaseFieldNames(TestCamelCaseFieldNames other) { - MergeFrom(other); + primitiveField_ = other.primitiveField_; + stringField_ = other.stringField_; + enumField_ = other.enumField_; + MessageField = other.messageField_ != null ? other.MessageField.Clone() : null; + repeatedPrimitiveField_ = other.repeatedPrimitiveField_.Clone(); + repeatedStringField_ = other.repeatedStringField_.Clone(); + repeatedEnumField_ = other.repeatedEnumField_.Clone(); + repeatedMessageField_ = other.repeatedMessageField_.Clone(); + } + + public TestCamelCaseFieldNames Clone() { + return new TestCamelCaseFieldNames(this); } + public const int PrimitiveFieldFieldNumber = 1; private int primitiveField_; public int PrimitiveField { @@ -2996,7 +3137,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class TestFieldOrderings : pb::IMessage<TestFieldOrderings>, global::System.IEquatable<TestFieldOrderings> { + public sealed partial class TestFieldOrderings : pb::IMessage<TestFieldOrderings> { private static readonly pb::MessageParser<TestFieldOrderings> _parser = new pb::MessageParser<TestFieldOrderings>(() => new TestFieldOrderings()); public static pb::MessageParser<TestFieldOrderings> Parser { get { return _parser; } } @@ -3011,9 +3152,18 @@ namespace Google.Protobuf.TestProtos { } public TestFieldOrderings() { } + public TestFieldOrderings(TestFieldOrderings other) { - MergeFrom(other); + myString_ = other.myString_; + myInt_ = other.myInt_; + myFloat_ = other.myFloat_; + SingleNestedMessage = other.singleNestedMessage_ != null ? other.SingleNestedMessage.Clone() : null; } + + public TestFieldOrderings Clone() { + return new TestFieldOrderings(this); + } + public const int MyStringFieldNumber = 11; private string myString_ = ""; public string MyString { @@ -3165,7 +3315,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class Types { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class NestedMessage : pb::IMessage<NestedMessage>, global::System.IEquatable<NestedMessage> { + public sealed partial class NestedMessage : pb::IMessage<NestedMessage> { private static readonly pb::MessageParser<NestedMessage> _parser = new pb::MessageParser<NestedMessage>(() => new NestedMessage()); public static pb::MessageParser<NestedMessage> Parser { get { return _parser; } } @@ -3180,9 +3330,16 @@ namespace Google.Protobuf.TestProtos { } public NestedMessage() { } + public NestedMessage(NestedMessage other) { - MergeFrom(other); + oo_ = other.oo_; + bb_ = other.bb_; + } + + public NestedMessage Clone() { + return new NestedMessage(this); } + public const int OoFieldNumber = 2; private long oo_; public long Oo { @@ -3286,7 +3443,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class SparseEnumMessage : pb::IMessage<SparseEnumMessage>, global::System.IEquatable<SparseEnumMessage> { + public sealed partial class SparseEnumMessage : pb::IMessage<SparseEnumMessage> { private static readonly pb::MessageParser<SparseEnumMessage> _parser = new pb::MessageParser<SparseEnumMessage>(() => new SparseEnumMessage()); public static pb::MessageParser<SparseEnumMessage> Parser { get { return _parser; } } @@ -3301,9 +3458,15 @@ namespace Google.Protobuf.TestProtos { } public SparseEnumMessage() { } + public SparseEnumMessage(SparseEnumMessage other) { - MergeFrom(other); + sparseEnum_ = other.sparseEnum_; } + + public SparseEnumMessage Clone() { + return new SparseEnumMessage(this); + } + public const int SparseEnumFieldNumber = 1; private global::Google.Protobuf.TestProtos.TestSparseEnum sparseEnum_ = global::Google.Protobuf.TestProtos.TestSparseEnum.TEST_SPARSE_ENUM_UNSPECIFIED; public global::Google.Protobuf.TestProtos.TestSparseEnum SparseEnum { @@ -3378,7 +3541,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class OneString : pb::IMessage<OneString>, global::System.IEquatable<OneString> { + public sealed partial class OneString : pb::IMessage<OneString> { private static readonly pb::MessageParser<OneString> _parser = new pb::MessageParser<OneString>(() => new OneString()); public static pb::MessageParser<OneString> Parser { get { return _parser; } } @@ -3393,9 +3556,15 @@ namespace Google.Protobuf.TestProtos { } public OneString() { } + public OneString(OneString other) { - MergeFrom(other); + data_ = other.data_; + } + + public OneString Clone() { + return new OneString(this); } + public const int DataFieldNumber = 1; private string data_ = ""; public string Data { @@ -3470,7 +3639,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class MoreString : pb::IMessage<MoreString>, global::System.IEquatable<MoreString> { + public sealed partial class MoreString : pb::IMessage<MoreString> { private static readonly pb::MessageParser<MoreString> _parser = new pb::MessageParser<MoreString>(() => new MoreString()); public static pb::MessageParser<MoreString> Parser { get { return _parser; } } @@ -3485,9 +3654,15 @@ namespace Google.Protobuf.TestProtos { } public MoreString() { } + public MoreString(MoreString other) { - MergeFrom(other); + data_ = other.data_.Clone(); + } + + public MoreString Clone() { + return new MoreString(this); } + public const int DataFieldNumber = 1; private readonly pbc::RepeatedField<string> data_ = new pbc::RepeatedField<string>(); public pbc::RepeatedField<string> Data { @@ -3562,7 +3737,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class OneBytes : pb::IMessage<OneBytes>, global::System.IEquatable<OneBytes> { + public sealed partial class OneBytes : pb::IMessage<OneBytes> { private static readonly pb::MessageParser<OneBytes> _parser = new pb::MessageParser<OneBytes>(() => new OneBytes()); public static pb::MessageParser<OneBytes> Parser { get { return _parser; } } @@ -3577,9 +3752,15 @@ namespace Google.Protobuf.TestProtos { } public OneBytes() { } + public OneBytes(OneBytes other) { - MergeFrom(other); + data_ = other.data_; } + + public OneBytes Clone() { + return new OneBytes(this); + } + public const int DataFieldNumber = 1; private pb::ByteString data_ = pb::ByteString.Empty; public pb::ByteString Data { @@ -3654,7 +3835,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class MoreBytes : pb::IMessage<MoreBytes>, global::System.IEquatable<MoreBytes> { + public sealed partial class MoreBytes : pb::IMessage<MoreBytes> { private static readonly pb::MessageParser<MoreBytes> _parser = new pb::MessageParser<MoreBytes>(() => new MoreBytes()); public static pb::MessageParser<MoreBytes> Parser { get { return _parser; } } @@ -3669,9 +3850,15 @@ namespace Google.Protobuf.TestProtos { } public MoreBytes() { } + public MoreBytes(MoreBytes other) { - MergeFrom(other); + data_ = other.data_; + } + + public MoreBytes Clone() { + return new MoreBytes(this); } + public const int DataFieldNumber = 1; private pb::ByteString data_ = pb::ByteString.Empty; public pb::ByteString Data { @@ -3746,7 +3933,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class Int32Message : pb::IMessage<Int32Message>, global::System.IEquatable<Int32Message> { + public sealed partial class Int32Message : pb::IMessage<Int32Message> { private static readonly pb::MessageParser<Int32Message> _parser = new pb::MessageParser<Int32Message>(() => new Int32Message()); public static pb::MessageParser<Int32Message> Parser { get { return _parser; } } @@ -3761,9 +3948,15 @@ namespace Google.Protobuf.TestProtos { } public Int32Message() { } + public Int32Message(Int32Message other) { - MergeFrom(other); + data_ = other.data_; } + + public Int32Message Clone() { + return new Int32Message(this); + } + public const int DataFieldNumber = 1; private int data_; public int Data { @@ -3838,7 +4031,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class Uint32Message : pb::IMessage<Uint32Message>, global::System.IEquatable<Uint32Message> { + public sealed partial class Uint32Message : pb::IMessage<Uint32Message> { private static readonly pb::MessageParser<Uint32Message> _parser = new pb::MessageParser<Uint32Message>(() => new Uint32Message()); public static pb::MessageParser<Uint32Message> Parser { get { return _parser; } } @@ -3853,9 +4046,15 @@ namespace Google.Protobuf.TestProtos { } public Uint32Message() { } + public Uint32Message(Uint32Message other) { - MergeFrom(other); + data_ = other.data_; + } + + public Uint32Message Clone() { + return new Uint32Message(this); } + public const int DataFieldNumber = 1; private uint data_; public uint Data { @@ -3930,7 +4129,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class Int64Message : pb::IMessage<Int64Message>, global::System.IEquatable<Int64Message> { + public sealed partial class Int64Message : pb::IMessage<Int64Message> { private static readonly pb::MessageParser<Int64Message> _parser = new pb::MessageParser<Int64Message>(() => new Int64Message()); public static pb::MessageParser<Int64Message> Parser { get { return _parser; } } @@ -3945,9 +4144,15 @@ namespace Google.Protobuf.TestProtos { } public Int64Message() { } + public Int64Message(Int64Message other) { - MergeFrom(other); + data_ = other.data_; + } + + public Int64Message Clone() { + return new Int64Message(this); } + public const int DataFieldNumber = 1; private long data_; public long Data { @@ -4022,7 +4227,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class Uint64Message : pb::IMessage<Uint64Message>, global::System.IEquatable<Uint64Message> { + public sealed partial class Uint64Message : pb::IMessage<Uint64Message> { private static readonly pb::MessageParser<Uint64Message> _parser = new pb::MessageParser<Uint64Message>(() => new Uint64Message()); public static pb::MessageParser<Uint64Message> Parser { get { return _parser; } } @@ -4037,9 +4242,15 @@ namespace Google.Protobuf.TestProtos { } public Uint64Message() { } + public Uint64Message(Uint64Message other) { - MergeFrom(other); + data_ = other.data_; } + + public Uint64Message Clone() { + return new Uint64Message(this); + } + public const int DataFieldNumber = 1; private ulong data_; public ulong Data { @@ -4114,7 +4325,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class BoolMessage : pb::IMessage<BoolMessage>, global::System.IEquatable<BoolMessage> { + public sealed partial class BoolMessage : pb::IMessage<BoolMessage> { private static readonly pb::MessageParser<BoolMessage> _parser = new pb::MessageParser<BoolMessage>(() => new BoolMessage()); public static pb::MessageParser<BoolMessage> Parser { get { return _parser; } } @@ -4129,9 +4340,15 @@ namespace Google.Protobuf.TestProtos { } public BoolMessage() { } + public BoolMessage(BoolMessage other) { - MergeFrom(other); + data_ = other.data_; + } + + public BoolMessage Clone() { + return new BoolMessage(this); } + public const int DataFieldNumber = 1; private bool data_; public bool Data { @@ -4206,7 +4423,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class TestOneof : pb::IMessage<TestOneof>, global::System.IEquatable<TestOneof> { + public sealed partial class TestOneof : pb::IMessage<TestOneof> { private static readonly pb::MessageParser<TestOneof> _parser = new pb::MessageParser<TestOneof>(() => new TestOneof()); public static pb::MessageParser<TestOneof> Parser { get { return _parser; } } @@ -4221,9 +4438,26 @@ namespace Google.Protobuf.TestProtos { } public TestOneof() { } + public TestOneof(TestOneof other) { - MergeFrom(other); + switch (other.FooCase) { + case FooOneofCase.FooInt: + FooInt = other.FooInt; + break; + case FooOneofCase.FooString: + FooString = other.FooString; + break; + case FooOneofCase.FooMessage: + FooMessage = other.FooMessage.Clone(); + break; + } + + } + + public TestOneof Clone() { + return new TestOneof(this); } + public const int FooIntFieldNumber = 1; public int FooInt { get { return fooCase_ == FooOneofCase.FooInt ? (int) foo_ : 0; } @@ -4373,7 +4607,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class TestPackedTypes : pb::IMessage<TestPackedTypes>, global::System.IEquatable<TestPackedTypes> { + public sealed partial class TestPackedTypes : pb::IMessage<TestPackedTypes> { private static readonly pb::MessageParser<TestPackedTypes> _parser = new pb::MessageParser<TestPackedTypes>(() => new TestPackedTypes()); public static pb::MessageParser<TestPackedTypes> Parser { get { return _parser; } } @@ -4388,9 +4622,28 @@ namespace Google.Protobuf.TestProtos { } public TestPackedTypes() { } + public TestPackedTypes(TestPackedTypes other) { - MergeFrom(other); + packedInt32_ = other.packedInt32_.Clone(); + packedInt64_ = other.packedInt64_.Clone(); + packedUint32_ = other.packedUint32_.Clone(); + packedUint64_ = other.packedUint64_.Clone(); + packedSint32_ = other.packedSint32_.Clone(); + packedSint64_ = other.packedSint64_.Clone(); + packedFixed32_ = other.packedFixed32_.Clone(); + packedFixed64_ = other.packedFixed64_.Clone(); + packedSfixed32_ = other.packedSfixed32_.Clone(); + packedSfixed64_ = other.packedSfixed64_.Clone(); + packedFloat_ = other.packedFloat_.Clone(); + packedDouble_ = other.packedDouble_.Clone(); + packedBool_ = other.packedBool_.Clone(); + packedEnum_ = other.packedEnum_.Clone(); + } + + public TestPackedTypes Clone() { + return new TestPackedTypes(this); } + public const int PackedInt32FieldNumber = 90; private readonly pbc::RepeatedField<int> packedInt32_ = new pbc::RepeatedField<int>(); public pbc::RepeatedField<int> PackedInt32 { @@ -4791,7 +5044,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class TestUnpackedTypes : pb::IMessage<TestUnpackedTypes>, global::System.IEquatable<TestUnpackedTypes> { + public sealed partial class TestUnpackedTypes : pb::IMessage<TestUnpackedTypes> { private static readonly pb::MessageParser<TestUnpackedTypes> _parser = new pb::MessageParser<TestUnpackedTypes>(() => new TestUnpackedTypes()); public static pb::MessageParser<TestUnpackedTypes> Parser { get { return _parser; } } @@ -4806,9 +5059,28 @@ namespace Google.Protobuf.TestProtos { } public TestUnpackedTypes() { } + public TestUnpackedTypes(TestUnpackedTypes other) { - MergeFrom(other); + unpackedInt32_ = other.unpackedInt32_.Clone(); + unpackedInt64_ = other.unpackedInt64_.Clone(); + unpackedUint32_ = other.unpackedUint32_.Clone(); + unpackedUint64_ = other.unpackedUint64_.Clone(); + unpackedSint32_ = other.unpackedSint32_.Clone(); + unpackedSint64_ = other.unpackedSint64_.Clone(); + unpackedFixed32_ = other.unpackedFixed32_.Clone(); + unpackedFixed64_ = other.unpackedFixed64_.Clone(); + unpackedSfixed32_ = other.unpackedSfixed32_.Clone(); + unpackedSfixed64_ = other.unpackedSfixed64_.Clone(); + unpackedFloat_ = other.unpackedFloat_.Clone(); + unpackedDouble_ = other.unpackedDouble_.Clone(); + unpackedBool_ = other.unpackedBool_.Clone(); + unpackedEnum_ = other.unpackedEnum_.Clone(); + } + + public TestUnpackedTypes Clone() { + return new TestUnpackedTypes(this); } + public const int UnpackedInt32FieldNumber = 90; private readonly pbc::RepeatedField<int> unpackedInt32_ = new pbc::RepeatedField<int>(); public pbc::RepeatedField<int> UnpackedInt32 { @@ -5195,7 +5467,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class TestRepeatedScalarDifferentTagSizes : pb::IMessage<TestRepeatedScalarDifferentTagSizes>, global::System.IEquatable<TestRepeatedScalarDifferentTagSizes> { + public sealed partial class TestRepeatedScalarDifferentTagSizes : pb::IMessage<TestRepeatedScalarDifferentTagSizes> { private static readonly pb::MessageParser<TestRepeatedScalarDifferentTagSizes> _parser = new pb::MessageParser<TestRepeatedScalarDifferentTagSizes>(() => new TestRepeatedScalarDifferentTagSizes()); public static pb::MessageParser<TestRepeatedScalarDifferentTagSizes> Parser { get { return _parser; } } @@ -5210,9 +5482,20 @@ namespace Google.Protobuf.TestProtos { } public TestRepeatedScalarDifferentTagSizes() { } + public TestRepeatedScalarDifferentTagSizes(TestRepeatedScalarDifferentTagSizes other) { - MergeFrom(other); + repeatedFixed32_ = other.repeatedFixed32_.Clone(); + repeatedInt32_ = other.repeatedInt32_.Clone(); + repeatedFixed64_ = other.repeatedFixed64_.Clone(); + repeatedInt64_ = other.repeatedInt64_.Clone(); + repeatedFloat_ = other.repeatedFloat_.Clone(); + repeatedUint64_ = other.repeatedUint64_.Clone(); + } + + public TestRepeatedScalarDifferentTagSizes Clone() { + return new TestRepeatedScalarDifferentTagSizes(this); } + public const int RepeatedFixed32FieldNumber = 12; private readonly pbc::RepeatedField<uint> repeatedFixed32_ = new pbc::RepeatedField<uint>(); public pbc::RepeatedField<uint> RepeatedFixed32 { @@ -5413,7 +5696,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class TestCommentInjectionMessage : pb::IMessage<TestCommentInjectionMessage>, global::System.IEquatable<TestCommentInjectionMessage> { + public sealed partial class TestCommentInjectionMessage : pb::IMessage<TestCommentInjectionMessage> { private static readonly pb::MessageParser<TestCommentInjectionMessage> _parser = new pb::MessageParser<TestCommentInjectionMessage>(() => new TestCommentInjectionMessage()); public static pb::MessageParser<TestCommentInjectionMessage> Parser { get { return _parser; } } @@ -5428,9 +5711,15 @@ namespace Google.Protobuf.TestProtos { } public TestCommentInjectionMessage() { } + public TestCommentInjectionMessage(TestCommentInjectionMessage other) { - MergeFrom(other); + a_ = other.a_; + } + + public TestCommentInjectionMessage Clone() { + return new TestCommentInjectionMessage(this); } + public const int AFieldNumber = 1; private string a_ = ""; public string A { @@ -5505,7 +5794,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class FooRequest : pb::IMessage<FooRequest>, global::System.IEquatable<FooRequest> { + public sealed partial class FooRequest : pb::IMessage<FooRequest> { private static readonly pb::MessageParser<FooRequest> _parser = new pb::MessageParser<FooRequest>(() => new FooRequest()); public static pb::MessageParser<FooRequest> Parser { get { return _parser; } } @@ -5520,9 +5809,14 @@ namespace Google.Protobuf.TestProtos { } public FooRequest() { } + public FooRequest(FooRequest other) { - MergeFrom(other); } + + public FooRequest Clone() { + return new FooRequest(this); + } + public override bool Equals(object other) { return Equals(other as FooRequest); } @@ -5573,7 +5867,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class FooResponse : pb::IMessage<FooResponse>, global::System.IEquatable<FooResponse> { + public sealed partial class FooResponse : pb::IMessage<FooResponse> { private static readonly pb::MessageParser<FooResponse> _parser = new pb::MessageParser<FooResponse>(() => new FooResponse()); public static pb::MessageParser<FooResponse> Parser { get { return _parser; } } @@ -5588,9 +5882,14 @@ namespace Google.Protobuf.TestProtos { } public FooResponse() { } + public FooResponse(FooResponse other) { - MergeFrom(other); } + + public FooResponse Clone() { + return new FooResponse(this); + } + public override bool Equals(object other) { return Equals(other as FooResponse); } @@ -5641,7 +5940,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class FooClientMessage : pb::IMessage<FooClientMessage>, global::System.IEquatable<FooClientMessage> { + public sealed partial class FooClientMessage : pb::IMessage<FooClientMessage> { private static readonly pb::MessageParser<FooClientMessage> _parser = new pb::MessageParser<FooClientMessage>(() => new FooClientMessage()); public static pb::MessageParser<FooClientMessage> Parser { get { return _parser; } } @@ -5656,9 +5955,14 @@ namespace Google.Protobuf.TestProtos { } public FooClientMessage() { } + public FooClientMessage(FooClientMessage other) { - MergeFrom(other); } + + public FooClientMessage Clone() { + return new FooClientMessage(this); + } + public override bool Equals(object other) { return Equals(other as FooClientMessage); } @@ -5709,7 +6013,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class FooServerMessage : pb::IMessage<FooServerMessage>, global::System.IEquatable<FooServerMessage> { + public sealed partial class FooServerMessage : pb::IMessage<FooServerMessage> { private static readonly pb::MessageParser<FooServerMessage> _parser = new pb::MessageParser<FooServerMessage>(() => new FooServerMessage()); public static pb::MessageParser<FooServerMessage> Parser { get { return _parser; } } @@ -5724,9 +6028,14 @@ namespace Google.Protobuf.TestProtos { } public FooServerMessage() { } + public FooServerMessage(FooServerMessage other) { - MergeFrom(other); } + + public FooServerMessage Clone() { + return new FooServerMessage(this); + } + public override bool Equals(object other) { return Equals(other as FooServerMessage); } @@ -5777,7 +6086,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class BarRequest : pb::IMessage<BarRequest>, global::System.IEquatable<BarRequest> { + public sealed partial class BarRequest : pb::IMessage<BarRequest> { private static readonly pb::MessageParser<BarRequest> _parser = new pb::MessageParser<BarRequest>(() => new BarRequest()); public static pb::MessageParser<BarRequest> Parser { get { return _parser; } } @@ -5792,9 +6101,14 @@ namespace Google.Protobuf.TestProtos { } public BarRequest() { } + public BarRequest(BarRequest other) { - MergeFrom(other); } + + public BarRequest Clone() { + return new BarRequest(this); + } + public override bool Equals(object other) { return Equals(other as BarRequest); } @@ -5845,7 +6159,7 @@ namespace Google.Protobuf.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class BarResponse : pb::IMessage<BarResponse>, global::System.IEquatable<BarResponse> { + public sealed partial class BarResponse : pb::IMessage<BarResponse> { private static readonly pb::MessageParser<BarResponse> _parser = new pb::MessageParser<BarResponse>(() => new BarResponse()); public static pb::MessageParser<BarResponse> Parser { get { return _parser; } } @@ -5860,9 +6174,14 @@ namespace Google.Protobuf.TestProtos { } public BarResponse() { } + public BarResponse(BarResponse other) { - MergeFrom(other); } + + public BarResponse Clone() { + return new BarResponse(this); + } + public override bool Equals(object other) { return Equals(other as BarResponse); } |