Explicitly convert an enum to an int (#19537)
[google-protobuf.git] / objectivec / GPBUnknownField.h
blob0b1b922692481a3edb046d0b15b78fd1a8b98ef6
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
8 #import <Foundation/Foundation.h>
10 #import "GPBArray.h"
11 #import "GPBUnknownFields.h"
13 @class GPBUnknownFields;
15 NS_ASSUME_NONNULL_BEGIN
17 typedef NS_ENUM(uint8_t, GPBUnknownFieldType) {
18 GPBUnknownFieldTypeVarint,
19 GPBUnknownFieldTypeFixed32,
20 GPBUnknownFieldTypeFixed64,
21 GPBUnknownFieldTypeLengthDelimited, // Length prefixed
22 GPBUnknownFieldTypeGroup, // Tag delimited
25 /**
26 * Store an unknown field. These are used in conjunction with GPBUnknownFields.
27 **/
28 __attribute__((objc_subclassing_restricted))
29 @interface GPBUnknownField : NSObject<NSCopying>
31 /** The field number the data is stored under. */
32 @property(nonatomic, readonly, assign) int32_t number;
34 /** The type of the field. */
35 @property(nonatomic, readonly, assign) GPBUnknownFieldType type;
37 /**
38 * Fetch the varint value.
40 * It is a programming error to call this when the `type` is not a varint.
42 @property(nonatomic, readonly, assign) uint64_t varint;
44 /**
45 * Fetch the fixed32 value.
47 * It is a programming error to call this when the `type` is not a fixed32.
49 @property(nonatomic, readonly, assign) uint32_t fixed32;
51 /**
52 * Fetch the fixed64 value.
54 * It is a programming error to call this when the `type` is not a fixed64.
56 @property(nonatomic, readonly, assign) uint64_t fixed64;
58 /**
59 * Fetch the length delimited (length prefixed) value.
61 * It is a programming error to call this when the `type` is not a length
62 * delimited.
64 @property(nonatomic, readonly, strong, nonnull) NSData *lengthDelimited;
66 /**
67 * Fetch the group (tag delimited) value.
69 * It is a programming error to call this when the `type` is not a group.
71 @property(nonatomic, readonly, strong, nonnull) GPBUnknownFields *group;
73 @end
75 NS_ASSUME_NONNULL_END