csharptest | 17699c2 | 2011-06-03 21:57:15 -0500 | [diff] [blame^] | 1 | using System;
|
| 2 | using System.Collections.Generic;
|
| 3 | using Google.ProtocolBuffers.Descriptors;
|
| 4 |
|
| 5 | //Disable warning CS3010: CLS-compliant interfaces must have only CLS-compliant members
|
| 6 | #pragma warning disable 3010
|
| 7 |
|
| 8 | namespace Google.ProtocolBuffers
|
| 9 | {
|
| 10 | public interface ICodedInputStream
|
| 11 | {
|
| 12 | /// <summary>
|
| 13 | /// Attempt to read a field tag, returning false if we have reached the end
|
| 14 | /// of the input data.
|
| 15 | /// </summary>
|
| 16 | /// <remarks>
|
| 17 | /// <para>
|
| 18 | /// If fieldTag is non-zero and ReadTag returns true then the value in fieldName
|
| 19 | /// may or may not be populated. However, if fieldTag is zero and ReadTag returns
|
| 20 | /// true, then fieldName should be populated with a non-null field name.
|
| 21 | /// </para><para>
|
| 22 | /// In other words if ReadTag returns true then either fieldTag will be non-zero OR
|
| 23 | /// fieldName will be non-zero. In some cases both may be populated, however the
|
| 24 | /// builders will always prefer the fieldTag over fieldName.
|
| 25 | /// </para>
|
| 26 | /// </remarks>
|
| 27 | [CLSCompliant(false)]
|
| 28 | bool ReadTag(out uint fieldTag, out string fieldName);
|
| 29 |
|
| 30 | /// <summary>
|
| 31 | /// Read a double field from the stream.
|
| 32 | /// </summary>
|
| 33 | bool ReadDouble(ref double value);
|
| 34 |
|
| 35 | /// <summary>
|
| 36 | /// Read a float field from the stream.
|
| 37 | /// </summary>
|
| 38 | bool ReadFloat(ref float value);
|
| 39 |
|
| 40 | /// <summary>
|
| 41 | /// Read a uint64 field from the stream.
|
| 42 | /// </summary>
|
| 43 | [CLSCompliant(false)]
|
| 44 | bool ReadUInt64(ref ulong value);
|
| 45 |
|
| 46 | /// <summary>
|
| 47 | /// Read an int64 field from the stream.
|
| 48 | /// </summary>
|
| 49 | bool ReadInt64(ref long value);
|
| 50 |
|
| 51 | /// <summary>
|
| 52 | /// Read an int32 field from the stream.
|
| 53 | /// </summary>
|
| 54 | bool ReadInt32(ref int value);
|
| 55 |
|
| 56 | /// <summary>
|
| 57 | /// Read a fixed64 field from the stream.
|
| 58 | /// </summary>
|
| 59 | [CLSCompliant(false)]
|
| 60 | bool ReadFixed64(ref ulong value);
|
| 61 |
|
| 62 | /// <summary>
|
| 63 | /// Read a fixed32 field from the stream.
|
| 64 | /// </summary>
|
| 65 | [CLSCompliant(false)]
|
| 66 | bool ReadFixed32(ref uint value);
|
| 67 |
|
| 68 | /// <summary>
|
| 69 | /// Read a bool field from the stream.
|
| 70 | /// </summary>
|
| 71 | bool ReadBool(ref bool value);
|
| 72 |
|
| 73 | /// <summary>
|
| 74 | /// Reads a string field from the stream.
|
| 75 | /// </summary>
|
| 76 | bool ReadString(ref string value);
|
| 77 |
|
| 78 | /// <summary>
|
| 79 | /// Reads a group field value from the stream.
|
| 80 | /// </summary>
|
| 81 | void ReadGroup(int fieldNumber, IBuilderLite builder,
|
| 82 | ExtensionRegistry extensionRegistry);
|
| 83 |
|
| 84 | /// <summary>
|
| 85 | /// Reads a group field value from the stream and merges it into the given
|
| 86 | /// UnknownFieldSet.
|
| 87 | /// </summary>
|
| 88 | [Obsolete]
|
| 89 | void ReadUnknownGroup(int fieldNumber, IBuilderLite builder);
|
| 90 |
|
| 91 | /// <summary>
|
| 92 | /// Reads an embedded message field value from the stream.
|
| 93 | /// </summary>
|
| 94 | void ReadMessage(IBuilderLite builder, ExtensionRegistry extensionRegistry);
|
| 95 |
|
| 96 | /// <summary>
|
| 97 | /// Reads a bytes field value from the stream.
|
| 98 | /// </summary>
|
| 99 | bool ReadBytes(ref ByteString value);
|
| 100 |
|
| 101 | /// <summary>
|
| 102 | /// Reads a uint32 field value from the stream.
|
| 103 | /// </summary>
|
| 104 | [CLSCompliant(false)]
|
| 105 | bool ReadUInt32(ref uint value);
|
| 106 |
|
| 107 | /// <summary>
|
| 108 | /// Reads an enum field value from the stream. The caller is responsible
|
| 109 | /// for converting the numeric value to an actual enum.
|
| 110 | /// </summary>
|
| 111 | bool ReadEnum(ref IEnumLite value, out object unknown, IEnumLiteMap mapping);
|
| 112 |
|
| 113 | /// <summary>
|
| 114 | /// Reads an enum field value from the stream. If the enum is valid for type T,
|
| 115 | /// then the ref value is set and it returns true. Otherwise the unkown output
|
| 116 | /// value is set and this method returns false.
|
| 117 | /// </summary>
|
| 118 | [CLSCompliant(false)]
|
| 119 | bool ReadEnum<T>(ref T value, out object unknown)
|
| 120 | where T : struct, IComparable, IFormattable, IConvertible;
|
| 121 |
|
| 122 | /// <summary>
|
| 123 | /// Reads an sfixed32 field value from the stream.
|
| 124 | /// </summary>
|
| 125 | bool ReadSFixed32(ref int value);
|
| 126 |
|
| 127 | /// <summary>
|
| 128 | /// Reads an sfixed64 field value from the stream.
|
| 129 | /// </summary>
|
| 130 | bool ReadSFixed64(ref long value);
|
| 131 |
|
| 132 | /// <summary>
|
| 133 | /// Reads an sint32 field value from the stream.
|
| 134 | /// </summary>
|
| 135 | bool ReadSInt32(ref int value);
|
| 136 |
|
| 137 | /// <summary>
|
| 138 | /// Reads an sint64 field value from the stream.
|
| 139 | /// </summary>
|
| 140 | bool ReadSInt64(ref long value);
|
| 141 |
|
| 142 | /// <summary>
|
| 143 | /// Reads an array of primitive values into the list, if the wire-type of fieldTag is length-prefixed and the
|
| 144 | /// type is numberic, it will read a packed array.
|
| 145 | /// </summary>
|
| 146 | [CLSCompliant(false)]
|
| 147 | void ReadPrimitiveArray<T>(FieldType fieldType, uint fieldTag, string fieldName, ICollection<T> list);
|
| 148 |
|
| 149 | /// <summary>
|
| 150 | /// Reads an array of primitive values into the list, if the wire-type of fieldTag is length-prefixed, it will
|
| 151 | /// read a packed array.
|
| 152 | /// </summary>
|
| 153 | [CLSCompliant(false)]
|
| 154 | void ReadEnumArray(uint fieldTag, string fieldName, ICollection<IEnumLite> list, out ICollection<object> unknown, IEnumLiteMap mapping);
|
| 155 |
|
| 156 | /// <summary>
|
| 157 | /// Reads an array of primitive values into the list, if the wire-type of fieldTag is length-prefixed, it will
|
| 158 | /// read a packed array.
|
| 159 | /// </summary>
|
| 160 | [CLSCompliant(false)]
|
| 161 | void ReadEnumArray<T>(uint fieldTag, string fieldName, ICollection<T> list, out ICollection<object> unknown)
|
| 162 | where T : struct, IComparable, IFormattable, IConvertible;
|
| 163 |
|
| 164 | /// <summary>
|
| 165 | /// Reads a set of messages using the <paramref name="messageType"/> as a template. T is not guaranteed to be
|
| 166 | /// the most derived type, it is only the type specifier for the collection.
|
| 167 | /// </summary>
|
| 168 | [CLSCompliant(false)]
|
| 169 | void ReadMessageArray<T>(uint fieldTag, string fieldName, ICollection<T> list, T messageType, ExtensionRegistry registry) where T : IMessageLite;
|
| 170 |
|
| 171 | /// <summary>
|
| 172 | /// Reads a set of messages using the <paramref name="messageType"/> as a template.
|
| 173 | /// </summary>
|
| 174 | [CLSCompliant(false)]
|
| 175 | void ReadGroupArray<T>(uint fieldTag, string fieldName, ICollection<T> list, T messageType, ExtensionRegistry registry) where T : IMessageLite;
|
| 176 |
|
| 177 | /// <summary>
|
| 178 | /// Reads a field of any primitive type. Enums, groups and embedded
|
| 179 | /// messages are not handled by this method.
|
| 180 | /// </summary>
|
| 181 | bool ReadPrimitiveField(FieldType fieldType, ref object value);
|
| 182 |
|
| 183 | /// <summary>
|
| 184 | /// Returns true if the stream has reached the end of the input. This is the
|
| 185 | /// case if either the end of the underlying input source has been reached or
|
| 186 | /// the stream has reached a limit created using PushLimit.
|
| 187 | /// </summary>
|
| 188 | bool IsAtEnd { get; }
|
| 189 |
|
| 190 | /// <summary>
|
| 191 | /// Reads and discards a single field, given its tag value.
|
| 192 | /// </summary>
|
| 193 | /// <returns>false if the tag is an end-group tag, in which case
|
| 194 | /// nothing is skipped. Otherwise, returns true.</returns>
|
| 195 | [CLSCompliant(false)]
|
| 196 | bool SkipField();
|
| 197 | }
|
| 198 | } |