diff options
Diffstat (limited to 'objectivec/GPBMessage.m')
-rw-r--r-- | objectivec/GPBMessage.m | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/objectivec/GPBMessage.m b/objectivec/GPBMessage.m index 919fb931..7ab184c1 100644 --- a/objectivec/GPBMessage.m +++ b/objectivec/GPBMessage.m @@ -3199,4 +3199,34 @@ static void ResolveIvarSet(GPBFieldDescriptor *field, @end +#pragma mark - Messages from GPBUtilities.h but defined here for access to helpers. + +// Only exists for public api, no core code should use this. +id GPBGetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field) { +#if defined(DEBUG) && DEBUG + if (field.fieldType != GPBFieldTypeRepeated) { + [NSException raise:NSInvalidArgumentException + format:@"%@.%@ is not a repeated field.", + [self class], field.name]; + } +#endif + GPBDescriptor *descriptor = [[self class] descriptor]; + GPBFileSyntax syntax = descriptor.file.syntax; + return GetOrCreateArrayIvarWithField(self, field, syntax); +} + +// Only exists for public api, no core code should use this. +id GPBGetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field) { +#if defined(DEBUG) && DEBUG + if (field.fieldType != GPBFieldTypeMap) { + [NSException raise:NSInvalidArgumentException + format:@"%@.%@ is not a map<> field.", + [self class], field.name]; + } +#endif + GPBDescriptor *descriptor = [[self class] descriptor]; + GPBFileSyntax syntax = descriptor.file.syntax; + return GetOrCreateMapIvarWithField(self, field, syntax); +} + #pragma clang diagnostic pop |