Commit b99577c5 authored by Sergio Campamá's avatar Sergio Campamá Committed by Thomas Van Lenten

Exposes the currently registered extensions for a message and removes the…

Exposes the currently registered extensions for a message and removes the internal sortedExtensionsInUse
parent f6d1d1a1
......@@ -275,6 +275,9 @@ CF_EXTERN_C_END
/// Return the descriptor for the message.
- (GPBDescriptor *)descriptor;
/// Returns an array with the currently set GPBExtensionDescriptors.
- (NSArray *)extensionsCurrentlySet;
/// Test to see if the given extension is set on the message.
- (BOOL)hasExtension:(GPBExtensionDescriptor *)extension;
......
......@@ -1777,11 +1777,6 @@ static GPBUnknownFieldSet *GetOrMakeUnknownFields(GPBMessage *self) {
}
}
- (NSArray *)sortedExtensionsInUse {
return [[extensionMap_ allKeys]
sortedArrayUsingSelector:@selector(compareByFieldNumber:)];
}
- (void)setExtension:(GPBExtensionDescriptor *)extension value:(id)value {
if (!value) {
[self clearExtension:extension];
......
......@@ -78,10 +78,6 @@ typedef struct GPBMessage_Storage *GPBMessage_StoragePtr;
// returns nil if the extension is not set)
- (id)getExistingExtension:(GPBExtensionDescriptor *)extension;
// Returns an array of GPBExtensionDescriptor* for all the extensions currently
// in use on the message. They are sorted by field number.
- (NSArray *)sortedExtensionsInUse;
// Parses a message of this type from the input and merges it with this
// message.
//
......
......@@ -1472,7 +1472,8 @@ static void AppendTextFormatForMessage(GPBMessage *message,
NSUInteger fieldCount = fieldsArray.count;
const GPBExtensionRange *extensionRanges = descriptor.extensionRanges;
NSUInteger extensionRangesCount = descriptor.extensionRangesCount;
NSArray *activeExtensions = [message sortedExtensionsInUse];
NSArray *activeExtensions = [[message extensionsCurrentlySet]
sortedArrayUsingSelector:@selector(compareByFieldNumber:)];
for (NSUInteger i = 0, j = 0; i < fieldCount || j < extensionRangesCount;) {
if (i == fieldCount) {
AppendTextFormatForMessageExtensionRange(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment