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 33 #import "GPBRuntimeTypes.h" 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 47 NS_ASSUME_NONNULL_BEGIN 48 49 /** 50 * @c GPBCodedOutputStream exception names. 51 **/ 52 extern NSString *const GPBCodedOutputStreamException_OutOfSpace; 53 extern NSString *const GPBCodedOutputStreamException_WriteFailed; 54 55 /** 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 * 61 * @note Any -write* api can raise the GPBCodedOutputStreamException_* 62 * exceptions. 63 * 64 * @note Subclassing of GPBCodedOutputStream is NOT supported. 65 **/ 66 @interface GPBCodedOutputStream : NSObject 67 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 **/ 76 + (instancetype)streamWithData:(NSMutableData *)data; 77 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 **/ 85 + (instancetype)streamWithOutputStream:(NSOutputStream *)output; 86 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 **/ 95 - (instancetype)initWithData:(NSMutableData *)data; 96 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 **/ 104 - (instancetype)initWithOutputStream:(NSOutputStream *)output; 105 106 /** 107 * Flush any buffered data out. 108 **/ 109 - (void)flush; 110 111 /** 112 * Write the raw byte out. 113 * 114 * @param value The value to write out. 115 **/ 116 - (void)writeRawByte:(uint8_t)value; 117 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 **/ 124 - (void)writeTag:(uint32_t)fieldNumber format:(GPBWireFormat)format; 125 126 /** 127 * Write a 32bit value out in little endian format. 128 * 129 * @param value The value to write out. 130 **/ 131 - (void)writeRawLittleEndian32:(int32_t)value; 132 /** 133 * Write a 64bit value out in little endian format. 134 * 135 * @param value The value to write out. 136 **/ 137 - (void)writeRawLittleEndian64:(int64_t)value; 138 139 /** 140 * Write a 32bit value out in varint format. 141 * 142 * @param value The value to write out. 143 **/ 144 - (void)writeRawVarint32:(int32_t)value; 145 /** 146 * Write a 64bit value out in varint format. 147 * 148 * @param value The value to write out. 149 **/ 150 - (void)writeRawVarint64:(int64_t)value; 151 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 **/ 159 - (void)writeRawVarintSizeTAs32:(size_t)value; 160 161 /** 162 * Writes the contents of an NSData out. 163 * 164 * @param data The data to write out. 165 **/ 166 - (void)writeRawData:(NSData *)data; 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 **/ 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. 180 181 /** 182 * Write a double for the given field number. 183 * 184 * @param fieldNumber The field number assigned to the value. 185 * @param value The value to write out. 186 **/ 187 - (void)writeDouble:(int32_t)fieldNumber value:(double)value; 188 /** 189 * Write a packed array of double for the given field number. 190 * 191 * @param fieldNumber The field number assigned to the values. 192 * @param values The values to write out. 193 * @param tag The tag assigned to the values. 194 **/ 195 - (void)writeDoubleArray:(int32_t)fieldNumber 196 values:(GPBDoubleArray *)values 197 tag:(uint32_t)tag; 198 /** 199 * Write a double without any tag. 200 * 201 * @param value The value to write out. 202 **/ 203 - (void)writeDoubleNoTag:(double)value; 204 205 /** 206 * Write a float for the given field number. 207 * 208 * @param fieldNumber The field number assigned to the value. 209 * @param value The value to write out. 210 **/ 211 - (void)writeFloat:(int32_t)fieldNumber value:(float)value; 212 /** 213 * Write a packed array of float for the given field number. 214 * 215 * @param fieldNumber The field number assigned to the values. 216 * @param values The values to write out. 217 * @param tag The tag assigned to the values. 218 **/ 219 - (void)writeFloatArray:(int32_t)fieldNumber 220 values:(GPBFloatArray *)values 221 tag:(uint32_t)tag; 222 /** 223 * Write a float without any tag. 224 * 225 * @param value The value to write out. 226 **/ 227 - (void)writeFloatNoTag:(float)value; 228 229 /** 230 * Write a uint64_t for the given field number. 231 * 232 * @param fieldNumber The field number assigned to the value. 233 * @param value The value to write out. 234 **/ 235 - (void)writeUInt64:(int32_t)fieldNumber value:(uint64_t)value; 236 /** 237 * Write a packed array of uint64_t for the given field number. 238 * 239 * @param fieldNumber The field number assigned to the values. 240 * @param values The values to write out. 241 * @param tag The tag assigned to the values. 242 **/ 243 - (void)writeUInt64Array:(int32_t)fieldNumber 244 values:(GPBUInt64Array *)values 245 tag:(uint32_t)tag; 246 /** 247 * Write a uint64_t without any tag. 248 * 249 * @param value The value to write out. 250 **/ 251 - (void)writeUInt64NoTag:(uint64_t)value; 252 253 /** 254 * Write a int64_t for the given field number. 255 * 256 * @param fieldNumber The field number assigned to the value. 257 * @param value The value to write out. 258 **/ 259 - (void)writeInt64:(int32_t)fieldNumber value:(int64_t)value; 260 /** 261 * Write a packed array of int64_t for the given field number. 262 * 263 * @param fieldNumber The field number assigned to the values. 264 * @param values The values to write out. 265 * @param tag The tag assigned to the values. 266 **/ 267 - (void)writeInt64Array:(int32_t)fieldNumber 268 values:(GPBInt64Array *)values 269 tag:(uint32_t)tag; 270 /** 271 * Write a int64_t without any tag. 272 * 273 * @param value The value to write out. 274 **/ 275 - (void)writeInt64NoTag:(int64_t)value; 276 277 /** 278 * Write a int32_t for the given field number. 279 * 280 * @param fieldNumber The field number assigned to the value. 281 * @param value The value to write out. 282 **/ 283 - (void)writeInt32:(int32_t)fieldNumber value:(int32_t)value; 284 /** 285 * Write a packed array of int32_t for the given field number. 286 * 287 * @param fieldNumber The field number assigned to the values. 288 * @param values The values to write out. 289 * @param tag The tag assigned to the values. 290 **/ 291 - (void)writeInt32Array:(int32_t)fieldNumber 292 values:(GPBInt32Array *)values 293 tag:(uint32_t)tag; 294 /** 295 * Write a int32_t without any tag. 296 * 297 * @param value The value to write out. 298 **/ 299 - (void)writeInt32NoTag:(int32_t)value; 300 301 /** 302 * Write a uint32_t for the given field number. 303 * 304 * @param fieldNumber The field number assigned to the value. 305 * @param value The value to write out. 306 **/ 307 - (void)writeUInt32:(int32_t)fieldNumber value:(uint32_t)value; 308 /** 309 * Write a packed array of uint32_t for the given field number. 310 * 311 * @param fieldNumber The field number assigned to the values. 312 * @param values The values to write out. 313 * @param tag The tag assigned to the values. 314 **/ 315 - (void)writeUInt32Array:(int32_t)fieldNumber 316 values:(GPBUInt32Array *)values 317 tag:(uint32_t)tag; 318 /** 319 * Write a uint32_t without any tag. 320 * 321 * @param value The value to write out. 322 **/ 323 - (void)writeUInt32NoTag:(uint32_t)value; 324 325 /** 326 * Write a uint64_t for the given field number. 327 * 328 * @param fieldNumber The field number assigned to the value. 329 * @param value The value to write out. 330 **/ 331 - (void)writeFixed64:(int32_t)fieldNumber value:(uint64_t)value; 332 /** 333 * Write a packed array of uint64_t for the given field number. 334 * 335 * @param fieldNumber The field number assigned to the values. 336 * @param values The values to write out. 337 * @param tag The tag assigned to the values. 338 **/ 339 - (void)writeFixed64Array:(int32_t)fieldNumber 340 values:(GPBUInt64Array *)values 341 tag:(uint32_t)tag; 342 /** 343 * Write a uint64_t without any tag. 344 * 345 * @param value The value to write out. 346 **/ 347 - (void)writeFixed64NoTag:(uint64_t)value; 348 349 /** 350 * Write a uint32_t for the given field number. 351 * 352 * @param fieldNumber The field number assigned to the value. 353 * @param value The value to write out. 354 **/ 355 - (void)writeFixed32:(int32_t)fieldNumber value:(uint32_t)value; 356 /** 357 * Write a packed array of uint32_t for the given field number. 358 * 359 * @param fieldNumber The field number assigned to the values. 360 * @param values The values to write out. 361 * @param tag The tag assigned to the values. 362 **/ 363 - (void)writeFixed32Array:(int32_t)fieldNumber 364 values:(GPBUInt32Array *)values 365 tag:(uint32_t)tag; 366 /** 367 * Write a uint32_t without any tag. 368 * 369 * @param value The value to write out. 370 **/ 371 - (void)writeFixed32NoTag:(uint32_t)value; 372 373 /** 374 * Write a int32_t for the given field number. 375 * 376 * @param fieldNumber The field number assigned to the value. 377 * @param value The value to write out. 378 **/ 379 - (void)writeSInt32:(int32_t)fieldNumber value:(int32_t)value; 380 /** 381 * Write a packed array of int32_t for the given field number. 382 * 383 * @param fieldNumber The field number assigned to the values. 384 * @param values The values to write out. 385 * @param tag The tag assigned to the values. 386 **/ 387 - (void)writeSInt32Array:(int32_t)fieldNumber 388 values:(GPBInt32Array *)values 389 tag:(uint32_t)tag; 390 /** 391 * Write a int32_t without any tag. 392 * 393 * @param value The value to write out. 394 **/ 395 - (void)writeSInt32NoTag:(int32_t)value; 396 397 /** 398 * Write a int64_t for the given field number. 399 * 400 * @param fieldNumber The field number assigned to the value. 401 * @param value The value to write out. 402 **/ 403 - (void)writeSInt64:(int32_t)fieldNumber value:(int64_t)value; 404 /** 405 * Write a packed array of int64_t for the given field number. 406 * 407 * @param fieldNumber The field number assigned to the values. 408 * @param values The values to write out. 409 * @param tag The tag assigned to the values. 410 **/ 411 - (void)writeSInt64Array:(int32_t)fieldNumber 412 values:(GPBInt64Array *)values 413 tag:(uint32_t)tag; 414 /** 415 * Write a int64_t without any tag. 416 * 417 * @param value The value to write out. 418 **/ 419 - (void)writeSInt64NoTag:(int64_t)value; 420 421 /** 422 * Write a int64_t for the given field number. 423 * 424 * @param fieldNumber The field number assigned to the value. 425 * @param value The value to write out. 426 **/ 427 - (void)writeSFixed64:(int32_t)fieldNumber value:(int64_t)value; 428 /** 429 * Write a packed array of int64_t for the given field number. 430 * 431 * @param fieldNumber The field number assigned to the values. 432 * @param values The values to write out. 433 * @param tag The tag assigned to the values. 434 **/ 435 - (void)writeSFixed64Array:(int32_t)fieldNumber 436 values:(GPBInt64Array *)values 437 tag:(uint32_t)tag; 438 /** 439 * Write a int64_t without any tag. 440 * 441 * @param value The value to write out. 442 **/ 443 - (void)writeSFixed64NoTag:(int64_t)value; 444 445 /** 446 * Write a int32_t for the given field number. 447 * 448 * @param fieldNumber The field number assigned to the value. 449 * @param value The value to write out. 450 **/ 451 - (void)writeSFixed32:(int32_t)fieldNumber value:(int32_t)value; 452 /** 453 * Write a packed array of int32_t for the given field number. 454 * 455 * @param fieldNumber The field number assigned to the values. 456 * @param values The values to write out. 457 * @param tag The tag assigned to the values. 458 **/ 459 - (void)writeSFixed32Array:(int32_t)fieldNumber 460 values:(GPBInt32Array *)values 461 tag:(uint32_t)tag; 462 /** 463 * Write a int32_t without any tag. 464 * 465 * @param value The value to write out. 466 **/ 467 - (void)writeSFixed32NoTag:(int32_t)value; 468 469 /** 470 * Write a BOOL for the given field number. 471 * 472 * @param fieldNumber The field number assigned to the value. 473 * @param value The value to write out. 474 **/ 475 - (void)writeBool:(int32_t)fieldNumber value:(BOOL)value; 476 /** 477 * Write a packed array of BOOL for the given field number. 478 * 479 * @param fieldNumber The field number assigned to the values. 480 * @param values The values to write out. 481 * @param tag The tag assigned to the values. 482 **/ 483 - (void)writeBoolArray:(int32_t)fieldNumber 484 values:(GPBBoolArray *)values 485 tag:(uint32_t)tag; 486 /** 487 * Write a BOOL without any tag. 488 * 489 * @param value The value to write out. 490 **/ 491 - (void)writeBoolNoTag:(BOOL)value; 492 493 /** 494 * Write a int32_t for the given field number. 495 * 496 * @param fieldNumber The field number assigned to the value. 497 * @param value The value to write out. 498 **/ 499 - (void)writeEnum:(int32_t)fieldNumber value:(int32_t)value; 500 /** 501 * Write a packed array of int32_t for the given field number. 502 * 503 * @param fieldNumber The field number assigned to the values. 504 * @param values The values to write out. 505 * @param tag The tag assigned to the values. 506 **/ 507 - (void)writeEnumArray:(int32_t)fieldNumber 508 values:(GPBEnumArray *)values 509 tag:(uint32_t)tag; 510 /** 511 * Write a int32_t without any tag. 512 * 513 * @param value The value to write out. 514 **/ 515 - (void)writeEnumNoTag:(int32_t)value; 516 517 /** 518 * Write a NSString for the given field number. 519 * 520 * @param fieldNumber The field number assigned to the value. 521 * @param value The value to write out. 522 **/ 523 - (void)writeString:(int32_t)fieldNumber value:(NSString *)value; 524 /** 525 * Write an array of NSString for the given field number. 526 * 527 * @param fieldNumber The field number assigned to the values. 528 * @param values The values to write out. 529 **/ 530 - (void)writeStringArray:(int32_t)fieldNumber values:(NSArray<NSString*> *)values; 531 /** 532 * Write a NSString without any tag. 533 * 534 * @param value The value to write out. 535 **/ 536 - (void)writeStringNoTag:(NSString *)value; 537 538 /** 539 * Write a GPBMessage for the given field number. 540 * 541 * @param fieldNumber The field number assigned to the value. 542 * @param value The value to write out. 543 **/ 544 - (void)writeMessage:(int32_t)fieldNumber value:(GPBMessage *)value; 545 /** 546 * Write an array of GPBMessage for the given field number. 547 * 548 * @param fieldNumber The field number assigned to the values. 549 * @param values The values to write out. 550 **/ 551 - (void)writeMessageArray:(int32_t)fieldNumber values:(NSArray<GPBMessage*> *)values; 552 /** 553 * Write a GPBMessage without any tag. 554 * 555 * @param value The value to write out. 556 **/ 557 - (void)writeMessageNoTag:(GPBMessage *)value; 558 559 /** 560 * Write a NSData for the given field number. 561 * 562 * @param fieldNumber The field number assigned to the value. 563 * @param value The value to write out. 564 **/ 565 - (void)writeBytes:(int32_t)fieldNumber value:(NSData *)value; 566 /** 567 * Write an array of NSData for the given field number. 568 * 569 * @param fieldNumber The field number assigned to the values. 570 * @param values The values to write out. 571 **/ 572 - (void)writeBytesArray:(int32_t)fieldNumber values:(NSArray<NSData*> *)values; 573 /** 574 * Write a NSData without any tag. 575 * 576 * @param value The value to write out. 577 **/ 578 - (void)writeBytesNoTag:(NSData *)value; 579 580 /** 581 * Write a GPBMessage for the given field number. 582 * 583 * @param fieldNumber The field number assigned to the value. 584 * @param value The value to write out. 585 **/ 586 - (void)writeGroup:(int32_t)fieldNumber 587 value:(GPBMessage *)value; 588 /** 589 * Write an array of GPBMessage for the given field number. 590 * 591 * @param fieldNumber The field number assigned to the values. 592 * @param values The values to write out. 593 **/ 594 - (void)writeGroupArray:(int32_t)fieldNumber values:(NSArray<GPBMessage*> *)values; 595 /** 596 * Write a GPBMessage without any tag (but does write the endGroup tag). 597 * 598 * @param fieldNumber The field number assigned to the value. 599 * @param value The value to write out. 600 **/ 601 - (void)writeGroupNoTag:(int32_t)fieldNumber 602 value:(GPBMessage *)value; 603 604 /** 605 * Write a GPBUnknownFieldSet for the given field number. 606 * 607 * @param fieldNumber The field number assigned to the value. 608 * @param value The value to write out. 609 **/ 610 - (void)writeUnknownGroup:(int32_t)fieldNumber 611 value:(GPBUnknownFieldSet *)value; 612 /** 613 * Write an array of GPBUnknownFieldSet for the given field number. 614 * 615 * @param fieldNumber The field number assigned to the values. 616 * @param values The values to write out. 617 **/ 618 - (void)writeUnknownGroupArray:(int32_t)fieldNumber values:(NSArray<GPBUnknownFieldSet*> *)values; 619 /** 620 * Write a GPBUnknownFieldSet without any tag (but does write the endGroup tag). 621 * 622 * @param fieldNumber The field number assigned to the value. 623 * @param value The value to write out. 624 **/ 625 - (void)writeUnknownGroupNoTag:(int32_t)fieldNumber 626 value:(GPBUnknownFieldSet *)value; 627 628 //%PDDM-EXPAND-END _WRITE_DECLS() 629 630 /** 631 Write a MessageSet extension field to the stream. For historical reasons, 632 the wire format differs from normal fields. 633 634 @param fieldNumber The extension field number to write out. 635 @param value The message from where to get the extension. 636 */ 637 - (void)writeMessageSetExtension:(int32_t)fieldNumber value:(GPBMessage *)value; 638 639 /** 640 Write an unparsed MessageSet extension field to the stream. For historical 641 reasons, the wire format differs from normal fields. 642 643 @param fieldNumber The extension field number to write out. 644 @param value The raw message from where to get the extension. 645 */ 646 - (void)writeRawMessageSetExtension:(int32_t)fieldNumber value:(NSData *)value; 647 648 @end 649 650 NS_ASSUME_NONNULL_END 651 652 // Write methods for types that can be in packed arrays. 653 //%PDDM-DEFINE _WRITE_PACKABLE_DECLS(NAME, ARRAY_TYPE, TYPE) 654 //%/** 655 //% * Write a TYPE for the given field number. 656 //% * 657 //% * @param fieldNumber The field number assigned to the value. 658 //% * @param value The value to write out. 659 //% **/ 660 //%- (void)write##NAME:(int32_t)fieldNumber value:(TYPE)value; 661 //%/** 662 //% * Write a packed array of TYPE for the given field number. 663 //% * 664 //% * @param fieldNumber The field number assigned to the values. 665 //% * @param values The values to write out. 666 //% * @param tag The tag assigned to the values. 667 //% **/ 668 //%- (void)write##NAME##Array:(int32_t)fieldNumber 669 //% NAME$S values:(GPB##ARRAY_TYPE##Array *)values 670 //% NAME$S tag:(uint32_t)tag; 671 //%/** 672 //% * Write a TYPE without any tag. 673 //% * 674 //% * @param value The value to write out. 675 //% **/ 676 //%- (void)write##NAME##NoTag:(TYPE)value; 677 //% 678 // Write methods for types that aren't in packed arrays. 679 //%PDDM-DEFINE _WRITE_UNPACKABLE_DECLS(NAME, TYPE) 680 //%/** 681 //% * Write a TYPE for the given field number. 682 //% * 683 //% * @param fieldNumber The field number assigned to the value. 684 //% * @param value The value to write out. 685 //% **/ 686 //%- (void)write##NAME:(int32_t)fieldNumber value:(TYPE *)value; 687 //%/** 688 //% * Write an array of TYPE for the given field number. 689 //% * 690 //% * @param fieldNumber The field number assigned to the values. 691 //% * @param values The values to write out. 692 //% **/ 693 //%- (void)write##NAME##Array:(int32_t)fieldNumber values:(NSArray<##TYPE##*> *)values; 694 //%/** 695 //% * Write a TYPE without any tag. 696 //% * 697 //% * @param value The value to write out. 698 //% **/ 699 //%- (void)write##NAME##NoTag:(TYPE *)value; 700 //% 701 // Special write methods for Groups. 702 //%PDDM-DEFINE _WRITE_GROUP_DECLS(NAME, TYPE) 703 //%/** 704 //% * Write a TYPE for the given field number. 705 //% * 706 //% * @param fieldNumber The field number assigned to the value. 707 //% * @param value The value to write out. 708 //% **/ 709 //%- (void)write##NAME:(int32_t)fieldNumber 710 //% NAME$S value:(TYPE *)value; 711 //%/** 712 //% * Write an array of TYPE for the given field number. 713 //% * 714 //% * @param fieldNumber The field number assigned to the values. 715 //% * @param values The values to write out. 716 //% **/ 717 //%- (void)write##NAME##Array:(int32_t)fieldNumber values:(NSArray<##TYPE##*> *)values; 718 //%/** 719 //% * Write a TYPE without any tag (but does write the endGroup tag). 720 //% * 721 //% * @param fieldNumber The field number assigned to the value. 722 //% * @param value The value to write out. 723 //% **/ 724 //%- (void)write##NAME##NoTag:(int32_t)fieldNumber 725 //% NAME$S value:(TYPE *)value; 726 //% 727 728 // One macro to hide it all up above. 729 //%PDDM-DEFINE _WRITE_DECLS() 730 //%_WRITE_PACKABLE_DECLS(Double, Double, double) 731 //%_WRITE_PACKABLE_DECLS(Float, Float, float) 732 //%_WRITE_PACKABLE_DECLS(UInt64, UInt64, uint64_t) 733 //%_WRITE_PACKABLE_DECLS(Int64, Int64, int64_t) 734 //%_WRITE_PACKABLE_DECLS(Int32, Int32, int32_t) 735 //%_WRITE_PACKABLE_DECLS(UInt32, UInt32, uint32_t) 736 //%_WRITE_PACKABLE_DECLS(Fixed64, UInt64, uint64_t) 737 //%_WRITE_PACKABLE_DECLS(Fixed32, UInt32, uint32_t) 738 //%_WRITE_PACKABLE_DECLS(SInt32, Int32, int32_t) 739 //%_WRITE_PACKABLE_DECLS(SInt64, Int64, int64_t) 740 //%_WRITE_PACKABLE_DECLS(SFixed64, Int64, int64_t) 741 //%_WRITE_PACKABLE_DECLS(SFixed32, Int32, int32_t) 742 //%_WRITE_PACKABLE_DECLS(Bool, Bool, BOOL) 743 //%_WRITE_PACKABLE_DECLS(Enum, Enum, int32_t) 744 //%_WRITE_UNPACKABLE_DECLS(String, NSString) 745 //%_WRITE_UNPACKABLE_DECLS(Message, GPBMessage) 746 //%_WRITE_UNPACKABLE_DECLS(Bytes, NSData) 747 //%_WRITE_GROUP_DECLS(Group, GPBMessage) 748 //%_WRITE_GROUP_DECLS(UnknownGroup, GPBUnknownFieldSet) 749