bloaty/third_party/protobuf/objectivec/GPBMessage.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 "GPBBootstrap.h"
34 
35 @class GPBDescriptor;
36 @class GPBCodedInputStream;
40 @class GPBFieldDescriptor;
41 @class GPBUnknownFieldSet;
42 
43 NS_ASSUME_NONNULL_BEGIN
44 
45 CF_EXTERN_C_BEGIN
46 
48 extern NSString *const GPBMessageErrorDomain;
49 
51 typedef NS_ENUM(NSInteger, GPBMessageErrorCode) {
53  GPBMessageErrorCodeOther = -100,
55  GPBMessageErrorCodeMissingRequiredField = -101,
56 };
57 
62 extern NSString *const GPBErrorReasonKey;
63 
64 CF_EXTERN_C_END
65 
83 @interface GPBMessage : NSObject<NSSecureCoding, NSCopying>
84 
85 // If you add an instance method/property to this class that may conflict with
86 // fields declared in protos, you need to update objective_helpers.cc. The main
87 // cases are methods that take no arguments, or setFoo:/hasFoo: type methods.
88 
96 @property(nonatomic, copy, nullable) GPBUnknownFieldSet *unknownFields;
97 
103 @property(nonatomic, readonly, getter=isInitialized) BOOL initialized;
104 
108 + (instancetype)message;
109 
128 + (nullable instancetype)parseFromData:(NSData *)data error:(NSError **)errorPtr;
129 
149 + (nullable instancetype)parseFromData:(NSData *)data
150  extensionRegistry:(nullable GPBExtensionRegistry *)extensionRegistry
151  error:(NSError **)errorPtr;
152 
172 + (nullable instancetype)parseFromCodedInputStream:(GPBCodedInputStream *)input
173  extensionRegistry:
174  (nullable GPBExtensionRegistry *)extensionRegistry
175  error:(NSError **)errorPtr;
176 
197 + (nullable instancetype)parseDelimitedFromCodedInputStream:(GPBCodedInputStream *)input
198  extensionRegistry:
199  (nullable GPBExtensionRegistry *)extensionRegistry
200  error:(NSError **)errorPtr;
201 
220 - (nullable instancetype)initWithData:(NSData *)data error:(NSError **)errorPtr;
221 
241 - (nullable instancetype)initWithData:(NSData *)data
242  extensionRegistry:(nullable GPBExtensionRegistry *)extensionRegistry
243  error:(NSError **)errorPtr;
244 
265 - (nullable instancetype)initWithCodedInputStream:(GPBCodedInputStream *)input
266  extensionRegistry:
267  (nullable GPBExtensionRegistry *)extensionRegistry
268  error:(NSError **)errorPtr;
269 
280 - (void)mergeFromData:(NSData *)data
281  extensionRegistry:(nullable GPBExtensionRegistry *)extensionRegistry;
282 
289 - (void)mergeFrom:(GPBMessage *)other;
290 
299 - (void)writeToCodedOutputStream:(GPBCodedOutputStream *)output;
300 
308 - (void)writeToOutputStream:(NSOutputStream *)output;
309 
318 - (void)writeDelimitedToCodedOutputStream:(GPBCodedOutputStream *)output;
319 
328 - (void)writeDelimitedToOutputStream:(NSOutputStream *)output;
329 
343 - (nullable NSData *)data;
344 
354 - (NSData *)delimitedData;
355 
380 - (size_t)serializedSize;
381 
386 
391 
396 - (NSArray *)extensionsCurrentlySet;
397 
406 - (BOOL)hasExtension:(GPBExtensionDescriptor *)extension;
407 
408 /*
409  * Fetches the given extension's value for this message.
410  *
411  * Extensions use boxed values (NSNumbers) for PODs and NSMutableArrays for
412  * repeated fields. If the extension is a Message one will be auto created for
413  * you and returned similar to fields.
414  *
415  * @param extension The extension descriptor of the extension to fetch.
416  *
417  * @return The extension matching the given descriptor, or nil if none found.
418  **/
419 - (nullable id)getExtension:(GPBExtensionDescriptor *)extension;
420 
430 - (void)setExtension:(GPBExtensionDescriptor *)extension
431  value:(nullable id)value;
432 
441 - (void)addExtension:(GPBExtensionDescriptor *)extension value:(id)value;
442 
452 - (void)setExtension:(GPBExtensionDescriptor *)extension
453  index:(NSUInteger)index
454  value:(id)value;
455 
461 - (void)clearExtension:(GPBExtensionDescriptor *)extension;
462 
466 - (void)clear;
467 
468 @end
469 
470 NS_ASSUME_NONNULL_END
+[GPBMessage message]
instancetype message()
GPBBootstrap.h
GPBExtensionRegistry
Definition: bloaty/third_party/protobuf/objectivec/GPBExtensionRegistry.h:57
copy
static int copy(grpc_slice_buffer *input, grpc_slice_buffer *output)
Definition: message_compress.cc:145
-[GPBMessage extensionsCurrentlySet]
NSArray * extensionsCurrentlySet()
-[GPBMessage data]
nullable NSData * data()
GPBDescriptor
Definition: bloaty/third_party/protobuf/objectivec/GPBDescriptor.h:65
GPBErrorReasonKey
NSString *const GPBErrorReasonKey
BOOL
int BOOL
Definition: undname.c:46
+[GPBMessage descriptor]
GPBDescriptor * descriptor()
GPBMessage::initialized
BOOL initialized
Definition: bloaty/third_party/protobuf/objectivec/GPBMessage.h:103
-[GPBMessage serializedSize]
size_t serializedSize()
GPBMessageErrorDomain
NS_ASSUME_NONNULL_BEGIN CF_EXTERN_C_BEGIN NSString *const GPBMessageErrorDomain
GPBCodedOutputStream
Definition: bloaty/third_party/protobuf/objectivec/GPBCodedOutputStream.h:66
-[GPBMessage clear]
void clear()
GPBFieldDescriptor
Definition: bloaty/third_party/protobuf/objectivec/GPBDescriptor.h:167
NS_ENUM
typedef NS_ENUM(NSInteger, GPBMessageErrorCode)
Definition: bloaty/third_party/protobuf/objectivec/GPBMessage.h:51
GPBExtensionDescriptor
Definition: bloaty/third_party/protobuf/objectivec/GPBDescriptor.h:296
GPBMessage
Definition: bloaty/third_party/protobuf/objectivec/GPBMessage.h:83
-[GPBMessage delimitedData]
NSData * delimitedData()
GPBUnknownFieldSet
Definition: bloaty/third_party/protobuf/objectivec/GPBUnknownFieldSet.h:43
GPBCodedInputStream
Definition: bloaty/third_party/protobuf/objectivec/GPBCodedInputStream.h:85
id
uint32_t id
Definition: flow_control_fuzzer.cc:70
GPBMessage::unknownFields
GPBUnknownFieldSet * unknownFields
Definition: bloaty/third_party/protobuf/objectivec/GPBMessage.h:96


grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:44