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 |
|
---|
37 | using System;
|
---|
38 | using System.Collections;
|
---|
39 | using System.Collections.Generic;
|
---|
40 | using Google.ProtocolBuffers.Descriptors;
|
---|
41 |
|
---|
42 | //Disable warning CS3010: CLS-compliant interfaces must have only CLS-compliant members
|
---|
43 | #pragma warning disable 3010
|
---|
44 |
|
---|
45 | namespace Google.ProtocolBuffers
|
---|
46 | {
|
---|
47 | /// <summary>
|
---|
48 | /// Provides an interface that is used write a message. Most often proto buffers are written
|
---|
49 | /// in their binary form by creating a instance via the CodedOutputStream.CreateInstance
|
---|
50 | /// static factory.
|
---|
51 | /// </summary>
|
---|
52 | public interface ICodedOutputStream
|
---|
53 | {
|
---|
54 | /// <summary>
|
---|
55 | /// Writes any message initialization data needed to the output stream
|
---|
56 | /// </summary>
|
---|
57 | /// <remarks>
|
---|
58 | /// This is primarily used by text formats and unnecessary for protobuffers' own
|
---|
59 | /// binary format. The API for MessageStart/End was added for consistent handling
|
---|
60 | /// of output streams regardless of the actual writer implementation.
|
---|
61 | /// </remarks>
|
---|
62 | void WriteMessageStart();
|
---|
63 | /// <summary>
|
---|
64 | /// Writes any message finalization data needed to the output stream
|
---|
65 | /// </summary>
|
---|
66 | /// <remarks>
|
---|
67 | /// This is primarily used by text formats and unnecessary for protobuffers' own
|
---|
68 | /// binary format. The API for MessageStart/End was added for consistent handling
|
---|
69 | /// of output streams regardless of the actual writer implementation.
|
---|
70 | /// </remarks>
|
---|
71 | void WriteMessageEnd();
|
---|
72 | /// <summary>
|
---|
73 | /// Indicates that all temporary buffers be written to the final output.
|
---|
74 | /// </summary>
|
---|
75 | void Flush();
|
---|
76 | /// <summary>
|
---|
77 | /// Writes an unknown message as a group
|
---|
78 | /// </summary>
|
---|
79 | [Obsolete]
|
---|
80 | void WriteUnknownGroup(int fieldNumber, IMessageLite value);
|
---|
81 | /// <summary>
|
---|
82 | /// Writes an unknown field value of bytes
|
---|
83 | /// </summary>
|
---|
84 | void WriteUnknownBytes(int fieldNumber, ByteString value);
|
---|
85 | /// <summary>
|
---|
86 | /// Writes an unknown field of a primitive type
|
---|
87 | /// </summary>
|
---|
88 | [CLSCompliant(false)]
|
---|
89 | void WriteUnknownField(int fieldNumber, WireFormat.WireType wireType, ulong value);
|
---|
90 | /// <summary>
|
---|
91 | /// Writes an extension as a message-set group
|
---|
92 | /// </summary>
|
---|
93 | void WriteMessageSetExtension(int fieldNumber, string fieldName, IMessageLite value);
|
---|
94 | /// <summary>
|
---|
95 | /// Writes an unknown extension as a message-set group
|
---|
96 | /// </summary>
|
---|
97 | void WriteMessageSetExtension(int fieldNumber, string fieldName, ByteString value);
|
---|
98 |
|
---|
99 | /// <summary>
|
---|
100 | /// Writes a field value, including tag, to the stream.
|
---|
101 | /// </summary>
|
---|
102 | void WriteField(FieldType fieldType, int fieldNumber, string fieldName, object value);
|
---|
103 |
|
---|
104 | /// <summary>
|
---|
105 | /// Writes a double field value, including tag, to the stream.
|
---|
106 | /// </summary>
|
---|
107 | void WriteDouble(int fieldNumber, string fieldName, double value);
|
---|
108 |
|
---|
109 | /// <summary>
|
---|
110 | /// Writes a float field value, including tag, to the stream.
|
---|
111 | /// </summary>
|
---|
112 | void WriteFloat(int fieldNumber, string fieldName, float value);
|
---|
113 |
|
---|
114 | /// <summary>
|
---|
115 | /// Writes a uint64 field value, including tag, to the stream.
|
---|
116 | /// </summary>
|
---|
117 | [CLSCompliant(false)]
|
---|
118 | void WriteUInt64(int fieldNumber, string fieldName, ulong value);
|
---|
119 |
|
---|
120 | /// <summary>
|
---|
121 | /// Writes an int64 field value, including tag, to the stream.
|
---|
122 | /// </summary>
|
---|
123 | void WriteInt64(int fieldNumber, string fieldName, long value);
|
---|
124 |
|
---|
125 | /// <summary>
|
---|
126 | /// Writes an int32 field value, including tag, to the stream.
|
---|
127 | /// </summary>
|
---|
128 | void WriteInt32(int fieldNumber, string fieldName, int value);
|
---|
129 |
|
---|
130 | /// <summary>
|
---|
131 | /// Writes a fixed64 field value, including tag, to the stream.
|
---|
132 | /// </summary>
|
---|
133 | [CLSCompliant(false)]
|
---|
134 | void WriteFixed64(int fieldNumber, string fieldName, ulong value);
|
---|
135 |
|
---|
136 | /// <summary>
|
---|
137 | /// Writes a fixed32 field value, including tag, to the stream.
|
---|
138 | /// </summary>
|
---|
139 | [CLSCompliant(false)]
|
---|
140 | void WriteFixed32(int fieldNumber, string fieldName, uint value);
|
---|
141 |
|
---|
142 | /// <summary>
|
---|
143 | /// Writes a bool field value, including tag, to the stream.
|
---|
144 | /// </summary>
|
---|
145 | void WriteBool(int fieldNumber, string fieldName, bool value);
|
---|
146 |
|
---|
147 | /// <summary>
|
---|
148 | /// Writes a string field value, including tag, to the stream.
|
---|
149 | /// </summary>
|
---|
150 | void WriteString(int fieldNumber, string fieldName, string value);
|
---|
151 |
|
---|
152 | /// <summary>
|
---|
153 | /// Writes a group field value, including tag, to the stream.
|
---|
154 | /// </summary>
|
---|
155 | void WriteGroup(int fieldNumber, string fieldName, IMessageLite value);
|
---|
156 |
|
---|
157 | /// <summary>
|
---|
158 | /// Writes a message field value, including tag, to the stream.
|
---|
159 | /// </summary>
|
---|
160 | void WriteMessage(int fieldNumber, string fieldName, IMessageLite value);
|
---|
161 |
|
---|
162 | /// <summary>
|
---|
163 | /// Writes a byte array field value, including tag, to the stream.
|
---|
164 | /// </summary>
|
---|
165 | void WriteBytes(int fieldNumber, string fieldName, ByteString value);
|
---|
166 |
|
---|
167 | /// <summary>
|
---|
168 | /// Writes a UInt32 field value, including tag, to the stream.
|
---|
169 | /// </summary>
|
---|
170 | [CLSCompliant(false)]
|
---|
171 | void WriteUInt32(int fieldNumber, string fieldName, uint value);
|
---|
172 |
|
---|
173 | /// <summary>
|
---|
174 | /// Writes an enum field value, including tag, to the stream.
|
---|
175 | /// </summary>
|
---|
176 | void WriteEnum(int fieldNumber, string fieldName, int value, object rawValue);
|
---|
177 |
|
---|
178 | /// <summary>
|
---|
179 | /// Writes a fixed 32-bit field value, including tag, to the stream.
|
---|
180 | /// </summary>
|
---|
181 | void WriteSFixed32(int fieldNumber, string fieldName, int value);
|
---|
182 |
|
---|
183 | /// <summary>
|
---|
184 | /// Writes a signed fixed 64-bit field value, including tag, to the stream.
|
---|
185 | /// </summary>
|
---|
186 | void WriteSFixed64(int fieldNumber, string fieldName, long value);
|
---|
187 |
|
---|
188 | /// <summary>
|
---|
189 | /// Writes a signed 32-bit field value, including tag, to the stream.
|
---|
190 | /// </summary>
|
---|
191 | void WriteSInt32(int fieldNumber, string fieldName, int value);
|
---|
192 |
|
---|
193 | /// <summary>
|
---|
194 | /// Writes a signed 64-bit field value, including tag, to the stream.
|
---|
195 | /// </summary>
|
---|
196 | void WriteSInt64(int fieldNumber, string fieldName, long value);
|
---|
197 |
|
---|
198 | /// <summary>
|
---|
199 | /// Writes a repeated field value, including tag(s), to the stream.
|
---|
200 | /// </summary>
|
---|
201 | void WriteArray(FieldType fieldType, int fieldNumber, string fieldName, IEnumerable list);
|
---|
202 |
|
---|
203 | /// <summary>
|
---|
204 | /// Writes a repeated group value, including tag(s), to the stream.
|
---|
205 | /// </summary>
|
---|
206 | void WriteGroupArray<T>(int fieldNumber, string fieldName, IEnumerable<T> list)
|
---|
207 | where T : IMessageLite;
|
---|
208 |
|
---|
209 | /// <summary>
|
---|
210 | /// Writes a repeated message value, including tag(s), to the stream.
|
---|
211 | /// </summary>
|
---|
212 | void WriteMessageArray<T>(int fieldNumber, string fieldName, IEnumerable<T> list)
|
---|
213 | where T : IMessageLite;
|
---|
214 |
|
---|
215 | /// <summary>
|
---|
216 | /// Writes a repeated string value, including tag(s), to the stream.
|
---|
217 | /// </summary>
|
---|
218 | void WriteStringArray(int fieldNumber, string fieldName, IEnumerable<string> list);
|
---|
219 |
|
---|
220 | /// <summary>
|
---|
221 | /// Writes a repeated ByteString value, including tag(s), to the stream.
|
---|
222 | /// </summary>
|
---|
223 | void WriteBytesArray(int fieldNumber, string fieldName, IEnumerable<ByteString> list);
|
---|
224 |
|
---|
225 | /// <summary>
|
---|
226 | /// Writes a repeated boolean value, including tag(s), to the stream.
|
---|
227 | /// </summary>
|
---|
228 | void WriteBoolArray(int fieldNumber, string fieldName, IEnumerable<bool> list);
|
---|
229 |
|
---|
230 | /// <summary>
|
---|
231 | /// Writes a repeated Int32 value, including tag(s), to the stream.
|
---|
232 | /// </summary>
|
---|
233 | void WriteInt32Array(int fieldNumber, string fieldName, IEnumerable<int> list);
|
---|
234 |
|
---|
235 | /// <summary>
|
---|
236 | /// Writes a repeated SInt32 value, including tag(s), to the stream.
|
---|
237 | /// </summary>
|
---|
238 | void WriteSInt32Array(int fieldNumber, string fieldName, IEnumerable<int> list);
|
---|
239 |
|
---|
240 | /// <summary>
|
---|
241 | /// Writes a repeated UInt32 value, including tag(s), to the stream.
|
---|
242 | /// </summary>
|
---|
243 | void WriteUInt32Array(int fieldNumber, string fieldName, IEnumerable<uint> list);
|
---|
244 |
|
---|
245 | /// <summary>
|
---|
246 | /// Writes a repeated Fixed32 value, including tag(s), to the stream.
|
---|
247 | /// </summary>
|
---|
248 | void WriteFixed32Array(int fieldNumber, string fieldName, IEnumerable<uint> list);
|
---|
249 |
|
---|
250 | /// <summary>
|
---|
251 | /// Writes a repeated SFixed32 value, including tag(s), to the stream.
|
---|
252 | /// </summary>
|
---|
253 | void WriteSFixed32Array(int fieldNumber, string fieldName, IEnumerable<int> list);
|
---|
254 |
|
---|
255 | /// <summary>
|
---|
256 | /// Writes a repeated Int64 value, including tag(s), to the stream.
|
---|
257 | /// </summary>
|
---|
258 | void WriteInt64Array(int fieldNumber, string fieldName, IEnumerable<long> list);
|
---|
259 |
|
---|
260 | /// <summary>
|
---|
261 | /// Writes a repeated SInt64 value, including tag(s), to the stream.
|
---|
262 | /// </summary>
|
---|
263 | void WriteSInt64Array(int fieldNumber, string fieldName, IEnumerable<long> list);
|
---|
264 |
|
---|
265 | /// <summary>
|
---|
266 | /// Writes a repeated UInt64 value, including tag(s), to the stream.
|
---|
267 | /// </summary>
|
---|
268 | void WriteUInt64Array(int fieldNumber, string fieldName, IEnumerable<ulong> list);
|
---|
269 |
|
---|
270 | /// <summary>
|
---|
271 | /// Writes a repeated Fixed64 value, including tag(s), to the stream.
|
---|
272 | /// </summary>
|
---|
273 | void WriteFixed64Array(int fieldNumber, string fieldName, IEnumerable<ulong> list);
|
---|
274 |
|
---|
275 | /// <summary>
|
---|
276 | /// Writes a repeated SFixed64 value, including tag(s), to the stream.
|
---|
277 | /// </summary>
|
---|
278 | void WriteSFixed64Array(int fieldNumber, string fieldName, IEnumerable<long> list);
|
---|
279 |
|
---|
280 | /// <summary>
|
---|
281 | /// Writes a repeated Double value, including tag(s), to the stream.
|
---|
282 | /// </summary>
|
---|
283 | void WriteDoubleArray(int fieldNumber, string fieldName, IEnumerable<double> list);
|
---|
284 |
|
---|
285 | /// <summary>
|
---|
286 | /// Writes a repeated Float value, including tag(s), to the stream.
|
---|
287 | /// </summary>
|
---|
288 | void WriteFloatArray(int fieldNumber, string fieldName, IEnumerable<float> list);
|
---|
289 |
|
---|
290 | /// <summary>
|
---|
291 | /// Writes a repeated enumeration value of type T, including tag(s), to the stream.
|
---|
292 | /// </summary>
|
---|
293 | [CLSCompliant(false)]
|
---|
294 | void WriteEnumArray<T>(int fieldNumber, string fieldName, IEnumerable<T> list)
|
---|
295 | where T : struct, IComparable, IFormattable, IConvertible;
|
---|
296 |
|
---|
297 | /// <summary>
|
---|
298 | /// Writes a packed repeated primitive, including tag and length, to the stream.
|
---|
299 | /// </summary>
|
---|
300 | void WritePackedArray(FieldType fieldType, int fieldNumber, string fieldName, IEnumerable list);
|
---|
301 |
|
---|
302 | /// <summary>
|
---|
303 | /// Writes a packed repeated boolean, including tag and length, to the stream.
|
---|
304 | /// </summary>
|
---|
305 | void WritePackedBoolArray(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<bool> list);
|
---|
306 |
|
---|
307 | /// <summary>
|
---|
308 | /// Writes a packed repeated Int32, including tag and length, to the stream.
|
---|
309 | /// </summary>
|
---|
310 | void WritePackedInt32Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<int> list);
|
---|
311 |
|
---|
312 | /// <summary>
|
---|
313 | /// Writes a packed repeated SInt32, including tag and length, to the stream.
|
---|
314 | /// </summary>
|
---|
315 | void WritePackedSInt32Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<int> list);
|
---|
316 |
|
---|
317 | /// <summary>
|
---|
318 | /// Writes a packed repeated UInt32, including tag and length, to the stream.
|
---|
319 | /// </summary>
|
---|
320 | void WritePackedUInt32Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<uint> list);
|
---|
321 |
|
---|
322 | /// <summary>
|
---|
323 | /// Writes a packed repeated Fixed32, including tag and length, to the stream.
|
---|
324 | /// </summary>
|
---|
325 | void WritePackedFixed32Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<uint> list);
|
---|
326 |
|
---|
327 | /// <summary>
|
---|
328 | /// Writes a packed repeated SFixed32, including tag and length, to the stream.
|
---|
329 | /// </summary>
|
---|
330 | void WritePackedSFixed32Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<int> list);
|
---|
331 |
|
---|
332 | /// <summary>
|
---|
333 | /// Writes a packed repeated Int64, including tag and length, to the stream.
|
---|
334 | /// </summary>
|
---|
335 | void WritePackedInt64Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<long> list);
|
---|
336 |
|
---|
337 | /// <summary>
|
---|
338 | /// Writes a packed repeated SInt64, including tag and length, to the stream.
|
---|
339 | /// </summary>
|
---|
340 | void WritePackedSInt64Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<long> list);
|
---|
341 |
|
---|
342 | /// <summary>
|
---|
343 | /// Writes a packed repeated UInt64, including tag and length, to the stream.
|
---|
344 | /// </summary>
|
---|
345 | void WritePackedUInt64Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<ulong> list);
|
---|
346 |
|
---|
347 | /// <summary>
|
---|
348 | /// Writes a packed repeated Fixed64, including tag and length, to the stream.
|
---|
349 | /// </summary>
|
---|
350 | void WritePackedFixed64Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<ulong> list);
|
---|
351 |
|
---|
352 | /// <summary>
|
---|
353 | /// Writes a packed repeated SFixed64, including tag and length, to the stream.
|
---|
354 | /// </summary>
|
---|
355 | void WritePackedSFixed64Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<long> list);
|
---|
356 |
|
---|
357 | /// <summary>
|
---|
358 | /// Writes a packed repeated Double, including tag and length, to the stream.
|
---|
359 | /// </summary>
|
---|
360 | void WritePackedDoubleArray(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<double> list);
|
---|
361 |
|
---|
362 | /// <summary>
|
---|
363 | /// Writes a packed repeated Float, including tag and length, to the stream.
|
---|
364 | /// </summary>
|
---|
365 | void WritePackedFloatArray(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<float> list);
|
---|
366 |
|
---|
367 | /// <summary>
|
---|
368 | /// Writes a packed repeated enumeration of type T, including tag and length, to the stream.
|
---|
369 | /// </summary>
|
---|
370 | [CLSCompliant(false)]
|
---|
371 | void WritePackedEnumArray<T>(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<T> list)
|
---|
372 | where T : struct, IComparable, IFormattable, IConvertible;
|
---|
373 | }
|
---|
374 | } |
---|