|
|
|
@ -39,6 +39,12 @@ |
|
|
|
|
#import "GPBUnknownField.h" |
|
|
|
|
#import "GPBUnknownFieldSet.h" |
|
|
|
|
|
|
|
|
|
// Direct access is use for speed, to avoid even internally declaring things |
|
|
|
|
// read/write, etc. The warning is enabled in the project to ensure code calling |
|
|
|
|
// protos can turn on -Wdirect-ivar-access without issues. |
|
|
|
|
#pragma clang diagnostic push |
|
|
|
|
#pragma clang diagnostic ignored "-Wdirect-ivar-access" |
|
|
|
|
|
|
|
|
|
static void AppendTextFormatForMessage(GPBMessage *message, |
|
|
|
|
NSMutableString *toStr, |
|
|
|
|
NSString *lineIndent); |
|
|
|
@ -891,7 +897,7 @@ void GPBSetMessageGroupField(GPBMessage *self, |
|
|
|
|
|
|
|
|
|
// Only exists for public api, no core code should use this. |
|
|
|
|
id GPBGetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field) { |
|
|
|
|
#if DEBUG |
|
|
|
|
#if defined(DEBUG) && DEBUG |
|
|
|
|
if (field.fieldType != GPBFieldTypeRepeated) { |
|
|
|
|
[NSException raise:NSInvalidArgumentException |
|
|
|
|
format:@"%@.%@ is not a repeated field.", |
|
|
|
@ -903,7 +909,7 @@ id GPBGetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field) { |
|
|
|
|
|
|
|
|
|
// Only exists for public api, no core code should use this. |
|
|
|
|
void GPBSetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field, id array) { |
|
|
|
|
#if DEBUG |
|
|
|
|
#if defined(DEBUG) && DEBUG |
|
|
|
|
if (field.fieldType != GPBFieldTypeRepeated) { |
|
|
|
|
[NSException raise:NSInvalidArgumentException |
|
|
|
|
format:@"%@.%@ is not a repeated field.", |
|
|
|
@ -957,7 +963,7 @@ void GPBSetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field, id |
|
|
|
|
GPBSetObjectIvarWithField(self, field, array); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#if DEBUG |
|
|
|
|
#if defined(DEBUG) && DEBUG |
|
|
|
|
static NSString *TypeToStr(GPBDataType dataType) { |
|
|
|
|
switch (dataType) { |
|
|
|
|
case GPBDataTypeBool: |
|
|
|
@ -993,7 +999,7 @@ static NSString *TypeToStr(GPBDataType dataType) { |
|
|
|
|
|
|
|
|
|
// Only exists for public api, no core code should use this. |
|
|
|
|
id GPBGetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field) { |
|
|
|
|
#if DEBUG |
|
|
|
|
#if defined(DEBUG) && DEBUG |
|
|
|
|
if (field.fieldType != GPBFieldTypeMap) { |
|
|
|
|
[NSException raise:NSInvalidArgumentException |
|
|
|
|
format:@"%@.%@ is not a map<> field.", |
|
|
|
@ -1006,7 +1012,7 @@ id GPBGetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field) { |
|
|
|
|
// Only exists for public api, no core code should use this. |
|
|
|
|
void GPBSetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field, |
|
|
|
|
id dictionary) { |
|
|
|
|
#if DEBUG |
|
|
|
|
#if defined(DEBUG) && DEBUG |
|
|
|
|
if (field.fieldType != GPBFieldTypeMap) { |
|
|
|
|
[NSException raise:NSInvalidArgumentException |
|
|
|
|
format:@"%@.%@ is not a map<> field.", |
|
|
|
@ -1133,6 +1139,8 @@ static void AppendTextFormatForMapMessageField( |
|
|
|
|
[toStr appendString:@"\n"]; |
|
|
|
|
|
|
|
|
|
[toStr appendString:valueLine]; |
|
|
|
|
#pragma clang diagnostic push |
|
|
|
|
#pragma clang diagnostic ignored "-Wswitch-enum" |
|
|
|
|
switch (valueDataType) { |
|
|
|
|
case GPBDataTypeString: |
|
|
|
|
AppendStringEscaped(value, toStr); |
|
|
|
@ -1153,6 +1161,7 @@ static void AppendTextFormatForMapMessageField( |
|
|
|
|
NSCAssert(NO, @"Can't happen"); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
#pragma clang diagnostic pop |
|
|
|
|
[toStr appendString:@"\n"]; |
|
|
|
|
|
|
|
|
|
[toStr appendString:msgEnd]; |
|
|
|
@ -1174,6 +1183,8 @@ static void AppendTextFormatForMapMessageField( |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[toStr appendString:valueLine]; |
|
|
|
|
#pragma clang diagnostic push |
|
|
|
|
#pragma clang diagnostic ignored "-Wswitch-enum" |
|
|
|
|
switch (valueDataType) { |
|
|
|
|
case GPBDataTypeString: |
|
|
|
|
AppendStringEscaped(valueObj, toStr); |
|
|
|
@ -1211,6 +1222,7 @@ static void AppendTextFormatForMapMessageField( |
|
|
|
|
[toStr appendString:valueObj]; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
#pragma clang diagnostic pop |
|
|
|
|
[toStr appendString:@"\n"]; |
|
|
|
|
|
|
|
|
|
[toStr appendString:msgEnd]; |
|
|
|
@ -1706,6 +1718,8 @@ NSString *GPBDecodeTextFormatName(const uint8_t *decodeData, int32_t key, |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#pragma clang diagnostic pop |
|
|
|
|
|
|
|
|
|
#pragma mark - GPBMessageSignatureProtocol |
|
|
|
|
|
|
|
|
|
// A series of selectors that are used solely to get @encoding values |
|
|
|
|