ICodedOutputStream.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. #region Copyright notice and license
  2. // Protocol Buffers - Google's data interchange format
  3. // Copyright 2008 Google Inc. All rights reserved.
  4. // http://github.com/jskeet/dotnet-protobufs/
  5. // Original C++/Java/Python code:
  6. // http://code.google.com/p/protobuf/
  7. //
  8. // Redistribution and use in source and binary forms, with or without
  9. // modification, are permitted provided that the following conditions are
  10. // met:
  11. //
  12. // * Redistributions of source code must retain the above copyright
  13. // notice, this list of conditions and the following disclaimer.
  14. // * Redistributions in binary form must reproduce the above
  15. // copyright notice, this list of conditions and the following disclaimer
  16. // in the documentation and/or other materials provided with the
  17. // distribution.
  18. // * Neither the name of Google Inc. nor the names of its
  19. // contributors may be used to endorse or promote products derived from
  20. // this software without specific prior written permission.
  21. //
  22. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  23. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  24. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  25. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  26. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  27. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  28. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  29. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  30. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  31. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  32. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  33. #endregion
  34. using System;
  35. using System.Collections;
  36. using System.Collections.Generic;
  37. using Google.ProtocolBuffers.Descriptors;
  38. //Disable warning CS3010: CLS-compliant interfaces must have only CLS-compliant members
  39. #pragma warning disable 3010
  40. namespace Google.ProtocolBuffers
  41. {
  42. public interface ICodedOutputStream
  43. {
  44. void Flush();
  45. [Obsolete]
  46. void WriteUnknownGroup(int fieldNumber, IMessageLite value);
  47. void WriteUnknownBytes(int fieldNumber, ByteString value);
  48. [CLSCompliant(false)]
  49. void WriteUnknownField(int fieldNumber, WireFormat.WireType wireType, ulong value);
  50. void WriteMessageSetExtension(int fieldNumber, string fieldName, IMessageLite value);
  51. void WriteMessageSetExtension(int fieldNumber, string fieldName, ByteString value);
  52. void WriteField(FieldType fieldType, int fieldNumber, string fieldName, object value);
  53. /// <summary>
  54. /// Writes a double field value, including tag, to the stream.
  55. /// </summary>
  56. void WriteDouble(int fieldNumber, string fieldName, double value);
  57. /// <summary>
  58. /// Writes a float field value, including tag, to the stream.
  59. /// </summary>
  60. void WriteFloat(int fieldNumber, string fieldName, float value);
  61. /// <summary>
  62. /// Writes a uint64 field value, including tag, to the stream.
  63. /// </summary>
  64. [CLSCompliant(false)]
  65. void WriteUInt64(int fieldNumber, string fieldName, ulong value);
  66. /// <summary>
  67. /// Writes an int64 field value, including tag, to the stream.
  68. /// </summary>
  69. void WriteInt64(int fieldNumber, string fieldName, long value);
  70. /// <summary>
  71. /// Writes an int32 field value, including tag, to the stream.
  72. /// </summary>
  73. void WriteInt32(int fieldNumber, string fieldName, int value);
  74. /// <summary>
  75. /// Writes a fixed64 field value, including tag, to the stream.
  76. /// </summary>
  77. [CLSCompliant(false)]
  78. void WriteFixed64(int fieldNumber, string fieldName, ulong value);
  79. /// <summary>
  80. /// Writes a fixed32 field value, including tag, to the stream.
  81. /// </summary>
  82. [CLSCompliant(false)]
  83. void WriteFixed32(int fieldNumber, string fieldName, uint value);
  84. /// <summary>
  85. /// Writes a bool field value, including tag, to the stream.
  86. /// </summary>
  87. void WriteBool(int fieldNumber, string fieldName, bool value);
  88. /// <summary>
  89. /// Writes a string field value, including tag, to the stream.
  90. /// </summary>
  91. void WriteString(int fieldNumber, string fieldName, string value);
  92. /// <summary>
  93. /// Writes a group field value, including tag, to the stream.
  94. /// </summary>
  95. void WriteGroup(int fieldNumber, string fieldName, IMessageLite value);
  96. /// <summary>
  97. /// Writes a message field value, including tag, to the stream.
  98. /// </summary>
  99. void WriteMessage(int fieldNumber, string fieldName, IMessageLite value);
  100. /// <summary>
  101. /// Writes a byte array field value, including tag, to the stream.
  102. /// </summary>
  103. void WriteBytes(int fieldNumber, string fieldName, ByteString value);
  104. /// <summary>
  105. /// Writes a UInt32 field value, including tag, to the stream.
  106. /// </summary>
  107. [CLSCompliant(false)]
  108. void WriteUInt32(int fieldNumber, string fieldName, uint value);
  109. /// <summary>
  110. /// Writes an enum field value, including tag, to the stream.
  111. /// </summary>
  112. void WriteEnum(int fieldNumber, string fieldName, int value, object rawValue);
  113. /// <summary>
  114. /// Writes a fixed 32-bit field value, including tag, to the stream.
  115. /// </summary>
  116. void WriteSFixed32(int fieldNumber, string fieldName, int value);
  117. /// <summary>
  118. /// Writes a signed fixed 64-bit field value, including tag, to the stream.
  119. /// </summary>
  120. void WriteSFixed64(int fieldNumber, string fieldName, long value);
  121. /// <summary>
  122. /// Writes a signed 32-bit field value, including tag, to the stream.
  123. /// </summary>
  124. void WriteSInt32(int fieldNumber, string fieldName, int value);
  125. /// <summary>
  126. /// Writes a signed 64-bit field value, including tag, to the stream.
  127. /// </summary>
  128. void WriteSInt64(int fieldNumber, string fieldName, long value);
  129. void WriteArray(FieldType fieldType, int fieldNumber, string fieldName, IEnumerable list);
  130. void WriteGroupArray<T>(int fieldNumber, string fieldName, IEnumerable<T> list)
  131. where T : IMessageLite;
  132. void WriteMessageArray<T>(int fieldNumber, string fieldName, IEnumerable<T> list)
  133. where T : IMessageLite;
  134. void WriteStringArray(int fieldNumber, string fieldName, IEnumerable<string> list);
  135. void WriteBytesArray(int fieldNumber, string fieldName, IEnumerable<ByteString> list);
  136. void WriteBoolArray(int fieldNumber, string fieldName, IEnumerable<bool> list);
  137. void WriteInt32Array(int fieldNumber, string fieldName, IEnumerable<int> list);
  138. void WriteSInt32Array(int fieldNumber, string fieldName, IEnumerable<int> list);
  139. void WriteUInt32Array(int fieldNumber, string fieldName, IEnumerable<uint> list);
  140. void WriteFixed32Array(int fieldNumber, string fieldName, IEnumerable<uint> list);
  141. void WriteSFixed32Array(int fieldNumber, string fieldName, IEnumerable<int> list);
  142. void WriteInt64Array(int fieldNumber, string fieldName, IEnumerable<long> list);
  143. void WriteSInt64Array(int fieldNumber, string fieldName, IEnumerable<long> list);
  144. void WriteUInt64Array(int fieldNumber, string fieldName, IEnumerable<ulong> list);
  145. void WriteFixed64Array(int fieldNumber, string fieldName, IEnumerable<ulong> list);
  146. void WriteSFixed64Array(int fieldNumber, string fieldName, IEnumerable<long> list);
  147. void WriteDoubleArray(int fieldNumber, string fieldName, IEnumerable<double> list);
  148. void WriteFloatArray(int fieldNumber, string fieldName, IEnumerable<float> list);
  149. [CLSCompliant(false)]
  150. void WriteEnumArray<T>(int fieldNumber, string fieldName, IEnumerable<T> list)
  151. where T : struct, IComparable, IFormattable, IConvertible;
  152. void WritePackedArray(FieldType fieldType, int fieldNumber, string fieldName, IEnumerable list);
  153. void WritePackedBoolArray(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<bool> list);
  154. void WritePackedInt32Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<int> list);
  155. void WritePackedSInt32Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<int> list);
  156. void WritePackedUInt32Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<uint> list);
  157. void WritePackedFixed32Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<uint> list);
  158. void WritePackedSFixed32Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<int> list);
  159. void WritePackedInt64Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<long> list);
  160. void WritePackedSInt64Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<long> list);
  161. void WritePackedUInt64Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<ulong> list);
  162. void WritePackedFixed64Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<ulong> list);
  163. void WritePackedSFixed64Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<long> list);
  164. void WritePackedDoubleArray(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<double> list);
  165. void WritePackedFloatArray(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<float> list);
  166. [CLSCompliant(false)]
  167. void WritePackedEnumArray<T>(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<T> list)
  168. where T : struct, IComparable, IFormattable, IConvertible;
  169. }
  170. }