Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 1 | // Protocol Buffers - Google's data interchange format |
| 2 | // Copyright 2008 Google Inc. All rights reserved. |
| 3 | // https://developers.google.com/protocol-buffers/ |
| 4 | // |
| 5 | // Redistribution and use in source and binary forms, with or without |
| 6 | // modification, are permitted provided that the following conditions are |
| 7 | // met: |
| 8 | // |
| 9 | // * Redistributions of source code must retain the above copyright |
| 10 | // notice, this list of conditions and the following disclaimer. |
| 11 | // * Redistributions in binary form must reproduce the above |
| 12 | // copyright notice, this list of conditions and the following disclaimer |
| 13 | // in the documentation and/or other materials provided with the |
| 14 | // distribution. |
| 15 | // * Neither the name of Google Inc. nor the names of its |
| 16 | // contributors may be used to endorse or promote products derived from |
| 17 | // this software without specific prior written permission. |
| 18 | // |
| 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | |
| 31 | #import <Foundation/Foundation.h> |
| 32 | |
Thomas Van Lenten | d846b0b | 2015-06-08 16:24:57 -0400 | [diff] [blame] | 33 | #import "GPBRuntimeTypes.h" |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 34 | #import "GPBWireFormat.h" |
| 35 | |
| 36 | @class GPBBoolArray; |
| 37 | @class GPBDoubleArray; |
| 38 | @class GPBEnumArray; |
| 39 | @class GPBFloatArray; |
| 40 | @class GPBMessage; |
| 41 | @class GPBInt32Array; |
| 42 | @class GPBInt64Array; |
| 43 | @class GPBUInt32Array; |
| 44 | @class GPBUInt64Array; |
| 45 | @class GPBUnknownFieldSet; |
| 46 | |
Thomas Van Lenten | 8c88957 | 2015-06-16 16:45:14 -0400 | [diff] [blame] | 47 | NS_ASSUME_NONNULL_BEGIN |
| 48 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 49 | /** |
Thomas Van Lenten | 5fd71ce | 2017-06-19 10:21:33 -0400 | [diff] [blame] | 50 | * @c GPBCodedOutputStream exception names. |
| 51 | **/ |
| 52 | extern NSString *const GPBCodedOutputStreamException_OutOfSpace; |
| 53 | extern NSString *const GPBCodedOutputStreamException_WriteFailed; |
| 54 | |
| 55 | /** |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 56 | * Writes out protocol message fields. |
| 57 | * |
| 58 | * The common uses of protocol buffers shouldn't need to use this class. |
| 59 | * GPBMessage's provide a -data method that will serialize the message for you. |
| 60 | * |
Thomas Van Lenten | 5fd71ce | 2017-06-19 10:21:33 -0400 | [diff] [blame] | 61 | * @note Any -write* api can raise the GPBCodedOutputStreamException_* |
| 62 | * exceptions. |
| 63 | * |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 64 | * @note Subclassing of GPBCodedOutputStream is NOT supported. |
| 65 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 66 | @interface GPBCodedOutputStream : NSObject |
| 67 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 68 | /** |
| 69 | * Creates a stream to fill in the given data. Data must be sized to fit or |
| 70 | * an error will be raised when out of space. |
| 71 | * |
| 72 | * @param data The data where the stream will be written to. |
| 73 | * |
| 74 | * @return A newly instanced GPBCodedOutputStream. |
| 75 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 76 | + (instancetype)streamWithData:(NSMutableData *)data; |
Thomas Van Lenten | 36650a0 | 2016-03-07 12:07:03 -0500 | [diff] [blame] | 77 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 78 | /** |
| 79 | * Creates a stream to write into the given NSOutputStream. |
| 80 | * |
| 81 | * @param output The output stream where the stream will be written to. |
| 82 | * |
| 83 | * @return A newly instanced GPBCodedOutputStream. |
| 84 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 85 | + (instancetype)streamWithOutputStream:(NSOutputStream *)output; |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 86 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 87 | /** |
| 88 | * Initializes a stream to fill in the given data. Data must be sized to fit |
| 89 | * or an error will be raised when out of space. |
| 90 | * |
| 91 | * @param data The data where the stream will be written to. |
| 92 | * |
| 93 | * @return A newly initialized GPBCodedOutputStream. |
| 94 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 95 | - (instancetype)initWithData:(NSMutableData *)data; |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 96 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 97 | /** |
| 98 | * Initializes a stream to write into the given @c NSOutputStream. |
| 99 | * |
| 100 | * @param output The output stream where the stream will be written to. |
| 101 | * |
| 102 | * @return A newly initialized GPBCodedOutputStream. |
| 103 | **/ |
Thomas Van Lenten | 36650a0 | 2016-03-07 12:07:03 -0500 | [diff] [blame] | 104 | - (instancetype)initWithOutputStream:(NSOutputStream *)output; |
| 105 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 106 | /** |
| 107 | * Flush any buffered data out. |
| 108 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 109 | - (void)flush; |
| 110 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 111 | /** |
| 112 | * Write the raw byte out. |
| 113 | * |
| 114 | * @param value The value to write out. |
| 115 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 116 | - (void)writeRawByte:(uint8_t)value; |
| 117 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 118 | /** |
| 119 | * Write the tag for the given field number and wire format. |
| 120 | * |
| 121 | * @param fieldNumber The field number. |
| 122 | * @param format The wire format the data for the field will be in. |
| 123 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 124 | - (void)writeTag:(uint32_t)fieldNumber format:(GPBWireFormat)format; |
| 125 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 126 | /** |
| 127 | * Write a 32bit value out in little endian format. |
| 128 | * |
| 129 | * @param value The value to write out. |
| 130 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 131 | - (void)writeRawLittleEndian32:(int32_t)value; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 132 | /** |
| 133 | * Write a 64bit value out in little endian format. |
| 134 | * |
| 135 | * @param value The value to write out. |
| 136 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 137 | - (void)writeRawLittleEndian64:(int64_t)value; |
| 138 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 139 | /** |
| 140 | * Write a 32bit value out in varint format. |
| 141 | * |
| 142 | * @param value The value to write out. |
| 143 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 144 | - (void)writeRawVarint32:(int32_t)value; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 145 | /** |
| 146 | * Write a 64bit value out in varint format. |
| 147 | * |
| 148 | * @param value The value to write out. |
| 149 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 150 | - (void)writeRawVarint64:(int64_t)value; |
| 151 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 152 | /** |
| 153 | * Write a size_t out as a 32bit varint value. |
| 154 | * |
| 155 | * @note This will truncate 64 bit values to 32. |
| 156 | * |
| 157 | * @param value The value to write out. |
| 158 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 159 | - (void)writeRawVarintSizeTAs32:(size_t)value; |
| 160 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 161 | /** |
| 162 | * Writes the contents of an NSData out. |
| 163 | * |
| 164 | * @param data The data to write out. |
| 165 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 166 | - (void)writeRawData:(NSData *)data; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 167 | /** |
| 168 | * Writes out the given data. |
| 169 | * |
| 170 | * @param data The data blob to write out. |
| 171 | * @param offset The offset into the blob to start writing out. |
| 172 | * @param length The number of bytes from the blob to write out. |
| 173 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 174 | - (void)writeRawPtr:(const void *)data |
| 175 | offset:(size_t)offset |
| 176 | length:(size_t)length; |
| 177 | |
| 178 | //%PDDM-EXPAND _WRITE_DECLS() |
| 179 | // This block of code is generated, do not edit it directly. |
Dave MacLachlan | ab48ecf | 2020-01-20 13:47:20 -0800 | [diff] [blame] | 180 | // clang-format off |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 181 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 182 | /** |
| 183 | * Write a double for the given field number. |
| 184 | * |
| 185 | * @param fieldNumber The field number assigned to the value. |
| 186 | * @param value The value to write out. |
| 187 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 188 | - (void)writeDouble:(int32_t)fieldNumber value:(double)value; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 189 | /** |
| 190 | * Write a packed array of double for the given field number. |
| 191 | * |
| 192 | * @param fieldNumber The field number assigned to the values. |
| 193 | * @param values The values to write out. |
| 194 | * @param tag The tag assigned to the values. |
| 195 | **/ |
Thomas Van Lenten | d846b0b | 2015-06-08 16:24:57 -0400 | [diff] [blame] | 196 | - (void)writeDoubleArray:(int32_t)fieldNumber |
| 197 | values:(GPBDoubleArray *)values |
| 198 | tag:(uint32_t)tag; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 199 | /** |
| 200 | * Write a double without any tag. |
| 201 | * |
| 202 | * @param value The value to write out. |
| 203 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 204 | - (void)writeDoubleNoTag:(double)value; |
| 205 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 206 | /** |
| 207 | * Write a float for the given field number. |
| 208 | * |
| 209 | * @param fieldNumber The field number assigned to the value. |
| 210 | * @param value The value to write out. |
| 211 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 212 | - (void)writeFloat:(int32_t)fieldNumber value:(float)value; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 213 | /** |
| 214 | * Write a packed array of float for the given field number. |
| 215 | * |
| 216 | * @param fieldNumber The field number assigned to the values. |
| 217 | * @param values The values to write out. |
| 218 | * @param tag The tag assigned to the values. |
| 219 | **/ |
Thomas Van Lenten | d846b0b | 2015-06-08 16:24:57 -0400 | [diff] [blame] | 220 | - (void)writeFloatArray:(int32_t)fieldNumber |
| 221 | values:(GPBFloatArray *)values |
| 222 | tag:(uint32_t)tag; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 223 | /** |
| 224 | * Write a float without any tag. |
| 225 | * |
| 226 | * @param value The value to write out. |
| 227 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 228 | - (void)writeFloatNoTag:(float)value; |
| 229 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 230 | /** |
| 231 | * Write a uint64_t for the given field number. |
| 232 | * |
| 233 | * @param fieldNumber The field number assigned to the value. |
| 234 | * @param value The value to write out. |
| 235 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 236 | - (void)writeUInt64:(int32_t)fieldNumber value:(uint64_t)value; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 237 | /** |
| 238 | * Write a packed array of uint64_t for the given field number. |
| 239 | * |
| 240 | * @param fieldNumber The field number assigned to the values. |
| 241 | * @param values The values to write out. |
| 242 | * @param tag The tag assigned to the values. |
| 243 | **/ |
Thomas Van Lenten | d846b0b | 2015-06-08 16:24:57 -0400 | [diff] [blame] | 244 | - (void)writeUInt64Array:(int32_t)fieldNumber |
| 245 | values:(GPBUInt64Array *)values |
| 246 | tag:(uint32_t)tag; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 247 | /** |
| 248 | * Write a uint64_t without any tag. |
| 249 | * |
| 250 | * @param value The value to write out. |
| 251 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 252 | - (void)writeUInt64NoTag:(uint64_t)value; |
| 253 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 254 | /** |
| 255 | * Write a int64_t for the given field number. |
| 256 | * |
| 257 | * @param fieldNumber The field number assigned to the value. |
| 258 | * @param value The value to write out. |
| 259 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 260 | - (void)writeInt64:(int32_t)fieldNumber value:(int64_t)value; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 261 | /** |
| 262 | * Write a packed array of int64_t for the given field number. |
| 263 | * |
| 264 | * @param fieldNumber The field number assigned to the values. |
| 265 | * @param values The values to write out. |
| 266 | * @param tag The tag assigned to the values. |
| 267 | **/ |
Thomas Van Lenten | d846b0b | 2015-06-08 16:24:57 -0400 | [diff] [blame] | 268 | - (void)writeInt64Array:(int32_t)fieldNumber |
| 269 | values:(GPBInt64Array *)values |
| 270 | tag:(uint32_t)tag; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 271 | /** |
| 272 | * Write a int64_t without any tag. |
| 273 | * |
| 274 | * @param value The value to write out. |
| 275 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 276 | - (void)writeInt64NoTag:(int64_t)value; |
| 277 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 278 | /** |
| 279 | * Write a int32_t for the given field number. |
| 280 | * |
| 281 | * @param fieldNumber The field number assigned to the value. |
| 282 | * @param value The value to write out. |
| 283 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 284 | - (void)writeInt32:(int32_t)fieldNumber value:(int32_t)value; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 285 | /** |
| 286 | * Write a packed array of int32_t for the given field number. |
| 287 | * |
| 288 | * @param fieldNumber The field number assigned to the values. |
| 289 | * @param values The values to write out. |
| 290 | * @param tag The tag assigned to the values. |
| 291 | **/ |
Thomas Van Lenten | d846b0b | 2015-06-08 16:24:57 -0400 | [diff] [blame] | 292 | - (void)writeInt32Array:(int32_t)fieldNumber |
| 293 | values:(GPBInt32Array *)values |
| 294 | tag:(uint32_t)tag; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 295 | /** |
| 296 | * Write a int32_t without any tag. |
| 297 | * |
| 298 | * @param value The value to write out. |
| 299 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 300 | - (void)writeInt32NoTag:(int32_t)value; |
| 301 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 302 | /** |
| 303 | * Write a uint32_t for the given field number. |
| 304 | * |
| 305 | * @param fieldNumber The field number assigned to the value. |
| 306 | * @param value The value to write out. |
| 307 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 308 | - (void)writeUInt32:(int32_t)fieldNumber value:(uint32_t)value; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 309 | /** |
| 310 | * Write a packed array of uint32_t for the given field number. |
| 311 | * |
| 312 | * @param fieldNumber The field number assigned to the values. |
| 313 | * @param values The values to write out. |
| 314 | * @param tag The tag assigned to the values. |
| 315 | **/ |
Thomas Van Lenten | d846b0b | 2015-06-08 16:24:57 -0400 | [diff] [blame] | 316 | - (void)writeUInt32Array:(int32_t)fieldNumber |
| 317 | values:(GPBUInt32Array *)values |
| 318 | tag:(uint32_t)tag; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 319 | /** |
| 320 | * Write a uint32_t without any tag. |
| 321 | * |
| 322 | * @param value The value to write out. |
| 323 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 324 | - (void)writeUInt32NoTag:(uint32_t)value; |
| 325 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 326 | /** |
| 327 | * Write a uint64_t for the given field number. |
| 328 | * |
| 329 | * @param fieldNumber The field number assigned to the value. |
| 330 | * @param value The value to write out. |
| 331 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 332 | - (void)writeFixed64:(int32_t)fieldNumber value:(uint64_t)value; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 333 | /** |
| 334 | * Write a packed array of uint64_t for the given field number. |
| 335 | * |
| 336 | * @param fieldNumber The field number assigned to the values. |
| 337 | * @param values The values to write out. |
| 338 | * @param tag The tag assigned to the values. |
| 339 | **/ |
Thomas Van Lenten | d846b0b | 2015-06-08 16:24:57 -0400 | [diff] [blame] | 340 | - (void)writeFixed64Array:(int32_t)fieldNumber |
| 341 | values:(GPBUInt64Array *)values |
| 342 | tag:(uint32_t)tag; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 343 | /** |
| 344 | * Write a uint64_t without any tag. |
| 345 | * |
| 346 | * @param value The value to write out. |
| 347 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 348 | - (void)writeFixed64NoTag:(uint64_t)value; |
| 349 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 350 | /** |
| 351 | * Write a uint32_t for the given field number. |
| 352 | * |
| 353 | * @param fieldNumber The field number assigned to the value. |
| 354 | * @param value The value to write out. |
| 355 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 356 | - (void)writeFixed32:(int32_t)fieldNumber value:(uint32_t)value; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 357 | /** |
| 358 | * Write a packed array of uint32_t for the given field number. |
| 359 | * |
| 360 | * @param fieldNumber The field number assigned to the values. |
| 361 | * @param values The values to write out. |
| 362 | * @param tag The tag assigned to the values. |
| 363 | **/ |
Thomas Van Lenten | d846b0b | 2015-06-08 16:24:57 -0400 | [diff] [blame] | 364 | - (void)writeFixed32Array:(int32_t)fieldNumber |
| 365 | values:(GPBUInt32Array *)values |
| 366 | tag:(uint32_t)tag; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 367 | /** |
| 368 | * Write a uint32_t without any tag. |
| 369 | * |
| 370 | * @param value The value to write out. |
| 371 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 372 | - (void)writeFixed32NoTag:(uint32_t)value; |
| 373 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 374 | /** |
| 375 | * Write a int32_t for the given field number. |
| 376 | * |
| 377 | * @param fieldNumber The field number assigned to the value. |
| 378 | * @param value The value to write out. |
| 379 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 380 | - (void)writeSInt32:(int32_t)fieldNumber value:(int32_t)value; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 381 | /** |
| 382 | * Write a packed array of int32_t for the given field number. |
| 383 | * |
| 384 | * @param fieldNumber The field number assigned to the values. |
| 385 | * @param values The values to write out. |
| 386 | * @param tag The tag assigned to the values. |
| 387 | **/ |
Thomas Van Lenten | d846b0b | 2015-06-08 16:24:57 -0400 | [diff] [blame] | 388 | - (void)writeSInt32Array:(int32_t)fieldNumber |
| 389 | values:(GPBInt32Array *)values |
| 390 | tag:(uint32_t)tag; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 391 | /** |
| 392 | * Write a int32_t without any tag. |
| 393 | * |
| 394 | * @param value The value to write out. |
| 395 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 396 | - (void)writeSInt32NoTag:(int32_t)value; |
| 397 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 398 | /** |
| 399 | * Write a int64_t for the given field number. |
| 400 | * |
| 401 | * @param fieldNumber The field number assigned to the value. |
| 402 | * @param value The value to write out. |
| 403 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 404 | - (void)writeSInt64:(int32_t)fieldNumber value:(int64_t)value; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 405 | /** |
| 406 | * Write a packed array of int64_t for the given field number. |
| 407 | * |
| 408 | * @param fieldNumber The field number assigned to the values. |
| 409 | * @param values The values to write out. |
| 410 | * @param tag The tag assigned to the values. |
| 411 | **/ |
Thomas Van Lenten | d846b0b | 2015-06-08 16:24:57 -0400 | [diff] [blame] | 412 | - (void)writeSInt64Array:(int32_t)fieldNumber |
| 413 | values:(GPBInt64Array *)values |
| 414 | tag:(uint32_t)tag; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 415 | /** |
| 416 | * Write a int64_t without any tag. |
| 417 | * |
| 418 | * @param value The value to write out. |
| 419 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 420 | - (void)writeSInt64NoTag:(int64_t)value; |
| 421 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 422 | /** |
| 423 | * Write a int64_t for the given field number. |
| 424 | * |
| 425 | * @param fieldNumber The field number assigned to the value. |
| 426 | * @param value The value to write out. |
| 427 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 428 | - (void)writeSFixed64:(int32_t)fieldNumber value:(int64_t)value; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 429 | /** |
| 430 | * Write a packed array of int64_t for the given field number. |
| 431 | * |
| 432 | * @param fieldNumber The field number assigned to the values. |
| 433 | * @param values The values to write out. |
| 434 | * @param tag The tag assigned to the values. |
| 435 | **/ |
Thomas Van Lenten | d846b0b | 2015-06-08 16:24:57 -0400 | [diff] [blame] | 436 | - (void)writeSFixed64Array:(int32_t)fieldNumber |
| 437 | values:(GPBInt64Array *)values |
| 438 | tag:(uint32_t)tag; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 439 | /** |
| 440 | * Write a int64_t without any tag. |
| 441 | * |
| 442 | * @param value The value to write out. |
| 443 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 444 | - (void)writeSFixed64NoTag:(int64_t)value; |
| 445 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 446 | /** |
| 447 | * Write a int32_t for the given field number. |
| 448 | * |
| 449 | * @param fieldNumber The field number assigned to the value. |
| 450 | * @param value The value to write out. |
| 451 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 452 | - (void)writeSFixed32:(int32_t)fieldNumber value:(int32_t)value; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 453 | /** |
| 454 | * Write a packed array of int32_t for the given field number. |
| 455 | * |
| 456 | * @param fieldNumber The field number assigned to the values. |
| 457 | * @param values The values to write out. |
| 458 | * @param tag The tag assigned to the values. |
| 459 | **/ |
Thomas Van Lenten | d846b0b | 2015-06-08 16:24:57 -0400 | [diff] [blame] | 460 | - (void)writeSFixed32Array:(int32_t)fieldNumber |
| 461 | values:(GPBInt32Array *)values |
| 462 | tag:(uint32_t)tag; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 463 | /** |
| 464 | * Write a int32_t without any tag. |
| 465 | * |
| 466 | * @param value The value to write out. |
| 467 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 468 | - (void)writeSFixed32NoTag:(int32_t)value; |
| 469 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 470 | /** |
| 471 | * Write a BOOL for the given field number. |
| 472 | * |
| 473 | * @param fieldNumber The field number assigned to the value. |
| 474 | * @param value The value to write out. |
| 475 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 476 | - (void)writeBool:(int32_t)fieldNumber value:(BOOL)value; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 477 | /** |
| 478 | * Write a packed array of BOOL for the given field number. |
| 479 | * |
| 480 | * @param fieldNumber The field number assigned to the values. |
| 481 | * @param values The values to write out. |
| 482 | * @param tag The tag assigned to the values. |
| 483 | **/ |
Thomas Van Lenten | d846b0b | 2015-06-08 16:24:57 -0400 | [diff] [blame] | 484 | - (void)writeBoolArray:(int32_t)fieldNumber |
| 485 | values:(GPBBoolArray *)values |
| 486 | tag:(uint32_t)tag; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 487 | /** |
| 488 | * Write a BOOL without any tag. |
| 489 | * |
| 490 | * @param value The value to write out. |
| 491 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 492 | - (void)writeBoolNoTag:(BOOL)value; |
| 493 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 494 | /** |
| 495 | * Write a int32_t for the given field number. |
| 496 | * |
| 497 | * @param fieldNumber The field number assigned to the value. |
| 498 | * @param value The value to write out. |
| 499 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 500 | - (void)writeEnum:(int32_t)fieldNumber value:(int32_t)value; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 501 | /** |
| 502 | * Write a packed array of int32_t for the given field number. |
| 503 | * |
| 504 | * @param fieldNumber The field number assigned to the values. |
| 505 | * @param values The values to write out. |
| 506 | * @param tag The tag assigned to the values. |
| 507 | **/ |
Thomas Van Lenten | d846b0b | 2015-06-08 16:24:57 -0400 | [diff] [blame] | 508 | - (void)writeEnumArray:(int32_t)fieldNumber |
| 509 | values:(GPBEnumArray *)values |
| 510 | tag:(uint32_t)tag; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 511 | /** |
| 512 | * Write a int32_t without any tag. |
| 513 | * |
| 514 | * @param value The value to write out. |
| 515 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 516 | - (void)writeEnumNoTag:(int32_t)value; |
| 517 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 518 | /** |
| 519 | * Write a NSString for the given field number. |
| 520 | * |
| 521 | * @param fieldNumber The field number assigned to the value. |
| 522 | * @param value The value to write out. |
| 523 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 524 | - (void)writeString:(int32_t)fieldNumber value:(NSString *)value; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 525 | /** |
| 526 | * Write an array of NSString for the given field number. |
| 527 | * |
| 528 | * @param fieldNumber The field number assigned to the values. |
| 529 | * @param values The values to write out. |
| 530 | **/ |
Dave MacLachlan | ab48ecf | 2020-01-20 13:47:20 -0800 | [diff] [blame] | 531 | - (void)writeStringArray:(int32_t)fieldNumber |
| 532 | values:(NSArray<NSString*> *)values; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 533 | /** |
| 534 | * Write a NSString without any tag. |
| 535 | * |
| 536 | * @param value The value to write out. |
| 537 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 538 | - (void)writeStringNoTag:(NSString *)value; |
| 539 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 540 | /** |
| 541 | * Write a GPBMessage for the given field number. |
| 542 | * |
| 543 | * @param fieldNumber The field number assigned to the value. |
| 544 | * @param value The value to write out. |
| 545 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 546 | - (void)writeMessage:(int32_t)fieldNumber value:(GPBMessage *)value; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 547 | /** |
| 548 | * Write an array of GPBMessage for the given field number. |
| 549 | * |
| 550 | * @param fieldNumber The field number assigned to the values. |
| 551 | * @param values The values to write out. |
| 552 | **/ |
Dave MacLachlan | ab48ecf | 2020-01-20 13:47:20 -0800 | [diff] [blame] | 553 | - (void)writeMessageArray:(int32_t)fieldNumber |
| 554 | values:(NSArray<GPBMessage*> *)values; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 555 | /** |
| 556 | * Write a GPBMessage without any tag. |
| 557 | * |
| 558 | * @param value The value to write out. |
| 559 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 560 | - (void)writeMessageNoTag:(GPBMessage *)value; |
| 561 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 562 | /** |
| 563 | * Write a NSData for the given field number. |
| 564 | * |
| 565 | * @param fieldNumber The field number assigned to the value. |
| 566 | * @param value The value to write out. |
| 567 | **/ |
Thomas Van Lenten | d846b0b | 2015-06-08 16:24:57 -0400 | [diff] [blame] | 568 | - (void)writeBytes:(int32_t)fieldNumber value:(NSData *)value; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 569 | /** |
| 570 | * Write an array of NSData for the given field number. |
| 571 | * |
| 572 | * @param fieldNumber The field number assigned to the values. |
| 573 | * @param values The values to write out. |
| 574 | **/ |
Dave MacLachlan | ab48ecf | 2020-01-20 13:47:20 -0800 | [diff] [blame] | 575 | - (void)writeBytesArray:(int32_t)fieldNumber |
| 576 | values:(NSArray<NSData*> *)values; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 577 | /** |
| 578 | * Write a NSData without any tag. |
| 579 | * |
| 580 | * @param value The value to write out. |
| 581 | **/ |
Thomas Van Lenten | d846b0b | 2015-06-08 16:24:57 -0400 | [diff] [blame] | 582 | - (void)writeBytesNoTag:(NSData *)value; |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 583 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 584 | /** |
| 585 | * Write a GPBMessage for the given field number. |
| 586 | * |
| 587 | * @param fieldNumber The field number assigned to the value. |
| 588 | * @param value The value to write out. |
| 589 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 590 | - (void)writeGroup:(int32_t)fieldNumber |
| 591 | value:(GPBMessage *)value; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 592 | /** |
| 593 | * Write an array of GPBMessage for the given field number. |
| 594 | * |
| 595 | * @param fieldNumber The field number assigned to the values. |
| 596 | * @param values The values to write out. |
| 597 | **/ |
Dave MacLachlan | ab48ecf | 2020-01-20 13:47:20 -0800 | [diff] [blame] | 598 | - (void)writeGroupArray:(int32_t)fieldNumber |
| 599 | values:(NSArray<GPBMessage*> *)values; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 600 | /** |
| 601 | * Write a GPBMessage without any tag (but does write the endGroup tag). |
| 602 | * |
| 603 | * @param fieldNumber The field number assigned to the value. |
| 604 | * @param value The value to write out. |
| 605 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 606 | - (void)writeGroupNoTag:(int32_t)fieldNumber |
| 607 | value:(GPBMessage *)value; |
| 608 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 609 | /** |
| 610 | * Write a GPBUnknownFieldSet for the given field number. |
| 611 | * |
| 612 | * @param fieldNumber The field number assigned to the value. |
| 613 | * @param value The value to write out. |
| 614 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 615 | - (void)writeUnknownGroup:(int32_t)fieldNumber |
| 616 | value:(GPBUnknownFieldSet *)value; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 617 | /** |
| 618 | * Write an array of GPBUnknownFieldSet for the given field number. |
| 619 | * |
| 620 | * @param fieldNumber The field number assigned to the values. |
| 621 | * @param values The values to write out. |
| 622 | **/ |
Dave MacLachlan | ab48ecf | 2020-01-20 13:47:20 -0800 | [diff] [blame] | 623 | - (void)writeUnknownGroupArray:(int32_t)fieldNumber |
| 624 | values:(NSArray<GPBUnknownFieldSet*> *)values; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 625 | /** |
| 626 | * Write a GPBUnknownFieldSet without any tag (but does write the endGroup tag). |
| 627 | * |
| 628 | * @param fieldNumber The field number assigned to the value. |
| 629 | * @param value The value to write out. |
| 630 | **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 631 | - (void)writeUnknownGroupNoTag:(int32_t)fieldNumber |
| 632 | value:(GPBUnknownFieldSet *)value; |
| 633 | |
Dave MacLachlan | ab48ecf | 2020-01-20 13:47:20 -0800 | [diff] [blame] | 634 | // clang-format on |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 635 | //%PDDM-EXPAND-END _WRITE_DECLS() |
| 636 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 637 | /** |
| 638 | Write a MessageSet extension field to the stream. For historical reasons, |
| 639 | the wire format differs from normal fields. |
| 640 | |
| 641 | @param fieldNumber The extension field number to write out. |
| 642 | @param value The message from where to get the extension. |
| 643 | */ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 644 | - (void)writeMessageSetExtension:(int32_t)fieldNumber value:(GPBMessage *)value; |
| 645 | |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 646 | /** |
| 647 | Write an unparsed MessageSet extension field to the stream. For historical |
| 648 | reasons, the wire format differs from normal fields. |
| 649 | |
| 650 | @param fieldNumber The extension field number to write out. |
| 651 | @param value The raw message from where to get the extension. |
| 652 | */ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 653 | - (void)writeRawMessageSetExtension:(int32_t)fieldNumber value:(NSData *)value; |
| 654 | |
| 655 | @end |
| 656 | |
Thomas Van Lenten | 8c88957 | 2015-06-16 16:45:14 -0400 | [diff] [blame] | 657 | NS_ASSUME_NONNULL_END |
| 658 | |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 659 | // Write methods for types that can be in packed arrays. |
| 660 | //%PDDM-DEFINE _WRITE_PACKABLE_DECLS(NAME, ARRAY_TYPE, TYPE) |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 661 | //%/** |
| 662 | //% * Write a TYPE for the given field number. |
| 663 | //% * |
| 664 | //% * @param fieldNumber The field number assigned to the value. |
| 665 | //% * @param value The value to write out. |
| 666 | //% **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 667 | //%- (void)write##NAME:(int32_t)fieldNumber value:(TYPE)value; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 668 | //%/** |
| 669 | //% * Write a packed array of TYPE for the given field number. |
| 670 | //% * |
| 671 | //% * @param fieldNumber The field number assigned to the values. |
| 672 | //% * @param values The values to write out. |
| 673 | //% * @param tag The tag assigned to the values. |
| 674 | //% **/ |
Thomas Van Lenten | d846b0b | 2015-06-08 16:24:57 -0400 | [diff] [blame] | 675 | //%- (void)write##NAME##Array:(int32_t)fieldNumber |
| 676 | //% NAME$S values:(GPB##ARRAY_TYPE##Array *)values |
| 677 | //% NAME$S tag:(uint32_t)tag; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 678 | //%/** |
| 679 | //% * Write a TYPE without any tag. |
| 680 | //% * |
| 681 | //% * @param value The value to write out. |
| 682 | //% **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 683 | //%- (void)write##NAME##NoTag:(TYPE)value; |
| 684 | //% |
| 685 | // Write methods for types that aren't in packed arrays. |
| 686 | //%PDDM-DEFINE _WRITE_UNPACKABLE_DECLS(NAME, TYPE) |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 687 | //%/** |
| 688 | //% * Write a TYPE for the given field number. |
| 689 | //% * |
| 690 | //% * @param fieldNumber The field number assigned to the value. |
| 691 | //% * @param value The value to write out. |
| 692 | //% **/ |
Thomas Van Lenten | 2480acb | 2015-11-30 14:38:04 -0500 | [diff] [blame] | 693 | //%- (void)write##NAME:(int32_t)fieldNumber value:(TYPE *)value; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 694 | //%/** |
| 695 | //% * Write an array of TYPE for the given field number. |
| 696 | //% * |
| 697 | //% * @param fieldNumber The field number assigned to the values. |
| 698 | //% * @param values The values to write out. |
| 699 | //% **/ |
Dave MacLachlan | ab48ecf | 2020-01-20 13:47:20 -0800 | [diff] [blame] | 700 | //%- (void)write##NAME##Array:(int32_t)fieldNumber |
| 701 | //% NAME$S values:(NSArray<##TYPE##*> *)values; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 702 | //%/** |
| 703 | //% * Write a TYPE without any tag. |
| 704 | //% * |
| 705 | //% * @param value The value to write out. |
| 706 | //% **/ |
Thomas Van Lenten | 2480acb | 2015-11-30 14:38:04 -0500 | [diff] [blame] | 707 | //%- (void)write##NAME##NoTag:(TYPE *)value; |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 708 | //% |
| 709 | // Special write methods for Groups. |
| 710 | //%PDDM-DEFINE _WRITE_GROUP_DECLS(NAME, TYPE) |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 711 | //%/** |
| 712 | //% * Write a TYPE for the given field number. |
| 713 | //% * |
| 714 | //% * @param fieldNumber The field number assigned to the value. |
| 715 | //% * @param value The value to write out. |
| 716 | //% **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 717 | //%- (void)write##NAME:(int32_t)fieldNumber |
Thomas Van Lenten | 2480acb | 2015-11-30 14:38:04 -0500 | [diff] [blame] | 718 | //% NAME$S value:(TYPE *)value; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 719 | //%/** |
| 720 | //% * Write an array of TYPE for the given field number. |
| 721 | //% * |
| 722 | //% * @param fieldNumber The field number assigned to the values. |
| 723 | //% * @param values The values to write out. |
| 724 | //% **/ |
Dave MacLachlan | ab48ecf | 2020-01-20 13:47:20 -0800 | [diff] [blame] | 725 | //%- (void)write##NAME##Array:(int32_t)fieldNumber |
| 726 | //% NAME$S values:(NSArray<##TYPE##*> *)values; |
Sergio Campamá | 32fadc0 | 2016-08-08 07:15:02 -0700 | [diff] [blame] | 727 | //%/** |
| 728 | //% * Write a TYPE without any tag (but does write the endGroup tag). |
| 729 | //% * |
| 730 | //% * @param fieldNumber The field number assigned to the value. |
| 731 | //% * @param value The value to write out. |
| 732 | //% **/ |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 733 | //%- (void)write##NAME##NoTag:(int32_t)fieldNumber |
Thomas Van Lenten | 2480acb | 2015-11-30 14:38:04 -0500 | [diff] [blame] | 734 | //% NAME$S value:(TYPE *)value; |
Thomas Van Lenten | 30650d8 | 2015-05-01 08:57:16 -0400 | [diff] [blame] | 735 | //% |
| 736 | |
| 737 | // One macro to hide it all up above. |
| 738 | //%PDDM-DEFINE _WRITE_DECLS() |
| 739 | //%_WRITE_PACKABLE_DECLS(Double, Double, double) |
| 740 | //%_WRITE_PACKABLE_DECLS(Float, Float, float) |
| 741 | //%_WRITE_PACKABLE_DECLS(UInt64, UInt64, uint64_t) |
| 742 | //%_WRITE_PACKABLE_DECLS(Int64, Int64, int64_t) |
| 743 | //%_WRITE_PACKABLE_DECLS(Int32, Int32, int32_t) |
| 744 | //%_WRITE_PACKABLE_DECLS(UInt32, UInt32, uint32_t) |
| 745 | //%_WRITE_PACKABLE_DECLS(Fixed64, UInt64, uint64_t) |
| 746 | //%_WRITE_PACKABLE_DECLS(Fixed32, UInt32, uint32_t) |
| 747 | //%_WRITE_PACKABLE_DECLS(SInt32, Int32, int32_t) |
| 748 | //%_WRITE_PACKABLE_DECLS(SInt64, Int64, int64_t) |
| 749 | //%_WRITE_PACKABLE_DECLS(SFixed64, Int64, int64_t) |
| 750 | //%_WRITE_PACKABLE_DECLS(SFixed32, Int32, int32_t) |
| 751 | //%_WRITE_PACKABLE_DECLS(Bool, Bool, BOOL) |
| 752 | //%_WRITE_PACKABLE_DECLS(Enum, Enum, int32_t) |
Thomas Van Lenten | 2480acb | 2015-11-30 14:38:04 -0500 | [diff] [blame] | 753 | //%_WRITE_UNPACKABLE_DECLS(String, NSString) |
| 754 | //%_WRITE_UNPACKABLE_DECLS(Message, GPBMessage) |
| 755 | //%_WRITE_UNPACKABLE_DECLS(Bytes, NSData) |
| 756 | //%_WRITE_GROUP_DECLS(Group, GPBMessage) |
| 757 | //%_WRITE_GROUP_DECLS(UnknownGroup, GPBUnknownFieldSet) |