diff --git a/csharp/src/AddressBook/Addressbook.cs b/csharp/src/AddressBook/Addressbook.cs index 5f4a5139e4..b7a08ef042 100644 --- a/csharp/src/AddressBook/Addressbook.cs +++ b/csharp/src/AddressBook/Addressbook.cs @@ -160,6 +160,10 @@ namespace Google.Protobuf.Examples.AddressBook { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Name.Length != 0) { output.WriteRawTag(10); @@ -330,6 +334,10 @@ namespace Google.Protobuf.Examples.AddressBook { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Number.Length != 0) { output.WriteRawTag(10); @@ -463,6 +471,10 @@ namespace Google.Protobuf.Examples.AddressBook { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { person_.WriteTo(output, _repeated_person_codec); } diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/MapUnittestProto3.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/MapUnittestProto3.cs index 55434c534a..0e261e1b77 100644 --- a/csharp/src/ProtocolBuffers.Test/TestProtos/MapUnittestProto3.cs +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/MapUnittestProto3.cs @@ -602,6 +602,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { mapInt32Int32_.WriteTo(output, _map_mapInt32Int32_codec); mapInt64Int64_.WriteTo(output, _map_mapInt64Int64_codec); @@ -836,6 +840,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0) { output.WriteRawTag(8); @@ -978,6 +986,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0L) { output.WriteRawTag(8); @@ -1120,6 +1132,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0) { output.WriteRawTag(8); @@ -1262,6 +1278,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0UL) { output.WriteRawTag(8); @@ -1404,6 +1424,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0) { output.WriteRawTag(8); @@ -1546,6 +1570,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0L) { output.WriteRawTag(8); @@ -1688,6 +1716,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0) { output.WriteRawTag(13); @@ -1830,6 +1862,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0UL) { output.WriteRawTag(9); @@ -1972,6 +2008,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0) { output.WriteRawTag(13); @@ -2114,6 +2154,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0L) { output.WriteRawTag(9); @@ -2256,6 +2300,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0) { output.WriteRawTag(8); @@ -2398,6 +2446,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0) { output.WriteRawTag(8); @@ -2540,6 +2592,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != false) { output.WriteRawTag(8); @@ -2682,6 +2738,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key.Length != 0) { output.WriteRawTag(10); @@ -2824,6 +2884,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0) { output.WriteRawTag(8); @@ -2966,6 +3030,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0) { output.WriteRawTag(8); @@ -3109,6 +3177,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0) { output.WriteRawTag(8); @@ -3250,6 +3322,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (testMap_ != null) { output.WriteRawTag(10); @@ -3370,6 +3446,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { mapInt32Message_.WriteTo(output, _map_mapInt32Message_codec); } @@ -3493,6 +3573,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0) { output.WriteRawTag(8); @@ -3644,6 +3728,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { map1_.WriteTo(output, _map_map1_codec); map2_.WriteTo(output, _map_map2_codec); @@ -3773,6 +3861,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0) { output.WriteRawTag(8); @@ -3915,6 +4007,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0) { output.WriteRawTag(8); @@ -4216,6 +4312,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { mapInt32Int32_.WriteTo(output, _map_mapInt32Int32_codec); mapInt64Int64_.WriteTo(output, _map_mapInt64Int64_codec); @@ -4436,6 +4536,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0) { output.WriteRawTag(8); @@ -4578,6 +4682,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0L) { output.WriteRawTag(8); @@ -4720,6 +4828,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0) { output.WriteRawTag(8); @@ -4862,6 +4974,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0UL) { output.WriteRawTag(8); @@ -5004,6 +5120,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0) { output.WriteRawTag(8); @@ -5146,6 +5266,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0L) { output.WriteRawTag(8); @@ -5288,6 +5412,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0) { output.WriteRawTag(13); @@ -5430,6 +5558,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0UL) { output.WriteRawTag(9); @@ -5572,6 +5704,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0) { output.WriteRawTag(13); @@ -5714,6 +5850,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0L) { output.WriteRawTag(9); @@ -5856,6 +5996,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0) { output.WriteRawTag(8); @@ -5998,6 +6142,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0) { output.WriteRawTag(8); @@ -6140,6 +6288,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != false) { output.WriteRawTag(8); @@ -6282,6 +6434,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0) { output.WriteRawTag(8); @@ -6425,6 +6581,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0) { output.WriteRawTag(8); @@ -6564,6 +6724,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { type_.WriteTo(output, _map_type_codec); } @@ -6691,6 +6855,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0) { output.WriteRawTag(8); @@ -6830,6 +6998,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { entry_.WriteTo(output, _map_entry_codec); } @@ -6952,6 +7124,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Key != 0) { output.WriteRawTag(8); diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportProto3.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportProto3.cs index d30f22db6e..14c844feae 100644 --- a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportProto3.cs +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportProto3.cs @@ -124,6 +124,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (D != 0) { output.WriteRawTag(8); diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportPublicProto3.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportPublicProto3.cs index 5aa03a641a..b8c62bc9a9 100644 --- a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportPublicProto3.cs +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportPublicProto3.cs @@ -109,6 +109,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (E != 0) { output.WriteRawTag(8); diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestIssues.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestIssues.cs index 0e409c8b72..59c551dc1b 100644 --- a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestIssues.cs +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestIssues.cs @@ -148,6 +148,10 @@ namespace UnitTest.Issues.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { } @@ -237,6 +241,10 @@ namespace UnitTest.Issues.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { } @@ -326,6 +334,10 @@ namespace UnitTest.Issues.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { } @@ -459,6 +471,10 @@ namespace UnitTest.Issues.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Value != global::UnitTest.Issues.TestProtos.NegativeEnum.NEGATIVE_ENUM_ZERO) { output.WriteRawTag(8); @@ -577,6 +593,10 @@ namespace UnitTest.Issues.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { } @@ -746,6 +766,10 @@ namespace UnitTest.Issues.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (PrimitiveValue != 0) { output.WriteRawTag(8); @@ -918,6 +942,10 @@ namespace UnitTest.Issues.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Item != 0) { output.WriteRawTag(8); diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestProto3.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestProto3.cs index d2437bf4b7..0e63e1d6f9 100644 --- a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestProto3.cs +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestProto3.cs @@ -1019,6 +1019,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (SingleInt32 != 0) { output.WriteRawTag(8); @@ -1695,6 +1699,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Bb != 0) { output.WriteRawTag(8); @@ -1842,6 +1850,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (child_ != null) { output.WriteRawTag(10); @@ -1991,6 +2003,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (DeprecatedInt32 != 0) { output.WriteRawTag(8); @@ -2106,6 +2122,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (C != 0) { output.WriteRawTag(8); @@ -2208,6 +2228,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { } @@ -2310,6 +2334,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (foreignNested_ != null) { output.WriteRawTag(10); @@ -2444,6 +2472,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (A != 0) { output.WriteRawTag(8); @@ -2587,6 +2619,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (a_ != null) { output.WriteRawTag(10); @@ -2723,6 +2759,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (bb_ != null) { output.WriteRawTag(10); @@ -2858,6 +2898,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (a_ != null) { output.WriteRawTag(10); @@ -3080,6 +3124,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (PrimitiveField != 0) { output.WriteRawTag(8); @@ -3313,6 +3361,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (MyInt != 0L) { output.WriteRawTag(8); @@ -3490,6 +3542,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Bb != 0) { output.WriteRawTag(8); @@ -3624,6 +3680,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (SparseEnum != global::Google.Protobuf.TestProtos.TestSparseEnum.TEST_SPARSE_ENUM_UNSPECIFIED) { output.WriteRawTag(8); @@ -3739,6 +3799,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Data.Length != 0) { output.WriteRawTag(10); @@ -3853,6 +3917,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { data_.WriteTo(output, _repeated_data_codec); } @@ -3961,6 +4029,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Data.Length != 0) { output.WriteRawTag(10); @@ -4076,6 +4148,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Data.Length != 0) { output.WriteRawTag(10); @@ -4191,6 +4267,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Data != 0) { output.WriteRawTag(8); @@ -4306,6 +4386,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Data != 0) { output.WriteRawTag(8); @@ -4421,6 +4505,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Data != 0L) { output.WriteRawTag(8); @@ -4536,6 +4624,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Data != 0UL) { output.WriteRawTag(8); @@ -4651,6 +4743,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Data != false) { output.WriteRawTag(8); @@ -4820,6 +4916,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (fooCase_ == FooOneofCase.FooInt) { output.WriteRawTag(8); @@ -5125,6 +5225,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { packedInt32_.WriteTo(output, _repeated_packedInt32_codec); packedInt64_.WriteTo(output, _repeated_packedInt64_codec); @@ -5492,6 +5596,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { unpackedInt32_.WriteTo(output, _repeated_unpackedInt32_codec); unpackedInt64_.WriteTo(output, _repeated_unpackedInt64_codec); @@ -5764,6 +5872,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { repeatedFixed32_.WriteTo(output, _repeated_repeatedFixed32_codec); repeatedInt32_.WriteTo(output, _repeated_repeatedInt32_codec); @@ -5913,6 +6025,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (A.Length != 0) { output.WriteRawTag(10); @@ -6015,6 +6131,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { } @@ -6103,6 +6223,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { } @@ -6191,6 +6315,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { } @@ -6279,6 +6407,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { } @@ -6367,6 +6499,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { } @@ -6455,6 +6591,10 @@ namespace Google.Protobuf.TestProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { } diff --git a/csharp/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs b/csharp/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs index c87b367a32..a7d1d72628 100644 --- a/csharp/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs +++ b/csharp/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs @@ -299,6 +299,10 @@ namespace Google.Protobuf.DescriptorProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { file_.WriteTo(output, _repeated_file_codec); } @@ -545,6 +549,10 @@ namespace Google.Protobuf.DescriptorProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Name.Length != 0) { output.WriteRawTag(10); @@ -889,6 +897,10 @@ namespace Google.Protobuf.DescriptorProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Name.Length != 0) { output.WriteRawTag(10); @@ -1094,6 +1106,10 @@ namespace Google.Protobuf.DescriptorProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Start != 0) { output.WriteRawTag(8); @@ -1236,6 +1252,10 @@ namespace Google.Protobuf.DescriptorProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Start != 0) { output.WriteRawTag(8); @@ -1475,6 +1495,10 @@ namespace Google.Protobuf.DescriptorProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Name.Length != 0) { output.WriteRawTag(10); @@ -1741,6 +1765,10 @@ namespace Google.Protobuf.DescriptorProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Name.Length != 0) { output.WriteRawTag(10); @@ -1882,6 +1910,10 @@ namespace Google.Protobuf.DescriptorProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Name.Length != 0) { output.WriteRawTag(10); @@ -2051,6 +2083,10 @@ namespace Google.Protobuf.DescriptorProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Name.Length != 0) { output.WriteRawTag(10); @@ -2226,6 +2262,10 @@ namespace Google.Protobuf.DescriptorProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Name.Length != 0) { output.WriteRawTag(10); @@ -2434,6 +2474,10 @@ namespace Google.Protobuf.DescriptorProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Name.Length != 0) { output.WriteRawTag(10); @@ -2806,6 +2850,10 @@ namespace Google.Protobuf.DescriptorProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (JavaPackage.Length != 0) { output.WriteRawTag(10); @@ -3173,6 +3221,10 @@ namespace Google.Protobuf.DescriptorProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (MessageSetWireFormat != false) { output.WriteRawTag(8); @@ -3414,6 +3466,10 @@ namespace Google.Protobuf.DescriptorProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Ctype != global::Google.Protobuf.DescriptorProtos.FieldOptions.Types.CType.STRING) { output.WriteRawTag(8); @@ -3649,6 +3705,10 @@ namespace Google.Protobuf.DescriptorProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (AllowAlias != false) { output.WriteRawTag(16); @@ -3797,6 +3857,10 @@ namespace Google.Protobuf.DescriptorProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Deprecated != false) { output.WriteRawTag(8); @@ -3931,6 +3995,10 @@ namespace Google.Protobuf.DescriptorProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Deprecated != false) { output.WriteRawTag(136, 2); @@ -4065,6 +4133,10 @@ namespace Google.Protobuf.DescriptorProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (Deprecated != false) { output.WriteRawTag(136, 2); @@ -4264,6 +4336,10 @@ namespace Google.Protobuf.DescriptorProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { name_.WriteTo(output, _repeated_name_codec); if (IdentifierValue.Length != 0) { @@ -4470,6 +4546,10 @@ namespace Google.Protobuf.DescriptorProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { if (NamePart_.Length != 0) { output.WriteRawTag(10); @@ -4603,6 +4683,10 @@ namespace Google.Protobuf.DescriptorProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { location_.WriteTo(output, _repeated_location_codec); } @@ -4761,6 +4845,10 @@ namespace Google.Protobuf.DescriptorProtos { return hash; } + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + public void WriteTo(pb::CodedOutputStream output) { path_.WriteTo(output, _repeated_path_codec); span_.WriteTo(output, _repeated_span_codec); diff --git a/src/google/protobuf/compiler/csharp/csharp_field_base.h b/src/google/protobuf/compiler/csharp/csharp_field_base.h index 349d835bac..bffa206239 100644 --- a/src/google/protobuf/compiler/csharp/csharp_field_base.h +++ b/src/google/protobuf/compiler/csharp/csharp_field_base.h @@ -58,6 +58,7 @@ class FieldGeneratorBase : public SourceGeneratorBase { virtual void WriteHash(io::Printer* printer) = 0; virtual void WriteEquals(io::Printer* printer) = 0; + // Currently unused, as we use reflection to generate JSON virtual void WriteToString(io::Printer* printer) = 0; protected: diff --git a/src/google/protobuf/compiler/csharp/csharp_map_field.cc b/src/google/protobuf/compiler/csharp/csharp_map_field.cc index cb7ce5f006..32c05232c4 100644 --- a/src/google/protobuf/compiler/csharp/csharp_map_field.cc +++ b/src/google/protobuf/compiler/csharp/csharp_map_field.cc @@ -117,12 +117,9 @@ void MapFieldGenerator::WriteEquals(io::Printer* printer) { variables_, "if (!$property_name$.Equals(other.$property_name$)) return false;\n"); } + void MapFieldGenerator::WriteToString(io::Printer* printer) { - /* - variables_["field_name"] = GetFieldName(descriptor_); - printer->Print( - variables_, - "PrintField(\"$field_name$\", has$property_name$, $name$_, writer);\n");*/ + // TODO: If we ever actually use ToString, we'll need to impleme this... } void MapFieldGenerator::GenerateCloningCode(io::Printer* printer) { diff --git a/src/google/protobuf/compiler/csharp/csharp_message.cc b/src/google/protobuf/compiler/csharp/csharp_message.cc index 13544b2681..ac13595178 100644 --- a/src/google/protobuf/compiler/csharp/csharp_message.cc +++ b/src/google/protobuf/compiler/csharp/csharp_message.cc @@ -429,7 +429,10 @@ void MessageGenerator::GenerateFrameworkMethods(io::Printer* printer) { printer->Outdent(); printer->Print("}\n\n"); - // TODO(jonskeet): ToString. + printer->Print( + "public override string ToString() {\n" + " return pb::JsonFormatter.Default.Format(this);\n" + "}\n\n"); } void MessageGenerator::GenerateMessageSerializationMethods(io::Printer* printer) {