GPBUnknownFieldSet.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. #import <Foundation/Foundation.h>
  8. @class GPBUnknownField;
  9. NS_ASSUME_NONNULL_BEGIN
  10. /**
  11. * A collection of unknown fields. Fields parsed from the binary representation
  12. * of a message that are unknown end up in an instance of this set.
  13. **/
  14. __attribute__((objc_subclassing_restricted))
  15. @interface GPBUnknownFieldSet : NSObject<NSCopying>
  16. /**
  17. * Tests to see if the given field number has a value.
  18. *
  19. * @param number The field number to check.
  20. *
  21. * @return YES if there is an unknown field for the given field number.
  22. **/
  23. - (BOOL)hasField:(int32_t)number;
  24. /**
  25. * Fetches the GPBUnknownField for the given field number.
  26. *
  27. * @param number The field number to look up.
  28. *
  29. * @return The GPBUnknownField or nil if none found.
  30. **/
  31. - (nullable GPBUnknownField *)getField:(int32_t)number;
  32. /**
  33. * @return The number of fields in this set.
  34. **/
  35. - (NSUInteger)countOfFields;
  36. /**
  37. * Adds the given field to the set.
  38. *
  39. * @param field The field to add to the set.
  40. **/
  41. - (void)addField:(GPBUnknownField *)field;
  42. /**
  43. * @return An array of the GPBUnknownFields sorted by the field numbers.
  44. **/
  45. - (NSArray<GPBUnknownField *> *)sortedFields;
  46. @end
  47. NS_ASSUME_NONNULL_END