diff options
author | Jon Skeet <skeet@pobox.com> | 2015-06-12 09:53:12 +0100 |
---|---|---|
committer | Jon Skeet <skeet@pobox.com> | 2015-06-12 09:53:12 +0100 |
commit | 96ddf01aed1a49d73a7fda50e28c431ffc977e5a (patch) | |
tree | 4f603245ff514486481f126ca8d81deeff572534 /csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportPublicProto3.cs | |
parent | 39aaf21d5194fdc07c296847def8e7795279e041 (diff) | |
download | protobuf-96ddf01aed1a49d73a7fda50e28c431ffc977e5a.tar.gz protobuf-96ddf01aed1a49d73a7fda50e28c431ffc977e5a.tar.bz2 protobuf-96ddf01aed1a49d73a7fda50e28c431ffc977e5a.zip |
Coded*Stream streamlining.
Remove ICodedInputStream and ICodedOutputStream, and rewrite CodedInputStream and CodedOutputStream to be specific to the binary format. If we want to support text-based formats, that can be a whole different serialization mechanism.
Diffstat (limited to 'csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportPublicProto3.cs')
-rw-r--r-- | csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportPublicProto3.cs | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportPublicProto3.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportPublicProto3.cs index 2f7f8699..32123d53 100644 --- a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportPublicProto3.cs +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportPublicProto3.cs @@ -92,10 +92,9 @@ namespace Google.Protobuf.TestProtos { return hash; } - public void WriteTo(pb::ICodedOutputStream output) { - string[] fieldNames = _fieldNames; + public void WriteTo(pb::CodedOutputStream output) { if (E != 0) { - output.WriteInt32(1, fieldNames[0], E); + output.WriteInt32(1, E); } } @@ -115,16 +114,9 @@ namespace Google.Protobuf.TestProtos { } } - public void MergeFrom(pb::ICodedInputStream input) { + public void MergeFrom(pb::CodedInputStream input) { uint tag; - string fieldName; - while (input.ReadTag(out tag, out fieldName)) { - if (tag == 0 && fieldName != null) { - int fieldOrdinal = global::System.Array.BinarySearch(_fieldNames, fieldName, global::System.StringComparer.Ordinal); - if (fieldOrdinal >= 0) { - tag = _fieldTags[fieldOrdinal]; - } - } + while (input.ReadTag(out tag)) { switch(tag) { case 0: throw pb::InvalidProtocolBufferException.InvalidTag(); @@ -134,7 +126,7 @@ namespace Google.Protobuf.TestProtos { } break; case 8: { - input.ReadInt32(ref e_); + e_ = input.ReadInt32(); break; } } |