Base class for all of the generated message classes.
More...
#import <GPBMessage.h>
Base class for all of the generated message classes.
◆ addExtension:value:()
Adds the given value to the extension for this message. This is only for repeated field extensions. If the field is a repeated POD type the value
is a NSNumber
.
◆ clear()
Resets all of the fields of this message to their default values.
◆ clearExtension:()
Clears the given extension for this message.
◆ data()
Serializes the message to a 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.
◆ delimitedData()
Serializes a varint with the message size followed by the message data, returning that as a NSData
.
- Note
- This value is not cached, so if you are using it repeatedly, cache it yourself.
◆ descriptor() [1/2]
Return the descriptor for the message.
◆ descriptor() [2/2]
Return the descriptor for the message class.
◆ getExtension:()
Fetches the given extension's value for this message.
Extensions use boxed values (NSNumbers) for PODs and NSMutableArrays for repeated fields. If the extension is a Message one will be auto created for you and returned similar to fields.
◆ hasExtension:()
Test to see if the given extension is set on the message.
◆ initWithCodedInputStream:extensionRegistry:error:()
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.
- 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. |
◆ initWithData:error:()
- (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.
- 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. |
◆ initWithData:extensionRegistry:error:()
- (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.
- 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. |
◆ mergeFrom:()
Merges the fields from another message (of the same type) into this message.
◆ mergeFromData:extensionRegistry:()
Parses a message of this type from the input and merges it with this message.
- Note
- This will throw if there is an error parsing the data.
◆ message()
Returns an autoreleased instance.
◆ parseDelimitedFromCodedInputStream:extensionRegistry:error:()
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.
- 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 class messaged.
◆ parseFromCodedInputStream:extensionRegistry:error:()
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.
- 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 class messaged.
◆ parseFromData:error:()
+ (instancetype) parseFromData: |
|
(NSData *) |
data |
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.
- 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 class messaged.
◆ parseFromData:extensionRegistry:error:()
+ (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.
- 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 class messaged.
◆ 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)];
[foo appendData:[aMsg
data]];
you would be better doing:
NSUInteger size = [aMsg
length];
NSMutableData *foo = [NSMutableData dataWithCapacity:size +
sizeof(
size)];
◆ setExtension:index:value:()
Replaces the given value at an index for the extension on this message. This is only for repeated field extensions. If the field is a repeated POD type the value
is a NSNumber
.
◆ setExtension:value:()
Sets the given extension's value for this message. This is only for single field extensions (i.e. - not repeated fields).
Extensions use boxed values (NSNumbers
).
◆ writeDelimitedToCodedOutputStream:()
Writes out a varint for the message size followed by the the message to the given output stream.
◆ writeDelimitedToOutputStream:()
- (void) writeDelimitedToOutputStream: |
|
(NSOutputStream *) |
output |
|
Writes out a varint for the message size followed by the the message to the given output stream.
◆ writeToCodedOutputStream:()
Writes out the message to the given output stream.
◆ writeToOutputStream:()
- (void) writeToOutputStream: |
|
(NSOutputStream *) |
output |
|
Writes out the message to the given output stream.
◆ initialized
Are all required fields set in the message and all embedded messages.
◆ unknownFields
The 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.
The documentation for this class was generated from the following files:
- Source/ThirdParty/libwebrtc/Source/third_party/protobuf/objectivec/GPBMessage.h
- Source/ThirdParty/libwebrtc/Source/third_party/protobuf/objectivec/GPBMessage.m