OLD | NEW |
(Empty) | |
| 1 // Protocol Buffers - Google's data interchange format |
| 2 // Copyright 2008 Google Inc. All rights reserved. |
| 3 // https://developers.google.com/protocol-buffers/ |
| 4 // |
| 5 // Redistribution and use in source and binary forms, with or without |
| 6 // modification, are permitted provided that the following conditions are |
| 7 // met: |
| 8 // |
| 9 // * Redistributions of source code must retain the above copyright |
| 10 // notice, this list of conditions and the following disclaimer. |
| 11 // * Redistributions in binary form must reproduce the above |
| 12 // copyright notice, this list of conditions and the following disclaimer |
| 13 // in the documentation and/or other materials provided with the |
| 14 // distribution. |
| 15 // * Neither the name of Google Inc. nor the names of its |
| 16 // contributors may be used to endorse or promote products derived from |
| 17 // this software without specific prior written permission. |
| 18 // |
| 19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 |
| 31 #import <Foundation/Foundation.h> |
| 32 |
| 33 #import "GPBRuntimeTypes.h" |
| 34 |
| 35 @class GPBEnumDescriptor; |
| 36 @class GPBFieldDescriptor; |
| 37 @class GPBFieldOptions; |
| 38 @class GPBFileDescriptor; |
| 39 @class GPBOneofDescriptor; |
| 40 |
| 41 NS_ASSUME_NONNULL_BEGIN |
| 42 |
| 43 typedef NS_ENUM(NSInteger, GPBFileSyntax) { |
| 44 GPBFileSyntaxUnknown = 0, |
| 45 GPBFileSyntaxProto2 = 2, |
| 46 GPBFileSyntaxProto3 = 3, |
| 47 }; |
| 48 |
| 49 typedef NS_ENUM(NSInteger, GPBFieldType) { |
| 50 GPBFieldTypeSingle, // optional/required |
| 51 GPBFieldTypeRepeated, // repeated |
| 52 GPBFieldTypeMap, // map<K,V> |
| 53 }; |
| 54 |
| 55 @interface GPBDescriptor : NSObject<NSCopying> |
| 56 |
| 57 @property(nonatomic, readonly, copy) NSString *name; |
| 58 @property(nonatomic, readonly, strong, nullable) NSArray *fields; |
| 59 @property(nonatomic, readonly, strong, nullable) NSArray *oneofs; |
| 60 @property(nonatomic, readonly, strong, nullable) NSArray *enums; |
| 61 @property(nonatomic, readonly, nullable) const GPBExtensionRange *extensionRange
s; |
| 62 @property(nonatomic, readonly) NSUInteger extensionRangesCount; |
| 63 @property(nonatomic, readonly, assign) GPBFileDescriptor *file; |
| 64 |
| 65 @property(nonatomic, readonly, getter=isWireFormat) BOOL wireFormat; |
| 66 @property(nonatomic, readonly) Class messageClass; |
| 67 |
| 68 - (nullable GPBFieldDescriptor *)fieldWithNumber:(uint32_t)fieldNumber; |
| 69 - (nullable GPBFieldDescriptor *)fieldWithName:(NSString *)name; |
| 70 - (nullable GPBOneofDescriptor *)oneofWithName:(NSString *)name; |
| 71 - (nullable GPBEnumDescriptor *)enumWithName:(NSString *)name; |
| 72 |
| 73 @end |
| 74 |
| 75 @interface GPBFileDescriptor : NSObject |
| 76 |
| 77 @property(nonatomic, readonly, copy) NSString *package; |
| 78 @property(nonatomic, readonly) GPBFileSyntax syntax; |
| 79 |
| 80 @end |
| 81 |
| 82 @interface GPBOneofDescriptor : NSObject |
| 83 @property(nonatomic, readonly) NSString *name; |
| 84 @property(nonatomic, readonly) NSArray *fields; |
| 85 |
| 86 - (nullable GPBFieldDescriptor *)fieldWithNumber:(uint32_t)fieldNumber; |
| 87 - (nullable GPBFieldDescriptor *)fieldWithName:(NSString *)name; |
| 88 @end |
| 89 |
| 90 @interface GPBFieldDescriptor : NSObject |
| 91 |
| 92 @property(nonatomic, readonly, copy) NSString *name; |
| 93 @property(nonatomic, readonly) uint32_t number; |
| 94 @property(nonatomic, readonly) GPBDataType dataType; |
| 95 @property(nonatomic, readonly) BOOL hasDefaultValue; |
| 96 @property(nonatomic, readonly) GPBGenericValue defaultValue; |
| 97 @property(nonatomic, readonly, getter=isRequired) BOOL required; |
| 98 @property(nonatomic, readonly, getter=isOptional) BOOL optional; |
| 99 @property(nonatomic, readonly) GPBFieldType fieldType; |
| 100 // If it is a map, the value type is in -type. |
| 101 @property(nonatomic, readonly) GPBDataType mapKeyDataType; |
| 102 @property(nonatomic, readonly, getter=isPackable) BOOL packable; |
| 103 |
| 104 @property(nonatomic, readonly, assign, nullable) GPBOneofDescriptor *containingO
neof; |
| 105 |
| 106 @property(nonatomic, readonly, nullable) GPBFieldOptions *fieldOptions; |
| 107 |
| 108 // Message properties |
| 109 @property(nonatomic, readonly, assign, nullable) Class msgClass; |
| 110 |
| 111 // Enum properties |
| 112 @property(nonatomic, readonly, strong, nullable) GPBEnumDescriptor *enumDescript
or; |
| 113 |
| 114 - (BOOL)isValidEnumValue:(int32_t)value; |
| 115 |
| 116 // For now, this will return nil if it doesn't know the name to use for |
| 117 // TextFormat. |
| 118 - (nullable NSString *)textFormatName; |
| 119 |
| 120 @end |
| 121 |
| 122 @interface GPBEnumDescriptor : NSObject |
| 123 |
| 124 @property(nonatomic, readonly, copy) NSString *name; |
| 125 @property(nonatomic, readonly) GPBEnumValidationFunc enumVerifier; |
| 126 |
| 127 - (nullable NSString *)enumNameForValue:(int32_t)number; |
| 128 - (BOOL)getValue:(nullable int32_t *)outValue forEnumName:(NSString *)name; |
| 129 |
| 130 - (nullable NSString *)textFormatNameForValue:(int32_t)number; |
| 131 |
| 132 @end |
| 133 |
| 134 @interface GPBExtensionDescriptor : NSObject<NSCopying> |
| 135 @property(nonatomic, readonly) uint32_t fieldNumber; |
| 136 @property(nonatomic, readonly) Class containingMessageClass; |
| 137 @property(nonatomic, readonly) GPBDataType dataType; |
| 138 @property(nonatomic, readonly, getter=isRepeated) BOOL repeated; |
| 139 @property(nonatomic, readonly, getter=isPackable) BOOL packable; |
| 140 @property(nonatomic, readonly, assign) Class msgClass; |
| 141 @property(nonatomic, readonly) NSString *singletonName; |
| 142 @property(nonatomic, readonly, strong, nullable) GPBEnumDescriptor *enumDescript
or; |
| 143 @property(nonatomic, readonly) id defaultValue; |
| 144 @end |
| 145 |
| 146 NS_ASSUME_NONNULL_END |
OLD | NEW |