protobuf/objectivec/GPBCodedOutputStream.h
Go to the documentation of this file.
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 
52 extern NSString *const GPBCodedOutputStreamException_OutOfSpace;
53 extern NSString *const GPBCodedOutputStreamException_WriteFailed;
54 
66 @interface GPBCodedOutputStream : NSObject
67 
76 + (instancetype)streamWithData:(NSMutableData *)data;
77 
85 + (instancetype)streamWithOutputStream:(NSOutputStream *)output;
86 
95 - (instancetype)initWithData:(NSMutableData *)data;
96 
104 - (instancetype)initWithOutputStream:(NSOutputStream *)output;
105 
109 - (void)flush;
110 
116 - (void)writeRawByte:(uint8_t)value;
117 
124 - (void)writeTag:(uint32_t)fieldNumber format:(GPBWireFormat)format;
125 
131 - (void)writeRawLittleEndian32:(int32_t)value;
137 - (void)writeRawLittleEndian64:(int64_t)value;
138 
144 - (void)writeRawVarint32:(int32_t)value;
150 - (void)writeRawVarint64:(int64_t)value;
151 
159 - (void)writeRawVarintSizeTAs32:(size_t)value;
160 
166 - (void)writeRawData:(NSData *)data;
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 
188 - (void)writeDouble:(int32_t)fieldNumber value:(double)value;
196 - (void)writeDoubleArray:(int32_t)fieldNumber
197  values:(GPBDoubleArray *)values
198  tag:(uint32_t)tag;
204 - (void)writeDoubleNoTag:(double)value;
205 
212 - (void)writeFloat:(int32_t)fieldNumber value:(float)value;
220 - (void)writeFloatArray:(int32_t)fieldNumber
221  values:(GPBFloatArray *)values
222  tag:(uint32_t)tag;
228 - (void)writeFloatNoTag:(float)value;
229 
236 - (void)writeUInt64:(int32_t)fieldNumber value:(uint64_t)value;
244 - (void)writeUInt64Array:(int32_t)fieldNumber
245  values:(GPBUInt64Array *)values
246  tag:(uint32_t)tag;
252 - (void)writeUInt64NoTag:(uint64_t)value;
253 
260 - (void)writeInt64:(int32_t)fieldNumber value:(int64_t)value;
268 - (void)writeInt64Array:(int32_t)fieldNumber
269  values:(GPBInt64Array *)values
270  tag:(uint32_t)tag;
276 - (void)writeInt64NoTag:(int64_t)value;
277 
284 - (void)writeInt32:(int32_t)fieldNumber value:(int32_t)value;
292 - (void)writeInt32Array:(int32_t)fieldNumber
293  values:(GPBInt32Array *)values
294  tag:(uint32_t)tag;
300 - (void)writeInt32NoTag:(int32_t)value;
301 
308 - (void)writeUInt32:(int32_t)fieldNumber value:(uint32_t)value;
316 - (void)writeUInt32Array:(int32_t)fieldNumber
317  values:(GPBUInt32Array *)values
318  tag:(uint32_t)tag;
324 - (void)writeUInt32NoTag:(uint32_t)value;
325 
332 - (void)writeFixed64:(int32_t)fieldNumber value:(uint64_t)value;
340 - (void)writeFixed64Array:(int32_t)fieldNumber
341  values:(GPBUInt64Array *)values
342  tag:(uint32_t)tag;
348 - (void)writeFixed64NoTag:(uint64_t)value;
349 
356 - (void)writeFixed32:(int32_t)fieldNumber value:(uint32_t)value;
364 - (void)writeFixed32Array:(int32_t)fieldNumber
365  values:(GPBUInt32Array *)values
366  tag:(uint32_t)tag;
372 - (void)writeFixed32NoTag:(uint32_t)value;
373 
380 - (void)writeSInt32:(int32_t)fieldNumber value:(int32_t)value;
388 - (void)writeSInt32Array:(int32_t)fieldNumber
389  values:(GPBInt32Array *)values
390  tag:(uint32_t)tag;
396 - (void)writeSInt32NoTag:(int32_t)value;
397 
404 - (void)writeSInt64:(int32_t)fieldNumber value:(int64_t)value;
412 - (void)writeSInt64Array:(int32_t)fieldNumber
413  values:(GPBInt64Array *)values
414  tag:(uint32_t)tag;
420 - (void)writeSInt64NoTag:(int64_t)value;
421 
428 - (void)writeSFixed64:(int32_t)fieldNumber value:(int64_t)value;
436 - (void)writeSFixed64Array:(int32_t)fieldNumber
437  values:(GPBInt64Array *)values
438  tag:(uint32_t)tag;
444 - (void)writeSFixed64NoTag:(int64_t)value;
445 
452 - (void)writeSFixed32:(int32_t)fieldNumber value:(int32_t)value;
460 - (void)writeSFixed32Array:(int32_t)fieldNumber
461  values:(GPBInt32Array *)values
462  tag:(uint32_t)tag;
468 - (void)writeSFixed32NoTag:(int32_t)value;
469 
476 - (void)writeBool:(int32_t)fieldNumber value:(BOOL)value;
484 - (void)writeBoolArray:(int32_t)fieldNumber
485  values:(GPBBoolArray *)values
486  tag:(uint32_t)tag;
492 - (void)writeBoolNoTag:(BOOL)value;
493 
500 - (void)writeEnum:(int32_t)fieldNumber value:(int32_t)value;
508 - (void)writeEnumArray:(int32_t)fieldNumber
509  values:(GPBEnumArray *)values
510  tag:(uint32_t)tag;
516 - (void)writeEnumNoTag:(int32_t)value;
517 
524 - (void)writeString:(int32_t)fieldNumber value:(NSString *)value;
531 - (void)writeStringArray:(int32_t)fieldNumber
532  values:(NSArray<NSString*> *)values;
538 - (void)writeStringNoTag:(NSString *)value;
539 
546 - (void)writeMessage:(int32_t)fieldNumber value:(GPBMessage *)value;
553 - (void)writeMessageArray:(int32_t)fieldNumber
554  values:(NSArray<GPBMessage*> *)values;
560 - (void)writeMessageNoTag:(GPBMessage *)value;
561 
568 - (void)writeBytes:(int32_t)fieldNumber value:(NSData *)value;
575 - (void)writeBytesArray:(int32_t)fieldNumber
576  values:(NSArray<NSData*> *)values;
582 - (void)writeBytesNoTag:(NSData *)value;
583 
590 - (void)writeGroup:(int32_t)fieldNumber
591  value:(GPBMessage *)value;
598 - (void)writeGroupArray:(int32_t)fieldNumber
599  values:(NSArray<GPBMessage*> *)values;
606 - (void)writeGroupNoTag:(int32_t)fieldNumber
607  value:(GPBMessage *)value;
608 
615 - (void)writeUnknownGroup:(int32_t)fieldNumber
616  value:(GPBUnknownFieldSet *)value;
623 - (void)writeUnknownGroupArray:(int32_t)fieldNumber
624  values:(NSArray<GPBUnknownFieldSet*> *)values;
631 - (void)writeUnknownGroupNoTag:(int32_t)fieldNumber
632  value:(GPBUnknownFieldSet *)value;
633 
634 // clang-format on
635 //%PDDM-EXPAND-END _WRITE_DECLS()
636 
644 - (void)writeMessageSetExtension:(int32_t)fieldNumber value:(GPBMessage *)value;
645 
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)
GPBInt64Array
Definition: bloaty/third_party/protobuf/objectivec/GPBArray.h:392
GPBBoolArray
Definition: bloaty/third_party/protobuf/objectivec/GPBArray.h:1080
GPBCodedOutputStreamException_OutOfSpace
NS_ASSUME_NONNULL_BEGIN NSString *const GPBCodedOutputStreamException_OutOfSpace
Json::writeString
std::string JSON_API writeString(StreamWriter::Factory const &factory, Value const &root)
Write into stringstream, then return string, for convenience. A StreamWriter will be created from the...
Definition: bloaty/third_party/protobuf/conformance/third_party/jsoncpp/jsoncpp.cpp:5169
const
#define const
Definition: bloaty/third_party/zlib/zconf.h:230
GPBRuntimeTypes.h
uint8_t
unsigned char uint8_t
Definition: stdint-msvc2008.h:78
BOOL
int BOOL
Definition: undname.c:46
uint32_t
unsigned int uint32_t
Definition: stdint-msvc2008.h:80
int64_t
signed __int64 int64_t
Definition: stdint-msvc2008.h:89
GPBEnumArray
Definition: bloaty/third_party/protobuf/objectivec/GPBArray.h:1252
uint64_t
unsigned __int64 uint64_t
Definition: stdint-msvc2008.h:90
GPBFloatArray
Definition: bloaty/third_party/protobuf/objectivec/GPBArray.h:736
GPBUInt32Array
Definition: bloaty/third_party/protobuf/objectivec/GPBArray.h:220
GPBCodedOutputStream
Definition: bloaty/third_party/protobuf/objectivec/GPBCodedOutputStream.h:66
GPBDoubleArray
Definition: bloaty/third_party/protobuf/objectivec/GPBArray.h:908
GPBCodedOutputStreamException_WriteFailed
NSString *const GPBCodedOutputStreamException_WriteFailed
GPBMessage
Definition: bloaty/third_party/protobuf/objectivec/GPBMessage.h:83
GPBUInt64Array
Definition: bloaty/third_party/protobuf/objectivec/GPBArray.h:564
GPBWireFormat.h
-[GPBCodedOutputStream flush]
void flush()
GPBUnknownFieldSet
Definition: bloaty/third_party/protobuf/objectivec/GPBUnknownFieldSet.h:43
GPBWireFormat
GPBWireFormat
Definition: bloaty/third_party/protobuf/objectivec/GPBWireFormat.h:37
GPBInt32Array
Definition: bloaty/third_party/protobuf/objectivec/GPBArray.h:48
int32_t
signed int int32_t
Definition: stdint-msvc2008.h:77


grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:59:45