| OLD | NEW |
| 1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
| 2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
| 3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
| 4 // | 4 // |
| 5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
| 6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
| 7 // met: | 7 // met: |
| 8 // | 8 // |
| 9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
| 10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 @class GPBFloatArray; | 39 @class GPBFloatArray; |
| 40 @class GPBMessage; | 40 @class GPBMessage; |
| 41 @class GPBInt32Array; | 41 @class GPBInt32Array; |
| 42 @class GPBInt64Array; | 42 @class GPBInt64Array; |
| 43 @class GPBUInt32Array; | 43 @class GPBUInt32Array; |
| 44 @class GPBUInt64Array; | 44 @class GPBUInt64Array; |
| 45 @class GPBUnknownFieldSet; | 45 @class GPBUnknownFieldSet; |
| 46 | 46 |
| 47 NS_ASSUME_NONNULL_BEGIN | 47 NS_ASSUME_NONNULL_BEGIN |
| 48 | 48 |
| 49 /// Writes out protocol message fields. |
| 50 /// |
| 51 /// The common uses of protocol buffers shouldn't need to use this class. |
| 52 /// @c GPBMessage's provide a @c -data method that will serialize the message |
| 53 /// for you. |
| 54 /// |
| 55 /// @note Subclassing of GPBCodedOutputStream is NOT supported. |
| 49 @interface GPBCodedOutputStream : NSObject | 56 @interface GPBCodedOutputStream : NSObject |
| 50 | 57 |
| 51 // Creates a new stream to write into data. Data must be sized to fit or it | 58 /// Creates a stream to fill in the given data. Data must be sized to fit or |
| 52 // will error when it runs out of space. | 59 /// an error will be raised when out of space. |
| 53 + (instancetype)streamWithData:(NSMutableData *)data; | 60 + (instancetype)streamWithData:(NSMutableData *)data; |
| 61 |
| 62 /// Creates a stream to write into the given @c NSOutputStream. |
| 54 + (instancetype)streamWithOutputStream:(NSOutputStream *)output; | 63 + (instancetype)streamWithOutputStream:(NSOutputStream *)output; |
| 55 + (instancetype)streamWithOutputStream:(NSOutputStream *)output | |
| 56 bufferSize:(size_t)bufferSize; | |
| 57 | 64 |
| 65 /// Initializes a stream to fill in the given data. Data must be sized to fit |
| 66 /// or an error will be raised when out of space. |
| 58 - (instancetype)initWithData:(NSMutableData *)data; | 67 - (instancetype)initWithData:(NSMutableData *)data; |
| 68 |
| 69 /// Initializes a stream to write into the given @c NSOutputStream. |
| 59 - (instancetype)initWithOutputStream:(NSOutputStream *)output; | 70 - (instancetype)initWithOutputStream:(NSOutputStream *)output; |
| 60 - (instancetype)initWithOutputStream:(NSOutputStream *)output | |
| 61 bufferSize:(size_t)bufferSize; | |
| 62 | 71 |
| 72 /// Flush any buffered data out. |
| 63 - (void)flush; | 73 - (void)flush; |
| 64 | 74 |
| 75 /// Write the raw byte out. |
| 65 - (void)writeRawByte:(uint8_t)value; | 76 - (void)writeRawByte:(uint8_t)value; |
| 66 | 77 |
| 78 /// Write the tag for the given field number and wire format. |
| 79 /// |
| 80 /// @param fieldNumber The field number. |
| 81 /// @param format The wire format the data for the field will be in. |
| 67 - (void)writeTag:(uint32_t)fieldNumber format:(GPBWireFormat)format; | 82 - (void)writeTag:(uint32_t)fieldNumber format:(GPBWireFormat)format; |
| 68 | 83 |
| 84 /// Write a 32bit value out in little endian format. |
| 69 - (void)writeRawLittleEndian32:(int32_t)value; | 85 - (void)writeRawLittleEndian32:(int32_t)value; |
| 86 /// Write a 64bit value out in little endian format. |
| 70 - (void)writeRawLittleEndian64:(int64_t)value; | 87 - (void)writeRawLittleEndian64:(int64_t)value; |
| 71 | 88 |
| 89 /// Write a 32bit value out in varint format. |
| 72 - (void)writeRawVarint32:(int32_t)value; | 90 - (void)writeRawVarint32:(int32_t)value; |
| 91 /// Write a 64bit value out in varint format. |
| 73 - (void)writeRawVarint64:(int64_t)value; | 92 - (void)writeRawVarint64:(int64_t)value; |
| 74 | 93 |
| 75 // Note that this will truncate 64 bit values to 32. | 94 /// Write a size_t out as a 32bit varint value. |
| 95 /// |
| 96 /// @note This will truncate 64 bit values to 32. |
| 76 - (void)writeRawVarintSizeTAs32:(size_t)value; | 97 - (void)writeRawVarintSizeTAs32:(size_t)value; |
| 77 | 98 |
| 99 /// Writes the contents of an @c NSData out. |
| 78 - (void)writeRawData:(NSData *)data; | 100 - (void)writeRawData:(NSData *)data; |
| 101 /// Writes out the given data. |
| 102 /// |
| 103 /// @param data The data blob to write out. |
| 104 /// @param offset The offset into the blob to start writing out. |
| 105 /// @param length The number of bytes from the blob to write out. |
| 79 - (void)writeRawPtr:(const void *)data | 106 - (void)writeRawPtr:(const void *)data |
| 80 offset:(size_t)offset | 107 offset:(size_t)offset |
| 81 length:(size_t)length; | 108 length:(size_t)length; |
| 82 | 109 |
| 83 //%PDDM-EXPAND _WRITE_DECLS() | 110 //%PDDM-EXPAND _WRITE_DECLS() |
| 84 // This block of code is generated, do not edit it directly. | 111 // This block of code is generated, do not edit it directly. |
| 85 | 112 |
| 113 /// Write a double for the given field number. |
| 86 - (void)writeDouble:(int32_t)fieldNumber value:(double)value; | 114 - (void)writeDouble:(int32_t)fieldNumber value:(double)value; |
| 115 /// Write a packed array of double for the given field number. |
| 87 - (void)writeDoubleArray:(int32_t)fieldNumber | 116 - (void)writeDoubleArray:(int32_t)fieldNumber |
| 88 values:(GPBDoubleArray *)values | 117 values:(GPBDoubleArray *)values |
| 89 tag:(uint32_t)tag; | 118 tag:(uint32_t)tag; |
| 119 /// Write a double without any tag. |
| 90 - (void)writeDoubleNoTag:(double)value; | 120 - (void)writeDoubleNoTag:(double)value; |
| 91 | 121 |
| 122 /// Write a float for the given field number. |
| 92 - (void)writeFloat:(int32_t)fieldNumber value:(float)value; | 123 - (void)writeFloat:(int32_t)fieldNumber value:(float)value; |
| 124 /// Write a packed array of float for the given field number. |
| 93 - (void)writeFloatArray:(int32_t)fieldNumber | 125 - (void)writeFloatArray:(int32_t)fieldNumber |
| 94 values:(GPBFloatArray *)values | 126 values:(GPBFloatArray *)values |
| 95 tag:(uint32_t)tag; | 127 tag:(uint32_t)tag; |
| 128 /// Write a float without any tag. |
| 96 - (void)writeFloatNoTag:(float)value; | 129 - (void)writeFloatNoTag:(float)value; |
| 97 | 130 |
| 131 /// Write a uint64_t for the given field number. |
| 98 - (void)writeUInt64:(int32_t)fieldNumber value:(uint64_t)value; | 132 - (void)writeUInt64:(int32_t)fieldNumber value:(uint64_t)value; |
| 133 /// Write a packed array of uint64_t for the given field number. |
| 99 - (void)writeUInt64Array:(int32_t)fieldNumber | 134 - (void)writeUInt64Array:(int32_t)fieldNumber |
| 100 values:(GPBUInt64Array *)values | 135 values:(GPBUInt64Array *)values |
| 101 tag:(uint32_t)tag; | 136 tag:(uint32_t)tag; |
| 137 /// Write a uint64_t without any tag. |
| 102 - (void)writeUInt64NoTag:(uint64_t)value; | 138 - (void)writeUInt64NoTag:(uint64_t)value; |
| 103 | 139 |
| 140 /// Write a int64_t for the given field number. |
| 104 - (void)writeInt64:(int32_t)fieldNumber value:(int64_t)value; | 141 - (void)writeInt64:(int32_t)fieldNumber value:(int64_t)value; |
| 142 /// Write a packed array of int64_t for the given field number. |
| 105 - (void)writeInt64Array:(int32_t)fieldNumber | 143 - (void)writeInt64Array:(int32_t)fieldNumber |
| 106 values:(GPBInt64Array *)values | 144 values:(GPBInt64Array *)values |
| 107 tag:(uint32_t)tag; | 145 tag:(uint32_t)tag; |
| 146 /// Write a int64_t without any tag. |
| 108 - (void)writeInt64NoTag:(int64_t)value; | 147 - (void)writeInt64NoTag:(int64_t)value; |
| 109 | 148 |
| 149 /// Write a int32_t for the given field number. |
| 110 - (void)writeInt32:(int32_t)fieldNumber value:(int32_t)value; | 150 - (void)writeInt32:(int32_t)fieldNumber value:(int32_t)value; |
| 151 /// Write a packed array of int32_t for the given field number. |
| 111 - (void)writeInt32Array:(int32_t)fieldNumber | 152 - (void)writeInt32Array:(int32_t)fieldNumber |
| 112 values:(GPBInt32Array *)values | 153 values:(GPBInt32Array *)values |
| 113 tag:(uint32_t)tag; | 154 tag:(uint32_t)tag; |
| 155 /// Write a int32_t without any tag. |
| 114 - (void)writeInt32NoTag:(int32_t)value; | 156 - (void)writeInt32NoTag:(int32_t)value; |
| 115 | 157 |
| 158 /// Write a uint32_t for the given field number. |
| 116 - (void)writeUInt32:(int32_t)fieldNumber value:(uint32_t)value; | 159 - (void)writeUInt32:(int32_t)fieldNumber value:(uint32_t)value; |
| 160 /// Write a packed array of uint32_t for the given field number. |
| 117 - (void)writeUInt32Array:(int32_t)fieldNumber | 161 - (void)writeUInt32Array:(int32_t)fieldNumber |
| 118 values:(GPBUInt32Array *)values | 162 values:(GPBUInt32Array *)values |
| 119 tag:(uint32_t)tag; | 163 tag:(uint32_t)tag; |
| 164 /// Write a uint32_t without any tag. |
| 120 - (void)writeUInt32NoTag:(uint32_t)value; | 165 - (void)writeUInt32NoTag:(uint32_t)value; |
| 121 | 166 |
| 167 /// Write a uint64_t for the given field number. |
| 122 - (void)writeFixed64:(int32_t)fieldNumber value:(uint64_t)value; | 168 - (void)writeFixed64:(int32_t)fieldNumber value:(uint64_t)value; |
| 169 /// Write a packed array of uint64_t for the given field number. |
| 123 - (void)writeFixed64Array:(int32_t)fieldNumber | 170 - (void)writeFixed64Array:(int32_t)fieldNumber |
| 124 values:(GPBUInt64Array *)values | 171 values:(GPBUInt64Array *)values |
| 125 tag:(uint32_t)tag; | 172 tag:(uint32_t)tag; |
| 173 /// Write a uint64_t without any tag. |
| 126 - (void)writeFixed64NoTag:(uint64_t)value; | 174 - (void)writeFixed64NoTag:(uint64_t)value; |
| 127 | 175 |
| 176 /// Write a uint32_t for the given field number. |
| 128 - (void)writeFixed32:(int32_t)fieldNumber value:(uint32_t)value; | 177 - (void)writeFixed32:(int32_t)fieldNumber value:(uint32_t)value; |
| 178 /// Write a packed array of uint32_t for the given field number. |
| 129 - (void)writeFixed32Array:(int32_t)fieldNumber | 179 - (void)writeFixed32Array:(int32_t)fieldNumber |
| 130 values:(GPBUInt32Array *)values | 180 values:(GPBUInt32Array *)values |
| 131 tag:(uint32_t)tag; | 181 tag:(uint32_t)tag; |
| 182 /// Write a uint32_t without any tag. |
| 132 - (void)writeFixed32NoTag:(uint32_t)value; | 183 - (void)writeFixed32NoTag:(uint32_t)value; |
| 133 | 184 |
| 185 /// Write a int32_t for the given field number. |
| 134 - (void)writeSInt32:(int32_t)fieldNumber value:(int32_t)value; | 186 - (void)writeSInt32:(int32_t)fieldNumber value:(int32_t)value; |
| 187 /// Write a packed array of int32_t for the given field number. |
| 135 - (void)writeSInt32Array:(int32_t)fieldNumber | 188 - (void)writeSInt32Array:(int32_t)fieldNumber |
| 136 values:(GPBInt32Array *)values | 189 values:(GPBInt32Array *)values |
| 137 tag:(uint32_t)tag; | 190 tag:(uint32_t)tag; |
| 191 /// Write a int32_t without any tag. |
| 138 - (void)writeSInt32NoTag:(int32_t)value; | 192 - (void)writeSInt32NoTag:(int32_t)value; |
| 139 | 193 |
| 194 /// Write a int64_t for the given field number. |
| 140 - (void)writeSInt64:(int32_t)fieldNumber value:(int64_t)value; | 195 - (void)writeSInt64:(int32_t)fieldNumber value:(int64_t)value; |
| 196 /// Write a packed array of int64_t for the given field number. |
| 141 - (void)writeSInt64Array:(int32_t)fieldNumber | 197 - (void)writeSInt64Array:(int32_t)fieldNumber |
| 142 values:(GPBInt64Array *)values | 198 values:(GPBInt64Array *)values |
| 143 tag:(uint32_t)tag; | 199 tag:(uint32_t)tag; |
| 200 /// Write a int64_t without any tag. |
| 144 - (void)writeSInt64NoTag:(int64_t)value; | 201 - (void)writeSInt64NoTag:(int64_t)value; |
| 145 | 202 |
| 203 /// Write a int64_t for the given field number. |
| 146 - (void)writeSFixed64:(int32_t)fieldNumber value:(int64_t)value; | 204 - (void)writeSFixed64:(int32_t)fieldNumber value:(int64_t)value; |
| 205 /// Write a packed array of int64_t for the given field number. |
| 147 - (void)writeSFixed64Array:(int32_t)fieldNumber | 206 - (void)writeSFixed64Array:(int32_t)fieldNumber |
| 148 values:(GPBInt64Array *)values | 207 values:(GPBInt64Array *)values |
| 149 tag:(uint32_t)tag; | 208 tag:(uint32_t)tag; |
| 209 /// Write a int64_t without any tag. |
| 150 - (void)writeSFixed64NoTag:(int64_t)value; | 210 - (void)writeSFixed64NoTag:(int64_t)value; |
| 151 | 211 |
| 212 /// Write a int32_t for the given field number. |
| 152 - (void)writeSFixed32:(int32_t)fieldNumber value:(int32_t)value; | 213 - (void)writeSFixed32:(int32_t)fieldNumber value:(int32_t)value; |
| 214 /// Write a packed array of int32_t for the given field number. |
| 153 - (void)writeSFixed32Array:(int32_t)fieldNumber | 215 - (void)writeSFixed32Array:(int32_t)fieldNumber |
| 154 values:(GPBInt32Array *)values | 216 values:(GPBInt32Array *)values |
| 155 tag:(uint32_t)tag; | 217 tag:(uint32_t)tag; |
| 218 /// Write a int32_t without any tag. |
| 156 - (void)writeSFixed32NoTag:(int32_t)value; | 219 - (void)writeSFixed32NoTag:(int32_t)value; |
| 157 | 220 |
| 221 /// Write a BOOL for the given field number. |
| 158 - (void)writeBool:(int32_t)fieldNumber value:(BOOL)value; | 222 - (void)writeBool:(int32_t)fieldNumber value:(BOOL)value; |
| 223 /// Write a packed array of BOOL for the given field number. |
| 159 - (void)writeBoolArray:(int32_t)fieldNumber | 224 - (void)writeBoolArray:(int32_t)fieldNumber |
| 160 values:(GPBBoolArray *)values | 225 values:(GPBBoolArray *)values |
| 161 tag:(uint32_t)tag; | 226 tag:(uint32_t)tag; |
| 227 /// Write a BOOL without any tag. |
| 162 - (void)writeBoolNoTag:(BOOL)value; | 228 - (void)writeBoolNoTag:(BOOL)value; |
| 163 | 229 |
| 230 /// Write a int32_t for the given field number. |
| 164 - (void)writeEnum:(int32_t)fieldNumber value:(int32_t)value; | 231 - (void)writeEnum:(int32_t)fieldNumber value:(int32_t)value; |
| 232 /// Write a packed array of int32_t for the given field number. |
| 165 - (void)writeEnumArray:(int32_t)fieldNumber | 233 - (void)writeEnumArray:(int32_t)fieldNumber |
| 166 values:(GPBEnumArray *)values | 234 values:(GPBEnumArray *)values |
| 167 tag:(uint32_t)tag; | 235 tag:(uint32_t)tag; |
| 236 /// Write a int32_t without any tag. |
| 168 - (void)writeEnumNoTag:(int32_t)value; | 237 - (void)writeEnumNoTag:(int32_t)value; |
| 169 | 238 |
| 239 /// Write a NSString for the given field number. |
| 170 - (void)writeString:(int32_t)fieldNumber value:(NSString *)value; | 240 - (void)writeString:(int32_t)fieldNumber value:(NSString *)value; |
| 171 - (void)writeStringArray:(int32_t)fieldNumber values:(NSArray *)values; | 241 /// Write an array of NSString for the given field number. |
| 242 - (void)writeStringArray:(int32_t)fieldNumber values:(NSArray<NSString*> *)value
s; |
| 243 /// Write a NSString without any tag. |
| 172 - (void)writeStringNoTag:(NSString *)value; | 244 - (void)writeStringNoTag:(NSString *)value; |
| 173 | 245 |
| 246 /// Write a GPBMessage for the given field number. |
| 174 - (void)writeMessage:(int32_t)fieldNumber value:(GPBMessage *)value; | 247 - (void)writeMessage:(int32_t)fieldNumber value:(GPBMessage *)value; |
| 175 - (void)writeMessageArray:(int32_t)fieldNumber values:(NSArray *)values; | 248 /// Write an array of GPBMessage for the given field number. |
| 249 - (void)writeMessageArray:(int32_t)fieldNumber values:(NSArray<GPBMessage*> *)va
lues; |
| 250 /// Write a GPBMessage without any tag. |
| 176 - (void)writeMessageNoTag:(GPBMessage *)value; | 251 - (void)writeMessageNoTag:(GPBMessage *)value; |
| 177 | 252 |
| 253 /// Write a NSData for the given field number. |
| 178 - (void)writeBytes:(int32_t)fieldNumber value:(NSData *)value; | 254 - (void)writeBytes:(int32_t)fieldNumber value:(NSData *)value; |
| 179 - (void)writeBytesArray:(int32_t)fieldNumber values:(NSArray *)values; | 255 /// Write an array of NSData for the given field number. |
| 256 - (void)writeBytesArray:(int32_t)fieldNumber values:(NSArray<NSData*> *)values; |
| 257 /// Write a NSData without any tag. |
| 180 - (void)writeBytesNoTag:(NSData *)value; | 258 - (void)writeBytesNoTag:(NSData *)value; |
| 181 | 259 |
| 260 /// Write a GPBMessage for the given field number. |
| 182 - (void)writeGroup:(int32_t)fieldNumber | 261 - (void)writeGroup:(int32_t)fieldNumber |
| 183 value:(GPBMessage *)value; | 262 value:(GPBMessage *)value; |
| 184 - (void)writeGroupArray:(int32_t)fieldNumber values:(NSArray *)values; | 263 /// Write an array of GPBMessage for the given field number. |
| 264 - (void)writeGroupArray:(int32_t)fieldNumber values:(NSArray<GPBMessage*> *)valu
es; |
| 265 /// Write a GPBMessage without any tag (but does write the endGroup tag). |
| 185 - (void)writeGroupNoTag:(int32_t)fieldNumber | 266 - (void)writeGroupNoTag:(int32_t)fieldNumber |
| 186 value:(GPBMessage *)value; | 267 value:(GPBMessage *)value; |
| 187 | 268 |
| 269 /// Write a GPBUnknownFieldSet for the given field number. |
| 188 - (void)writeUnknownGroup:(int32_t)fieldNumber | 270 - (void)writeUnknownGroup:(int32_t)fieldNumber |
| 189 value:(GPBUnknownFieldSet *)value; | 271 value:(GPBUnknownFieldSet *)value; |
| 190 - (void)writeUnknownGroupArray:(int32_t)fieldNumber values:(NSArray *)values; | 272 /// Write an array of GPBUnknownFieldSet for the given field number. |
| 273 - (void)writeUnknownGroupArray:(int32_t)fieldNumber values:(NSArray<GPBUnknownFi
eldSet*> *)values; |
| 274 /// Write a GPBUnknownFieldSet without any tag (but does write the endGroup tag)
. |
| 191 - (void)writeUnknownGroupNoTag:(int32_t)fieldNumber | 275 - (void)writeUnknownGroupNoTag:(int32_t)fieldNumber |
| 192 value:(GPBUnknownFieldSet *)value; | 276 value:(GPBUnknownFieldSet *)value; |
| 193 | 277 |
| 194 //%PDDM-EXPAND-END _WRITE_DECLS() | 278 //%PDDM-EXPAND-END _WRITE_DECLS() |
| 195 | 279 |
| 196 // Write a MessageSet extension field to the stream. For historical reasons, | 280 /// Write a MessageSet extension field to the stream. For historical reasons, |
| 197 // the wire format differs from normal fields. | 281 /// the wire format differs from normal fields. |
| 198 - (void)writeMessageSetExtension:(int32_t)fieldNumber value:(GPBMessage *)value; | 282 - (void)writeMessageSetExtension:(int32_t)fieldNumber value:(GPBMessage *)value; |
| 199 | 283 |
| 200 // Write an unparsed MessageSet extension field to the stream. For | 284 /// Write an unparsed MessageSet extension field to the stream. For |
| 201 // historical reasons, the wire format differs from normal fields. | 285 /// historical reasons, the wire format differs from normal fields. |
| 202 - (void)writeRawMessageSetExtension:(int32_t)fieldNumber value:(NSData *)value; | 286 - (void)writeRawMessageSetExtension:(int32_t)fieldNumber value:(NSData *)value; |
| 203 | 287 |
| 204 @end | 288 @end |
| 205 | 289 |
| 206 CF_EXTERN_C_BEGIN | |
| 207 | |
| 208 size_t GPBComputeDoubleSize(int32_t fieldNumber, double value) | |
| 209 __attribute__((const)); | |
| 210 size_t GPBComputeFloatSize(int32_t fieldNumber, float value) | |
| 211 __attribute__((const)); | |
| 212 size_t GPBComputeUInt64Size(int32_t fieldNumber, uint64_t value) | |
| 213 __attribute__((const)); | |
| 214 size_t GPBComputeInt64Size(int32_t fieldNumber, int64_t value) | |
| 215 __attribute__((const)); | |
| 216 size_t GPBComputeInt32Size(int32_t fieldNumber, int32_t value) | |
| 217 __attribute__((const)); | |
| 218 size_t GPBComputeFixed64Size(int32_t fieldNumber, uint64_t value) | |
| 219 __attribute__((const)); | |
| 220 size_t GPBComputeFixed32Size(int32_t fieldNumber, uint32_t value) | |
| 221 __attribute__((const)); | |
| 222 size_t GPBComputeBoolSize(int32_t fieldNumber, BOOL value) | |
| 223 __attribute__((const)); | |
| 224 size_t GPBComputeStringSize(int32_t fieldNumber, NSString *value) | |
| 225 __attribute__((const)); | |
| 226 size_t GPBComputeGroupSize(int32_t fieldNumber, GPBMessage *value) | |
| 227 __attribute__((const)); | |
| 228 size_t GPBComputeUnknownGroupSize(int32_t fieldNumber, | |
| 229 GPBUnknownFieldSet *value) | |
| 230 __attribute__((const)); | |
| 231 size_t GPBComputeMessageSize(int32_t fieldNumber, GPBMessage *value) | |
| 232 __attribute__((const)); | |
| 233 size_t GPBComputeBytesSize(int32_t fieldNumber, NSData *value) | |
| 234 __attribute__((const)); | |
| 235 size_t GPBComputeUInt32Size(int32_t fieldNumber, uint32_t value) | |
| 236 __attribute__((const)); | |
| 237 size_t GPBComputeSFixed32Size(int32_t fieldNumber, int32_t value) | |
| 238 __attribute__((const)); | |
| 239 size_t GPBComputeSFixed64Size(int32_t fieldNumber, int64_t value) | |
| 240 __attribute__((const)); | |
| 241 size_t GPBComputeSInt32Size(int32_t fieldNumber, int32_t value) | |
| 242 __attribute__((const)); | |
| 243 size_t GPBComputeSInt64Size(int32_t fieldNumber, int64_t value) | |
| 244 __attribute__((const)); | |
| 245 size_t GPBComputeTagSize(int32_t fieldNumber) __attribute__((const)); | |
| 246 size_t GPBComputeWireFormatTagSize(int field_number, GPBDataType dataType) | |
| 247 __attribute__((const)); | |
| 248 | |
| 249 size_t GPBComputeDoubleSizeNoTag(double value) __attribute__((const)); | |
| 250 size_t GPBComputeFloatSizeNoTag(float value) __attribute__((const)); | |
| 251 size_t GPBComputeUInt64SizeNoTag(uint64_t value) __attribute__((const)); | |
| 252 size_t GPBComputeInt64SizeNoTag(int64_t value) __attribute__((const)); | |
| 253 size_t GPBComputeInt32SizeNoTag(int32_t value) __attribute__((const)); | |
| 254 size_t GPBComputeFixed64SizeNoTag(uint64_t value) __attribute__((const)); | |
| 255 size_t GPBComputeFixed32SizeNoTag(uint32_t value) __attribute__((const)); | |
| 256 size_t GPBComputeBoolSizeNoTag(BOOL value) __attribute__((const)); | |
| 257 size_t GPBComputeStringSizeNoTag(NSString *value) __attribute__((const)); | |
| 258 size_t GPBComputeGroupSizeNoTag(GPBMessage *value) __attribute__((const)); | |
| 259 size_t GPBComputeUnknownGroupSizeNoTag(GPBUnknownFieldSet *value) | |
| 260 __attribute__((const)); | |
| 261 size_t GPBComputeMessageSizeNoTag(GPBMessage *value) __attribute__((const)); | |
| 262 size_t GPBComputeBytesSizeNoTag(NSData *value) __attribute__((const)); | |
| 263 size_t GPBComputeUInt32SizeNoTag(int32_t value) __attribute__((const)); | |
| 264 size_t GPBComputeEnumSizeNoTag(int32_t value) __attribute__((const)); | |
| 265 size_t GPBComputeSFixed32SizeNoTag(int32_t value) __attribute__((const)); | |
| 266 size_t GPBComputeSFixed64SizeNoTag(int64_t value) __attribute__((const)); | |
| 267 size_t GPBComputeSInt32SizeNoTag(int32_t value) __attribute__((const)); | |
| 268 size_t GPBComputeSInt64SizeNoTag(int64_t value) __attribute__((const)); | |
| 269 | |
| 270 // Note that this will calculate the size of 64 bit values truncated to 32. | |
| 271 size_t GPBComputeSizeTSizeAsInt32NoTag(size_t value) __attribute__((const)); | |
| 272 | |
| 273 size_t GPBComputeRawVarint32Size(int32_t value) __attribute__((const)); | |
| 274 size_t GPBComputeRawVarint64Size(int64_t value) __attribute__((const)); | |
| 275 | |
| 276 // Note that this will calculate the size of 64 bit values truncated to 32. | |
| 277 size_t GPBComputeRawVarint32SizeForInteger(NSInteger value) | |
| 278 __attribute__((const)); | |
| 279 | |
| 280 // Compute the number of bytes that would be needed to encode a | |
| 281 // MessageSet extension to the stream. For historical reasons, | |
| 282 // the wire format differs from normal fields. | |
| 283 size_t GPBComputeMessageSetExtensionSize(int32_t fieldNumber, GPBMessage *value) | |
| 284 __attribute__((const)); | |
| 285 | |
| 286 // Compute the number of bytes that would be needed to encode an | |
| 287 // unparsed MessageSet extension field to the stream. For | |
| 288 // historical reasons, the wire format differs from normal fields. | |
| 289 size_t GPBComputeRawMessageSetExtensionSize(int32_t fieldNumber, NSData *value) | |
| 290 __attribute__((const)); | |
| 291 | |
| 292 size_t GPBComputeEnumSize(int32_t fieldNumber, int32_t value) | |
| 293 __attribute__((const)); | |
| 294 | |
| 295 CF_EXTERN_C_END | |
| 296 | |
| 297 NS_ASSUME_NONNULL_END | 290 NS_ASSUME_NONNULL_END |
| 298 | 291 |
| 299 // Write methods for types that can be in packed arrays. | 292 // Write methods for types that can be in packed arrays. |
| 300 //%PDDM-DEFINE _WRITE_PACKABLE_DECLS(NAME, ARRAY_TYPE, TYPE) | 293 //%PDDM-DEFINE _WRITE_PACKABLE_DECLS(NAME, ARRAY_TYPE, TYPE) |
| 294 //%/// Write a TYPE for the given field number. |
| 301 //%- (void)write##NAME:(int32_t)fieldNumber value:(TYPE)value; | 295 //%- (void)write##NAME:(int32_t)fieldNumber value:(TYPE)value; |
| 296 //%/// Write a packed array of TYPE for the given field number. |
| 302 //%- (void)write##NAME##Array:(int32_t)fieldNumber | 297 //%- (void)write##NAME##Array:(int32_t)fieldNumber |
| 303 //% NAME$S values:(GPB##ARRAY_TYPE##Array *)values | 298 //% NAME$S values:(GPB##ARRAY_TYPE##Array *)values |
| 304 //% NAME$S tag:(uint32_t)tag; | 299 //% NAME$S tag:(uint32_t)tag; |
| 300 //%/// Write a TYPE without any tag. |
| 305 //%- (void)write##NAME##NoTag:(TYPE)value; | 301 //%- (void)write##NAME##NoTag:(TYPE)value; |
| 306 //% | 302 //% |
| 307 // Write methods for types that aren't in packed arrays. | 303 // Write methods for types that aren't in packed arrays. |
| 308 //%PDDM-DEFINE _WRITE_UNPACKABLE_DECLS(NAME, TYPE) | 304 //%PDDM-DEFINE _WRITE_UNPACKABLE_DECLS(NAME, TYPE) |
| 309 //%- (void)write##NAME:(int32_t)fieldNumber value:(TYPE)value; | 305 //%/// Write a TYPE for the given field number. |
| 310 //%- (void)write##NAME##Array:(int32_t)fieldNumber values:(NSArray *)values; | 306 //%- (void)write##NAME:(int32_t)fieldNumber value:(TYPE *)value; |
| 311 //%- (void)write##NAME##NoTag:(TYPE)value; | 307 //%/// Write an array of TYPE for the given field number. |
| 308 //%- (void)write##NAME##Array:(int32_t)fieldNumber values:(NSArray<##TYPE##*> *)
values; |
| 309 //%/// Write a TYPE without any tag. |
| 310 //%- (void)write##NAME##NoTag:(TYPE *)value; |
| 312 //% | 311 //% |
| 313 // Special write methods for Groups. | 312 // Special write methods for Groups. |
| 314 //%PDDM-DEFINE _WRITE_GROUP_DECLS(NAME, TYPE) | 313 //%PDDM-DEFINE _WRITE_GROUP_DECLS(NAME, TYPE) |
| 314 //%/// Write a TYPE for the given field number. |
| 315 //%- (void)write##NAME:(int32_t)fieldNumber | 315 //%- (void)write##NAME:(int32_t)fieldNumber |
| 316 //% NAME$S value:(TYPE)value; | 316 //% NAME$S value:(TYPE *)value; |
| 317 //%- (void)write##NAME##Array:(int32_t)fieldNumber values:(NSArray *)values; | 317 //%/// Write an array of TYPE for the given field number. |
| 318 //%- (void)write##NAME##Array:(int32_t)fieldNumber values:(NSArray<##TYPE##*> *)
values; |
| 319 //%/// Write a TYPE without any tag (but does write the endGroup tag). |
| 318 //%- (void)write##NAME##NoTag:(int32_t)fieldNumber | 320 //%- (void)write##NAME##NoTag:(int32_t)fieldNumber |
| 319 //% NAME$S value:(TYPE)value; | 321 //% NAME$S value:(TYPE *)value; |
| 320 //% | 322 //% |
| 321 | 323 |
| 322 // One macro to hide it all up above. | 324 // One macro to hide it all up above. |
| 323 //%PDDM-DEFINE _WRITE_DECLS() | 325 //%PDDM-DEFINE _WRITE_DECLS() |
| 324 //%_WRITE_PACKABLE_DECLS(Double, Double, double) | 326 //%_WRITE_PACKABLE_DECLS(Double, Double, double) |
| 325 //%_WRITE_PACKABLE_DECLS(Float, Float, float) | 327 //%_WRITE_PACKABLE_DECLS(Float, Float, float) |
| 326 //%_WRITE_PACKABLE_DECLS(UInt64, UInt64, uint64_t) | 328 //%_WRITE_PACKABLE_DECLS(UInt64, UInt64, uint64_t) |
| 327 //%_WRITE_PACKABLE_DECLS(Int64, Int64, int64_t) | 329 //%_WRITE_PACKABLE_DECLS(Int64, Int64, int64_t) |
| 328 //%_WRITE_PACKABLE_DECLS(Int32, Int32, int32_t) | 330 //%_WRITE_PACKABLE_DECLS(Int32, Int32, int32_t) |
| 329 //%_WRITE_PACKABLE_DECLS(UInt32, UInt32, uint32_t) | 331 //%_WRITE_PACKABLE_DECLS(UInt32, UInt32, uint32_t) |
| 330 //%_WRITE_PACKABLE_DECLS(Fixed64, UInt64, uint64_t) | 332 //%_WRITE_PACKABLE_DECLS(Fixed64, UInt64, uint64_t) |
| 331 //%_WRITE_PACKABLE_DECLS(Fixed32, UInt32, uint32_t) | 333 //%_WRITE_PACKABLE_DECLS(Fixed32, UInt32, uint32_t) |
| 332 //%_WRITE_PACKABLE_DECLS(SInt32, Int32, int32_t) | 334 //%_WRITE_PACKABLE_DECLS(SInt32, Int32, int32_t) |
| 333 //%_WRITE_PACKABLE_DECLS(SInt64, Int64, int64_t) | 335 //%_WRITE_PACKABLE_DECLS(SInt64, Int64, int64_t) |
| 334 //%_WRITE_PACKABLE_DECLS(SFixed64, Int64, int64_t) | 336 //%_WRITE_PACKABLE_DECLS(SFixed64, Int64, int64_t) |
| 335 //%_WRITE_PACKABLE_DECLS(SFixed32, Int32, int32_t) | 337 //%_WRITE_PACKABLE_DECLS(SFixed32, Int32, int32_t) |
| 336 //%_WRITE_PACKABLE_DECLS(Bool, Bool, BOOL) | 338 //%_WRITE_PACKABLE_DECLS(Bool, Bool, BOOL) |
| 337 //%_WRITE_PACKABLE_DECLS(Enum, Enum, int32_t) | 339 //%_WRITE_PACKABLE_DECLS(Enum, Enum, int32_t) |
| 338 //%_WRITE_UNPACKABLE_DECLS(String, NSString *) | 340 //%_WRITE_UNPACKABLE_DECLS(String, NSString) |
| 339 //%_WRITE_UNPACKABLE_DECLS(Message, GPBMessage *) | 341 //%_WRITE_UNPACKABLE_DECLS(Message, GPBMessage) |
| 340 //%_WRITE_UNPACKABLE_DECLS(Bytes, NSData *) | 342 //%_WRITE_UNPACKABLE_DECLS(Bytes, NSData) |
| 341 //%_WRITE_GROUP_DECLS(Group, GPBMessage *) | 343 //%_WRITE_GROUP_DECLS(Group, GPBMessage) |
| 342 //%_WRITE_GROUP_DECLS(UnknownGroup, GPBUnknownFieldSet *) | 344 //%_WRITE_GROUP_DECLS(UnknownGroup, GPBUnknownFieldSet) |
| OLD | NEW |