1 // Protocol Buffers - Google's data interchange format 2 // Copyright 2008 Google Inc. All rights reserved. 3 // 4 // Use of this source code is governed by a BSD-style 5 // license that can be found in the LICENSE file or at 6 // https://developers.google.com/open-source/licenses/bsd 7 8 #import <Foundation/Foundation.h> 9 10 #import "GPBUnknownField.h" 11 12 @class GPBUnknownField; 13 14 NS_ASSUME_NONNULL_BEGIN 15 16 /** 17 * A collection of unknown fields. Fields parsed from the binary representation 18 * of a message that are unknown end up in an instance of this set. 19 **/ 20 __attribute__((deprecated("Use GPBUnknownFields instead.", "GPBUnknownFields"))) 21 __attribute__((objc_subclassing_restricted)) 22 @interface GPBUnknownFieldSet : NSObject<NSCopying> 23 24 /** 25 * Tests to see if the given field number has a value. 26 * 27 * @param number The field number to check. 28 * 29 * @return YES if there is an unknown field for the given field number. 30 **/ 31 - (BOOL)hasField:(int32_t)number; 32 33 /** 34 * Fetches the GPBUnknownField for the given field number. 35 * 36 * @param number The field number to look up. 37 * 38 * @return The GPBUnknownField or nil if none found. 39 **/ 40 - (nullable GPBUnknownField *)getField:(int32_t)number; 41 42 /** 43 * @return The number of fields in this set. 44 **/ 45 - (NSUInteger)countOfFields; 46 47 /** 48 * Adds the given field to the set. 49 * 50 * @param field The field to add to the set. 51 **/ 52 - (void)addField:(GPBUnknownField *)field; 53 54 /** 55 * @return An array of the GPBUnknownFields sorted by the field numbers. 56 **/ 57 - (NSArray<GPBUnknownField *> *)sortedFields; 58 59 @end 60 61 NS_ASSUME_NONNULL_END 62