Functions
protobuf/objectivec/GPBUtilities.h File Reference
#import <Foundation/Foundation.h>
#import "GPBArray.h"
#import "GPBMessage.h"
#import "GPBRuntimeTypes.h"
Include dependency graph for protobuf/objectivec/GPBUtilities.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void GPBClearMessageField (GPBMessage *self, GPBFieldDescriptor *field)
 
void GPBClearOneof (GPBMessage *self, GPBOneofDescriptor *oneof)
 
NSData * GPBEmptyNSData (void) __attribute__((pure))
 
BOOL GPBGetMessageBoolField (GPBMessage *self, GPBFieldDescriptor *field)
 
NSData * GPBGetMessageBytesField (GPBMessage *self, GPBFieldDescriptor *field)
 
double GPBGetMessageDoubleField (GPBMessage *self, GPBFieldDescriptor *field)
 
int32_t GPBGetMessageEnumField (GPBMessage *self, GPBFieldDescriptor *field)
 
float GPBGetMessageFloatField (GPBMessage *self, GPBFieldDescriptor *field)
 
GPBMessageGPBGetMessageGroupField (GPBMessage *self, GPBFieldDescriptor *field)
 
int32_t GPBGetMessageInt32Field (GPBMessage *self, GPBFieldDescriptor *field)
 
int64_t GPBGetMessageInt64Field (GPBMessage *self, GPBFieldDescriptor *field)
 
id GPBGetMessageMapField (GPBMessage *self, GPBFieldDescriptor *field)
 
GPBMessageGPBGetMessageMessageField (GPBMessage *self, GPBFieldDescriptor *field)
 
int32_t GPBGetMessageRawEnumField (GPBMessage *self, GPBFieldDescriptor *field)
 
id GPBGetMessageRepeatedField (GPBMessage *self, GPBFieldDescriptor *field)
 
NSString * GPBGetMessageStringField (GPBMessage *self, GPBFieldDescriptor *field)
 
uint32_t GPBGetMessageUInt32Field (GPBMessage *self, GPBFieldDescriptor *field)
 
uint64_t GPBGetMessageUInt64Field (GPBMessage *self, GPBFieldDescriptor *field)
 
void GPBMessageDropUnknownFieldsRecursively (GPBMessage *message)
 
BOOL GPBMessageHasFieldNumberSet (GPBMessage *self, uint32_t fieldNumber)
 
BOOL GPBMessageHasFieldSet (GPBMessage *self, GPBFieldDescriptor *field)
 
void GPBSetMessageBoolField (GPBMessage *self, GPBFieldDescriptor *field, BOOL value)
 
void GPBSetMessageBytesField (GPBMessage *self, GPBFieldDescriptor *field, NSData *value)
 
void GPBSetMessageDoubleField (GPBMessage *self, GPBFieldDescriptor *field, double value)
 
void GPBSetMessageEnumField (GPBMessage *self, GPBFieldDescriptor *field, int32_t value)
 
void GPBSetMessageFloatField (GPBMessage *self, GPBFieldDescriptor *field, float value)
 
void GPBSetMessageGroupField (GPBMessage *self, GPBFieldDescriptor *field, GPBMessage *value)
 
void GPBSetMessageInt32Field (GPBMessage *self, GPBFieldDescriptor *field, int32_t value)
 
void GPBSetMessageInt64Field (GPBMessage *self, GPBFieldDescriptor *field, int64_t value)
 
void GPBSetMessageMapField (GPBMessage *self, GPBFieldDescriptor *field, id dictionary)
 
void GPBSetMessageMessageField (GPBMessage *self, GPBFieldDescriptor *field, GPBMessage *value)
 
void GPBSetMessageRawEnumField (GPBMessage *self, GPBFieldDescriptor *field, int32_t value)
 
void GPBSetMessageRepeatedField (GPBMessage *self, GPBFieldDescriptor *field, id array)
 
void GPBSetMessageStringField (GPBMessage *self, GPBFieldDescriptor *field, NSString *value)
 
void GPBSetMessageUInt32Field (GPBMessage *self, GPBFieldDescriptor *field, uint32_t value)
 
void GPBSetMessageUInt64Field (GPBMessage *self, GPBFieldDescriptor *field, uint64_t value)
 
CF_EXTERN_C_BEGIN NS_ASSUME_NONNULL_BEGIN NSString * GPBTextFormatForMessage (GPBMessage *message, NSString *__nullable lineIndent)
 
NSString * GPBTextFormatForUnknownFieldSet (GPBUnknownFieldSet *__nullable unknownSet, NSString *__nullable lineIndent)
 

Function Documentation

◆ GPBClearMessageField()

void GPBClearMessageField ( GPBMessage self,
GPBFieldDescriptor field 
)

Clears the given field for the given message.

Parameters
selfThe message for which to clear the field.
fieldThe field to clear.

◆ GPBClearOneof()

void GPBClearOneof ( GPBMessage self,
GPBOneofDescriptor oneof 
)

Clears the given oneof field for the given message.

Parameters
selfThe message for which to clear the field.
oneofThe oneof to clear.

◆ GPBEmptyNSData()

NSData* GPBEmptyNSData ( void  )

Returns an empty NSData to assign to byte fields when you wish to assign them to empty. Prevents allocating a lot of little [NSData data] objects.

◆ GPBGetMessageBoolField()

BOOL GPBGetMessageBoolField ( GPBMessage self,
GPBFieldDescriptor field 
)

Gets the value of a bool field.

Parameters
selfThe message from which to get the field.
fieldThe field to get.

◆ GPBGetMessageBytesField()

NSData* GPBGetMessageBytesField ( GPBMessage self,
GPBFieldDescriptor field 
)

Gets the value of a bytes field.

Parameters
selfThe message from which to get the field.
fieldThe field to get.

◆ GPBGetMessageDoubleField()

double GPBGetMessageDoubleField ( GPBMessage self,
GPBFieldDescriptor field 
)

Gets the value of a double field.

Parameters
selfThe message from which to get the field.
fieldThe field to get.

◆ GPBGetMessageEnumField()

int32_t GPBGetMessageEnumField ( GPBMessage self,
GPBFieldDescriptor field 
)

Gets the given enum field of a message. For proto3, if the value isn't a member of the enum, kGPBUnrecognizedEnumeratorValue will be returned. GPBGetMessageRawEnumField will bypass the check and return whatever value was set.

Parameters
selfThe message from which to get the field.
fieldThe field to get.
Returns
The enum value for the given field.

◆ GPBGetMessageFloatField()

float GPBGetMessageFloatField ( GPBMessage self,
GPBFieldDescriptor field 
)

Gets the value of a float field.

Parameters
selfThe message from which to get the field.
fieldThe field to get.

◆ GPBGetMessageGroupField()

GPBMessage* GPBGetMessageGroupField ( GPBMessage self,
GPBFieldDescriptor field 
)

Gets the value of a group field.

Parameters
selfThe message from which to get the field.
fieldThe field to get.

◆ GPBGetMessageInt32Field()

int32_t GPBGetMessageInt32Field ( GPBMessage self,
GPBFieldDescriptor field 
)

Gets the value of an int32 field.

Parameters
selfThe message from which to get the field.
fieldThe field to get.

◆ GPBGetMessageInt64Field()

int64_t GPBGetMessageInt64Field ( GPBMessage self,
GPBFieldDescriptor field 
)

Gets the value of an int64 field.

Parameters
selfThe message from which to get the field.
fieldThe field to get.

◆ GPBGetMessageMapField()

id GPBGetMessageMapField ( GPBMessage self,
GPBFieldDescriptor field 
)

Gets the value of a map<> field.

Parameters
selfThe message from which to get the field.
fieldThe repeated field to get.
Returns
A GPB*Dictionary or NSMutableDictionary based on the field's type.

◆ GPBGetMessageMessageField()

GPBMessage* GPBGetMessageMessageField ( GPBMessage self,
GPBFieldDescriptor field 
)

Gets the value of a message field.

Parameters
selfThe message from which to get the field.
fieldThe field to get.

◆ GPBGetMessageRawEnumField()

int32_t GPBGetMessageRawEnumField ( GPBMessage self,
GPBFieldDescriptor field 
)

Get the given enum field of a message. No check is done to ensure the value was defined in the enum.

Parameters
selfThe message from which to get the field.
fieldThe field to get.
Returns
The raw enum value for the given field.

◆ GPBGetMessageRepeatedField()

id GPBGetMessageRepeatedField ( GPBMessage self,
GPBFieldDescriptor field 
)

Gets the value of a repeated field.

Parameters
selfThe message from which to get the field.
fieldThe repeated field to get.
Returns
A GPB*Array or an NSMutableArray based on the field's type.

◆ GPBGetMessageStringField()

NSString* GPBGetMessageStringField ( GPBMessage self,
GPBFieldDescriptor field 
)

Gets the value of a string field.

Parameters
selfThe message from which to get the field.
fieldThe field to get.

◆ GPBGetMessageUInt32Field()

uint32_t GPBGetMessageUInt32Field ( GPBMessage self,
GPBFieldDescriptor field 
)

Gets the value of an uint32 field.

Parameters
selfThe message from which to get the field.
fieldThe field to get.

◆ GPBGetMessageUInt64Field()

uint64_t GPBGetMessageUInt64Field ( GPBMessage self,
GPBFieldDescriptor field 
)

Gets the value of an uint64 field.

Parameters
selfThe message from which to get the field.
fieldThe field to get.

◆ GPBMessageDropUnknownFieldsRecursively()

void GPBMessageDropUnknownFieldsRecursively ( GPBMessage message)

Drops the unknownFields from the given message and from all sub message.

◆ GPBMessageHasFieldNumberSet()

BOOL GPBMessageHasFieldNumberSet ( GPBMessage self,
uint32_t  fieldNumber 
)

Checks if the given field number is set on a message.

Parameters
selfThe message to check.
fieldNumberThe field number to check.
Returns
YES if the field number is set on the given message.

◆ GPBMessageHasFieldSet()

BOOL GPBMessageHasFieldSet ( GPBMessage self,
GPBFieldDescriptor field 
)

Checks if the given field is set on a message.

Parameters
selfThe message to check.
fieldThe field to check.
Returns
YES if the field is set on the given message.

◆ GPBSetMessageBoolField()

void GPBSetMessageBoolField ( GPBMessage self,
GPBFieldDescriptor field,
BOOL  value 
)

Sets the value of a bool field.

Parameters
selfThe message into which to set the field.
fieldThe field to set.
valueThe to set in the field.

◆ GPBSetMessageBytesField()

void GPBSetMessageBytesField ( GPBMessage self,
GPBFieldDescriptor field,
NSData *  value 
)

Sets the value of a bytes field.

Parameters
selfThe message into which to set the field.
fieldThe field to set.
valueThe to set in the field.

◆ GPBSetMessageDoubleField()

void GPBSetMessageDoubleField ( GPBMessage self,
GPBFieldDescriptor field,
double  value 
)

Sets the value of a double field.

Parameters
selfThe message into which to set the field.
fieldThe field to set.
valueThe to set in the field.

◆ GPBSetMessageEnumField()

void GPBSetMessageEnumField ( GPBMessage self,
GPBFieldDescriptor field,
int32_t  value 
)

Set the given enum field of a message. You can only set values that are members of the enum.

Parameters
selfThe message into which to set the field.
fieldThe field to set.
valueThe enum value to set in the field.

◆ GPBSetMessageFloatField()

void GPBSetMessageFloatField ( GPBMessage self,
GPBFieldDescriptor field,
float  value 
)

Sets the value of a float field.

Parameters
selfThe message into which to set the field.
fieldThe field to set.
valueThe to set in the field.

◆ GPBSetMessageGroupField()

void GPBSetMessageGroupField ( GPBMessage self,
GPBFieldDescriptor field,
GPBMessage value 
)

Sets the value of a group field.

Parameters
selfThe message into which to set the field.
fieldThe field to set.
valueThe to set in the field.

◆ GPBSetMessageInt32Field()

void GPBSetMessageInt32Field ( GPBMessage self,
GPBFieldDescriptor field,
int32_t  value 
)

Sets the value of an int32 field.

Parameters
selfThe message into which to set the field.
fieldThe field to set.
valueThe to set in the field.

◆ GPBSetMessageInt64Field()

void GPBSetMessageInt64Field ( GPBMessage self,
GPBFieldDescriptor field,
int64_t  value 
)

Sets the value of an int64 field.

Parameters
selfThe message into which to set the field.
fieldThe field to set.
valueThe to set in the field.

◆ GPBSetMessageMapField()

void GPBSetMessageMapField ( GPBMessage self,
GPBFieldDescriptor field,
id  dictionary 
)

Sets the value of a map<> field.

Parameters
selfThe message into which to set the field.
fieldThe field to set.
dictionaryA GPB*Dictionary or NSMutableDictionary based on the field's type.

◆ GPBSetMessageMessageField()

void GPBSetMessageMessageField ( GPBMessage self,
GPBFieldDescriptor field,
GPBMessage value 
)

Sets the value of a message field.

Parameters
selfThe message into which to set the field.
fieldThe field to set.
valueThe to set in the field.

◆ GPBSetMessageRawEnumField()

void GPBSetMessageRawEnumField ( GPBMessage self,
GPBFieldDescriptor field,
int32_t  value 
)

Set the given enum field of a message. You can set the value to anything, even a value that is not a member of the enum.

Parameters
selfThe message into which to set the field.
fieldThe field to set.
valueThe raw enum value to set in the field.

◆ GPBSetMessageRepeatedField()

void GPBSetMessageRepeatedField ( GPBMessage self,
GPBFieldDescriptor field,
id  array 
)

Sets the value of a repeated field.

Parameters
selfThe message into which to set the field.
fieldThe field to set.
arrayA GPB*Array or NSMutableArray based on the field's type.

◆ GPBSetMessageStringField()

void GPBSetMessageStringField ( GPBMessage self,
GPBFieldDescriptor field,
NSString *  value 
)

Sets the value of a string field.

Parameters
selfThe message into which to set the field.
fieldThe field to set.
valueThe to set in the field.

◆ GPBSetMessageUInt32Field()

void GPBSetMessageUInt32Field ( GPBMessage self,
GPBFieldDescriptor field,
uint32_t  value 
)

Sets the value of an uint32 field.

Parameters
selfThe message into which to set the field.
fieldThe field to set.
valueThe to set in the field.

◆ GPBSetMessageUInt64Field()

void GPBSetMessageUInt64Field ( GPBMessage self,
GPBFieldDescriptor field,
uint64_t  value 
)

Sets the value of an uint64 field.

Parameters
selfThe message into which to set the field.
fieldThe field to set.
valueThe to set in the field.

◆ GPBTextFormatForMessage()

CF_EXTERN_C_BEGIN NS_ASSUME_NONNULL_BEGIN NSString* GPBTextFormatForMessage ( GPBMessage message,
NSString *__nullable  lineIndent 
)

Generates a string that should be a valid "TextFormat" for the C++ version of Protocol Buffers.

Parameters
messageThe message to generate from.
lineIndentA string to use as the prefix for all lines generated. Can be nil if no extra indent is needed.
Returns
An NSString with the TextFormat of the message.

◆ GPBTextFormatForUnknownFieldSet()

NSString* GPBTextFormatForUnknownFieldSet ( GPBUnknownFieldSet *__nullable  unknownSet,
NSString *__nullable  lineIndent 
)

Generates a string that should be a valid "TextFormat" for the C++ version of Protocol Buffers.

Parameters
unknownSetThe unknown field set to generate from.
lineIndentA string to use as the prefix for all lines generated. Can be nil if no extra indent is needed.
Returns
An NSString with the TextFormat of the unknown field set.


grpc
Author(s):
autogenerated on Fri May 16 2025 03:01:16