• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 // clang-format off
181 
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  **/
188 - (void)writeDouble:(int32_t)fieldNumber value:(double)value;
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  **/
196 - (void)writeDoubleArray:(int32_t)fieldNumber
197                   values:(GPBDoubleArray *)values
198                      tag:(uint32_t)tag;
199 /**
200  * Write a double without any tag.
201  *
202  * @param value The value to write out.
203  **/
204 - (void)writeDoubleNoTag:(double)value;
205 
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  **/
212 - (void)writeFloat:(int32_t)fieldNumber value:(float)value;
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  **/
220 - (void)writeFloatArray:(int32_t)fieldNumber
221                  values:(GPBFloatArray *)values
222                     tag:(uint32_t)tag;
223 /**
224  * Write a float without any tag.
225  *
226  * @param value The value to write out.
227  **/
228 - (void)writeFloatNoTag:(float)value;
229 
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  **/
236 - (void)writeUInt64:(int32_t)fieldNumber value:(uint64_t)value;
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  **/
244 - (void)writeUInt64Array:(int32_t)fieldNumber
245                   values:(GPBUInt64Array *)values
246                      tag:(uint32_t)tag;
247 /**
248  * Write a uint64_t without any tag.
249  *
250  * @param value The value to write out.
251  **/
252 - (void)writeUInt64NoTag:(uint64_t)value;
253 
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  **/
260 - (void)writeInt64:(int32_t)fieldNumber value:(int64_t)value;
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  **/
268 - (void)writeInt64Array:(int32_t)fieldNumber
269                  values:(GPBInt64Array *)values
270                     tag:(uint32_t)tag;
271 /**
272  * Write a int64_t without any tag.
273  *
274  * @param value The value to write out.
275  **/
276 - (void)writeInt64NoTag:(int64_t)value;
277 
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  **/
284 - (void)writeInt32:(int32_t)fieldNumber value:(int32_t)value;
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  **/
292 - (void)writeInt32Array:(int32_t)fieldNumber
293                  values:(GPBInt32Array *)values
294                     tag:(uint32_t)tag;
295 /**
296  * Write a int32_t without any tag.
297  *
298  * @param value The value to write out.
299  **/
300 - (void)writeInt32NoTag:(int32_t)value;
301 
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  **/
308 - (void)writeUInt32:(int32_t)fieldNumber value:(uint32_t)value;
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  **/
316 - (void)writeUInt32Array:(int32_t)fieldNumber
317                   values:(GPBUInt32Array *)values
318                      tag:(uint32_t)tag;
319 /**
320  * Write a uint32_t without any tag.
321  *
322  * @param value The value to write out.
323  **/
324 - (void)writeUInt32NoTag:(uint32_t)value;
325 
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  **/
332 - (void)writeFixed64:(int32_t)fieldNumber value:(uint64_t)value;
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  **/
340 - (void)writeFixed64Array:(int32_t)fieldNumber
341                    values:(GPBUInt64Array *)values
342                       tag:(uint32_t)tag;
343 /**
344  * Write a uint64_t without any tag.
345  *
346  * @param value The value to write out.
347  **/
348 - (void)writeFixed64NoTag:(uint64_t)value;
349 
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  **/
356 - (void)writeFixed32:(int32_t)fieldNumber value:(uint32_t)value;
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  **/
364 - (void)writeFixed32Array:(int32_t)fieldNumber
365                    values:(GPBUInt32Array *)values
366                       tag:(uint32_t)tag;
367 /**
368  * Write a uint32_t without any tag.
369  *
370  * @param value The value to write out.
371  **/
372 - (void)writeFixed32NoTag:(uint32_t)value;
373 
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  **/
380 - (void)writeSInt32:(int32_t)fieldNumber value:(int32_t)value;
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  **/
388 - (void)writeSInt32Array:(int32_t)fieldNumber
389                   values:(GPBInt32Array *)values
390                      tag:(uint32_t)tag;
391 /**
392  * Write a int32_t without any tag.
393  *
394  * @param value The value to write out.
395  **/
396 - (void)writeSInt32NoTag:(int32_t)value;
397 
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  **/
404 - (void)writeSInt64:(int32_t)fieldNumber value:(int64_t)value;
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  **/
412 - (void)writeSInt64Array:(int32_t)fieldNumber
413                   values:(GPBInt64Array *)values
414                      tag:(uint32_t)tag;
415 /**
416  * Write a int64_t without any tag.
417  *
418  * @param value The value to write out.
419  **/
420 - (void)writeSInt64NoTag:(int64_t)value;
421 
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  **/
428 - (void)writeSFixed64:(int32_t)fieldNumber value:(int64_t)value;
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  **/
436 - (void)writeSFixed64Array:(int32_t)fieldNumber
437                     values:(GPBInt64Array *)values
438                        tag:(uint32_t)tag;
439 /**
440  * Write a int64_t without any tag.
441  *
442  * @param value The value to write out.
443  **/
444 - (void)writeSFixed64NoTag:(int64_t)value;
445 
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  **/
452 - (void)writeSFixed32:(int32_t)fieldNumber value:(int32_t)value;
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  **/
460 - (void)writeSFixed32Array:(int32_t)fieldNumber
461                     values:(GPBInt32Array *)values
462                        tag:(uint32_t)tag;
463 /**
464  * Write a int32_t without any tag.
465  *
466  * @param value The value to write out.
467  **/
468 - (void)writeSFixed32NoTag:(int32_t)value;
469 
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  **/
476 - (void)writeBool:(int32_t)fieldNumber value:(BOOL)value;
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  **/
484 - (void)writeBoolArray:(int32_t)fieldNumber
485                 values:(GPBBoolArray *)values
486                    tag:(uint32_t)tag;
487 /**
488  * Write a BOOL without any tag.
489  *
490  * @param value The value to write out.
491  **/
492 - (void)writeBoolNoTag:(BOOL)value;
493 
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  **/
500 - (void)writeEnum:(int32_t)fieldNumber value:(int32_t)value;
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  **/
508 - (void)writeEnumArray:(int32_t)fieldNumber
509                 values:(GPBEnumArray *)values
510                    tag:(uint32_t)tag;
511 /**
512  * Write a int32_t without any tag.
513  *
514  * @param value The value to write out.
515  **/
516 - (void)writeEnumNoTag:(int32_t)value;
517 
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  **/
524 - (void)writeString:(int32_t)fieldNumber value:(NSString *)value;
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  **/
531 - (void)writeStringArray:(int32_t)fieldNumber
532                   values:(NSArray<NSString*> *)values;
533 /**
534  * Write a NSString without any tag.
535  *
536  * @param value The value to write out.
537  **/
538 - (void)writeStringNoTag:(NSString *)value;
539 
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  **/
546 - (void)writeMessage:(int32_t)fieldNumber value:(GPBMessage *)value;
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  **/
553 - (void)writeMessageArray:(int32_t)fieldNumber
554                    values:(NSArray<GPBMessage*> *)values;
555 /**
556  * Write a GPBMessage without any tag.
557  *
558  * @param value The value to write out.
559  **/
560 - (void)writeMessageNoTag:(GPBMessage *)value;
561 
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  **/
568 - (void)writeBytes:(int32_t)fieldNumber value:(NSData *)value;
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  **/
575 - (void)writeBytesArray:(int32_t)fieldNumber
576                  values:(NSArray<NSData*> *)values;
577 /**
578  * Write a NSData without any tag.
579  *
580  * @param value The value to write out.
581  **/
582 - (void)writeBytesNoTag:(NSData *)value;
583 
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  **/
590 - (void)writeGroup:(int32_t)fieldNumber
591              value:(GPBMessage *)value;
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  **/
598 - (void)writeGroupArray:(int32_t)fieldNumber
599                  values:(NSArray<GPBMessage*> *)values;
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  **/
606 - (void)writeGroupNoTag:(int32_t)fieldNumber
607                   value:(GPBMessage *)value;
608 
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  **/
615 - (void)writeUnknownGroup:(int32_t)fieldNumber
616                     value:(GPBUnknownFieldSet *)value;
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  **/
623 - (void)writeUnknownGroupArray:(int32_t)fieldNumber
624                         values:(NSArray<GPBUnknownFieldSet*> *)values;
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  **/
631 - (void)writeUnknownGroupNoTag:(int32_t)fieldNumber
632                          value:(GPBUnknownFieldSet *)value;
633 
634 // clang-format on
635 //%PDDM-EXPAND-END _WRITE_DECLS()
636 
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 */
644 - (void)writeMessageSetExtension:(int32_t)fieldNumber value:(GPBMessage *)value;
645 
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 */
653 - (void)writeRawMessageSetExtension:(int32_t)fieldNumber value:(NSData *)value;
654 
655 @end
656 
657 NS_ASSUME_NONNULL_END
658 
659 // Write methods for types that can be in packed arrays.
660 //%PDDM-DEFINE _WRITE_PACKABLE_DECLS(NAME, ARRAY_TYPE, TYPE)
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 //% **/
667 //%- (void)write##NAME:(int32_t)fieldNumber value:(TYPE)value;
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 //% **/
675 //%- (void)write##NAME##Array:(int32_t)fieldNumber
676 //%       NAME$S     values:(GPB##ARRAY_TYPE##Array *)values
677 //%       NAME$S        tag:(uint32_t)tag;
678 //%/**
679 //% * Write a TYPE without any tag.
680 //% *
681 //% * @param value The value to write out.
682 //% **/
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)
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 //% **/
693 //%- (void)write##NAME:(int32_t)fieldNumber value:(TYPE *)value;
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 //% **/
700 //%- (void)write##NAME##Array:(int32_t)fieldNumber
701 //%           NAME$S values:(NSArray<##TYPE##*> *)values;
702 //%/**
703 //% * Write a TYPE without any tag.
704 //% *
705 //% * @param value The value to write out.
706 //% **/
707 //%- (void)write##NAME##NoTag:(TYPE *)value;
708 //%
709 // Special write methods for Groups.
710 //%PDDM-DEFINE _WRITE_GROUP_DECLS(NAME, TYPE)
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 //% **/
717 //%- (void)write##NAME:(int32_t)fieldNumber
718 //%       NAME$S value:(TYPE *)value;
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 //% **/
725 //%- (void)write##NAME##Array:(int32_t)fieldNumber
726 //%           NAME$S values:(NSArray<##TYPE##*> *)values;
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 //% **/
733 //%- (void)write##NAME##NoTag:(int32_t)fieldNumber
734 //%            NAME$S value:(TYPE *)value;
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)
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)
758