Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2893_BNLR/HeuristicLab.ExtLibs/HeuristicLab.ProtobufCS/2.4.1/ProtobufCS/src/ProtocolBuffers/ICodedInputStream.cs

Last change on this file was 8295, checked in by abeham, 12 years ago

#1897:

  • Removed protocol buffers 0.9.1
  • Added protocol buffers 2.4.1
  • Updated proto processing command
File size: 14.0 KB
Line 
1#region Copyright notice and license
2
3// Protocol Buffers - Google's data interchange format
4// Copyright 2008 Google Inc.  All rights reserved.
5// http://github.com/jskeet/dotnet-protobufs/
6// Original C++/Java/Python code:
7// http://code.google.com/p/protobuf/
8//
9// Redistribution and use in source and binary forms, with or without
10// modification, are permitted provided that the following conditions are
11// met:
12//
13//     * Redistributions of source code must retain the above copyright
14// notice, this list of conditions and the following disclaimer.
15//     * Redistributions in binary form must reproduce the above
16// copyright notice, this list of conditions and the following disclaimer
17// in the documentation and/or other materials provided with the
18// distribution.
19//     * Neither the name of Google Inc. nor the names of its
20// contributors may be used to endorse or promote products derived from
21// this software without specific prior written permission.
22//
23// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
35#endregion
36
37using System;
38using System.Collections.Generic;
39using Google.ProtocolBuffers.Descriptors;
40
41//Disable warning CS3010: CLS-compliant interfaces must have only CLS-compliant members
42#pragma warning disable 3010
43
44namespace Google.ProtocolBuffers
45{
46    public interface ICodedInputStream
47    {
48        /// <summary>
49        /// Reads any message initialization data expected from the input stream
50        /// </summary>
51        /// <remarks>
52        /// This is primarily used by text formats and unnecessary for protobuffers' own
53        /// binary format.  The API for MessageStart/End was added for consistent handling
54        /// of output streams regardless of the actual writer implementation.
55        /// </remarks>
56        void ReadMessageStart();
57        /// <summary>
58        /// Reads any message finalization data expected from the input stream
59        /// </summary>
60        /// <remarks>
61        /// This is primarily used by text formats and unnecessary for protobuffers' own
62        /// binary format.  The API for MessageStart/End was added for consistent handling
63        /// of output streams regardless of the actual writer implementation.
64        /// </remarks>
65        void ReadMessageEnd();
66        /// <summary>
67        /// Attempt to read a field tag, returning false if we have reached the end
68        /// of the input data.
69        /// </summary>
70        /// <remarks>
71        /// <para>
72        /// If fieldTag is non-zero and ReadTag returns true then the value in fieldName
73        /// may or may not be populated.  However, if fieldTag is zero and ReadTag returns
74        /// true, then fieldName should be populated with a non-null field name.
75        /// </para><para>
76        /// In other words if ReadTag returns true then either fieldTag will be non-zero OR
77        /// fieldName will be non-zero.  In some cases both may be populated, however the
78        /// builders will always prefer the fieldTag over fieldName.
79        /// </para>
80        /// </remarks>
81        [CLSCompliant(false)]
82        bool ReadTag(out uint fieldTag, out string fieldName);
83
84        /// <summary>
85        /// Read a double field from the stream.
86        /// </summary>
87        bool ReadDouble(ref double value);
88
89        /// <summary>
90        /// Read a float field from the stream.
91        /// </summary>
92        bool ReadFloat(ref float value);
93
94        /// <summary>
95        /// Read a uint64 field from the stream.
96        /// </summary>
97        [CLSCompliant(false)]
98        bool ReadUInt64(ref ulong value);
99
100        /// <summary>
101        /// Read an int64 field from the stream.
102        /// </summary>
103        bool ReadInt64(ref long value);
104
105        /// <summary>
106        /// Read an int32 field from the stream.
107        /// </summary>
108        bool ReadInt32(ref int value);
109
110        /// <summary>
111        /// Read a fixed64 field from the stream.
112        /// </summary>
113        [CLSCompliant(false)]
114        bool ReadFixed64(ref ulong value);
115
116        /// <summary>
117        /// Read a fixed32 field from the stream.
118        /// </summary>
119        [CLSCompliant(false)]
120        bool ReadFixed32(ref uint value);
121
122        /// <summary>
123        /// Read a bool field from the stream.
124        /// </summary>
125        bool ReadBool(ref bool value);
126
127        /// <summary>
128        /// Reads a string field from the stream.
129        /// </summary>
130        bool ReadString(ref string value);
131
132        /// <summary>
133        /// Reads a group field value from the stream.
134        /// </summary>   
135        void ReadGroup(int fieldNumber, IBuilderLite builder,
136                       ExtensionRegistry extensionRegistry);
137
138        /// <summary>
139        /// Reads a group field value from the stream and merges it into the given
140        /// UnknownFieldSet.
141        /// </summary>   
142        [Obsolete]
143        void ReadUnknownGroup(int fieldNumber, IBuilderLite builder);
144
145        /// <summary>
146        /// Reads an embedded message field value from the stream.
147        /// </summary>   
148        void ReadMessage(IBuilderLite builder, ExtensionRegistry extensionRegistry);
149
150        /// <summary>
151        /// Reads a bytes field value from the stream.
152        /// </summary>   
153        bool ReadBytes(ref ByteString value);
154
155        /// <summary>
156        /// Reads a uint32 field value from the stream.
157        /// </summary>   
158        [CLSCompliant(false)]
159        bool ReadUInt32(ref uint value);
160
161        /// <summary>
162        /// Reads an enum field value from the stream. The caller is responsible
163        /// for converting the numeric value to an actual enum.
164        /// </summary>   
165        bool ReadEnum(ref IEnumLite value, out object unknown, IEnumLiteMap mapping);
166
167        /// <summary>
168        /// Reads an enum field value from the stream. If the enum is valid for type T,
169        /// then the ref value is set and it returns true.  Otherwise the unkown output
170        /// value is set and this method returns false.
171        /// </summary>   
172        [CLSCompliant(false)]
173        bool ReadEnum<T>(ref T value, out object unknown)
174            where T : struct, IComparable, IFormattable, IConvertible;
175
176        /// <summary>
177        /// Reads an sfixed32 field value from the stream.
178        /// </summary>   
179        bool ReadSFixed32(ref int value);
180
181        /// <summary>
182        /// Reads an sfixed64 field value from the stream.
183        /// </summary>   
184        bool ReadSFixed64(ref long value);
185
186        /// <summary>
187        /// Reads an sint32 field value from the stream.
188        /// </summary>   
189        bool ReadSInt32(ref int value);
190
191        /// <summary>
192        /// Reads an sint64 field value from the stream.
193        /// </summary>   
194        bool ReadSInt64(ref long value);
195
196        /// <summary>
197        /// Reads an array of primitive values into the list, if the wire-type of fieldTag is length-prefixed and the
198        /// type is numeric, it will read a packed array.
199        /// </summary>
200        [CLSCompliant(false)]
201        void ReadPrimitiveArray(FieldType fieldType, uint fieldTag, string fieldName, ICollection<object> list);
202
203        /// <summary>
204        /// Reads an array of primitive values into the list, if the wire-type of fieldTag is length-prefixed, it will
205        /// read a packed array.
206        /// </summary>
207        [CLSCompliant(false)]
208        void ReadEnumArray(uint fieldTag, string fieldName, ICollection<IEnumLite> list, out ICollection<object> unknown,
209                           IEnumLiteMap mapping);
210
211        /// <summary>
212        /// Reads an array of primitive values into the list, if the wire-type of fieldTag is length-prefixed, it will
213        /// read a packed array.
214        /// </summary>
215        [CLSCompliant(false)]
216        void ReadEnumArray<T>(uint fieldTag, string fieldName, ICollection<T> list, out ICollection<object> unknown)
217            where T : struct, IComparable, IFormattable, IConvertible;
218
219        /// <summary>
220        /// Reads a set of messages using the <paramref name="messageType"/> as a template.  T is not guaranteed to be
221        /// the most derived type, it is only the type specifier for the collection.
222        /// </summary>
223        [CLSCompliant(false)]
224        void ReadMessageArray<T>(uint fieldTag, string fieldName, ICollection<T> list, T messageType,
225                                 ExtensionRegistry registry) where T : IMessageLite;
226
227        /// <summary>
228        /// Reads a set of messages using the <paramref name="messageType"/> as a template.
229        /// </summary>
230        [CLSCompliant(false)]
231        void ReadGroupArray<T>(uint fieldTag, string fieldName, ICollection<T> list, T messageType,
232                               ExtensionRegistry registry) where T : IMessageLite;
233
234        /// <summary>
235        /// Reads a field of any primitive type. Enums, groups and embedded
236        /// messages are not handled by this method.
237        /// </summary>
238        bool ReadPrimitiveField(FieldType fieldType, ref object value);
239
240        /// <summary>
241        /// Returns true if the stream has reached the end of the input. This is the
242        /// case if either the end of the underlying input source has been reached or
243        /// the stream has reached a limit created using PushLimit.
244        /// </summary>
245        bool IsAtEnd { get; }
246
247        /// <summary>
248        /// Reads and discards a single field, given its tag value.
249        /// </summary>
250        /// <returns>false if the tag is an end-group tag, in which case
251        /// nothing is skipped. Otherwise, returns true.</returns>
252        [CLSCompliant(false)]
253        bool SkipField();
254
255        /// <summary>
256        /// Reads one or more repeated string field values from the stream.
257        /// </summary>   
258        [CLSCompliant(false)]
259        void ReadStringArray(uint fieldTag, string fieldName, ICollection<string> list);
260
261        /// <summary>
262        /// Reads one or more repeated ByteString field values from the stream.
263        /// </summary>   
264        [CLSCompliant(false)]
265        void ReadBytesArray(uint fieldTag, string fieldName, ICollection<ByteString> list);
266
267        /// <summary>
268        /// Reads one or more repeated boolean field values from the stream.
269        /// </summary>
270        [CLSCompliant(false)]
271        void ReadBoolArray(uint fieldTag, string fieldName, ICollection<bool> list);
272
273        /// <summary>
274        /// Reads one or more repeated Int32 field values from the stream.
275        /// </summary>
276        [CLSCompliant(false)]
277        void ReadInt32Array(uint fieldTag, string fieldName, ICollection<int> list);
278
279        /// <summary>
280        /// Reads one or more repeated SInt32 field values from the stream.
281        /// </summary>
282        [CLSCompliant(false)]
283        void ReadSInt32Array(uint fieldTag, string fieldName, ICollection<int> list);
284
285        /// <summary>
286        /// Reads one or more repeated UInt32 field values from the stream.
287        /// </summary>
288        [CLSCompliant(false)]
289        void ReadUInt32Array(uint fieldTag, string fieldName, ICollection<uint> list);
290
291        /// <summary>
292        /// Reads one or more repeated Fixed32 field values from the stream.
293        /// </summary>
294        [CLSCompliant(false)]
295        void ReadFixed32Array(uint fieldTag, string fieldName, ICollection<uint> list);
296
297        /// <summary>
298        /// Reads one or more repeated SFixed32 field values from the stream.
299        /// </summary>
300        [CLSCompliant(false)]
301        void ReadSFixed32Array(uint fieldTag, string fieldName, ICollection<int> list);
302
303        /// <summary>
304        /// Reads one or more repeated Int64 field values from the stream.
305        /// </summary>
306        [CLSCompliant(false)]
307        void ReadInt64Array(uint fieldTag, string fieldName, ICollection<long> list);
308
309        /// <summary>
310        /// Reads one or more repeated SInt64 field values from the stream.
311        /// </summary>
312        [CLSCompliant(false)]
313        void ReadSInt64Array(uint fieldTag, string fieldName, ICollection<long> list);
314
315        /// <summary>
316        /// Reads one or more repeated UInt64 field values from the stream.
317        /// </summary>
318        [CLSCompliant(false)]
319        void ReadUInt64Array(uint fieldTag, string fieldName, ICollection<ulong> list);
320
321        /// <summary>
322        /// Reads one or more repeated Fixed64 field values from the stream.
323        /// </summary>
324        [CLSCompliant(false)]
325        void ReadFixed64Array(uint fieldTag, string fieldName, ICollection<ulong> list);
326
327        /// <summary>
328        /// Reads one or more repeated SFixed64 field values from the stream.
329        /// </summary>
330        [CLSCompliant(false)]
331        void ReadSFixed64Array(uint fieldTag, string fieldName, ICollection<long> list);
332
333        /// <summary>
334        /// Reads one or more repeated Double field values from the stream.
335        /// </summary>
336        [CLSCompliant(false)]
337        void ReadDoubleArray(uint fieldTag, string fieldName, ICollection<double> list);
338
339        /// <summary>
340        /// Reads one or more repeated Float field values from the stream.
341        /// </summary>
342        [CLSCompliant(false)]
343        void ReadFloatArray(uint fieldTag, string fieldName, ICollection<float> list);
344    }
345}
Note: See TracBrowser for help on using the repository browser.