aboutsummaryrefslogtreecommitdiff
path: root/csharp/src/ProtocolBuffers/ICodedInputStream.cs
diff options
context:
space:
mode:
authorJon Skeet <skeet@pobox.com>2015-06-09 19:30:44 +0100
committerJon Skeet <skeet@pobox.com>2015-06-09 19:30:44 +0100
commite38294a62d7f37c0661273a9a26fda16d557423f (patch)
tree316989251907553408e7b32a12792f496333e075 /csharp/src/ProtocolBuffers/ICodedInputStream.cs
parentf52426827e4d5e8da7d205af538799740b5199b9 (diff)
downloadprotobuf-e38294a62d7f37c0661273a9a26fda16d557423f.tar.gz
protobuf-e38294a62d7f37c0661273a9a26fda16d557423f.tar.bz2
protobuf-e38294a62d7f37c0661273a9a26fda16d557423f.zip
First pass at the mutable API. Quite a bit more to do - in particular, it's pretty slow right now.
Diffstat (limited to 'csharp/src/ProtocolBuffers/ICodedInputStream.cs')
-rw-r--r--csharp/src/ProtocolBuffers/ICodedInputStream.cs50
1 files changed, 14 insertions, 36 deletions
diff --git a/csharp/src/ProtocolBuffers/ICodedInputStream.cs b/csharp/src/ProtocolBuffers/ICodedInputStream.cs
index 790274fb..748589a0 100644
--- a/csharp/src/ProtocolBuffers/ICodedInputStream.cs
+++ b/csharp/src/ProtocolBuffers/ICodedInputStream.cs
@@ -36,12 +36,12 @@
using System;
using System.Collections.Generic;
-using Google.ProtocolBuffers.Descriptors;
+using Google.Protobuf.Descriptors;
//Disable warning CS3010: CLS-compliant interfaces must have only CLS-compliant members
#pragma warning disable 3010
-namespace Google.ProtocolBuffers
+namespace Google.Protobuf
{
public interface ICodedInputStream
{
@@ -128,20 +128,12 @@ namespace Google.ProtocolBuffers
/// <summary>
/// Reads a group field value from the stream.
/// </summary>
- void ReadGroup(int fieldNumber, IBuilderLite builder,
- ExtensionRegistry extensionRegistry);
-
- /// <summary>
- /// Reads a group field value from the stream and merges it into the given
- /// UnknownFieldSet.
- /// </summary>
- [Obsolete]
- void ReadUnknownGroup(int fieldNumber, IBuilderLite builder);
+ void ReadGroup(int fieldNumber, IMessage message);
/// <summary>
/// Reads an embedded message field value from the stream.
/// </summary>
- void ReadMessage(IBuilderLite builder, ExtensionRegistry extensionRegistry);
+ void ReadMessage(IMessage message);
/// <summary>
/// Reads a bytes field value from the stream.
@@ -154,17 +146,13 @@ namespace Google.ProtocolBuffers
bool ReadUInt32(ref uint value);
/// <summary>
- /// Reads an enum field value from the stream. The caller is responsible
- /// for converting the numeric value to an actual enum.
- /// </summary>
- bool ReadEnum(ref IEnumLite value, out object unknown, IEnumLiteMap mapping);
-
- /// <summary>
/// Reads an enum field value from the stream. If the enum is valid for type T,
- /// then the ref value is set and it returns true. Otherwise the unkown output
- /// value is set and this method returns false.
+ /// then the ref value is set and it returns true. Otherwise, if a value is present
+ /// but invalid for the proto enum, it is still set in the field as a "preserved
+ /// but invalid" value, and the method returns true. If no value can be read, the
+ /// method does not affect the parameter and returns false.
/// </summary>
- bool ReadEnum<T>(ref T value, out object unknown)
+ bool ReadEnum<T>(ref T value)
where T : struct, IComparable, IFormattable;
/// <summary>
@@ -197,28 +185,18 @@ namespace Google.ProtocolBuffers
/// Reads an array of primitive values into the list, if the wire-type of fieldTag is length-prefixed, it will
/// read a packed array.
/// </summary>
- void ReadEnumArray(uint fieldTag, string fieldName, ICollection<IEnumLite> list, out ICollection<object> unknown,
- IEnumLiteMap mapping);
-
- /// <summary>
- /// Reads an array of primitive values into the list, if the wire-type of fieldTag is length-prefixed, it will
- /// read a packed array.
- /// </summary>
- void ReadEnumArray<T>(uint fieldTag, string fieldName, ICollection<T> list, out ICollection<object> unknown)
+ void ReadEnumArray<T>(uint fieldTag, string fieldName, ICollection<T> list)
where T : struct, IComparable, IFormattable;
/// <summary>
- /// Reads a set of messages using the <paramref name="messageType"/> as a template. T is not guaranteed to be
- /// the most derived type, it is only the type specifier for the collection.
+ /// Reads a set of messages using the <paramref name="parser"/> to read individual messages.
/// </summary>
- void ReadMessageArray<T>(uint fieldTag, string fieldName, ICollection<T> list, T messageType,
- ExtensionRegistry registry) where T : IMessageLite;
+ void ReadMessageArray<T>(uint fieldTag, string fieldName, ICollection<T> list, MessageParser<T> parser) where T : IMessage<T>;
/// <summary>
- /// Reads a set of messages using the <paramref name="messageType"/> as a template.
+ /// Reads a set of messages using the <paramref name="parser"/> as a template.
/// </summary>
- void ReadGroupArray<T>(uint fieldTag, string fieldName, ICollection<T> list, T messageType,
- ExtensionRegistry registry) where T : IMessageLite;
+ void ReadGroupArray<T>(uint fieldTag, string fieldName, ICollection<T> list, MessageParser<T> parser) where T : IMessage<T>;
/// <summary>
/// Reads a field of any primitive type. Enums, groups and embedded