Protocol Buffers - Google's data interchange format (grpc依赖)
https://developers.google.com/protocol-buffers/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
728 lines
25 KiB
728 lines
25 KiB
10 years ago
|
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||
|
// source: google/protobuf/type.proto
|
||
|
|
||
9 years ago
|
// This CPP symbol can be defined to use imports that match up to the framework
|
||
|
// imports needed when using CocoaPods.
|
||
|
#if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
|
||
|
#define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
|
||
|
#endif
|
||
|
|
||
|
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
|
||
5 years ago
|
#import <Protobuf/GPBProtocolBuffers_RuntimeSupport.h>
|
||
9 years ago
|
#else
|
||
|
#import "GPBProtocolBuffers_RuntimeSupport.h"
|
||
|
#endif
|
||
|
|
||
7 years ago
|
#import <stdatomic.h>
|
||
|
|
||
9 years ago
|
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
|
||
5 years ago
|
#import <Protobuf/GPBType.pbobjc.h>
|
||
|
#import <Protobuf/GPBAny.pbobjc.h>
|
||
|
#import <Protobuf/GPBSourceContext.pbobjc.h>
|
||
9 years ago
|
#else
|
||
5 years ago
|
#import "GPBType.pbobjc.h"
|
||
|
#import "GPBAny.pbobjc.h"
|
||
|
#import "GPBSourceContext.pbobjc.h"
|
||
9 years ago
|
#endif
|
||
10 years ago
|
// @@protoc_insertion_point(imports)
|
||
|
|
||
9 years ago
|
#pragma clang diagnostic push
|
||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||
5 years ago
|
#pragma clang diagnostic ignored "-Wdollar-in-identifier-extension"
|
||
|
|
||
5 years ago
|
#pragma mark - Objective C Class declarations
|
||
|
// Forward declarations of Objective C classes that we can use as
|
||
|
// static values in struct initializers.
|
||
|
// We don't use [Foo class] because it is not a static value.
|
||
|
GPBObjCClassDeclaration(GPBAny);
|
||
|
GPBObjCClassDeclaration(GPBEnumValue);
|
||
|
GPBObjCClassDeclaration(GPBField);
|
||
|
GPBObjCClassDeclaration(GPBOption);
|
||
|
GPBObjCClassDeclaration(GPBSourceContext);
|
||
9 years ago
|
|
||
10 years ago
|
#pragma mark - GPBTypeRoot
|
||
|
|
||
|
@implementation GPBTypeRoot
|
||
|
|
||
8 years ago
|
// No extensions in the file and none of the imports (direct or indirect)
|
||
|
// defined extensions, so no need to generate +extensionRegistry.
|
||
10 years ago
|
|
||
|
@end
|
||
|
|
||
10 years ago
|
#pragma mark - GPBTypeRoot_FileDescriptor
|
||
|
|
||
10 years ago
|
static GPBFileDescriptor *GPBTypeRoot_FileDescriptor(void) {
|
||
|
// This is called by +initialize so there is no need to worry
|
||
|
// about thread safety of the singleton.
|
||
|
static GPBFileDescriptor *descriptor = NULL;
|
||
|
if (!descriptor) {
|
||
8 years ago
|
GPB_DEBUG_CHECK_RUNTIME_VERSIONS();
|
||
10 years ago
|
descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"google.protobuf"
|
||
8 years ago
|
objcPrefix:@"GPB"
|
||
10 years ago
|
syntax:GPBFileSyntaxProto3];
|
||
|
}
|
||
|
return descriptor;
|
||
|
}
|
||
|
|
||
9 years ago
|
#pragma mark - Enum GPBSyntax
|
||
|
|
||
|
GPBEnumDescriptor *GPBSyntax_EnumDescriptor(void) {
|
||
7 years ago
|
static _Atomic(GPBEnumDescriptor*) descriptor = nil;
|
||
9 years ago
|
if (!descriptor) {
|
||
9 years ago
|
static const char *valueNames =
|
||
|
"SyntaxProto2\000SyntaxProto3\000";
|
||
|
static const int32_t values[] = {
|
||
|
GPBSyntax_SyntaxProto2,
|
||
|
GPBSyntax_SyntaxProto3,
|
||
9 years ago
|
};
|
||
9 years ago
|
GPBEnumDescriptor *worker =
|
||
|
[GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GPBSyntax)
|
||
|
valueNames:valueNames
|
||
|
values:values
|
||
|
count:(uint32_t)(sizeof(values) / sizeof(int32_t))
|
||
|
enumVerifier:GPBSyntax_IsValidValue];
|
||
7 years ago
|
GPBEnumDescriptor *expected = nil;
|
||
|
if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) {
|
||
9 years ago
|
[worker release];
|
||
|
}
|
||
9 years ago
|
}
|
||
|
return descriptor;
|
||
|
}
|
||
|
|
||
|
BOOL GPBSyntax_IsValidValue(int32_t value__) {
|
||
|
switch (value__) {
|
||
|
case GPBSyntax_SyntaxProto2:
|
||
|
case GPBSyntax_SyntaxProto3:
|
||
|
return YES;
|
||
|
default:
|
||
|
return NO;
|
||
|
}
|
||
|
}
|
||
|
|
||
10 years ago
|
#pragma mark - GPBType
|
||
|
|
||
|
@implementation GPBType
|
||
|
|
||
|
@dynamic name;
|
||
10 years ago
|
@dynamic fieldsArray, fieldsArray_Count;
|
||
|
@dynamic oneofsArray, oneofsArray_Count;
|
||
|
@dynamic optionsArray, optionsArray_Count;
|
||
10 years ago
|
@dynamic hasSourceContext, sourceContext;
|
||
9 years ago
|
@dynamic syntax;
|
||
10 years ago
|
|
||
10 years ago
|
typedef struct GPBType__storage_ {
|
||
10 years ago
|
uint32_t _has_storage_[1];
|
||
9 years ago
|
GPBSyntax syntax;
|
||
10 years ago
|
NSString *name;
|
||
|
NSMutableArray *fieldsArray;
|
||
|
NSMutableArray *oneofsArray;
|
||
|
NSMutableArray *optionsArray;
|
||
|
GPBSourceContext *sourceContext;
|
||
10 years ago
|
} GPBType__storage_;
|
||
10 years ago
|
|
||
|
// This method is threadsafe because it is initially called
|
||
|
// in +initialize for each subclass.
|
||
|
+ (GPBDescriptor *)descriptor {
|
||
10 years ago
|
static GPBDescriptor *descriptor = nil;
|
||
10 years ago
|
if (!descriptor) {
|
||
|
static GPBMessageFieldDescription fields[] = {
|
||
|
{
|
||
|
.name = "name",
|
||
5 years ago
|
.dataTypeSpecific.clazz = Nil,
|
||
10 years ago
|
.number = GPBType_FieldNumber_Name,
|
||
|
.hasIndex = 0,
|
||
9 years ago
|
.offset = (uint32_t)offsetof(GPBType__storage_, name),
|
||
10 years ago
|
.flags = GPBFieldOptional,
|
||
10 years ago
|
.dataType = GPBDataTypeString,
|
||
10 years ago
|
},
|
||
|
{
|
||
|
.name = "fieldsArray",
|
||
5 years ago
|
.dataTypeSpecific.clazz = GPBObjCClass(GPBField),
|
||
10 years ago
|
.number = GPBType_FieldNumber_FieldsArray,
|
||
|
.hasIndex = GPBNoHasBit,
|
||
9 years ago
|
.offset = (uint32_t)offsetof(GPBType__storage_, fieldsArray),
|
||
10 years ago
|
.flags = GPBFieldRepeated,
|
||
10 years ago
|
.dataType = GPBDataTypeMessage,
|
||
10 years ago
|
},
|
||
|
{
|
||
|
.name = "oneofsArray",
|
||
5 years ago
|
.dataTypeSpecific.clazz = Nil,
|
||
10 years ago
|
.number = GPBType_FieldNumber_OneofsArray,
|
||
|
.hasIndex = GPBNoHasBit,
|
||
9 years ago
|
.offset = (uint32_t)offsetof(GPBType__storage_, oneofsArray),
|
||
10 years ago
|
.flags = GPBFieldRepeated,
|
||
10 years ago
|
.dataType = GPBDataTypeString,
|
||
10 years ago
|
},
|
||
|
{
|
||
|
.name = "optionsArray",
|
||
5 years ago
|
.dataTypeSpecific.clazz = GPBObjCClass(GPBOption),
|
||
10 years ago
|
.number = GPBType_FieldNumber_OptionsArray,
|
||
|
.hasIndex = GPBNoHasBit,
|
||
9 years ago
|
.offset = (uint32_t)offsetof(GPBType__storage_, optionsArray),
|
||
10 years ago
|
.flags = GPBFieldRepeated,
|
||
10 years ago
|
.dataType = GPBDataTypeMessage,
|
||
10 years ago
|
},
|
||
|
{
|
||
|
.name = "sourceContext",
|
||
5 years ago
|
.dataTypeSpecific.clazz = GPBObjCClass(GPBSourceContext),
|
||
10 years ago
|
.number = GPBType_FieldNumber_SourceContext,
|
||
9 years ago
|
.hasIndex = 1,
|
||
|
.offset = (uint32_t)offsetof(GPBType__storage_, sourceContext),
|
||
10 years ago
|
.flags = GPBFieldOptional,
|
||
10 years ago
|
.dataType = GPBDataTypeMessage,
|
||
10 years ago
|
},
|
||
9 years ago
|
{
|
||
|
.name = "syntax",
|
||
9 years ago
|
.dataTypeSpecific.enumDescFunc = GPBSyntax_EnumDescriptor,
|
||
9 years ago
|
.number = GPBType_FieldNumber_Syntax,
|
||
9 years ago
|
.hasIndex = 2,
|
||
|
.offset = (uint32_t)offsetof(GPBType__storage_, syntax),
|
||
8 years ago
|
.flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor),
|
||
9 years ago
|
.dataType = GPBDataTypeEnum,
|
||
|
},
|
||
10 years ago
|
};
|
||
10 years ago
|
GPBDescriptor *localDescriptor =
|
||
|
[GPBDescriptor allocDescriptorForClass:[GPBType class]
|
||
|
rootClass:[GPBTypeRoot class]
|
||
|
file:GPBTypeRoot_FileDescriptor()
|
||
|
fields:fields
|
||
9 years ago
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||
10 years ago
|
storageSize:sizeof(GPBType__storage_)
|
||
5 years ago
|
flags:GPBDescriptorInitializationFlag_UsesClassRefs];
|
||
6 years ago
|
#if defined(DEBUG) && DEBUG
|
||
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
||
|
#endif // DEBUG
|
||
10 years ago
|
descriptor = localDescriptor;
|
||
10 years ago
|
}
|
||
|
return descriptor;
|
||
|
}
|
||
|
|
||
|
@end
|
||
|
|
||
9 years ago
|
int32_t GPBType_Syntax_RawValue(GPBType *message) {
|
||
|
GPBDescriptor *descriptor = [GPBType descriptor];
|
||
|
GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBType_FieldNumber_Syntax];
|
||
|
return GPBGetMessageInt32Field(message, field);
|
||
|
}
|
||
|
|
||
|
void SetGPBType_Syntax_RawValue(GPBType *message, int32_t value) {
|
||
|
GPBDescriptor *descriptor = [GPBType descriptor];
|
||
|
GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBType_FieldNumber_Syntax];
|
||
|
GPBSetInt32IvarWithFieldInternal(message, field, value, descriptor.file.syntax);
|
||
|
}
|
||
|
|
||
10 years ago
|
#pragma mark - GPBField
|
||
|
|
||
|
@implementation GPBField
|
||
|
|
||
|
@dynamic kind;
|
||
|
@dynamic cardinality;
|
||
|
@dynamic number;
|
||
|
@dynamic name;
|
||
|
@dynamic typeURL;
|
||
|
@dynamic oneofIndex;
|
||
|
@dynamic packed;
|
||
10 years ago
|
@dynamic optionsArray, optionsArray_Count;
|
||
9 years ago
|
@dynamic jsonName;
|
||
9 years ago
|
@dynamic defaultValue;
|
||
10 years ago
|
|
||
10 years ago
|
typedef struct GPBField__storage_ {
|
||
10 years ago
|
uint32_t _has_storage_[1];
|
||
|
GPBField_Kind kind;
|
||
|
GPBField_Cardinality cardinality;
|
||
|
int32_t number;
|
||
|
int32_t oneofIndex;
|
||
|
NSString *name;
|
||
|
NSString *typeURL;
|
||
|
NSMutableArray *optionsArray;
|
||
9 years ago
|
NSString *jsonName;
|
||
9 years ago
|
NSString *defaultValue;
|
||
10 years ago
|
} GPBField__storage_;
|
||
10 years ago
|
|
||
|
// This method is threadsafe because it is initially called
|
||
|
// in +initialize for each subclass.
|
||
|
+ (GPBDescriptor *)descriptor {
|
||
10 years ago
|
static GPBDescriptor *descriptor = nil;
|
||
10 years ago
|
if (!descriptor) {
|
||
|
static GPBMessageFieldDescription fields[] = {
|
||
|
{
|
||
|
.name = "kind",
|
||
9 years ago
|
.dataTypeSpecific.enumDescFunc = GPBField_Kind_EnumDescriptor,
|
||
10 years ago
|
.number = GPBField_FieldNumber_Kind,
|
||
|
.hasIndex = 0,
|
||
9 years ago
|
.offset = (uint32_t)offsetof(GPBField__storage_, kind),
|
||
8 years ago
|
.flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor),
|
||
10 years ago
|
.dataType = GPBDataTypeEnum,
|
||
10 years ago
|
},
|
||
|
{
|
||
|
.name = "cardinality",
|
||
9 years ago
|
.dataTypeSpecific.enumDescFunc = GPBField_Cardinality_EnumDescriptor,
|
||
10 years ago
|
.number = GPBField_FieldNumber_Cardinality,
|
||
|
.hasIndex = 1,
|
||
9 years ago
|
.offset = (uint32_t)offsetof(GPBField__storage_, cardinality),
|
||
8 years ago
|
.flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor),
|
||
10 years ago
|
.dataType = GPBDataTypeEnum,
|
||
10 years ago
|
},
|
||
|
{
|
||
|
.name = "number",
|
||
5 years ago
|
.dataTypeSpecific.clazz = Nil,
|
||
10 years ago
|
.number = GPBField_FieldNumber_Number,
|
||
|
.hasIndex = 2,
|
||
9 years ago
|
.offset = (uint32_t)offsetof(GPBField__storage_, number),
|
||
10 years ago
|
.flags = GPBFieldOptional,
|
||
10 years ago
|
.dataType = GPBDataTypeInt32,
|
||
10 years ago
|
},
|
||
|
{
|
||
|
.name = "name",
|
||
5 years ago
|
.dataTypeSpecific.clazz = Nil,
|
||
10 years ago
|
.number = GPBField_FieldNumber_Name,
|
||
|
.hasIndex = 3,
|
||
9 years ago
|
.offset = (uint32_t)offsetof(GPBField__storage_, name),
|
||
10 years ago
|
.flags = GPBFieldOptional,
|
||
10 years ago
|
.dataType = GPBDataTypeString,
|
||
10 years ago
|
},
|
||
|
{
|
||
|
.name = "typeURL",
|
||
5 years ago
|
.dataTypeSpecific.clazz = Nil,
|
||
10 years ago
|
.number = GPBField_FieldNumber_TypeURL,
|
||
|
.hasIndex = 4,
|
||
9 years ago
|
.offset = (uint32_t)offsetof(GPBField__storage_, typeURL),
|
||
8 years ago
|
.flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom),
|
||
10 years ago
|
.dataType = GPBDataTypeString,
|
||
10 years ago
|
},
|
||
|
{
|
||
|
.name = "oneofIndex",
|
||
5 years ago
|
.dataTypeSpecific.clazz = Nil,
|
||
10 years ago
|
.number = GPBField_FieldNumber_OneofIndex,
|
||
|
.hasIndex = 5,
|
||
9 years ago
|
.offset = (uint32_t)offsetof(GPBField__storage_, oneofIndex),
|
||
10 years ago
|
.flags = GPBFieldOptional,
|
||
10 years ago
|
.dataType = GPBDataTypeInt32,
|
||
10 years ago
|
},
|
||
|
{
|
||
|
.name = "packed",
|
||
5 years ago
|
.dataTypeSpecific.clazz = Nil,
|
||
10 years ago
|
.number = GPBField_FieldNumber_Packed,
|
||
|
.hasIndex = 6,
|
||
9 years ago
|
.offset = 7, // Stored in _has_storage_ to save space.
|
||
10 years ago
|
.flags = GPBFieldOptional,
|
||
10 years ago
|
.dataType = GPBDataTypeBool,
|
||
10 years ago
|
},
|
||
|
{
|
||
|
.name = "optionsArray",
|
||
5 years ago
|
.dataTypeSpecific.clazz = GPBObjCClass(GPBOption),
|
||
10 years ago
|
.number = GPBField_FieldNumber_OptionsArray,
|
||
|
.hasIndex = GPBNoHasBit,
|
||
9 years ago
|
.offset = (uint32_t)offsetof(GPBField__storage_, optionsArray),
|
||
10 years ago
|
.flags = GPBFieldRepeated,
|
||
10 years ago
|
.dataType = GPBDataTypeMessage,
|
||
10 years ago
|
},
|
||
9 years ago
|
{
|
||
|
.name = "jsonName",
|
||
5 years ago
|
.dataTypeSpecific.clazz = Nil,
|
||
9 years ago
|
.number = GPBField_FieldNumber_JsonName,
|
||
|
.hasIndex = 8,
|
||
9 years ago
|
.offset = (uint32_t)offsetof(GPBField__storage_, jsonName),
|
||
9 years ago
|
.flags = GPBFieldOptional,
|
||
|
.dataType = GPBDataTypeString,
|
||
|
},
|
||
9 years ago
|
{
|
||
|
.name = "defaultValue",
|
||
5 years ago
|
.dataTypeSpecific.clazz = Nil,
|
||
9 years ago
|
.number = GPBField_FieldNumber_DefaultValue,
|
||
|
.hasIndex = 9,
|
||
9 years ago
|
.offset = (uint32_t)offsetof(GPBField__storage_, defaultValue),
|
||
9 years ago
|
.flags = GPBFieldOptional,
|
||
|
.dataType = GPBDataTypeString,
|
||
|
},
|
||
10 years ago
|
};
|
||
10 years ago
|
GPBDescriptor *localDescriptor =
|
||
|
[GPBDescriptor allocDescriptorForClass:[GPBField class]
|
||
|
rootClass:[GPBTypeRoot class]
|
||
|
file:GPBTypeRoot_FileDescriptor()
|
||
|
fields:fields
|
||
9 years ago
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||
10 years ago
|
storageSize:sizeof(GPBField__storage_)
|
||
5 years ago
|
flags:GPBDescriptorInitializationFlag_UsesClassRefs];
|
||
9 years ago
|
#if !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS
|
||
|
static const char *extraTextFormatInfo =
|
||
|
"\001\006\004\241!!\000";
|
||
|
[localDescriptor setupExtraTextInfo:extraTextFormatInfo];
|
||
|
#endif // !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS
|
||
6 years ago
|
#if defined(DEBUG) && DEBUG
|
||
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
||
|
#endif // DEBUG
|
||
10 years ago
|
descriptor = localDescriptor;
|
||
10 years ago
|
}
|
||
|
return descriptor;
|
||
|
}
|
||
|
|
||
|
@end
|
||
|
|
||
|
int32_t GPBField_Kind_RawValue(GPBField *message) {
|
||
|
GPBDescriptor *descriptor = [GPBField descriptor];
|
||
|
GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBField_FieldNumber_Kind];
|
||
10 years ago
|
return GPBGetMessageInt32Field(message, field);
|
||
10 years ago
|
}
|
||
|
|
||
|
void SetGPBField_Kind_RawValue(GPBField *message, int32_t value) {
|
||
|
GPBDescriptor *descriptor = [GPBField descriptor];
|
||
|
GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBField_FieldNumber_Kind];
|
||
|
GPBSetInt32IvarWithFieldInternal(message, field, value, descriptor.file.syntax);
|
||
|
}
|
||
|
|
||
|
int32_t GPBField_Cardinality_RawValue(GPBField *message) {
|
||
|
GPBDescriptor *descriptor = [GPBField descriptor];
|
||
|
GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBField_FieldNumber_Cardinality];
|
||
10 years ago
|
return GPBGetMessageInt32Field(message, field);
|
||
10 years ago
|
}
|
||
|
|
||
|
void SetGPBField_Cardinality_RawValue(GPBField *message, int32_t value) {
|
||
|
GPBDescriptor *descriptor = [GPBField descriptor];
|
||
|
GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBField_FieldNumber_Cardinality];
|
||
|
GPBSetInt32IvarWithFieldInternal(message, field, value, descriptor.file.syntax);
|
||
|
}
|
||
|
|
||
|
#pragma mark - Enum GPBField_Kind
|
||
|
|
||
|
GPBEnumDescriptor *GPBField_Kind_EnumDescriptor(void) {
|
||
7 years ago
|
static _Atomic(GPBEnumDescriptor*) descriptor = nil;
|
||
10 years ago
|
if (!descriptor) {
|
||
9 years ago
|
static const char *valueNames =
|
||
|
"TypeUnknown\000TypeDouble\000TypeFloat\000TypeInt"
|
||
|
"64\000TypeUint64\000TypeInt32\000TypeFixed64\000Type"
|
||
|
"Fixed32\000TypeBool\000TypeString\000TypeGroup\000Ty"
|
||
|
"peMessage\000TypeBytes\000TypeUint32\000TypeEnum\000"
|
||
|
"TypeSfixed32\000TypeSfixed64\000TypeSint32\000Typ"
|
||
|
"eSint64\000";
|
||
|
static const int32_t values[] = {
|
||
|
GPBField_Kind_TypeUnknown,
|
||
|
GPBField_Kind_TypeDouble,
|
||
|
GPBField_Kind_TypeFloat,
|
||
|
GPBField_Kind_TypeInt64,
|
||
|
GPBField_Kind_TypeUint64,
|
||
|
GPBField_Kind_TypeInt32,
|
||
|
GPBField_Kind_TypeFixed64,
|
||
|
GPBField_Kind_TypeFixed32,
|
||
|
GPBField_Kind_TypeBool,
|
||
|
GPBField_Kind_TypeString,
|
||
|
GPBField_Kind_TypeGroup,
|
||
|
GPBField_Kind_TypeMessage,
|
||
|
GPBField_Kind_TypeBytes,
|
||
|
GPBField_Kind_TypeUint32,
|
||
|
GPBField_Kind_TypeEnum,
|
||
|
GPBField_Kind_TypeSfixed32,
|
||
|
GPBField_Kind_TypeSfixed64,
|
||
|
GPBField_Kind_TypeSint32,
|
||
|
GPBField_Kind_TypeSint64,
|
||
10 years ago
|
};
|
||
9 years ago
|
GPBEnumDescriptor *worker =
|
||
|
[GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GPBField_Kind)
|
||
|
valueNames:valueNames
|
||
|
values:values
|
||
|
count:(uint32_t)(sizeof(values) / sizeof(int32_t))
|
||
|
enumVerifier:GPBField_Kind_IsValidValue];
|
||
7 years ago
|
GPBEnumDescriptor *expected = nil;
|
||
|
if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) {
|
||
9 years ago
|
[worker release];
|
||
|
}
|
||
10 years ago
|
}
|
||
|
return descriptor;
|
||
|
}
|
||
|
|
||
|
BOOL GPBField_Kind_IsValidValue(int32_t value__) {
|
||
|
switch (value__) {
|
||
|
case GPBField_Kind_TypeUnknown:
|
||
|
case GPBField_Kind_TypeDouble:
|
||
|
case GPBField_Kind_TypeFloat:
|
||
|
case GPBField_Kind_TypeInt64:
|
||
|
case GPBField_Kind_TypeUint64:
|
||
|
case GPBField_Kind_TypeInt32:
|
||
|
case GPBField_Kind_TypeFixed64:
|
||
|
case GPBField_Kind_TypeFixed32:
|
||
|
case GPBField_Kind_TypeBool:
|
||
|
case GPBField_Kind_TypeString:
|
||
9 years ago
|
case GPBField_Kind_TypeGroup:
|
||
10 years ago
|
case GPBField_Kind_TypeMessage:
|
||
|
case GPBField_Kind_TypeBytes:
|
||
|
case GPBField_Kind_TypeUint32:
|
||
|
case GPBField_Kind_TypeEnum:
|
||
|
case GPBField_Kind_TypeSfixed32:
|
||
|
case GPBField_Kind_TypeSfixed64:
|
||
|
case GPBField_Kind_TypeSint32:
|
||
|
case GPBField_Kind_TypeSint64:
|
||
|
return YES;
|
||
|
default:
|
||
|
return NO;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#pragma mark - Enum GPBField_Cardinality
|
||
|
|
||
|
GPBEnumDescriptor *GPBField_Cardinality_EnumDescriptor(void) {
|
||
7 years ago
|
static _Atomic(GPBEnumDescriptor*) descriptor = nil;
|
||
10 years ago
|
if (!descriptor) {
|
||
9 years ago
|
static const char *valueNames =
|
||
|
"CardinalityUnknown\000CardinalityOptional\000C"
|
||
|
"ardinalityRequired\000CardinalityRepeated\000";
|
||
|
static const int32_t values[] = {
|
||
|
GPBField_Cardinality_CardinalityUnknown,
|
||
|
GPBField_Cardinality_CardinalityOptional,
|
||
|
GPBField_Cardinality_CardinalityRequired,
|
||
|
GPBField_Cardinality_CardinalityRepeated,
|
||
10 years ago
|
};
|
||
9 years ago
|
GPBEnumDescriptor *worker =
|
||
|
[GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GPBField_Cardinality)
|
||
|
valueNames:valueNames
|
||
|
values:values
|
||
|
count:(uint32_t)(sizeof(values) / sizeof(int32_t))
|
||
|
enumVerifier:GPBField_Cardinality_IsValidValue];
|
||
7 years ago
|
GPBEnumDescriptor *expected = nil;
|
||
|
if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) {
|
||
9 years ago
|
[worker release];
|
||
|
}
|
||
10 years ago
|
}
|
||
|
return descriptor;
|
||
|
}
|
||
|
|
||
|
BOOL GPBField_Cardinality_IsValidValue(int32_t value__) {
|
||
|
switch (value__) {
|
||
|
case GPBField_Cardinality_CardinalityUnknown:
|
||
|
case GPBField_Cardinality_CardinalityOptional:
|
||
|
case GPBField_Cardinality_CardinalityRequired:
|
||
|
case GPBField_Cardinality_CardinalityRepeated:
|
||
|
return YES;
|
||
|
default:
|
||
|
return NO;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#pragma mark - GPBEnum
|
||
|
|
||
|
@implementation GPBEnum
|
||
|
|
||
|
@dynamic name;
|
||
10 years ago
|
@dynamic enumvalueArray, enumvalueArray_Count;
|
||
|
@dynamic optionsArray, optionsArray_Count;
|
||
10 years ago
|
@dynamic hasSourceContext, sourceContext;
|
||
9 years ago
|
@dynamic syntax;
|
||
10 years ago
|
|
||
10 years ago
|
typedef struct GPBEnum__storage_ {
|
||
10 years ago
|
uint32_t _has_storage_[1];
|
||
9 years ago
|
GPBSyntax syntax;
|
||
10 years ago
|
NSString *name;
|
||
|
NSMutableArray *enumvalueArray;
|
||
|
NSMutableArray *optionsArray;
|
||
|
GPBSourceContext *sourceContext;
|
||
10 years ago
|
} GPBEnum__storage_;
|
||
10 years ago
|
|
||
|
// This method is threadsafe because it is initially called
|
||
|
// in +initialize for each subclass.
|
||
|
+ (GPBDescriptor *)descriptor {
|
||
10 years ago
|
static GPBDescriptor *descriptor = nil;
|
||
10 years ago
|
if (!descriptor) {
|
||
|
static GPBMessageFieldDescription fields[] = {
|
||
|
{
|
||
|
.name = "name",
|
||
5 years ago
|
.dataTypeSpecific.clazz = Nil,
|
||
10 years ago
|
.number = GPBEnum_FieldNumber_Name,
|
||
|
.hasIndex = 0,
|
||
9 years ago
|
.offset = (uint32_t)offsetof(GPBEnum__storage_, name),
|
||
10 years ago
|
.flags = GPBFieldOptional,
|
||
10 years ago
|
.dataType = GPBDataTypeString,
|
||
10 years ago
|
},
|
||
|
{
|
||
|
.name = "enumvalueArray",
|
||
5 years ago
|
.dataTypeSpecific.clazz = GPBObjCClass(GPBEnumValue),
|
||
10 years ago
|
.number = GPBEnum_FieldNumber_EnumvalueArray,
|
||
|
.hasIndex = GPBNoHasBit,
|
||
9 years ago
|
.offset = (uint32_t)offsetof(GPBEnum__storage_, enumvalueArray),
|
||
10 years ago
|
.flags = GPBFieldRepeated,
|
||
10 years ago
|
.dataType = GPBDataTypeMessage,
|
||
10 years ago
|
},
|
||
|
{
|
||
|
.name = "optionsArray",
|
||
5 years ago
|
.dataTypeSpecific.clazz = GPBObjCClass(GPBOption),
|
||
10 years ago
|
.number = GPBEnum_FieldNumber_OptionsArray,
|
||
|
.hasIndex = GPBNoHasBit,
|
||
9 years ago
|
.offset = (uint32_t)offsetof(GPBEnum__storage_, optionsArray),
|
||
10 years ago
|
.flags = GPBFieldRepeated,
|
||
10 years ago
|
.dataType = GPBDataTypeMessage,
|
||
10 years ago
|
},
|
||
|
{
|
||
|
.name = "sourceContext",
|
||
5 years ago
|
.dataTypeSpecific.clazz = GPBObjCClass(GPBSourceContext),
|
||
10 years ago
|
.number = GPBEnum_FieldNumber_SourceContext,
|
||
9 years ago
|
.hasIndex = 1,
|
||
|
.offset = (uint32_t)offsetof(GPBEnum__storage_, sourceContext),
|
||
10 years ago
|
.flags = GPBFieldOptional,
|
||
10 years ago
|
.dataType = GPBDataTypeMessage,
|
||
10 years ago
|
},
|
||
9 years ago
|
{
|
||
|
.name = "syntax",
|
||
9 years ago
|
.dataTypeSpecific.enumDescFunc = GPBSyntax_EnumDescriptor,
|
||
9 years ago
|
.number = GPBEnum_FieldNumber_Syntax,
|
||
9 years ago
|
.hasIndex = 2,
|
||
|
.offset = (uint32_t)offsetof(GPBEnum__storage_, syntax),
|
||
8 years ago
|
.flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor),
|
||
9 years ago
|
.dataType = GPBDataTypeEnum,
|
||
|
},
|
||
10 years ago
|
};
|
||
10 years ago
|
GPBDescriptor *localDescriptor =
|
||
|
[GPBDescriptor allocDescriptorForClass:[GPBEnum class]
|
||
|
rootClass:[GPBTypeRoot class]
|
||
|
file:GPBTypeRoot_FileDescriptor()
|
||
|
fields:fields
|
||
9 years ago
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||
10 years ago
|
storageSize:sizeof(GPBEnum__storage_)
|
||
5 years ago
|
flags:GPBDescriptorInitializationFlag_UsesClassRefs];
|
||
6 years ago
|
#if defined(DEBUG) && DEBUG
|
||
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
||
|
#endif // DEBUG
|
||
10 years ago
|
descriptor = localDescriptor;
|
||
10 years ago
|
}
|
||
|
return descriptor;
|
||
|
}
|
||
|
|
||
|
@end
|
||
|
|
||
9 years ago
|
int32_t GPBEnum_Syntax_RawValue(GPBEnum *message) {
|
||
|
GPBDescriptor *descriptor = [GPBEnum descriptor];
|
||
|
GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBEnum_FieldNumber_Syntax];
|
||
|
return GPBGetMessageInt32Field(message, field);
|
||
|
}
|
||
|
|
||
|
void SetGPBEnum_Syntax_RawValue(GPBEnum *message, int32_t value) {
|
||
|
GPBDescriptor *descriptor = [GPBEnum descriptor];
|
||
|
GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBEnum_FieldNumber_Syntax];
|
||
|
GPBSetInt32IvarWithFieldInternal(message, field, value, descriptor.file.syntax);
|
||
|
}
|
||
|
|
||
10 years ago
|
#pragma mark - GPBEnumValue
|
||
|
|
||
|
@implementation GPBEnumValue
|
||
|
|
||
|
@dynamic name;
|
||
|
@dynamic number;
|
||
10 years ago
|
@dynamic optionsArray, optionsArray_Count;
|
||
10 years ago
|
|
||
10 years ago
|
typedef struct GPBEnumValue__storage_ {
|
||
10 years ago
|
uint32_t _has_storage_[1];
|
||
|
int32_t number;
|
||
|
NSString *name;
|
||
|
NSMutableArray *optionsArray;
|
||
10 years ago
|
} GPBEnumValue__storage_;
|
||
10 years ago
|
|
||
|
// This method is threadsafe because it is initially called
|
||
|
// in +initialize for each subclass.
|
||
|
+ (GPBDescriptor *)descriptor {
|
||
10 years ago
|
static GPBDescriptor *descriptor = nil;
|
||
10 years ago
|
if (!descriptor) {
|
||
|
static GPBMessageFieldDescription fields[] = {
|
||
|
{
|
||
|
.name = "name",
|
||
5 years ago
|
.dataTypeSpecific.clazz = Nil,
|
||
10 years ago
|
.number = GPBEnumValue_FieldNumber_Name,
|
||
|
.hasIndex = 0,
|
||
9 years ago
|
.offset = (uint32_t)offsetof(GPBEnumValue__storage_, name),
|
||
10 years ago
|
.flags = GPBFieldOptional,
|
||
10 years ago
|
.dataType = GPBDataTypeString,
|
||
10 years ago
|
},
|
||
|
{
|
||
|
.name = "number",
|
||
5 years ago
|
.dataTypeSpecific.clazz = Nil,
|
||
10 years ago
|
.number = GPBEnumValue_FieldNumber_Number,
|
||
|
.hasIndex = 1,
|
||
9 years ago
|
.offset = (uint32_t)offsetof(GPBEnumValue__storage_, number),
|
||
10 years ago
|
.flags = GPBFieldOptional,
|
||
10 years ago
|
.dataType = GPBDataTypeInt32,
|
||
10 years ago
|
},
|
||
|
{
|
||
|
.name = "optionsArray",
|
||
5 years ago
|
.dataTypeSpecific.clazz = GPBObjCClass(GPBOption),
|
||
10 years ago
|
.number = GPBEnumValue_FieldNumber_OptionsArray,
|
||
|
.hasIndex = GPBNoHasBit,
|
||
9 years ago
|
.offset = (uint32_t)offsetof(GPBEnumValue__storage_, optionsArray),
|
||
10 years ago
|
.flags = GPBFieldRepeated,
|
||
10 years ago
|
.dataType = GPBDataTypeMessage,
|
||
10 years ago
|
},
|
||
|
};
|
||
10 years ago
|
GPBDescriptor *localDescriptor =
|
||
|
[GPBDescriptor allocDescriptorForClass:[GPBEnumValue class]
|
||
|
rootClass:[GPBTypeRoot class]
|
||
|
file:GPBTypeRoot_FileDescriptor()
|
||
|
fields:fields
|
||
9 years ago
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||
10 years ago
|
storageSize:sizeof(GPBEnumValue__storage_)
|
||
5 years ago
|
flags:GPBDescriptorInitializationFlag_UsesClassRefs];
|
||
6 years ago
|
#if defined(DEBUG) && DEBUG
|
||
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
||
|
#endif // DEBUG
|
||
10 years ago
|
descriptor = localDescriptor;
|
||
10 years ago
|
}
|
||
|
return descriptor;
|
||
|
}
|
||
|
|
||
|
@end
|
||
|
|
||
|
#pragma mark - GPBOption
|
||
|
|
||
|
@implementation GPBOption
|
||
|
|
||
|
@dynamic name;
|
||
|
@dynamic hasValue, value;
|
||
|
|
||
10 years ago
|
typedef struct GPBOption__storage_ {
|
||
10 years ago
|
uint32_t _has_storage_[1];
|
||
|
NSString *name;
|
||
|
GPBAny *value;
|
||
10 years ago
|
} GPBOption__storage_;
|
||
10 years ago
|
|
||
|
// This method is threadsafe because it is initially called
|
||
|
// in +initialize for each subclass.
|
||
|
+ (GPBDescriptor *)descriptor {
|
||
10 years ago
|
static GPBDescriptor *descriptor = nil;
|
||
10 years ago
|
if (!descriptor) {
|
||
|
static GPBMessageFieldDescription fields[] = {
|
||
|
{
|
||
|
.name = "name",
|
||
5 years ago
|
.dataTypeSpecific.clazz = Nil,
|
||
10 years ago
|
.number = GPBOption_FieldNumber_Name,
|
||
|
.hasIndex = 0,
|
||
9 years ago
|
.offset = (uint32_t)offsetof(GPBOption__storage_, name),
|
||
10 years ago
|
.flags = GPBFieldOptional,
|
||
10 years ago
|
.dataType = GPBDataTypeString,
|
||
10 years ago
|
},
|
||
|
{
|
||
|
.name = "value",
|
||
5 years ago
|
.dataTypeSpecific.clazz = GPBObjCClass(GPBAny),
|
||
10 years ago
|
.number = GPBOption_FieldNumber_Value,
|
||
|
.hasIndex = 1,
|
||
9 years ago
|
.offset = (uint32_t)offsetof(GPBOption__storage_, value),
|
||
10 years ago
|
.flags = GPBFieldOptional,
|
||
10 years ago
|
.dataType = GPBDataTypeMessage,
|
||
10 years ago
|
},
|
||
|
};
|
||
10 years ago
|
GPBDescriptor *localDescriptor =
|
||
|
[GPBDescriptor allocDescriptorForClass:[GPBOption class]
|
||
|
rootClass:[GPBTypeRoot class]
|
||
|
file:GPBTypeRoot_FileDescriptor()
|
||
|
fields:fields
|
||
9 years ago
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||
10 years ago
|
storageSize:sizeof(GPBOption__storage_)
|
||
5 years ago
|
flags:GPBDescriptorInitializationFlag_UsesClassRefs];
|
||
6 years ago
|
#if defined(DEBUG) && DEBUG
|
||
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
||
|
#endif // DEBUG
|
||
10 years ago
|
descriptor = localDescriptor;
|
||
10 years ago
|
}
|
||
|
return descriptor;
|
||
|
}
|
||
|
|
||
|
@end
|
||
|
|
||
|
|
||
9 years ago
|
#pragma clang diagnostic pop
|
||
|
|
||
10 years ago
|
// @@protoc_insertion_point(global_scope)
|