#import <GPBMessage.h>
Base class that each generated message subclasses from.
- Note
NSCopying
support is a "deep copy", in that all sub objects are copied. Just like you wouldn't want a UIView/NSView trying to exist in two places, you don't want a sub message to be a property property of two other messages.
-
While the class support NSSecureCoding, if the message has any extensions, they will end up reloaded in
unknownFields
as there is no way for the NSCoding
plumbing to pass through a GPBExtensionRegistry
. To support extensions, instead of passing the calls off to the Message, simple store the result of data
, and then when loading, fetch the data and use +parseFromData:extensionRegistry:error:
to provide an extension registry.
Definition at line 83 of file bloaty/third_party/protobuf/objectivec/GPBMessage.h.
◆ addExtension:value: [1/2]
Adds the given value to the extension for this message. This only applies to repeated field extensions. If the field is a repeated POD type, the value should be an NSNumber.
- Parameters
-
extension | The extension descriptor under which to add the value. |
value | The value to be added to the repeated extension. |
◆ addExtension:value: [2/2]
Adds the given value to the extension for this message. This only applies to repeated field extensions. If the field is a repeated POD type, the value should be an NSNumber.
- Parameters
-
extension | The extension descriptor under which to add the value. |
value | The value to be added to the repeated extension. |
◆ addUnknownMapEntry:value: [1/2]
- (void) addUnknownMapEntry: |
|
(int32_t) |
fieldNum |
value: |
|
(NSData *) |
data |
|
|
| |
|
implementation |
◆ addUnknownMapEntry:value: [2/2]
- (void) addUnknownMapEntry: |
|
(int32_t) |
fieldNum |
value: |
|
(NSData *) |
data |
|
|
| |
|
implementation |
◆ clear [1/2]
Resets all of the fields of this message to their default values.
◆ clear [2/2]
Resets all of the fields of this message to their default values.
◆ clearExtension: [1/2]
Clears the given extension for this message.
- Parameters
-
extension | The extension descriptor to be cleared from this message. |
◆ clearExtension: [2/2]
Clears the given extension for this message.
- Parameters
-
extension | The extension descriptor to be cleared from this message. |
◆ data [1/2]
- (nullable NSData *) data |
|
|
|
Serializes the message to an NSData.
If there is an error while generating the data, nil is returned.
- Note
- This value is not cached, so if you are using it repeatedly, cache it yourself.
-
In DEBUG ONLY, the message is also checked for all required field, if one is missing, nil will be returned.
- Returns
- The binary representation of the message.
◆ data [2/2]
- (nullable NSData *) data |
|
|
|
Serializes the message to an NSData.
If there is an error while generating the data, nil is returned.
- Note
- This value is not cached, so if you are using it repeatedly, cache it yourself.
-
In DEBUG ONLY, the message is also checked for all required field, if one is missing, nil will be returned.
- Returns
- The binary representation of the message.
◆ delimitedData [1/2]
- (NSData *) delimitedData |
|
|
|
Serializes a varint with the message size followed by the message data, returning that as an NSData.
- Note
- This value is not cached, so if you are using it repeatedly, it is recommended to keep a local copy.
- Returns
- The binary representation of the size along with the message.
◆ delimitedData [2/2]
- (NSData *) delimitedData |
|
|
|
Serializes a varint with the message size followed by the message data, returning that as an NSData.
- Note
- This value is not cached, so if you are using it repeatedly, it is recommended to keep a local copy.
- Returns
- The binary representation of the size along with the message.
◆ descriptor [1/4]
- Returns
- The descriptor for the message class.
◆ descriptor [2/4]
Return the descriptor for the message.
◆ descriptor [3/4]
- Returns
- The descriptor for the message class.
◆ descriptor [4/4]
Return the descriptor for the message.
◆ extensionsCurrentlySet [1/2]
- (NSArray *) extensionsCurrentlySet |
|
|
|
- Returns
- An array with the extension descriptors that are currently set on the message.
◆ extensionsCurrentlySet [2/2]
- (NSArray *) extensionsCurrentlySet |
|
|
|
- Returns
- An array with the extension descriptors that are currently set on the message.
◆ getExistingExtension: [1/2]
◆ getExistingExtension: [2/2]
◆ getExtension: [1/2]
◆ getExtension: [2/2]
◆ hasExtension: [1/2]
Checks whether there is an extension set on the message which matches the given extension descriptor.
- Parameters
-
extension | Extension descriptor to check if it's set on the message. |
- Returns
- Whether the extension is currently set on the message.
◆ hasExtension: [2/2]
Checks whether there is an extension set on the message which matches the given extension descriptor.
- Parameters
-
extension | Extension descriptor to check if it's set on the message. |
- Returns
- Whether the extension is currently set on the message.
◆ initWithCodedInputStream:extensionRegistry:error: [1/2]
Initializes an instance by parsing the data from the given input stream. This method should be sent to the generated message class that the data should be interpreted as. If there is an error the method returns nil and the error is returned in errorPtr (when provided).
- Note
- Unlike the parseFrom... methods, this never checks to see if all of the required fields are set. So this method can be used to reload messages that may not be complete.
-
The errors returned are likely coming from the domain and codes listed at the top of this file and GPBCodedInputStream.h.
- Parameters
-
input | The stream to read data from. |
extensionRegistry | The extension registry to use to look up extensions. |
errorPtr | An optional error pointer to fill in with a failure reason if the data can not be parsed. |
- Returns
- An initialized instance of the generated class.
◆ initWithCodedInputStream:extensionRegistry:error: [2/2]
Initializes an instance by parsing the data from the given input stream. This method should be sent to the generated message class that the data should be interpreted as. If there is an error the method returns nil and the error is returned in errorPtr (when provided).
- Note
- Unlike the parseFrom... methods, this never checks to see if all of the required fields are set. So this method can be used to reload messages that may not be complete.
-
The errors returned are likely coming from the domain and codes listed at the top of this file and GPBCodedInputStream.h.
- Parameters
-
input | The stream to read data from. |
extensionRegistry | The extension registry to use to look up extensions. |
errorPtr | An optional error pointer to fill in with a failure reason if the data can not be parsed. |
- Returns
- An initialized instance of the generated class.
◆ initWithData:error: [1/2]
- (nullable instancetype) initWithData: |
|
(NSData *) |
data |
error: |
|
(NSError **) |
errorPtr |
|
|
| |
Initializes an instance by parsing the data. This method should be sent to the generated message class that the data should be interpreted as. If there is an error the method returns nil and the error is returned in errorPtr (when provided).
- Note
- In DEBUG builds, the parsed message is checked to be sure all required fields were provided, and the parse will fail if some are missing.
-
The errors returned are likely coming from the domain and codes listed at the top of this file and GPBCodedInputStream.h.
- Parameters
-
data | The data to parse. |
errorPtr | An optional error pointer to fill in with a failure reason if the data can not be parsed. |
- Returns
- An initialized instance of the generated class.
◆ initWithData:error: [2/2]
- (nullable instancetype) initWithData: |
|
(NSData *) |
data |
error: |
|
(NSError **) |
errorPtr |
|
|
| |
Initializes an instance by parsing the data. This method should be sent to the generated message class that the data should be interpreted as. If there is an error the method returns nil and the error is returned in errorPtr (when provided).
- Note
- In DEBUG builds, the parsed message is checked to be sure all required fields were provided, and the parse will fail if some are missing.
-
The errors returned are likely coming from the domain and codes listed at the top of this file and GPBCodedInputStream.h.
- Parameters
-
data | The data to parse. |
errorPtr | An optional error pointer to fill in with a failure reason if the data can not be parsed. |
- Returns
- An initialized instance of the generated class.
◆ initWithData:extensionRegistry:error: [1/2]
- (nullable instancetype) initWithData: |
|
(NSData *) |
data |
extensionRegistry: |
|
(nullable GPBExtensionRegistry *) |
extensionRegistry |
error: |
|
(NSError **) |
errorPtr |
|
|
| |
Initializes an instance by parsing the data. This method should be sent to the generated message class that the data should be interpreted as. If there is an error the method returns nil and the error is returned in errorPtr (when provided).
- Note
- In DEBUG builds, the parsed message is checked to be sure all required fields were provided, and the parse will fail if some are missing.
-
The errors returned are likely coming from the domain and codes listed at the top of this file and GPBCodedInputStream.h.
- Parameters
-
data | The data to parse. |
extensionRegistry | The extension registry to use to look up extensions. |
errorPtr | An optional error pointer to fill in with a failure reason if the data can not be parsed. |
- Returns
- An initialized instance of the generated class.
◆ initWithData:extensionRegistry:error: [2/2]
- (nullable instancetype) initWithData: |
|
(NSData *) |
data |
extensionRegistry: |
|
(nullable GPBExtensionRegistry *) |
extensionRegistry |
error: |
|
(NSError **) |
errorPtr |
|
|
| |
Initializes an instance by parsing the data. This method should be sent to the generated message class that the data should be interpreted as. If there is an error the method returns nil and the error is returned in errorPtr (when provided).
- Note
- In DEBUG builds, the parsed message is checked to be sure all required fields were provided, and the parse will fail if some are missing.
-
The errors returned are likely coming from the domain and codes listed at the top of this file and GPBCodedInputStream.h.
- Parameters
-
data | The data to parse. |
extensionRegistry | The extension registry to use to look up extensions. |
errorPtr | An optional error pointer to fill in with a failure reason if the data can not be parsed. |
- Returns
- An initialized instance of the generated class.
◆ mergeDelimitedFromCodedInputStream:extensionRegistry: [1/2]
◆ mergeDelimitedFromCodedInputStream:extensionRegistry: [2/2]
◆ mergeFrom: [1/2]
Merges the fields from another message (of the same type) into this message.
- Parameters
-
other | Message to merge into this message. |
◆ mergeFrom: [2/2]
Merges the fields from another message (of the same type) into this message.
- Parameters
-
other | Message to merge into this message. |
◆ mergeFromCodedInputStream:extensionRegistry: [1/2]
◆ mergeFromCodedInputStream:extensionRegistry: [2/2]
◆ mergeFromData:extensionRegistry: [1/2]
- (void) mergeFromData: |
|
(NSData *) |
data |
extensionRegistry: |
|
(nullable GPBExtensionRegistry *) |
extensionRegistry |
|
|
| |
Parses the given data as this message's class, and merges those values into this message.
- Parameters
-
data | The binary representation of the message to merge. |
extensionRegistry | The extension registry to use to look up extensions. |
- Exceptions
-
GPBCodedInputStreamException | Exception thrown when parsing was unsuccessful. |
◆ mergeFromData:extensionRegistry: [2/2]
- (void) mergeFromData: |
|
(NSData *) |
data |
extensionRegistry: |
|
(nullable GPBExtensionRegistry *) |
extensionRegistry |
|
|
| |
Parses the given data as this message's class, and merges those values into this message.
- Parameters
-
data | The binary representation of the message to merge. |
extensionRegistry | The extension registry to use to look up extensions. |
- Exceptions
-
GPBCodedInputStreamException | Exception thrown when parsing was unsuccessful. |
◆ message [1/2]
- Returns
- An autoreleased message with the default values set.
◆ message [2/2]
- Returns
- An autoreleased message with the default values set.
◆ parseDelimitedFromCodedInputStream:extensionRegistry:error: [1/2]
Creates a new instance by parsing the data from the given input stream. This method should be sent to the generated message class that the data should be interpreted as. If there is an error the method returns nil and the error is returned in errorPtr (when provided).
- Note
- Unlike the parseFrom... methods, this never checks to see if all of the required fields are set. So this method can be used to reload messages that may not be complete.
-
The errors returned are likely coming from the domain and codes listed at the top of this file and GPBCodedInputStream.h.
- Parameters
-
input | The stream to read data from. |
extensionRegistry | The extension registry to use to look up extensions. |
errorPtr | An optional error pointer to fill in with a failure reason if the data can not be parsed. |
- Returns
- A new instance of the generated class.
◆ parseDelimitedFromCodedInputStream:extensionRegistry:error: [2/2]
Creates a new instance by parsing the data from the given input stream. This method should be sent to the generated message class that the data should be interpreted as. If there is an error the method returns nil and the error is returned in errorPtr (when provided).
- Note
- Unlike the parseFrom... methods, this never checks to see if all of the required fields are set. So this method can be used to reload messages that may not be complete.
-
The errors returned are likely coming from the domain and codes listed at the top of this file and GPBCodedInputStream.h.
- Parameters
-
input | The stream to read data from. |
extensionRegistry | The extension registry to use to look up extensions. |
errorPtr | An optional error pointer to fill in with a failure reason if the data can not be parsed. |
- Returns
- A new instance of the generated class.
◆ parseFromCodedInputStream:extensionRegistry:error: [1/2]
Creates a new instance by parsing the data from the given input stream. This method should be sent to the generated message class that the data should be interpreted as. If there is an error the method returns nil and the error is returned in errorPtr (when provided).
- Note
- In DEBUG builds, the parsed message is checked to be sure all required fields were provided, and the parse will fail if some are missing.
-
The errors returned are likely coming from the domain and codes listed at the top of this file and GPBCodedInputStream.h.
- Parameters
-
input | The stream to read data from. |
extensionRegistry | The extension registry to use to look up extensions. |
errorPtr | An optional error pointer to fill in with a failure reason if the data can not be parsed. |
- Returns
- A new instance of the generated class.
◆ parseFromCodedInputStream:extensionRegistry:error: [2/2]
Creates a new instance by parsing the data from the given input stream. This method should be sent to the generated message class that the data should be interpreted as. If there is an error the method returns nil and the error is returned in errorPtr (when provided).
- Note
- In DEBUG builds, the parsed message is checked to be sure all required fields were provided, and the parse will fail if some are missing.
-
The errors returned are likely coming from the domain and codes listed at the top of this file and GPBCodedInputStream.h.
- Parameters
-
input | The stream to read data from. |
extensionRegistry | The extension registry to use to look up extensions. |
errorPtr | An optional error pointer to fill in with a failure reason if the data can not be parsed. |
- Returns
- A new instance of the generated class.
◆ parseFromData:error: [1/2]
+ (nullable instancetype) parseFromData: |
|
(NSData *) |
data |
error: |
|
(NSError **) |
errorPtr |
|
|
| |
Creates a new instance by parsing the provided data. This method should be sent to the generated message class that the data should be interpreted as. If there is an error the method returns nil and the error is returned in errorPtr (when provided).
- Note
- In DEBUG builds, the parsed message is checked to be sure all required fields were provided, and the parse will fail if some are missing.
-
The errors returned are likely coming from the domain and codes listed at the top of this file and GPBCodedInputStream.h.
- Parameters
-
data | The data to parse. |
errorPtr | An optional error pointer to fill in with a failure reason if the data can not be parsed. |
- Returns
- A new instance of the generated class.
◆ parseFromData:error: [2/2]
+ (nullable instancetype) parseFromData: |
|
(NSData *) |
data |
error: |
|
(NSError **) |
errorPtr |
|
|
| |
Creates a new instance by parsing the provided data. This method should be sent to the generated message class that the data should be interpreted as. If there is an error the method returns nil and the error is returned in errorPtr (when provided).
- Note
- In DEBUG builds, the parsed message is checked to be sure all required fields were provided, and the parse will fail if some are missing.
-
The errors returned are likely coming from the domain and codes listed at the top of this file and GPBCodedInputStream.h.
- Parameters
-
data | The data to parse. |
errorPtr | An optional error pointer to fill in with a failure reason if the data can not be parsed. |
- Returns
- A new instance of the generated class.
◆ parseFromData:extensionRegistry:error: [1/2]
+ (nullable instancetype) parseFromData: |
|
(NSData *) |
data |
extensionRegistry: |
|
(nullable GPBExtensionRegistry *) |
extensionRegistry |
error: |
|
(NSError **) |
errorPtr |
|
|
| |
Creates a new instance by parsing the data. This method should be sent to the generated message class that the data should be interpreted as. If there is an error the method returns nil and the error is returned in errorPtr (when provided).
- Note
- In DEBUG builds, the parsed message is checked to be sure all required fields were provided, and the parse will fail if some are missing.
-
The errors returned are likely coming from the domain and codes listed at the top of this file and GPBCodedInputStream.h.
- Parameters
-
data | The data to parse. |
extensionRegistry | The extension registry to use to look up extensions. |
errorPtr | An optional error pointer to fill in with a failure reason if the data can not be parsed. |
- Returns
- A new instance of the generated class.
◆ parseFromData:extensionRegistry:error: [2/2]
+ (nullable instancetype) parseFromData: |
|
(NSData *) |
data |
extensionRegistry: |
|
(nullable GPBExtensionRegistry *) |
extensionRegistry |
error: |
|
(NSError **) |
errorPtr |
|
|
| |
Creates a new instance by parsing the data. This method should be sent to the generated message class that the data should be interpreted as. If there is an error the method returns nil and the error is returned in errorPtr (when provided).
- Note
- In DEBUG builds, the parsed message is checked to be sure all required fields were provided, and the parse will fail if some are missing.
-
The errors returned are likely coming from the domain and codes listed at the top of this file and GPBCodedInputStream.h.
- Parameters
-
data | The data to parse. |
extensionRegistry | The extension registry to use to look up extensions. |
errorPtr | An optional error pointer to fill in with a failure reason if the data can not be parsed. |
- Returns
- A new instance of the generated class.
◆ serializedSize [1/2]
- (size_t) serializedSize |
|
|
|
Calculates the size of the object if it were serialized.
This is not a cached value. If you are following a pattern like this:
NSMutableData *
foo = [NSMutableData dataWithCapacity:
size +
sizeof(
size)];
you would be better doing:
NSMutableData *
foo = [NSMutableData dataWithCapacity:
size +
sizeof(
size)];
- Returns
- The size of the message in it's binary representation.
◆ serializedSize [2/2]
- (size_t) serializedSize |
|
|
|
Calculates the size of the object if it were serialized.
This is not a cached value. If you are following a pattern like this:
NSMutableData *
foo = [NSMutableData dataWithCapacity:
size +
sizeof(
size)];
you would be better doing:
NSMutableData *
foo = [NSMutableData dataWithCapacity:
size +
sizeof(
size)];
- Returns
- The size of the message in it's binary representation.
◆ setExtension:index:value: [1/2]
Replaces the value at the given index with the given value for the extension on this message. This only applies to repeated field extensions. If the field is a repeated POD type, the value is should be an NSNumber.
- Parameters
-
extension | The extension descriptor under which to replace the value. |
index | The index of the extension to be replaced. |
value | The value to be replaced in the repeated extension. |
◆ setExtension:index:value: [2/2]
Replaces the value at the given index with the given value for the extension on this message. This only applies to repeated field extensions. If the field is a repeated POD type, the value is should be an NSNumber.
- Parameters
-
extension | The extension descriptor under which to replace the value. |
index | The index of the extension to be replaced. |
value | The value to be replaced in the repeated extension. |
◆ setExtension:value: [1/2]
Sets the given extension's value for this message. This only applies for single field extensions (i.e. - not repeated fields).
Extensions use boxed values (NSNumbers).
- Parameters
-
extension | The extension descriptor under which to set the value. |
value | The value to be set as the extension. |
◆ setExtension:value: [2/2]
Sets the given extension's value for this message. This only applies for single field extensions (i.e. - not repeated fields).
Extensions use boxed values (NSNumbers).
- Parameters
-
extension | The extension descriptor under which to set the value. |
value | The value to be set as the extension. |
◆ writeDelimitedToCodedOutputStream: [1/2]
Writes out a varint for the message size followed by the message to the given output stream.
- Parameters
-
output | The coded output stream into which to write the message. |
- Note
- This can raise the GPBCodedOutputStreamException_* exceptions.
◆ writeDelimitedToCodedOutputStream: [2/2]
Writes out a varint for the message size followed by the message to the given output stream.
- Parameters
-
output | The coded output stream into which to write the message. |
- Note
- This can raise the GPBCodedOutputStreamException_* exceptions.
◆ writeDelimitedToOutputStream: [1/2]
- (void) writeDelimitedToOutputStream: |
|
(NSOutputStream *) |
output |
|
Writes out a varint for the message size followed by the message to the given output stream.
- Parameters
-
output | The output stream into which to write the message. |
- Note
- This can raise the GPBCodedOutputStreamException_* exceptions.
◆ writeDelimitedToOutputStream: [2/2]
- (void) writeDelimitedToOutputStream: |
|
(NSOutputStream *) |
output |
|
Writes out a varint for the message size followed by the message to the given output stream.
- Parameters
-
output | The output stream into which to write the message. |
- Note
- This can raise the GPBCodedOutputStreamException_* exceptions.
◆ writeToCodedOutputStream: [1/2]
Writes out the message to the given coded output stream.
- Parameters
-
output | The coded output stream into which to write the message. |
- Note
- This can raise the GPBCodedOutputStreamException_* exceptions.
◆ writeToCodedOutputStream: [2/2]
Writes out the message to the given coded output stream.
- Parameters
-
output | The coded output stream into which to write the message. |
- Note
- This can raise the GPBCodedOutputStreamException_* exceptions.
◆ writeToOutputStream: [1/2]
- (void) writeToOutputStream: |
|
(NSOutputStream *) |
output |
|
Writes out the message to the given output stream.
- Parameters
-
output | The output stream into which to write the message. |
- Note
- This can raise the GPBCodedOutputStreamException_* exceptions.
◆ writeToOutputStream: [2/2]
- (void) writeToOutputStream: |
|
(NSOutputStream *) |
output |
|
Writes out the message to the given output stream.
- Parameters
-
output | The output stream into which to write the message. |
- Note
- This can raise the GPBCodedOutputStreamException_* exceptions.
◆ messageStorage_
◆ initialized
Whether the message, along with all submessages, have the required fields set. This is only applicable for files declared with "proto2" syntax, as there are no required fields for "proto3" syntax.
Definition at line 103 of file bloaty/third_party/protobuf/objectivec/GPBMessage.h.
◆ unknownFields
The set of unknown fields for this message.
Only messages from proto files declared with "proto2" syntax support unknown fields. For "proto3" syntax, any unknown fields found while parsing are dropped.
Definition at line 96 of file bloaty/third_party/protobuf/objectivec/GPBMessage.h.
The documentation for this class was generated from the following file: