Merge pull request #1325 from thomasvl/shrink_overhead
Shrink ObjC overhead (generated size and some runtime sizes)
This commit is contained in:
commit
5e933847cc
@ -381,13 +381,11 @@ objectivec_EXTRA_DIST= \
|
|||||||
objectivec/DevTools/full_mac_build.sh \
|
objectivec/DevTools/full_mac_build.sh \
|
||||||
objectivec/DevTools/pddm.py \
|
objectivec/DevTools/pddm.py \
|
||||||
objectivec/DevTools/pddm_tests.py \
|
objectivec/DevTools/pddm_tests.py \
|
||||||
objectivec/generate_descriptors_proto.sh \
|
objectivec/generate_well_known_types.sh \
|
||||||
objectivec/google/protobuf/Any.pbobjc.h \
|
objectivec/google/protobuf/Any.pbobjc.h \
|
||||||
objectivec/google/protobuf/Any.pbobjc.m \
|
objectivec/google/protobuf/Any.pbobjc.m \
|
||||||
objectivec/google/protobuf/Api.pbobjc.h \
|
objectivec/google/protobuf/Api.pbobjc.h \
|
||||||
objectivec/google/protobuf/Api.pbobjc.m \
|
objectivec/google/protobuf/Api.pbobjc.m \
|
||||||
objectivec/google/protobuf/Descriptor.pbobjc.h \
|
|
||||||
objectivec/google/protobuf/Descriptor.pbobjc.m \
|
|
||||||
objectivec/google/protobuf/Duration.pbobjc.h \
|
objectivec/google/protobuf/Duration.pbobjc.h \
|
||||||
objectivec/google/protobuf/Duration.pbobjc.m \
|
objectivec/google/protobuf/Duration.pbobjc.m \
|
||||||
objectivec/google/protobuf/Empty.pbobjc.h \
|
objectivec/google/protobuf/Empty.pbobjc.h \
|
||||||
|
@ -17,7 +17,6 @@ Pod::Spec.new do |s|
|
|||||||
s.source_files = 'objectivec/*.{h,m}',
|
s.source_files = 'objectivec/*.{h,m}',
|
||||||
'objectivec/google/protobuf/Any.pbobjc.{h,m}',
|
'objectivec/google/protobuf/Any.pbobjc.{h,m}',
|
||||||
'objectivec/google/protobuf/Api.pbobjc.{h,m}',
|
'objectivec/google/protobuf/Api.pbobjc.{h,m}',
|
||||||
'objectivec/google/protobuf/Descriptor.pbobjc.{h,m}',
|
|
||||||
'objectivec/google/protobuf/Duration.pbobjc.h',
|
'objectivec/google/protobuf/Duration.pbobjc.h',
|
||||||
'objectivec/google/protobuf/Empty.pbobjc.{h,m}',
|
'objectivec/google/protobuf/Empty.pbobjc.{h,m}',
|
||||||
'objectivec/google/protobuf/FieldMask.pbobjc.{h,m}',
|
'objectivec/google/protobuf/FieldMask.pbobjc.{h,m}',
|
||||||
|
@ -92,9 +92,9 @@ do
|
|||||||
done
|
done
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
if test -x objectivec/generate_descriptors_proto.sh; then
|
if test -x objectivec/generate_well_known_types.sh; then
|
||||||
echo "Generating messages for objc."
|
echo "Generating messages for objc."
|
||||||
objectivec/generate_descriptors_proto.sh $@
|
objectivec/generate_well_known_types.sh $@
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -x csharp/generate_protos.sh; then
|
if test -x csharp/generate_protos.sh; then
|
||||||
|
@ -67,29 +67,36 @@ fi
|
|||||||
# Ensure the output dir exists
|
# Ensure the output dir exists
|
||||||
mkdir -p "${OUTPUT_DIR}/google/protobuf"
|
mkdir -p "${OUTPUT_DIR}/google/protobuf"
|
||||||
|
|
||||||
CORE_PROTO_FILES=( \
|
CORE_PROTO_FILES=(
|
||||||
src/google/protobuf/unittest_arena.proto \
|
src/google/protobuf/unittest_arena.proto
|
||||||
src/google/protobuf/unittest_custom_options.proto \
|
src/google/protobuf/unittest_custom_options.proto
|
||||||
src/google/protobuf/unittest_enormous_descriptor.proto \
|
src/google/protobuf/unittest_enormous_descriptor.proto
|
||||||
src/google/protobuf/unittest_embed_optimize_for.proto \
|
src/google/protobuf/unittest_embed_optimize_for.proto
|
||||||
src/google/protobuf/unittest_empty.proto \
|
src/google/protobuf/unittest_empty.proto
|
||||||
src/google/protobuf/unittest_import.proto \
|
src/google/protobuf/unittest_import.proto
|
||||||
src/google/protobuf/unittest_import_lite.proto \
|
src/google/protobuf/unittest_import_lite.proto
|
||||||
src/google/protobuf/unittest_lite.proto \
|
src/google/protobuf/unittest_lite.proto
|
||||||
src/google/protobuf/unittest_mset.proto \
|
src/google/protobuf/unittest_mset.proto
|
||||||
src/google/protobuf/unittest_mset_wire_format.proto \
|
src/google/protobuf/unittest_mset_wire_format.proto
|
||||||
src/google/protobuf/unittest_no_arena.proto \
|
src/google/protobuf/unittest_no_arena.proto
|
||||||
src/google/protobuf/unittest_no_arena_import.proto \
|
src/google/protobuf/unittest_no_arena_import.proto
|
||||||
src/google/protobuf/unittest_no_generic_services.proto \
|
src/google/protobuf/unittest_no_generic_services.proto
|
||||||
src/google/protobuf/unittest_optimize_for.proto \
|
src/google/protobuf/unittest_optimize_for.proto
|
||||||
src/google/protobuf/unittest.proto \
|
src/google/protobuf/unittest.proto
|
||||||
src/google/protobuf/unittest_import_public.proto \
|
src/google/protobuf/unittest_import_public.proto
|
||||||
src/google/protobuf/unittest_import_public_lite.proto \
|
src/google/protobuf/unittest_import_public_lite.proto
|
||||||
src/google/protobuf/unittest_drop_unknown_fields.proto \
|
src/google/protobuf/unittest_drop_unknown_fields.proto
|
||||||
src/google/protobuf/unittest_preserve_unknown_enum.proto \
|
src/google/protobuf/unittest_preserve_unknown_enum.proto
|
||||||
src/google/protobuf/map_lite_unittest.proto \
|
src/google/protobuf/map_lite_unittest.proto
|
||||||
src/google/protobuf/map_proto2_unittest.proto \
|
src/google/protobuf/map_proto2_unittest.proto
|
||||||
src/google/protobuf/map_unittest.proto \
|
src/google/protobuf/map_unittest.proto
|
||||||
|
)
|
||||||
|
|
||||||
|
# The unittest_custom_options.proto extends the messages in descriptor.proto
|
||||||
|
# so we build it in to test extending in general. The library doesn't provide
|
||||||
|
# a descriptor as it doesn't use the classes/enums.
|
||||||
|
CORE_PROTO_FILES+=(
|
||||||
|
src/google/protobuf/descriptor.proto
|
||||||
)
|
)
|
||||||
|
|
||||||
compile_proto() {
|
compile_proto() {
|
||||||
@ -104,12 +111,12 @@ for a_proto in "${CORE_PROTO_FILES[@]}" ; do
|
|||||||
compile_proto "${a_proto}"
|
compile_proto "${a_proto}"
|
||||||
done
|
done
|
||||||
|
|
||||||
OBJC_PROTO_FILES=( \
|
OBJC_PROTO_FILES=(
|
||||||
objectivec/Tests/unittest_cycle.proto \
|
objectivec/Tests/unittest_cycle.proto
|
||||||
objectivec/Tests/unittest_runtime_proto2.proto \
|
objectivec/Tests/unittest_runtime_proto2.proto
|
||||||
objectivec/Tests/unittest_runtime_proto3.proto \
|
objectivec/Tests/unittest_runtime_proto3.proto
|
||||||
objectivec/Tests/unittest_objc.proto \
|
objectivec/Tests/unittest_objc.proto
|
||||||
objectivec/Tests/unittest_objc_startup.proto \
|
objectivec/Tests/unittest_objc_startup.proto
|
||||||
)
|
)
|
||||||
|
|
||||||
for a_proto in "${OBJC_PROTO_FILES[@]}" ; do
|
for a_proto in "${OBJC_PROTO_FILES[@]}" ; do
|
||||||
|
@ -190,7 +190,7 @@ header "Ensuring the ObjC descriptors are current."
|
|||||||
readonly NewestInput=$(find \
|
readonly NewestInput=$(find \
|
||||||
src/google/protobuf/*.proto \
|
src/google/protobuf/*.proto \
|
||||||
src/.libs src/*.la src/protoc \
|
src/.libs src/*.la src/protoc \
|
||||||
objectivec/generate_descriptors_proto.sh \
|
objectivec/generate_well_known_types.sh \
|
||||||
-type f -print0 \
|
-type f -print0 \
|
||||||
| xargs -0 stat -f "%m %N" \
|
| xargs -0 stat -f "%m %N" \
|
||||||
| sort -n | tail -n1 | cut -f2- -d" ")
|
| sort -n | tail -n1 | cut -f2- -d" ")
|
||||||
@ -203,7 +203,7 @@ readonly OldestOutput=$(find \
|
|||||||
# If the newest input is newer than the oldest output, regenerate.
|
# If the newest input is newer than the oldest output, regenerate.
|
||||||
if [[ "${NewestInput}" -nt "${OldestOutput}" ]] ; then
|
if [[ "${NewestInput}" -nt "${OldestOutput}" ]] ; then
|
||||||
echo ">> Newest input is newer than oldest output, regenerating."
|
echo ">> Newest input is newer than oldest output, regenerating."
|
||||||
objectivec/generate_descriptors_proto.sh -j "${NUM_MAKE_JOBS}"
|
objectivec/generate_well_known_types.sh -j "${NUM_MAKE_JOBS}"
|
||||||
else
|
else
|
||||||
echo ">> Newest input is older than oldest output, no need to regenerating."
|
echo ">> Newest input is older than oldest output, no need to regenerating."
|
||||||
fi
|
fi
|
||||||
|
@ -37,13 +37,6 @@
|
|||||||
#define GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS 0
|
#define GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Most uses of protocol buffers don't need field options, by default the
|
|
||||||
// static data will be compiled out, define this to 1 to include it. The only
|
|
||||||
// time you need this is if you are doing introspection of the protocol buffers.
|
|
||||||
#ifndef GPBOBJC_INCLUDE_FIELD_OPTIONS
|
|
||||||
#define GPBOBJC_INCLUDE_FIELD_OPTIONS 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Used in the generated code to give sizes to enums. int32_t was chosen based
|
// Used in the generated code to give sizes to enums. int32_t was chosen based
|
||||||
// on the fact that Protocol Buffers enums are limited to this range.
|
// on the fact that Protocol Buffers enums are limited to this range.
|
||||||
#if !__has_feature(objc_fixed_enum)
|
#if !__has_feature(objc_fixed_enum)
|
||||||
@ -89,4 +82,4 @@
|
|||||||
// generated Objective C sources. In general we don't want to change the
|
// generated Objective C sources. In general we don't want to change the
|
||||||
// runtime interfaces (or this version) as it means everything has to be
|
// runtime interfaces (or this version) as it means everything has to be
|
||||||
// regenerated.
|
// regenerated.
|
||||||
#define GOOGLE_PROTOBUF_OBJC_GEN_VERSION 30000
|
#define GOOGLE_PROTOBUF_OBJC_GEN_VERSION 30001
|
||||||
|
@ -34,19 +34,18 @@
|
|||||||
|
|
||||||
@class GPBEnumDescriptor;
|
@class GPBEnumDescriptor;
|
||||||
@class GPBFieldDescriptor;
|
@class GPBFieldDescriptor;
|
||||||
@class GPBFieldOptions;
|
|
||||||
@class GPBFileDescriptor;
|
@class GPBFileDescriptor;
|
||||||
@class GPBOneofDescriptor;
|
@class GPBOneofDescriptor;
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
typedef NS_ENUM(NSInteger, GPBFileSyntax) {
|
typedef NS_ENUM(uint8_t, GPBFileSyntax) {
|
||||||
GPBFileSyntaxUnknown = 0,
|
GPBFileSyntaxUnknown = 0,
|
||||||
GPBFileSyntaxProto2 = 2,
|
GPBFileSyntaxProto2 = 2,
|
||||||
GPBFileSyntaxProto3 = 3,
|
GPBFileSyntaxProto3 = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef NS_ENUM(NSInteger, GPBFieldType) {
|
typedef NS_ENUM(uint8_t, GPBFieldType) {
|
||||||
GPBFieldTypeSingle, // optional/required
|
GPBFieldTypeSingle, // optional/required
|
||||||
GPBFieldTypeRepeated, // repeated
|
GPBFieldTypeRepeated, // repeated
|
||||||
GPBFieldTypeMap, // map<K,V>
|
GPBFieldTypeMap, // map<K,V>
|
||||||
@ -57,9 +56,8 @@ typedef NS_ENUM(NSInteger, GPBFieldType) {
|
|||||||
@property(nonatomic, readonly, copy) NSString *name;
|
@property(nonatomic, readonly, copy) NSString *name;
|
||||||
@property(nonatomic, readonly, strong, nullable) NSArray<GPBFieldDescriptor*> *fields;
|
@property(nonatomic, readonly, strong, nullable) NSArray<GPBFieldDescriptor*> *fields;
|
||||||
@property(nonatomic, readonly, strong, nullable) NSArray<GPBOneofDescriptor*> *oneofs;
|
@property(nonatomic, readonly, strong, nullable) NSArray<GPBOneofDescriptor*> *oneofs;
|
||||||
@property(nonatomic, readonly, strong, nullable) NSArray<GPBEnumDescriptor*> *enums;
|
|
||||||
@property(nonatomic, readonly, nullable) const GPBExtensionRange *extensionRanges;
|
@property(nonatomic, readonly, nullable) const GPBExtensionRange *extensionRanges;
|
||||||
@property(nonatomic, readonly) NSUInteger extensionRangesCount;
|
@property(nonatomic, readonly) uint32_t extensionRangesCount;
|
||||||
@property(nonatomic, readonly, assign) GPBFileDescriptor *file;
|
@property(nonatomic, readonly, assign) GPBFileDescriptor *file;
|
||||||
|
|
||||||
@property(nonatomic, readonly, getter=isWireFormat) BOOL wireFormat;
|
@property(nonatomic, readonly, getter=isWireFormat) BOOL wireFormat;
|
||||||
@ -68,7 +66,6 @@ typedef NS_ENUM(NSInteger, GPBFieldType) {
|
|||||||
- (nullable GPBFieldDescriptor *)fieldWithNumber:(uint32_t)fieldNumber;
|
- (nullable GPBFieldDescriptor *)fieldWithNumber:(uint32_t)fieldNumber;
|
||||||
- (nullable GPBFieldDescriptor *)fieldWithName:(NSString *)name;
|
- (nullable GPBFieldDescriptor *)fieldWithName:(NSString *)name;
|
||||||
- (nullable GPBOneofDescriptor *)oneofWithName:(NSString *)name;
|
- (nullable GPBOneofDescriptor *)oneofWithName:(NSString *)name;
|
||||||
- (nullable GPBEnumDescriptor *)enumWithName:(NSString *)name;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@ -103,8 +100,6 @@ typedef NS_ENUM(NSInteger, GPBFieldType) {
|
|||||||
|
|
||||||
@property(nonatomic, readonly, assign, nullable) GPBOneofDescriptor *containingOneof;
|
@property(nonatomic, readonly, assign, nullable) GPBOneofDescriptor *containingOneof;
|
||||||
|
|
||||||
@property(nonatomic, readonly, nullable) GPBFieldOptions *fieldOptions;
|
|
||||||
|
|
||||||
// Message properties
|
// Message properties
|
||||||
@property(nonatomic, readonly, assign, nullable) Class msgClass;
|
@property(nonatomic, readonly, assign, nullable) Class msgClass;
|
||||||
|
|
||||||
|
@ -35,7 +35,6 @@
|
|||||||
#import "GPBUtilities_PackagePrivate.h"
|
#import "GPBUtilities_PackagePrivate.h"
|
||||||
#import "GPBWireFormat.h"
|
#import "GPBWireFormat.h"
|
||||||
#import "GPBMessage_PackagePrivate.h"
|
#import "GPBMessage_PackagePrivate.h"
|
||||||
#import "google/protobuf/Descriptor.pbobjc.h"
|
|
||||||
|
|
||||||
// The address of this variable is used as a key for obj_getAssociatedObject.
|
// The address of this variable is used as a key for obj_getAssociatedObject.
|
||||||
static const char kTextFormatExtraValueKey = 0;
|
static const char kTextFormatExtraValueKey = 0;
|
||||||
@ -92,7 +91,6 @@ static NSArray *NewFieldsArrayForHasIndex(int hasIndex,
|
|||||||
|
|
||||||
@implementation GPBDescriptor {
|
@implementation GPBDescriptor {
|
||||||
Class messageClass_;
|
Class messageClass_;
|
||||||
NSArray *enums_;
|
|
||||||
GPBFileDescriptor *file_;
|
GPBFileDescriptor *file_;
|
||||||
BOOL wireFormat_;
|
BOOL wireFormat_;
|
||||||
}
|
}
|
||||||
@ -100,7 +98,6 @@ static NSArray *NewFieldsArrayForHasIndex(int hasIndex,
|
|||||||
@synthesize messageClass = messageClass_;
|
@synthesize messageClass = messageClass_;
|
||||||
@synthesize fields = fields_;
|
@synthesize fields = fields_;
|
||||||
@synthesize oneofs = oneofs_;
|
@synthesize oneofs = oneofs_;
|
||||||
@synthesize enums = enums_;
|
|
||||||
@synthesize extensionRanges = extensionRanges_;
|
@synthesize extensionRanges = extensionRanges_;
|
||||||
@synthesize extensionRangesCount = extensionRangesCount_;
|
@synthesize extensionRangesCount = extensionRangesCount_;
|
||||||
@synthesize file = file_;
|
@synthesize file = file_;
|
||||||
@ -110,130 +107,58 @@ static NSArray *NewFieldsArrayForHasIndex(int hasIndex,
|
|||||||
allocDescriptorForClass:(Class)messageClass
|
allocDescriptorForClass:(Class)messageClass
|
||||||
rootClass:(Class)rootClass
|
rootClass:(Class)rootClass
|
||||||
file:(GPBFileDescriptor *)file
|
file:(GPBFileDescriptor *)file
|
||||||
fields:(GPBMessageFieldDescription *)fieldDescriptions
|
fields:(void *)fieldDescriptions
|
||||||
fieldCount:(NSUInteger)fieldCount
|
fieldCount:(uint32_t)fieldCount
|
||||||
oneofs:(GPBMessageOneofDescription *)oneofDescriptions
|
storageSize:(uint32_t)storageSize
|
||||||
oneofCount:(NSUInteger)oneofCount
|
flags:(GPBDescriptorInitializationFlags)flags {
|
||||||
enums:(GPBMessageEnumDescription *)enumDescriptions
|
// The rootClass is no longer used, but it is passed in to ensure it
|
||||||
enumCount:(NSUInteger)enumCount
|
// was started up during initialization also.
|
||||||
ranges:(const GPBExtensionRange *)ranges
|
(void)rootClass;
|
||||||
rangeCount:(NSUInteger)rangeCount
|
|
||||||
storageSize:(size_t)storageSize
|
|
||||||
wireFormat:(BOOL)wireFormat {
|
|
||||||
NSMutableArray *fields = nil;
|
NSMutableArray *fields = nil;
|
||||||
NSMutableArray *oneofs = nil;
|
|
||||||
NSMutableArray *enums = nil;
|
|
||||||
NSMutableArray *extensionRanges = nil;
|
|
||||||
GPBFileSyntax syntax = file.syntax;
|
GPBFileSyntax syntax = file.syntax;
|
||||||
for (NSUInteger i = 0; i < fieldCount; ++i) {
|
BOOL fieldsIncludeDefault =
|
||||||
|
(flags & GPBDescriptorInitializationFlag_FieldsWithDefault) != 0;
|
||||||
|
|
||||||
|
void *desc;
|
||||||
|
for (uint32_t i = 0; i < fieldCount; ++i) {
|
||||||
if (fields == nil) {
|
if (fields == nil) {
|
||||||
fields = [[NSMutableArray alloc] initWithCapacity:fieldCount];
|
fields = [[NSMutableArray alloc] initWithCapacity:fieldCount];
|
||||||
}
|
}
|
||||||
GPBFieldDescriptor *fieldDescriptor = [[GPBFieldDescriptor alloc]
|
// Need correctly typed pointer for array indexing below to work.
|
||||||
initWithFieldDescription:&fieldDescriptions[i]
|
if (fieldsIncludeDefault) {
|
||||||
rootClass:rootClass
|
GPBMessageFieldDescriptionWithDefault *fieldDescWithDefault = fieldDescriptions;
|
||||||
syntax:syntax];
|
desc = &(fieldDescWithDefault[i]);
|
||||||
|
} else {
|
||||||
|
GPBMessageFieldDescription *fieldDesc = fieldDescriptions;
|
||||||
|
desc = &(fieldDesc[i]);
|
||||||
|
}
|
||||||
|
GPBFieldDescriptor *fieldDescriptor =
|
||||||
|
[[GPBFieldDescriptor alloc] initWithFieldDescription:desc
|
||||||
|
includesDefault:fieldsIncludeDefault
|
||||||
|
syntax:syntax];
|
||||||
[fields addObject:fieldDescriptor];
|
[fields addObject:fieldDescriptor];
|
||||||
[fieldDescriptor release];
|
[fieldDescriptor release];
|
||||||
}
|
}
|
||||||
for (NSUInteger i = 0; i < oneofCount; ++i) {
|
|
||||||
if (oneofs == nil) {
|
|
||||||
oneofs = [[NSMutableArray alloc] initWithCapacity:oneofCount];
|
|
||||||
}
|
|
||||||
GPBMessageOneofDescription *oneofDescription = &oneofDescriptions[i];
|
|
||||||
NSArray *fieldsForOneof =
|
|
||||||
NewFieldsArrayForHasIndex(oneofDescription->index, fields);
|
|
||||||
GPBOneofDescriptor *oneofDescriptor =
|
|
||||||
[[GPBOneofDescriptor alloc] initWithOneofDescription:oneofDescription
|
|
||||||
fields:fieldsForOneof];
|
|
||||||
[oneofs addObject:oneofDescriptor];
|
|
||||||
[oneofDescriptor release];
|
|
||||||
[fieldsForOneof release];
|
|
||||||
}
|
|
||||||
for (NSUInteger i = 0; i < enumCount; ++i) {
|
|
||||||
if (enums == nil) {
|
|
||||||
enums = [[NSMutableArray alloc] initWithCapacity:enumCount];
|
|
||||||
}
|
|
||||||
GPBEnumDescriptor *enumDescriptor =
|
|
||||||
enumDescriptions[i].enumDescriptorFunc();
|
|
||||||
[enums addObject:enumDescriptor];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
BOOL wireFormat = (flags & GPBDescriptorInitializationFlag_WireFormat) != 0;
|
||||||
GPBDescriptor *descriptor = [[self alloc] initWithClass:messageClass
|
GPBDescriptor *descriptor = [[self alloc] initWithClass:messageClass
|
||||||
file:file
|
file:file
|
||||||
fields:fields
|
fields:fields
|
||||||
oneofs:oneofs
|
|
||||||
enums:enums
|
|
||||||
extensionRanges:ranges
|
|
||||||
extensionRangesCount:rangeCount
|
|
||||||
storageSize:storageSize
|
storageSize:storageSize
|
||||||
wireFormat:wireFormat];
|
wireFormat:wireFormat];
|
||||||
[fields release];
|
[fields release];
|
||||||
[oneofs release];
|
|
||||||
[enums release];
|
|
||||||
[extensionRanges release];
|
|
||||||
return descriptor;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (instancetype)
|
|
||||||
allocDescriptorForClass:(Class)messageClass
|
|
||||||
rootClass:(Class)rootClass
|
|
||||||
file:(GPBFileDescriptor *)file
|
|
||||||
fields:(GPBMessageFieldDescription *)fieldDescriptions
|
|
||||||
fieldCount:(NSUInteger)fieldCount
|
|
||||||
oneofs:(GPBMessageOneofDescription *)oneofDescriptions
|
|
||||||
oneofCount:(NSUInteger)oneofCount
|
|
||||||
enums:(GPBMessageEnumDescription *)enumDescriptions
|
|
||||||
enumCount:(NSUInteger)enumCount
|
|
||||||
ranges:(const GPBExtensionRange *)ranges
|
|
||||||
rangeCount:(NSUInteger)rangeCount
|
|
||||||
storageSize:(size_t)storageSize
|
|
||||||
wireFormat:(BOOL)wireFormat
|
|
||||||
extraTextFormatInfo:(const char *)extraTextFormatInfo {
|
|
||||||
GPBDescriptor *descriptor = [self allocDescriptorForClass:messageClass
|
|
||||||
rootClass:rootClass
|
|
||||||
file:file
|
|
||||||
fields:fieldDescriptions
|
|
||||||
fieldCount:fieldCount
|
|
||||||
oneofs:oneofDescriptions
|
|
||||||
oneofCount:oneofCount
|
|
||||||
enums:enumDescriptions
|
|
||||||
enumCount:enumCount
|
|
||||||
ranges:ranges
|
|
||||||
rangeCount:rangeCount
|
|
||||||
storageSize:storageSize
|
|
||||||
wireFormat:wireFormat];
|
|
||||||
// Extra info is a compile time option, so skip the work if not needed.
|
|
||||||
if (extraTextFormatInfo) {
|
|
||||||
NSValue *extraInfoValue = [NSValue valueWithPointer:extraTextFormatInfo];
|
|
||||||
for (GPBFieldDescriptor *fieldDescriptor in descriptor->fields_) {
|
|
||||||
if (fieldDescriptor->description_->flags & GPBFieldTextFormatNameCustom) {
|
|
||||||
objc_setAssociatedObject(fieldDescriptor, &kTextFormatExtraValueKey,
|
|
||||||
extraInfoValue,
|
|
||||||
OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return descriptor;
|
return descriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithClass:(Class)messageClass
|
- (instancetype)initWithClass:(Class)messageClass
|
||||||
file:(GPBFileDescriptor *)file
|
file:(GPBFileDescriptor *)file
|
||||||
fields:(NSArray *)fields
|
fields:(NSArray *)fields
|
||||||
oneofs:(NSArray *)oneofs
|
storageSize:(uint32_t)storageSize
|
||||||
enums:(NSArray *)enums
|
|
||||||
extensionRanges:(const GPBExtensionRange *)extensionRanges
|
|
||||||
extensionRangesCount:(NSUInteger)extensionRangesCount
|
|
||||||
storageSize:(size_t)storageSize
|
|
||||||
wireFormat:(BOOL)wireFormat {
|
wireFormat:(BOOL)wireFormat {
|
||||||
if ((self = [super init])) {
|
if ((self = [super init])) {
|
||||||
messageClass_ = messageClass;
|
messageClass_ = messageClass;
|
||||||
file_ = file;
|
file_ = file;
|
||||||
fields_ = [fields retain];
|
fields_ = [fields retain];
|
||||||
oneofs_ = [oneofs retain];
|
|
||||||
enums_ = [enums retain];
|
|
||||||
extensionRanges_ = extensionRanges;
|
|
||||||
extensionRangesCount_ = extensionRangesCount;
|
|
||||||
storageSize_ = storageSize;
|
storageSize_ = storageSize;
|
||||||
wireFormat_ = wireFormat;
|
wireFormat_ = wireFormat;
|
||||||
}
|
}
|
||||||
@ -243,10 +168,47 @@ static NSArray *NewFieldsArrayForHasIndex(int hasIndex,
|
|||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
[fields_ release];
|
[fields_ release];
|
||||||
[oneofs_ release];
|
[oneofs_ release];
|
||||||
[enums_ release];
|
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)setupOneofs:(const char **)oneofNames
|
||||||
|
count:(uint32_t)count
|
||||||
|
firstHasIndex:(int32_t)firstHasIndex {
|
||||||
|
NSCAssert(firstHasIndex < 0, @"Should always be <0");
|
||||||
|
NSMutableArray *oneofs = [[NSMutableArray alloc] initWithCapacity:count];
|
||||||
|
for (uint32_t i = 0, hasIndex = firstHasIndex; i < count; ++i, --hasIndex) {
|
||||||
|
const char *name = oneofNames[i];
|
||||||
|
NSArray *fieldsForOneof = NewFieldsArrayForHasIndex(hasIndex, fields_);
|
||||||
|
NSCAssert(fieldsForOneof.count > 0,
|
||||||
|
@"No fields for this oneof? (%s:%d)", name, hasIndex);
|
||||||
|
GPBOneofDescriptor *oneofDescriptor =
|
||||||
|
[[GPBOneofDescriptor alloc] initWithName:name fields:fieldsForOneof];
|
||||||
|
[oneofs addObject:oneofDescriptor];
|
||||||
|
[oneofDescriptor release];
|
||||||
|
[fieldsForOneof release];
|
||||||
|
}
|
||||||
|
oneofs_ = oneofs;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setupExtraTextInfo:(const char *)extraTextFormatInfo {
|
||||||
|
// Extra info is a compile time option, so skip the work if not needed.
|
||||||
|
if (extraTextFormatInfo) {
|
||||||
|
NSValue *extraInfoValue = [NSValue valueWithPointer:extraTextFormatInfo];
|
||||||
|
for (GPBFieldDescriptor *fieldDescriptor in fields_) {
|
||||||
|
if (fieldDescriptor->description_->flags & GPBFieldTextFormatNameCustom) {
|
||||||
|
objc_setAssociatedObject(fieldDescriptor, &kTextFormatExtraValueKey,
|
||||||
|
extraInfoValue,
|
||||||
|
OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setupExtensionRanges:(const GPBExtensionRange *)ranges count:(int32_t)count {
|
||||||
|
extensionRanges_ = ranges;
|
||||||
|
extensionRangesCount_ = count;
|
||||||
|
}
|
||||||
|
|
||||||
- (NSString *)name {
|
- (NSString *)name {
|
||||||
return NSStringFromClass(messageClass_);
|
return NSStringFromClass(messageClass_);
|
||||||
}
|
}
|
||||||
@ -283,15 +245,6 @@ static NSArray *NewFieldsArrayForHasIndex(int hasIndex,
|
|||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (GPBEnumDescriptor *)enumWithName:(NSString *)name {
|
|
||||||
for (GPBEnumDescriptor *descriptor in enums_) {
|
|
||||||
if ([descriptor.name isEqual:name]) {
|
|
||||||
return descriptor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation GPBFileDescriptor {
|
@implementation GPBFileDescriptor {
|
||||||
@ -318,19 +271,16 @@ static NSArray *NewFieldsArrayForHasIndex(int hasIndex,
|
|||||||
|
|
||||||
@synthesize fields = fields_;
|
@synthesize fields = fields_;
|
||||||
|
|
||||||
- (instancetype)initWithOneofDescription:
|
- (instancetype)initWithName:(const char *)name fields:(NSArray *)fields {
|
||||||
(GPBMessageOneofDescription *)oneofDescription
|
|
||||||
fields:(NSArray *)fields {
|
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self) {
|
if (self) {
|
||||||
NSAssert(oneofDescription->index < 0, @"Should always be <0");
|
name_ = name;
|
||||||
oneofDescription_ = oneofDescription;
|
|
||||||
fields_ = [fields retain];
|
fields_ = [fields retain];
|
||||||
for (GPBFieldDescriptor *fieldDesc in fields) {
|
for (GPBFieldDescriptor *fieldDesc in fields) {
|
||||||
fieldDesc->containingOneof_ = self;
|
fieldDesc->containingOneof_ = self;
|
||||||
}
|
}
|
||||||
|
|
||||||
caseSel_ = SelFromStrings(NULL, oneofDescription->name, "OneOfCase", NO);
|
caseSel_ = SelFromStrings(NULL, name, "OneOfCase", NO);
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@ -341,7 +291,7 @@ static NSArray *NewFieldsArrayForHasIndex(int hasIndex,
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *)name {
|
- (NSString *)name {
|
||||||
return @(oneofDescription_->name);
|
return @(name_);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (GPBFieldDescriptor *)fieldWithNumber:(uint32_t)fieldNumber {
|
- (GPBFieldDescriptor *)fieldWithNumber:(uint32_t)fieldNumber {
|
||||||
@ -389,7 +339,6 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
|
|||||||
|
|
||||||
@implementation GPBFieldDescriptor {
|
@implementation GPBFieldDescriptor {
|
||||||
GPBGenericValue defaultValue_;
|
GPBGenericValue defaultValue_;
|
||||||
GPBFieldOptions *fieldOptions_;
|
|
||||||
|
|
||||||
// Message ivars
|
// Message ivars
|
||||||
Class msgClass_;
|
Class msgClass_;
|
||||||
@ -403,7 +352,6 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
|
|||||||
} enumHandling_;
|
} enumHandling_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@synthesize fieldOptions = fieldOptions_;
|
|
||||||
@synthesize msgClass = msgClass_;
|
@synthesize msgClass = msgClass_;
|
||||||
@synthesize containingOneof = containingOneof_;
|
@synthesize containingOneof = containingOneof_;
|
||||||
|
|
||||||
@ -417,16 +365,21 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithFieldDescription:
|
- (instancetype)initWithFieldDescription:(void *)description
|
||||||
(GPBMessageFieldDescription *)description
|
includesDefault:(BOOL)includesDefault
|
||||||
rootClass:(Class)rootClass
|
|
||||||
syntax:(GPBFileSyntax)syntax {
|
syntax:(GPBFileSyntax)syntax {
|
||||||
if ((self = [super init])) {
|
if ((self = [super init])) {
|
||||||
description_ = description;
|
GPBMessageFieldDescription *coreDesc;
|
||||||
getSel_ = sel_getUid(description->name);
|
if (includesDefault) {
|
||||||
setSel_ = SelFromStrings("set", description->name, NULL, YES);
|
coreDesc = &(((GPBMessageFieldDescriptionWithDefault *)description)->core);
|
||||||
|
} else {
|
||||||
|
coreDesc = description;
|
||||||
|
}
|
||||||
|
description_ = coreDesc;
|
||||||
|
getSel_ = sel_getUid(coreDesc->name);
|
||||||
|
setSel_ = SelFromStrings("set", coreDesc->name, NULL, YES);
|
||||||
|
|
||||||
GPBDataType dataType = description->dataType;
|
GPBDataType dataType = coreDesc->dataType;
|
||||||
BOOL isMessage = GPBDataTypeIsMessage(dataType);
|
BOOL isMessage = GPBDataTypeIsMessage(dataType);
|
||||||
BOOL isMapOrArray = GPBFieldIsMapOrArray(self);
|
BOOL isMapOrArray = GPBFieldIsMapOrArray(self);
|
||||||
|
|
||||||
@ -434,39 +387,39 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
|
|||||||
// map<>/repeated fields get a *Count property (inplace of a has*) to
|
// map<>/repeated fields get a *Count property (inplace of a has*) to
|
||||||
// support checking if there are any entries without triggering
|
// support checking if there are any entries without triggering
|
||||||
// autocreation.
|
// autocreation.
|
||||||
hasOrCountSel_ = SelFromStrings(NULL, description->name, "_Count", NO);
|
hasOrCountSel_ = SelFromStrings(NULL, coreDesc->name, "_Count", NO);
|
||||||
} else {
|
} else {
|
||||||
// If there is a positive hasIndex, then:
|
// If there is a positive hasIndex, then:
|
||||||
// - All fields types for proto2 messages get has* selectors.
|
// - All fields types for proto2 messages get has* selectors.
|
||||||
// - Only message fields for proto3 messages get has* selectors.
|
// - Only message fields for proto3 messages get has* selectors.
|
||||||
// Note: the positive check is to handle oneOfs, we can't check
|
// Note: the positive check is to handle oneOfs, we can't check
|
||||||
// containingOneof_ because it isn't set until after initialization.
|
// containingOneof_ because it isn't set until after initialization.
|
||||||
if ((description->hasIndex >= 0) &&
|
if ((coreDesc->hasIndex >= 0) &&
|
||||||
(description->hasIndex != GPBNoHasBit) &&
|
(coreDesc->hasIndex != GPBNoHasBit) &&
|
||||||
((syntax != GPBFileSyntaxProto3) || isMessage)) {
|
((syntax != GPBFileSyntaxProto3) || isMessage)) {
|
||||||
hasOrCountSel_ = SelFromStrings("has", description->name, NULL, NO);
|
hasOrCountSel_ = SelFromStrings("has", coreDesc->name, NULL, NO);
|
||||||
setHasSel_ = SelFromStrings("setHas", description->name, NULL, YES);
|
setHasSel_ = SelFromStrings("setHas", coreDesc->name, NULL, YES);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extra type specific data.
|
// Extra type specific data.
|
||||||
if (isMessage) {
|
if (isMessage) {
|
||||||
const char *className = description->dataTypeSpecific.className;
|
const char *className = coreDesc->dataTypeSpecific.className;
|
||||||
msgClass_ = objc_getClass(className);
|
msgClass_ = objc_getClass(className);
|
||||||
NSAssert(msgClass_, @"Class %s not defined", className);
|
NSAssert(msgClass_, @"Class %s not defined", className);
|
||||||
} else if (dataType == GPBDataTypeEnum) {
|
} else if (dataType == GPBDataTypeEnum) {
|
||||||
if ((description_->flags & GPBFieldHasEnumDescriptor) != 0) {
|
if ((coreDesc->flags & GPBFieldHasEnumDescriptor) != 0) {
|
||||||
enumHandling_.enumDescriptor_ =
|
enumHandling_.enumDescriptor_ =
|
||||||
description->dataTypeSpecific.enumDescFunc();
|
coreDesc->dataTypeSpecific.enumDescFunc();
|
||||||
} else {
|
} else {
|
||||||
enumHandling_.enumVerifier_ =
|
enumHandling_.enumVerifier_ =
|
||||||
description->dataTypeSpecific.enumVerifier;
|
coreDesc->dataTypeSpecific.enumVerifier;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Non map<>/repeated fields can have defaults.
|
// Non map<>/repeated fields can have defaults in proto2 syntax.
|
||||||
if (!isMapOrArray) {
|
if (!isMapOrArray && includesDefault) {
|
||||||
defaultValue_ = description->defaultValue;
|
defaultValue_ = ((GPBMessageFieldDescriptionWithDefault *)description)->defaultValue;
|
||||||
if (dataType == GPBDataTypeBytes) {
|
if (dataType == GPBDataTypeBytes) {
|
||||||
// Data stored as a length prefixed (network byte order) c-string in
|
// Data stored as a length prefixed (network byte order) c-string in
|
||||||
// descriptor structure.
|
// descriptor structure.
|
||||||
@ -480,24 +433,6 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FieldOptions stored as a length prefixed (network byte order) c-escaped
|
|
||||||
// string in descriptor records.
|
|
||||||
if (description->fieldOptions) {
|
|
||||||
uint8_t *optionsBytes = (uint8_t *)description->fieldOptions;
|
|
||||||
uint32_t optionsLength = *((uint32_t *)optionsBytes);
|
|
||||||
optionsLength = ntohl(optionsLength);
|
|
||||||
if (optionsLength > 0) {
|
|
||||||
optionsBytes += sizeof(optionsLength);
|
|
||||||
NSData *optionsData = [NSData dataWithBytesNoCopy:optionsBytes
|
|
||||||
length:optionsLength
|
|
||||||
freeWhenDone:NO];
|
|
||||||
GPBExtensionRegistry *registry = [rootClass extensionRegistry];
|
|
||||||
fieldOptions_ = [[GPBFieldOptions parseFromData:optionsData
|
|
||||||
extensionRegistry:registry
|
|
||||||
error:NULL] retain];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@ -666,7 +601,7 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
|
|||||||
} else {
|
} else {
|
||||||
// Undo the CamelCase.
|
// Undo the CamelCase.
|
||||||
NSMutableString *result = [NSMutableString stringWithCapacity:len];
|
NSMutableString *result = [NSMutableString stringWithCapacity:len];
|
||||||
for (NSUInteger i = 0; i < len; i++) {
|
for (uint32_t i = 0; i < len; i++) {
|
||||||
unichar c = [name characterAtIndex:i];
|
unichar c = [name characterAtIndex:i];
|
||||||
if (c >= 'A' && c <= 'Z') {
|
if (c >= 'A' && c <= 'Z') {
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
@ -686,10 +621,16 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
|
|||||||
|
|
||||||
@implementation GPBEnumDescriptor {
|
@implementation GPBEnumDescriptor {
|
||||||
NSString *name_;
|
NSString *name_;
|
||||||
GPBMessageEnumValueDescription *valueDescriptions_;
|
// valueNames_ is a single c string with all of the value names appended
|
||||||
NSUInteger valueDescriptionsCount_;
|
// together, each null terminated. -calcValueNameOffsets fills in
|
||||||
|
// nameOffsets_ with the offsets to allow quicker access to the individual
|
||||||
|
// names.
|
||||||
|
const char *valueNames_;
|
||||||
|
const int32_t *values_;
|
||||||
GPBEnumValidationFunc enumVerifier_;
|
GPBEnumValidationFunc enumVerifier_;
|
||||||
const uint8_t *extraTextFormatInfo_;
|
const uint8_t *extraTextFormatInfo_;
|
||||||
|
uint32_t *nameOffsets_;
|
||||||
|
uint32_t valueCount_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@synthesize name = name_;
|
@synthesize name = name_;
|
||||||
@ -697,26 +638,30 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
|
|||||||
|
|
||||||
+ (instancetype)
|
+ (instancetype)
|
||||||
allocDescriptorForName:(NSString *)name
|
allocDescriptorForName:(NSString *)name
|
||||||
values:(GPBMessageEnumValueDescription *)valueDescriptions
|
valueNames:(const char *)valueNames
|
||||||
valueCount:(NSUInteger)valueCount
|
values:(const int32_t *)values
|
||||||
|
count:(uint32_t)valueCount
|
||||||
enumVerifier:(GPBEnumValidationFunc)enumVerifier {
|
enumVerifier:(GPBEnumValidationFunc)enumVerifier {
|
||||||
GPBEnumDescriptor *descriptor = [[self alloc] initWithName:name
|
GPBEnumDescriptor *descriptor = [[self alloc] initWithName:name
|
||||||
values:valueDescriptions
|
valueNames:valueNames
|
||||||
valueCount:valueCount
|
values:values
|
||||||
|
count:valueCount
|
||||||
enumVerifier:enumVerifier];
|
enumVerifier:enumVerifier];
|
||||||
return descriptor;
|
return descriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (instancetype)
|
+ (instancetype)
|
||||||
allocDescriptorForName:(NSString *)name
|
allocDescriptorForName:(NSString *)name
|
||||||
values:(GPBMessageEnumValueDescription *)valueDescriptions
|
valueNames:(const char *)valueNames
|
||||||
valueCount:(NSUInteger)valueCount
|
values:(const int32_t *)values
|
||||||
|
count:(uint32_t)valueCount
|
||||||
enumVerifier:(GPBEnumValidationFunc)enumVerifier
|
enumVerifier:(GPBEnumValidationFunc)enumVerifier
|
||||||
extraTextFormatInfo:(const char *)extraTextFormatInfo {
|
extraTextFormatInfo:(const char *)extraTextFormatInfo {
|
||||||
// Call the common case.
|
// Call the common case.
|
||||||
GPBEnumDescriptor *descriptor = [self allocDescriptorForName:name
|
GPBEnumDescriptor *descriptor = [self allocDescriptorForName:name
|
||||||
values:valueDescriptions
|
valueNames:valueNames
|
||||||
valueCount:valueCount
|
values:values
|
||||||
|
count:valueCount
|
||||||
enumVerifier:enumVerifier];
|
enumVerifier:enumVerifier];
|
||||||
// Set the extra info.
|
// Set the extra info.
|
||||||
descriptor->extraTextFormatInfo_ = (const uint8_t *)extraTextFormatInfo;
|
descriptor->extraTextFormatInfo_ = (const uint8_t *)extraTextFormatInfo;
|
||||||
@ -724,24 +669,49 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithName:(NSString *)name
|
- (instancetype)initWithName:(NSString *)name
|
||||||
values:(GPBMessageEnumValueDescription *)valueDescriptions
|
valueNames:(const char *)valueNames
|
||||||
valueCount:(NSUInteger)valueCount
|
values:(const int32_t *)values
|
||||||
|
count:(uint32_t)valueCount
|
||||||
enumVerifier:(GPBEnumValidationFunc)enumVerifier {
|
enumVerifier:(GPBEnumValidationFunc)enumVerifier {
|
||||||
if ((self = [super init])) {
|
if ((self = [super init])) {
|
||||||
name_ = [name copy];
|
name_ = [name copy];
|
||||||
valueDescriptions_ = valueDescriptions;
|
valueNames_ = valueNames;
|
||||||
valueDescriptionsCount_ = valueCount;
|
values_ = values;
|
||||||
|
valueCount_ = valueCount;
|
||||||
enumVerifier_ = enumVerifier;
|
enumVerifier_ = enumVerifier;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)dealloc {
|
||||||
|
[name_ release];
|
||||||
|
if (nameOffsets_) free(nameOffsets_);
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)calcValueNameOffsets {
|
||||||
|
@synchronized(self) {
|
||||||
|
if (nameOffsets_ != NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uint32_t *offsets = malloc(valueCount_ * sizeof(uint32_t));
|
||||||
|
const char *scan = valueNames_;
|
||||||
|
for (uint32_t i = 0; i < valueCount_; ++i) {
|
||||||
|
offsets[i] = (uint32_t)(scan - valueNames_);
|
||||||
|
while (*scan != '\0') ++scan;
|
||||||
|
++scan; // Step over the null.
|
||||||
|
}
|
||||||
|
nameOffsets_ = offsets;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (NSString *)enumNameForValue:(int32_t)number {
|
- (NSString *)enumNameForValue:(int32_t)number {
|
||||||
for (NSUInteger i = 0; i < valueDescriptionsCount_; ++i) {
|
if (nameOffsets_ == NULL) [self calcValueNameOffsets];
|
||||||
GPBMessageEnumValueDescription *scan = &valueDescriptions_[i];
|
|
||||||
if ((scan->number == number) && (scan->name != NULL)) {
|
for (uint32_t i = 0; i < valueCount_; ++i) {
|
||||||
NSString *fullName =
|
if (values_[i] == number) {
|
||||||
[NSString stringWithFormat:@"%@_%s", name_, scan->name];
|
const char *valueName = valueNames_ + nameOffsets_[i];
|
||||||
|
NSString *fullName = [NSString stringWithFormat:@"%@_%s", name_, valueName];
|
||||||
return fullName;
|
return fullName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -760,12 +730,14 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
|
|||||||
const char *nameAsCStr = [name UTF8String];
|
const char *nameAsCStr = [name UTF8String];
|
||||||
nameAsCStr += prefixLen;
|
nameAsCStr += prefixLen;
|
||||||
|
|
||||||
|
if (nameOffsets_ == NULL) [self calcValueNameOffsets];
|
||||||
|
|
||||||
// Find it.
|
// Find it.
|
||||||
for (NSUInteger i = 0; i < valueDescriptionsCount_; ++i) {
|
for (uint32_t i = 0; i < valueCount_; ++i) {
|
||||||
GPBMessageEnumValueDescription *scan = &valueDescriptions_[i];
|
const char *valueName = valueNames_ + nameOffsets_[i];
|
||||||
if ((scan->name != NULL) && (strcmp(nameAsCStr, scan->name) == 0)) {
|
if (strcmp(nameAsCStr, valueName) == 0) {
|
||||||
if (outValue) {
|
if (outValue) {
|
||||||
*outValue = scan->number;
|
*outValue = values_[i];
|
||||||
}
|
}
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
@ -773,34 +745,28 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc {
|
|
||||||
[name_ release];
|
|
||||||
[super dealloc];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSString *)textFormatNameForValue:(int32_t)number {
|
- (NSString *)textFormatNameForValue:(int32_t)number {
|
||||||
|
if (nameOffsets_ == NULL) [self calcValueNameOffsets];
|
||||||
|
|
||||||
// Find the EnumValue descriptor and its index.
|
// Find the EnumValue descriptor and its index.
|
||||||
GPBMessageEnumValueDescription *valueDescriptor = NULL;
|
BOOL foundIt = NO;
|
||||||
NSUInteger valueDescriptorIndex;
|
uint32_t valueDescriptorIndex;
|
||||||
for (valueDescriptorIndex = 0; valueDescriptorIndex < valueDescriptionsCount_;
|
for (valueDescriptorIndex = 0; valueDescriptorIndex < valueCount_;
|
||||||
++valueDescriptorIndex) {
|
++valueDescriptorIndex) {
|
||||||
GPBMessageEnumValueDescription *scan =
|
if (values_[valueDescriptorIndex] == number) {
|
||||||
&valueDescriptions_[valueDescriptorIndex];
|
foundIt = YES;
|
||||||
if (scan->number == number) {
|
|
||||||
valueDescriptor = scan;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we didn't find it, or names were disable at proto compile time, nothing
|
if (!foundIt) {
|
||||||
// we can do.
|
|
||||||
if (!valueDescriptor || !valueDescriptor->name) {
|
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString *result = nil;
|
NSString *result = nil;
|
||||||
// Naming adds an underscore between enum name and value name, skip that also.
|
// Naming adds an underscore between enum name and value name, skip that also.
|
||||||
NSString *shortName = @(valueDescriptor->name);
|
const char *valueName = valueNames_ + nameOffsets_[valueDescriptorIndex];
|
||||||
|
NSString *shortName = @(valueName);
|
||||||
|
|
||||||
// See if it is in the map of special format handling.
|
// See if it is in the map of special format handling.
|
||||||
if (extraTextFormatInfo_) {
|
if (extraTextFormatInfo_) {
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
#import "GPBWireFormat.h"
|
#import "GPBWireFormat.h"
|
||||||
|
|
||||||
// Describes attributes of the field.
|
// Describes attributes of the field.
|
||||||
typedef NS_OPTIONS(uint32_t, GPBFieldFlags) {
|
typedef NS_OPTIONS(uint16_t, GPBFieldFlags) {
|
||||||
// These map to standard protobuf concepts.
|
// These map to standard protobuf concepts.
|
||||||
GPBFieldRequired = 1 << 0,
|
GPBFieldRequired = 1 << 0,
|
||||||
GPBFieldRepeated = 1 << 1,
|
GPBFieldRepeated = 1 << 1,
|
||||||
@ -44,6 +44,12 @@ typedef NS_OPTIONS(uint32_t, GPBFieldFlags) {
|
|||||||
GPBFieldOptional = 1 << 3,
|
GPBFieldOptional = 1 << 3,
|
||||||
GPBFieldHasDefaultValue = 1 << 4,
|
GPBFieldHasDefaultValue = 1 << 4,
|
||||||
|
|
||||||
|
// Indicates the field needs custom handling for the TextFormat name, if not
|
||||||
|
// set, the name can be derived from the ObjC name.
|
||||||
|
GPBFieldTextFormatNameCustom = 1 << 6,
|
||||||
|
// Indicates the field has an enum descriptor.
|
||||||
|
GPBFieldHasEnumDescriptor = 1 << 7,
|
||||||
|
|
||||||
// These are not standard protobuf concepts, they are specific to the
|
// These are not standard protobuf concepts, they are specific to the
|
||||||
// Objective C runtime.
|
// Objective C runtime.
|
||||||
|
|
||||||
@ -62,35 +68,16 @@ typedef NS_OPTIONS(uint32_t, GPBFieldFlags) {
|
|||||||
GPBFieldMapKeySFixed64 = 10 << 8,
|
GPBFieldMapKeySFixed64 = 10 << 8,
|
||||||
GPBFieldMapKeyBool = 11 << 8,
|
GPBFieldMapKeyBool = 11 << 8,
|
||||||
GPBFieldMapKeyString = 12 << 8,
|
GPBFieldMapKeyString = 12 << 8,
|
||||||
|
|
||||||
// Indicates the field needs custom handling for the TextFormat name, if not
|
|
||||||
// set, the name can be derived from the ObjC name.
|
|
||||||
GPBFieldTextFormatNameCustom = 1 << 16,
|
|
||||||
// Indicates the field has an enum descriptor.
|
|
||||||
GPBFieldHasEnumDescriptor = 1 << 17,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// NOTE: The structures defined here have their members ordered to minimize
|
||||||
|
// their size. This directly impacts the size of apps since these exist per
|
||||||
|
// field/extension.
|
||||||
|
|
||||||
// Describes a single field in a protobuf as it is represented as an ivar.
|
// Describes a single field in a protobuf as it is represented as an ivar.
|
||||||
typedef struct GPBMessageFieldDescription {
|
typedef struct GPBMessageFieldDescription {
|
||||||
// Name of ivar.
|
// Name of ivar.
|
||||||
const char *name;
|
const char *name;
|
||||||
// The field number for the ivar.
|
|
||||||
uint32_t number;
|
|
||||||
// The index (in bits) into _has_storage_.
|
|
||||||
// > 0: the bit to use for a value being set.
|
|
||||||
// = 0: no storage used.
|
|
||||||
// < 0: in a oneOf, use a full int32 to record the field active.
|
|
||||||
int32_t hasIndex;
|
|
||||||
// Field flags. Use accessor functions below.
|
|
||||||
GPBFieldFlags flags;
|
|
||||||
// Data type of the ivar.
|
|
||||||
GPBDataType dataType;
|
|
||||||
// Offset of the variable into it's structure struct.
|
|
||||||
size_t offset;
|
|
||||||
// FieldOptions protobuf, serialized as string.
|
|
||||||
const char *fieldOptions;
|
|
||||||
|
|
||||||
GPBGenericValue defaultValue; // Default value for the ivar.
|
|
||||||
union {
|
union {
|
||||||
const char *className; // Name for message class.
|
const char *className; // Name for message class.
|
||||||
// For enums only: If EnumDescriptors are compiled in, it will be that,
|
// For enums only: If EnumDescriptors are compiled in, it will be that,
|
||||||
@ -98,31 +85,32 @@ typedef struct GPBMessageFieldDescription {
|
|||||||
GPBEnumDescriptorFunc enumDescFunc;
|
GPBEnumDescriptorFunc enumDescFunc;
|
||||||
GPBEnumValidationFunc enumVerifier;
|
GPBEnumValidationFunc enumVerifier;
|
||||||
} dataTypeSpecific;
|
} dataTypeSpecific;
|
||||||
|
// The field number for the ivar.
|
||||||
|
uint32_t number;
|
||||||
|
// The index (in bits) into _has_storage_.
|
||||||
|
// >= 0: the bit to use for a value being set.
|
||||||
|
// = GPBNoHasBit(INT32_MAX): no storage used.
|
||||||
|
// < 0: in a oneOf, use a full int32 to record the field active.
|
||||||
|
int32_t hasIndex;
|
||||||
|
// Offset of the variable into it's structure struct.
|
||||||
|
uint32_t offset;
|
||||||
|
// Field flags. Use accessor functions below.
|
||||||
|
GPBFieldFlags flags;
|
||||||
|
// Data type of the ivar.
|
||||||
|
GPBDataType dataType;
|
||||||
} GPBMessageFieldDescription;
|
} GPBMessageFieldDescription;
|
||||||
|
|
||||||
// Describes a oneof.
|
// Fields in messages defined in a 'proto2' syntax file can provide a default
|
||||||
typedef struct GPBMessageOneofDescription {
|
// value. This struct provides the default along with the field info.
|
||||||
// Name of this enum oneof.
|
typedef struct GPBMessageFieldDescriptionWithDefault {
|
||||||
const char *name;
|
// Default value for the ivar.
|
||||||
// The index of this oneof in the has_storage.
|
GPBGenericValue defaultValue;
|
||||||
int32_t index;
|
|
||||||
} GPBMessageOneofDescription;
|
|
||||||
|
|
||||||
// Describes an enum type defined in a .proto file.
|
GPBMessageFieldDescription core;
|
||||||
typedef struct GPBMessageEnumDescription {
|
} GPBMessageFieldDescriptionWithDefault;
|
||||||
GPBEnumDescriptorFunc enumDescriptorFunc;
|
|
||||||
} GPBMessageEnumDescription;
|
|
||||||
|
|
||||||
// Describes an individual enum constant of a particular type.
|
|
||||||
typedef struct GPBMessageEnumValueDescription {
|
|
||||||
// Name of this enum constant.
|
|
||||||
const char *name;
|
|
||||||
// Numeric value of this enum constant.
|
|
||||||
int32_t number;
|
|
||||||
} GPBMessageEnumValueDescription;
|
|
||||||
|
|
||||||
// Describes attributes of the extension.
|
// Describes attributes of the extension.
|
||||||
typedef NS_OPTIONS(uint32_t, GPBExtensionOptions) {
|
typedef NS_OPTIONS(uint8_t, GPBExtensionOptions) {
|
||||||
// These map to standard protobuf concepts.
|
// These map to standard protobuf concepts.
|
||||||
GPBExtensionRepeated = 1 << 0,
|
GPBExtensionRepeated = 1 << 0,
|
||||||
GPBExtensionPacked = 1 << 1,
|
GPBExtensionPacked = 1 << 1,
|
||||||
@ -131,65 +119,53 @@ typedef NS_OPTIONS(uint32_t, GPBExtensionOptions) {
|
|||||||
|
|
||||||
// An extension
|
// An extension
|
||||||
typedef struct GPBExtensionDescription {
|
typedef struct GPBExtensionDescription {
|
||||||
const char *singletonName;
|
|
||||||
GPBDataType dataType;
|
|
||||||
const char *extendedClass;
|
|
||||||
int32_t fieldNumber;
|
|
||||||
GPBGenericValue defaultValue;
|
GPBGenericValue defaultValue;
|
||||||
|
const char *singletonName;
|
||||||
|
const char *extendedClass;
|
||||||
const char *messageOrGroupClassName;
|
const char *messageOrGroupClassName;
|
||||||
GPBExtensionOptions options;
|
|
||||||
GPBEnumDescriptorFunc enumDescriptorFunc;
|
GPBEnumDescriptorFunc enumDescriptorFunc;
|
||||||
|
int32_t fieldNumber;
|
||||||
|
GPBDataType dataType;
|
||||||
|
GPBExtensionOptions options;
|
||||||
} GPBExtensionDescription;
|
} GPBExtensionDescription;
|
||||||
|
|
||||||
|
typedef NS_OPTIONS(uint32_t, GPBDescriptorInitializationFlags) {
|
||||||
|
GPBDescriptorInitializationFlag_FieldsWithDefault = 1 << 0,
|
||||||
|
GPBDescriptorInitializationFlag_WireFormat = 1 << 1,
|
||||||
|
};
|
||||||
|
|
||||||
@interface GPBDescriptor () {
|
@interface GPBDescriptor () {
|
||||||
@package
|
@package
|
||||||
NSArray *fields_;
|
NSArray *fields_;
|
||||||
NSArray *oneofs_;
|
NSArray *oneofs_;
|
||||||
size_t storageSize_;
|
uint32_t storageSize_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// fieldDescriptions, enumDescriptions, rangeDescriptions, and
|
// fieldDescriptions have to be long lived, they are held as raw pointers.
|
||||||
// extraTextFormatInfo have to be long lived, they are held as raw pointers.
|
|
||||||
+ (instancetype)
|
+ (instancetype)
|
||||||
allocDescriptorForClass:(Class)messageClass
|
allocDescriptorForClass:(Class)messageClass
|
||||||
rootClass:(Class)rootClass
|
rootClass:(Class)rootClass
|
||||||
file:(GPBFileDescriptor *)file
|
file:(GPBFileDescriptor *)file
|
||||||
fields:(GPBMessageFieldDescription *)fieldDescriptions
|
fields:(void *)fieldDescriptions
|
||||||
fieldCount:(NSUInteger)fieldCount
|
fieldCount:(uint32_t)fieldCount
|
||||||
oneofs:(GPBMessageOneofDescription *)oneofDescriptions
|
storageSize:(uint32_t)storageSize
|
||||||
oneofCount:(NSUInteger)oneofCount
|
flags:(GPBDescriptorInitializationFlags)flags;
|
||||||
enums:(GPBMessageEnumDescription *)enumDescriptions
|
|
||||||
enumCount:(NSUInteger)enumCount
|
|
||||||
ranges:(const GPBExtensionRange *)ranges
|
|
||||||
rangeCount:(NSUInteger)rangeCount
|
|
||||||
storageSize:(size_t)storageSize
|
|
||||||
wireFormat:(BOOL)wireFormat;
|
|
||||||
+ (instancetype)
|
|
||||||
allocDescriptorForClass:(Class)messageClass
|
|
||||||
rootClass:(Class)rootClass
|
|
||||||
file:(GPBFileDescriptor *)file
|
|
||||||
fields:(GPBMessageFieldDescription *)fieldDescriptions
|
|
||||||
fieldCount:(NSUInteger)fieldCount
|
|
||||||
oneofs:(GPBMessageOneofDescription *)oneofDescriptions
|
|
||||||
oneofCount:(NSUInteger)oneofCount
|
|
||||||
enums:(GPBMessageEnumDescription *)enumDescriptions
|
|
||||||
enumCount:(NSUInteger)enumCount
|
|
||||||
ranges:(const GPBExtensionRange *)ranges
|
|
||||||
rangeCount:(NSUInteger)rangeCount
|
|
||||||
storageSize:(size_t)storageSize
|
|
||||||
wireFormat:(BOOL)wireFormat
|
|
||||||
extraTextFormatInfo:(const char *)extraTextFormatInfo;
|
|
||||||
|
|
||||||
- (instancetype)initWithClass:(Class)messageClass
|
- (instancetype)initWithClass:(Class)messageClass
|
||||||
file:(GPBFileDescriptor *)file
|
file:(GPBFileDescriptor *)file
|
||||||
fields:(NSArray *)fields
|
fields:(NSArray *)fields
|
||||||
oneofs:(NSArray *)oneofs
|
storageSize:(uint32_t)storage
|
||||||
enums:(NSArray *)enums
|
|
||||||
extensionRanges:(const GPBExtensionRange *)ranges
|
|
||||||
extensionRangesCount:(NSUInteger)rangeCount
|
|
||||||
storageSize:(size_t)storage
|
|
||||||
wireFormat:(BOOL)wireFormat;
|
wireFormat:(BOOL)wireFormat;
|
||||||
|
|
||||||
|
// Called right after init to provide extra information to avoid init having
|
||||||
|
// an explosion of args. These pointers are recorded, so they are expected
|
||||||
|
// to live for the lifetime of the app.
|
||||||
|
- (void)setupOneofs:(const char **)oneofNames
|
||||||
|
count:(uint32_t)count
|
||||||
|
firstHasIndex:(int32_t)firstHasIndex;
|
||||||
|
- (void)setupExtraTextInfo:(const char *)extraTextFormatInfo;
|
||||||
|
- (void)setupExtensionRanges:(const GPBExtensionRange *)ranges count:(int32_t)count;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface GPBFileDescriptor ()
|
@interface GPBFileDescriptor ()
|
||||||
@ -199,14 +175,12 @@ typedef struct GPBExtensionDescription {
|
|||||||
|
|
||||||
@interface GPBOneofDescriptor () {
|
@interface GPBOneofDescriptor () {
|
||||||
@package
|
@package
|
||||||
GPBMessageOneofDescription *oneofDescription_;
|
const char *name_;
|
||||||
NSArray *fields_;
|
NSArray *fields_;
|
||||||
|
|
||||||
SEL caseSel_;
|
SEL caseSel_;
|
||||||
}
|
}
|
||||||
- (instancetype)initWithOneofDescription:
|
// name must be long lived.
|
||||||
(GPBMessageOneofDescription *)oneofDescription
|
- (instancetype)initWithName:(const char *)name fields:(NSArray *)fields;
|
||||||
fields:(NSArray *)fields;
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface GPBFieldDescriptor () {
|
@interface GPBFieldDescriptor () {
|
||||||
@ -222,30 +196,32 @@ typedef struct GPBExtensionDescription {
|
|||||||
|
|
||||||
// Single initializer
|
// Single initializer
|
||||||
// description has to be long lived, it is held as a raw pointer.
|
// description has to be long lived, it is held as a raw pointer.
|
||||||
- (instancetype)initWithFieldDescription:
|
- (instancetype)initWithFieldDescription:(void *)description
|
||||||
(GPBMessageFieldDescription *)description
|
includesDefault:(BOOL)includesDefault
|
||||||
rootClass:(Class)rootClass
|
|
||||||
syntax:(GPBFileSyntax)syntax;
|
syntax:(GPBFileSyntax)syntax;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface GPBEnumDescriptor ()
|
@interface GPBEnumDescriptor ()
|
||||||
// valueDescriptions and extraTextFormatInfo have to be long lived, they are
|
// valueNames, values and extraTextFormatInfo have to be long lived, they are
|
||||||
// held as raw pointers.
|
// held as raw pointers.
|
||||||
+ (instancetype)
|
+ (instancetype)
|
||||||
allocDescriptorForName:(NSString *)name
|
allocDescriptorForName:(NSString *)name
|
||||||
values:(GPBMessageEnumValueDescription *)valueDescriptions
|
valueNames:(const char *)valueNames
|
||||||
valueCount:(NSUInteger)valueCount
|
values:(const int32_t *)values
|
||||||
|
count:(uint32_t)valueCount
|
||||||
enumVerifier:(GPBEnumValidationFunc)enumVerifier;
|
enumVerifier:(GPBEnumValidationFunc)enumVerifier;
|
||||||
+ (instancetype)
|
+ (instancetype)
|
||||||
allocDescriptorForName:(NSString *)name
|
allocDescriptorForName:(NSString *)name
|
||||||
values:(GPBMessageEnumValueDescription *)valueDescriptions
|
valueNames:(const char *)valueNames
|
||||||
valueCount:(NSUInteger)valueCount
|
values:(const int32_t *)values
|
||||||
|
count:(uint32_t)valueCount
|
||||||
enumVerifier:(GPBEnumValidationFunc)enumVerifier
|
enumVerifier:(GPBEnumValidationFunc)enumVerifier
|
||||||
extraTextFormatInfo:(const char *)extraTextFormatInfo;
|
extraTextFormatInfo:(const char *)extraTextFormatInfo;
|
||||||
|
|
||||||
- (instancetype)initWithName:(NSString *)name
|
- (instancetype)initWithName:(NSString *)name
|
||||||
values:(GPBMessageEnumValueDescription *)valueDescriptions
|
valueNames:(const char *)valueNames
|
||||||
valueCount:(NSUInteger)valueCount
|
values:(const int32_t *)values
|
||||||
|
count:(uint32_t)valueCount
|
||||||
enumVerifier:(GPBEnumValidationFunc)enumVerifier;
|
enumVerifier:(GPBEnumValidationFunc)enumVerifier;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@ -314,5 +290,24 @@ GPB_INLINE BOOL GPBExtensionIsWireFormat(GPBExtensionDescription *description) {
|
|||||||
return (description->options & GPBExtensionSetWireFormat) != 0;
|
return (description->options & GPBExtensionSetWireFormat) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Helper for compile time assets.
|
||||||
|
#ifndef _GPBCompileAssert
|
||||||
|
#if __has_feature(c_static_assert) || __has_extension(c_static_assert)
|
||||||
|
#define _GPBCompileAssert(test, msg) _Static_assert((test), #msg)
|
||||||
|
#else
|
||||||
|
// Pre-Xcode 7 support.
|
||||||
|
#define _GPBCompileAssertSymbolInner(line, msg) _GPBCompileAssert ## line ## __ ## msg
|
||||||
|
#define _GPBCompileAssertSymbol(line, msg) _GPBCompileAssertSymbolInner(line, msg)
|
||||||
|
#define _GPBCompileAssert(test, msg) \
|
||||||
|
typedef char _GPBCompileAssertSymbol(__LINE__, msg) [ ((test) ? 1 : -1) ]
|
||||||
|
#endif // __has_feature(c_static_assert) || __has_extension(c_static_assert)
|
||||||
|
#endif // _GPBCompileAssert
|
||||||
|
|
||||||
|
// Sanity check that there isn't padding between the field description
|
||||||
|
// structures with and without a default.
|
||||||
|
_GPBCompileAssert(sizeof(GPBMessageFieldDescriptionWithDefault) ==
|
||||||
|
(sizeof(GPBGenericValue) +
|
||||||
|
sizeof(GPBMessageFieldDescription)),
|
||||||
|
DescriptionsWithDefault_different_size_than_expected);
|
||||||
|
|
||||||
CF_EXTERN_C_END
|
CF_EXTERN_C_END
|
||||||
|
@ -54,18 +54,6 @@ NSString *const GPBExceptionMessageKey =
|
|||||||
|
|
||||||
static NSString *const kGPBDataCoderKey = @"GPBData";
|
static NSString *const kGPBDataCoderKey = @"GPBData";
|
||||||
|
|
||||||
#ifndef _GPBCompileAssert
|
|
||||||
#if __has_feature(c_static_assert) || __has_extension(c_static_assert)
|
|
||||||
#define _GPBCompileAssert(test, msg) _Static_assert((test), #msg)
|
|
||||||
#else
|
|
||||||
// Pre-Xcode 7 support.
|
|
||||||
#define _GPBCompileAssertSymbolInner(line, msg) _GPBCompileAssert ## line ## __ ## msg
|
|
||||||
#define _GPBCompileAssertSymbol(line, msg) _GPBCompileAssertSymbolInner(line, msg)
|
|
||||||
#define _GPBCompileAssert(test, msg) \
|
|
||||||
typedef char _GPBCompileAssertSymbol(__LINE__, msg) [ ((test) ? 1 : -1) ]
|
|
||||||
#endif // __has_feature(c_static_assert) || __has_extension(c_static_assert)
|
|
||||||
#endif // _GPBCompileAssert
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// PLEASE REMEMBER:
|
// PLEASE REMEMBER:
|
||||||
//
|
//
|
||||||
@ -789,14 +777,8 @@ static GPBUnknownFieldSet *GetOrMakeUnknownFields(GPBMessage *self) {
|
|||||||
file:fileDescriptor
|
file:fileDescriptor
|
||||||
fields:NULL
|
fields:NULL
|
||||||
fieldCount:0
|
fieldCount:0
|
||||||
oneofs:NULL
|
|
||||||
oneofCount:0
|
|
||||||
enums:NULL
|
|
||||||
enumCount:0
|
|
||||||
ranges:NULL
|
|
||||||
rangeCount:0
|
|
||||||
storageSize:0
|
storageSize:0
|
||||||
wireFormat:NO];
|
flags:0];
|
||||||
}
|
}
|
||||||
return descriptor;
|
return descriptor;
|
||||||
}
|
}
|
||||||
@ -3096,7 +3078,7 @@ static void ResolveIvarSet(GPBFieldDescriptor *field,
|
|||||||
} else {
|
} else {
|
||||||
GPBOneofDescriptor *oneof = field->containingOneof_;
|
GPBOneofDescriptor *oneof = field->containingOneof_;
|
||||||
if (oneof && (sel == oneof->caseSel_)) {
|
if (oneof && (sel == oneof->caseSel_)) {
|
||||||
int32_t index = oneof->oneofDescription_->index;
|
int32_t index = GPBFieldHasIndex(field);
|
||||||
result.impToAdd = imp_implementationWithBlock(^(id obj) {
|
result.impToAdd = imp_implementationWithBlock(^(id obj) {
|
||||||
return GPBGetHasOneof(obj, index);
|
return GPBGetHasOneof(obj, index);
|
||||||
});
|
});
|
||||||
|
@ -46,8 +46,6 @@
|
|||||||
#import "GPBWellKnownTypes.m"
|
#import "GPBWellKnownTypes.m"
|
||||||
#import "GPBWireFormat.m"
|
#import "GPBWireFormat.m"
|
||||||
|
|
||||||
#import "google/protobuf/Descriptor.pbobjc.m"
|
|
||||||
|
|
||||||
// Duration and Timestamp are #imported into GPBWellKnownTypes.m to the
|
// Duration and Timestamp are #imported into GPBWellKnownTypes.m to the
|
||||||
// Objective C categories added will always be linked in with the classes.
|
// Objective C categories added will always be linked in with the classes.
|
||||||
#import "google/protobuf/Any.pbobjc.m"
|
#import "google/protobuf/Any.pbobjc.m"
|
||||||
|
@ -67,7 +67,7 @@ typedef union {
|
|||||||
|
|
||||||
// Do not change the order of this enum (or add things to it) without thinking
|
// Do not change the order of this enum (or add things to it) without thinking
|
||||||
// about it very carefully. There are several things that depend on the order.
|
// about it very carefully. There are several things that depend on the order.
|
||||||
typedef enum {
|
typedef NS_ENUM(uint8_t, GPBDataType) {
|
||||||
GPBDataTypeBool = 0,
|
GPBDataTypeBool = 0,
|
||||||
GPBDataTypeFixed32,
|
GPBDataTypeFixed32,
|
||||||
GPBDataTypeSFixed32,
|
GPBDataTypeSFixed32,
|
||||||
@ -86,7 +86,7 @@ typedef enum {
|
|||||||
GPBDataTypeMessage,
|
GPBDataTypeMessage,
|
||||||
GPBDataTypeGroup,
|
GPBDataTypeGroup,
|
||||||
GPBDataTypeEnum,
|
GPBDataTypeEnum,
|
||||||
} GPBDataType;
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
// A count of the number of types in GPBDataType. Separated out from the
|
// A count of the number of types in GPBDataType. Separated out from the
|
||||||
|
@ -145,9 +145,8 @@ void GPBSetHasIvar(GPBMessage *self, int32_t idx, uint32_t fieldNumber,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GPBMaybeClearOneof(GPBMessage *self, GPBOneofDescriptor *oneof,
|
void GPBMaybeClearOneof(GPBMessage *self, GPBOneofDescriptor *oneof,
|
||||||
uint32_t fieldNumberNotToClear) {
|
int32_t oneofHasIndex, uint32_t fieldNumberNotToClear) {
|
||||||
int32_t hasIndex = oneof->oneofDescription_->index;
|
uint32_t fieldNumberSet = GPBGetHasOneof(self, oneofHasIndex);
|
||||||
uint32_t fieldNumberSet = GPBGetHasOneof(self, hasIndex);
|
|
||||||
if ((fieldNumberSet == fieldNumberNotToClear) || (fieldNumberSet == 0)) {
|
if ((fieldNumberSet == fieldNumberNotToClear) || (fieldNumberSet == 0)) {
|
||||||
// Do nothing/nothing set in the oneof.
|
// Do nothing/nothing set in the oneof.
|
||||||
return;
|
return;
|
||||||
@ -168,7 +167,7 @@ void GPBMaybeClearOneof(GPBMessage *self, GPBOneofDescriptor *oneof,
|
|||||||
|
|
||||||
// Set to nothing stored in the oneof.
|
// Set to nothing stored in the oneof.
|
||||||
// (field number doesn't matter since setting to nothing).
|
// (field number doesn't matter since setting to nothing).
|
||||||
GPBSetHasIvar(self, hasIndex, 1, NO);
|
GPBSetHasIvar(self, oneofHasIndex, 1, NO);
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - IVar accessors
|
#pragma mark - IVar accessors
|
||||||
@ -200,7 +199,8 @@ void GPBMaybeClearOneof(GPBMessage *self, GPBOneofDescriptor *oneof,
|
|||||||
//% NAME$S GPBFileSyntax syntax) {
|
//% NAME$S GPBFileSyntax syntax) {
|
||||||
//% GPBOneofDescriptor *oneof = field->containingOneof_;
|
//% GPBOneofDescriptor *oneof = field->containingOneof_;
|
||||||
//% if (oneof) {
|
//% if (oneof) {
|
||||||
//% GPBMaybeClearOneof(self, oneof, GPBFieldNumber(field));
|
//% GPBMessageFieldDescription *fieldDesc = field->description_;
|
||||||
|
//% GPBMaybeClearOneof(self, oneof, fieldDesc->hasIndex, fieldDesc->number);
|
||||||
//% }
|
//% }
|
||||||
//% NSCAssert(self->messageStorage_ != NULL,
|
//% NSCAssert(self->messageStorage_ != NULL,
|
||||||
//% @"%@: All messages should have storage (from init)",
|
//% @"%@: All messages should have storage (from init)",
|
||||||
@ -321,7 +321,8 @@ void GPBSetRetainedObjectIvarWithFieldInternal(GPBMessage *self,
|
|||||||
// oneof.
|
// oneof.
|
||||||
GPBOneofDescriptor *oneof = field->containingOneof_;
|
GPBOneofDescriptor *oneof = field->containingOneof_;
|
||||||
if (oneof) {
|
if (oneof) {
|
||||||
GPBMaybeClearOneof(self, oneof, GPBFieldNumber(field));
|
GPBMessageFieldDescription *fieldDesc = field->description_;
|
||||||
|
GPBMaybeClearOneof(self, oneof, fieldDesc->hasIndex, fieldDesc->number);
|
||||||
}
|
}
|
||||||
// Clear "has" if they are being set to nil.
|
// Clear "has" if they are being set to nil.
|
||||||
BOOL setHasValue = (value != nil);
|
BOOL setHasValue = (value != nil);
|
||||||
@ -476,15 +477,15 @@ void GPBSetMessageRawEnumField(GPBMessage *self, GPBFieldDescriptor *field,
|
|||||||
GPBSetInt32IvarWithFieldInternal(self, field, value, syntax);
|
GPBSetInt32IvarWithFieldInternal(self, field, value, syntax);
|
||||||
}
|
}
|
||||||
|
|
||||||
//%PDDM-EXPAND IVAR_POD_ACCESSORS_DEFN(Bool, BOOL)
|
|
||||||
// This block of code is generated, do not edit it directly.
|
|
||||||
|
|
||||||
BOOL GPBGetMessageBoolField(GPBMessage *self,
|
BOOL GPBGetMessageBoolField(GPBMessage *self,
|
||||||
GPBFieldDescriptor *field) {
|
GPBFieldDescriptor *field) {
|
||||||
if (GPBGetHasIvarField(self, field)) {
|
if (GPBGetHasIvarField(self, field)) {
|
||||||
uint8_t *storage = (uint8_t *)self->messageStorage_;
|
// Bools are stored in the has bits to avoid needing explicit space in the
|
||||||
BOOL *typePtr = (BOOL *)&storage[field->description_->offset];
|
// storage structure.
|
||||||
return *typePtr;
|
// (the field number passed to the HasIvar helper doesn't really matter
|
||||||
|
// since the offset is never negative)
|
||||||
|
GPBMessageFieldDescription *fieldDesc = field->description_;
|
||||||
|
return GPBGetHasIvar(self, (int32_t)(fieldDesc->offset), fieldDesc->number);
|
||||||
} else {
|
} else {
|
||||||
return field.defaultValue.valueBool;
|
return field.defaultValue.valueBool;
|
||||||
}
|
}
|
||||||
@ -503,19 +504,18 @@ void GPBSetBoolIvarWithFieldInternal(GPBMessage *self,
|
|||||||
GPBFieldDescriptor *field,
|
GPBFieldDescriptor *field,
|
||||||
BOOL value,
|
BOOL value,
|
||||||
GPBFileSyntax syntax) {
|
GPBFileSyntax syntax) {
|
||||||
|
GPBMessageFieldDescription *fieldDesc = field->description_;
|
||||||
GPBOneofDescriptor *oneof = field->containingOneof_;
|
GPBOneofDescriptor *oneof = field->containingOneof_;
|
||||||
if (oneof) {
|
if (oneof) {
|
||||||
GPBMaybeClearOneof(self, oneof, GPBFieldNumber(field));
|
GPBMaybeClearOneof(self, oneof, fieldDesc->hasIndex, fieldDesc->number);
|
||||||
}
|
}
|
||||||
NSCAssert(self->messageStorage_ != NULL,
|
|
||||||
@"%@: All messages should have storage (from init)",
|
// Bools are stored in the has bits to avoid needing explicit space in the
|
||||||
[self class]);
|
// storage structure.
|
||||||
#if defined(__clang_analyzer__)
|
// (the field number passed to the HasIvar helper doesn't really matter since
|
||||||
if (self->messageStorage_ == NULL) return;
|
// the offset is never negative)
|
||||||
#endif
|
GPBSetHasIvar(self, (int32_t)(fieldDesc->offset), fieldDesc->number, value);
|
||||||
uint8_t *storage = (uint8_t *)self->messageStorage_;
|
|
||||||
BOOL *typePtr = (BOOL *)&storage[field->description_->offset];
|
|
||||||
*typePtr = value;
|
|
||||||
// proto2: any value counts as having been set; proto3, it
|
// proto2: any value counts as having been set; proto3, it
|
||||||
// has to be a non zero value.
|
// has to be a non zero value.
|
||||||
BOOL hasValue =
|
BOOL hasValue =
|
||||||
@ -553,7 +553,8 @@ void GPBSetInt32IvarWithFieldInternal(GPBMessage *self,
|
|||||||
GPBFileSyntax syntax) {
|
GPBFileSyntax syntax) {
|
||||||
GPBOneofDescriptor *oneof = field->containingOneof_;
|
GPBOneofDescriptor *oneof = field->containingOneof_;
|
||||||
if (oneof) {
|
if (oneof) {
|
||||||
GPBMaybeClearOneof(self, oneof, GPBFieldNumber(field));
|
GPBMessageFieldDescription *fieldDesc = field->description_;
|
||||||
|
GPBMaybeClearOneof(self, oneof, fieldDesc->hasIndex, fieldDesc->number);
|
||||||
}
|
}
|
||||||
NSCAssert(self->messageStorage_ != NULL,
|
NSCAssert(self->messageStorage_ != NULL,
|
||||||
@"%@: All messages should have storage (from init)",
|
@"%@: All messages should have storage (from init)",
|
||||||
@ -601,7 +602,8 @@ void GPBSetUInt32IvarWithFieldInternal(GPBMessage *self,
|
|||||||
GPBFileSyntax syntax) {
|
GPBFileSyntax syntax) {
|
||||||
GPBOneofDescriptor *oneof = field->containingOneof_;
|
GPBOneofDescriptor *oneof = field->containingOneof_;
|
||||||
if (oneof) {
|
if (oneof) {
|
||||||
GPBMaybeClearOneof(self, oneof, GPBFieldNumber(field));
|
GPBMessageFieldDescription *fieldDesc = field->description_;
|
||||||
|
GPBMaybeClearOneof(self, oneof, fieldDesc->hasIndex, fieldDesc->number);
|
||||||
}
|
}
|
||||||
NSCAssert(self->messageStorage_ != NULL,
|
NSCAssert(self->messageStorage_ != NULL,
|
||||||
@"%@: All messages should have storage (from init)",
|
@"%@: All messages should have storage (from init)",
|
||||||
@ -649,7 +651,8 @@ void GPBSetInt64IvarWithFieldInternal(GPBMessage *self,
|
|||||||
GPBFileSyntax syntax) {
|
GPBFileSyntax syntax) {
|
||||||
GPBOneofDescriptor *oneof = field->containingOneof_;
|
GPBOneofDescriptor *oneof = field->containingOneof_;
|
||||||
if (oneof) {
|
if (oneof) {
|
||||||
GPBMaybeClearOneof(self, oneof, GPBFieldNumber(field));
|
GPBMessageFieldDescription *fieldDesc = field->description_;
|
||||||
|
GPBMaybeClearOneof(self, oneof, fieldDesc->hasIndex, fieldDesc->number);
|
||||||
}
|
}
|
||||||
NSCAssert(self->messageStorage_ != NULL,
|
NSCAssert(self->messageStorage_ != NULL,
|
||||||
@"%@: All messages should have storage (from init)",
|
@"%@: All messages should have storage (from init)",
|
||||||
@ -697,7 +700,8 @@ void GPBSetUInt64IvarWithFieldInternal(GPBMessage *self,
|
|||||||
GPBFileSyntax syntax) {
|
GPBFileSyntax syntax) {
|
||||||
GPBOneofDescriptor *oneof = field->containingOneof_;
|
GPBOneofDescriptor *oneof = field->containingOneof_;
|
||||||
if (oneof) {
|
if (oneof) {
|
||||||
GPBMaybeClearOneof(self, oneof, GPBFieldNumber(field));
|
GPBMessageFieldDescription *fieldDesc = field->description_;
|
||||||
|
GPBMaybeClearOneof(self, oneof, fieldDesc->hasIndex, fieldDesc->number);
|
||||||
}
|
}
|
||||||
NSCAssert(self->messageStorage_ != NULL,
|
NSCAssert(self->messageStorage_ != NULL,
|
||||||
@"%@: All messages should have storage (from init)",
|
@"%@: All messages should have storage (from init)",
|
||||||
@ -745,7 +749,8 @@ void GPBSetFloatIvarWithFieldInternal(GPBMessage *self,
|
|||||||
GPBFileSyntax syntax) {
|
GPBFileSyntax syntax) {
|
||||||
GPBOneofDescriptor *oneof = field->containingOneof_;
|
GPBOneofDescriptor *oneof = field->containingOneof_;
|
||||||
if (oneof) {
|
if (oneof) {
|
||||||
GPBMaybeClearOneof(self, oneof, GPBFieldNumber(field));
|
GPBMessageFieldDescription *fieldDesc = field->description_;
|
||||||
|
GPBMaybeClearOneof(self, oneof, fieldDesc->hasIndex, fieldDesc->number);
|
||||||
}
|
}
|
||||||
NSCAssert(self->messageStorage_ != NULL,
|
NSCAssert(self->messageStorage_ != NULL,
|
||||||
@"%@: All messages should have storage (from init)",
|
@"%@: All messages should have storage (from init)",
|
||||||
@ -793,7 +798,8 @@ void GPBSetDoubleIvarWithFieldInternal(GPBMessage *self,
|
|||||||
GPBFileSyntax syntax) {
|
GPBFileSyntax syntax) {
|
||||||
GPBOneofDescriptor *oneof = field->containingOneof_;
|
GPBOneofDescriptor *oneof = field->containingOneof_;
|
||||||
if (oneof) {
|
if (oneof) {
|
||||||
GPBMaybeClearOneof(self, oneof, GPBFieldNumber(field));
|
GPBMessageFieldDescription *fieldDesc = field->description_;
|
||||||
|
GPBMaybeClearOneof(self, oneof, fieldDesc->hasIndex, fieldDesc->number);
|
||||||
}
|
}
|
||||||
NSCAssert(self->messageStorage_ != NULL,
|
NSCAssert(self->messageStorage_ != NULL,
|
||||||
@"%@: All messages should have storage (from init)",
|
@"%@: All messages should have storage (from init)",
|
||||||
@ -812,7 +818,7 @@ void GPBSetDoubleIvarWithFieldInternal(GPBMessage *self,
|
|||||||
GPBBecomeVisibleToAutocreator(self);
|
GPBBecomeVisibleToAutocreator(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
//%PDDM-EXPAND-END (7 expansions)
|
//%PDDM-EXPAND-END (6 expansions)
|
||||||
|
|
||||||
// Aliases are function calls that are virtually the same.
|
// Aliases are function calls that are virtually the same.
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ GPB_INLINE void GPBSetHasIvarField(GPBMessage *self, GPBFieldDescriptor *field,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GPBMaybeClearOneof(GPBMessage *self, GPBOneofDescriptor *oneof,
|
void GPBMaybeClearOneof(GPBMessage *self, GPBOneofDescriptor *oneof,
|
||||||
uint32_t fieldNumberNotToClear);
|
int32_t oneofHasIndex, uint32_t fieldNumberNotToClear);
|
||||||
|
|
||||||
//%PDDM-DEFINE GPB_IVAR_SET_DECL(NAME, TYPE)
|
//%PDDM-DEFINE GPB_IVAR_SET_DECL(NAME, TYPE)
|
||||||
//%void GPBSet##NAME##IvarWithFieldInternal(GPBMessage *self,
|
//%void GPBSet##NAME##IvarWithFieldInternal(GPBMessage *self,
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
2CFB390415C718CE00CBF84D /* Descriptor.pbobjc.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BD3982214BE5B0C0081D629 /* Descriptor.pbobjc.m */; };
|
|
||||||
5102DABC1891A073002037B6 /* GPBConcurrencyTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5102DABB1891A052002037B6 /* GPBConcurrencyTests.m */; };
|
5102DABC1891A073002037B6 /* GPBConcurrencyTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5102DABB1891A052002037B6 /* GPBConcurrencyTests.m */; };
|
||||||
7461B5360F94FB4600A0C422 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
|
7461B5360F94FB4600A0C422 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
|
||||||
7461B53C0F94FB4E00A0C422 /* GPBCodedInputStream.m in Sources */ = {isa = PBXBuildFile; fileRef = 7461B48F0F94F99000A0C422 /* GPBCodedInputStream.m */; };
|
7461B53C0F94FB4E00A0C422 /* GPBCodedInputStream.m in Sources */ = {isa = PBXBuildFile; fileRef = 7461B48F0F94F99000A0C422 /* GPBCodedInputStream.m */; };
|
||||||
@ -27,7 +26,6 @@
|
|||||||
8B79657D14992E3F002FFBFC /* GPBRootObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B79657914992E3E002FFBFC /* GPBRootObject.m */; };
|
8B79657D14992E3F002FFBFC /* GPBRootObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B79657914992E3E002FFBFC /* GPBRootObject.m */; };
|
||||||
8B8B615D17DF7056002EE618 /* GPBARCUnittestProtos.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B8B615C17DF7056002EE618 /* GPBARCUnittestProtos.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
|
8B8B615D17DF7056002EE618 /* GPBARCUnittestProtos.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B8B615C17DF7056002EE618 /* GPBARCUnittestProtos.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
|
||||||
8B96157414C8C38C00A2AC0B /* GPBDescriptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B96157314C8C38C00A2AC0B /* GPBDescriptor.m */; };
|
8B96157414C8C38C00A2AC0B /* GPBDescriptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B96157314C8C38C00A2AC0B /* GPBDescriptor.m */; };
|
||||||
8B96157514CA019D00A2AC0B /* Descriptor.pbobjc.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BD3982214BE5B0C0081D629 /* Descriptor.pbobjc.m */; };
|
|
||||||
8BBEA4A9147C727D00C4ADB7 /* GPBCodedInputStreamTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 7461B69B0F94FDF800A0C422 /* GPBCodedInputStreamTests.m */; };
|
8BBEA4A9147C727D00C4ADB7 /* GPBCodedInputStreamTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 7461B69B0F94FDF800A0C422 /* GPBCodedInputStreamTests.m */; };
|
||||||
8BBEA4AA147C727D00C4ADB7 /* GPBCodedOuputStreamTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 7461B69D0F94FDF800A0C422 /* GPBCodedOuputStreamTests.m */; };
|
8BBEA4AA147C727D00C4ADB7 /* GPBCodedOuputStreamTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 7461B69D0F94FDF800A0C422 /* GPBCodedOuputStreamTests.m */; };
|
||||||
8BBEA4AC147C727D00C4ADB7 /* GPBMessageTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 7461B6A30F94FDF800A0C422 /* GPBMessageTests.m */; };
|
8BBEA4AC147C727D00C4ADB7 /* GPBMessageTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 7461B6A30F94FDF800A0C422 /* GPBMessageTests.m */; };
|
||||||
@ -140,10 +138,8 @@
|
|||||||
8B4248D51A92826400BC1EC6 /* Timestamp.pbobjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Timestamp.pbobjc.h; path = google/protobuf/Timestamp.pbobjc.h; sourceTree = "<group>"; };
|
8B4248D51A92826400BC1EC6 /* Timestamp.pbobjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Timestamp.pbobjc.h; path = google/protobuf/Timestamp.pbobjc.h; sourceTree = "<group>"; };
|
||||||
8B4248D61A92826400BC1EC6 /* Timestamp.pbobjc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Timestamp.pbobjc.m; path = google/protobuf/Timestamp.pbobjc.m; sourceTree = "<group>"; };
|
8B4248D61A92826400BC1EC6 /* Timestamp.pbobjc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Timestamp.pbobjc.m; path = google/protobuf/Timestamp.pbobjc.m; sourceTree = "<group>"; };
|
||||||
8B4248DB1A92933A00BC1EC6 /* GPBWellKnownTypesTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBWellKnownTypesTest.m; sourceTree = "<group>"; };
|
8B4248DB1A92933A00BC1EC6 /* GPBWellKnownTypesTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBWellKnownTypesTest.m; sourceTree = "<group>"; };
|
||||||
8B42494B1A92A16600BC1EC6 /* descriptor.proto */ = {isa = PBXFileReference; lastKnownFileType = text; name = descriptor.proto; path = ../src/google/protobuf/descriptor.proto; sourceTree = "<group>"; };
|
|
||||||
8B42494C1A92A16600BC1EC6 /* duration.proto */ = {isa = PBXFileReference; lastKnownFileType = text; name = duration.proto; path = ../src/google/protobuf/duration.proto; sourceTree = "<group>"; };
|
8B42494C1A92A16600BC1EC6 /* duration.proto */ = {isa = PBXFileReference; lastKnownFileType = text; name = duration.proto; path = ../src/google/protobuf/duration.proto; sourceTree = "<group>"; };
|
||||||
8B42494D1A92A16600BC1EC6 /* timestamp.proto */ = {isa = PBXFileReference; lastKnownFileType = text; name = timestamp.proto; path = ../src/google/protobuf/timestamp.proto; sourceTree = "<group>"; };
|
8B42494D1A92A16600BC1EC6 /* timestamp.proto */ = {isa = PBXFileReference; lastKnownFileType = text; name = timestamp.proto; path = ../src/google/protobuf/timestamp.proto; sourceTree = "<group>"; };
|
||||||
8B54585814DCC34E003D7338 /* Descriptor.pbobjc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Descriptor.pbobjc.h; path = google/protobuf/Descriptor.pbobjc.h; sourceTree = SOURCE_ROOT; };
|
|
||||||
8B79657814992E3E002FFBFC /* GPBRootObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GPBRootObject.h; sourceTree = "<group>"; };
|
8B79657814992E3E002FFBFC /* GPBRootObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GPBRootObject.h; sourceTree = "<group>"; };
|
||||||
8B79657914992E3E002FFBFC /* GPBRootObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBRootObject.m; sourceTree = "<group>"; };
|
8B79657914992E3E002FFBFC /* GPBRootObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBRootObject.m; sourceTree = "<group>"; };
|
||||||
8B7E6A7414893DBA00F8884A /* unittest_custom_options.proto */ = {isa = PBXFileReference; lastKnownFileType = text; name = unittest_custom_options.proto; path = ../../src/google/protobuf/unittest_custom_options.proto; sourceTree = "<group>"; };
|
8B7E6A7414893DBA00F8884A /* unittest_custom_options.proto */ = {isa = PBXFileReference; lastKnownFileType = text; name = unittest_custom_options.proto; path = ../../src/google/protobuf/unittest_custom_options.proto; sourceTree = "<group>"; };
|
||||||
@ -162,7 +158,6 @@
|
|||||||
8BCF338814ED799900BC5317 /* GPBProtocolBuffers.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GPBProtocolBuffers.m; sourceTree = "<group>"; };
|
8BCF338814ED799900BC5317 /* GPBProtocolBuffers.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GPBProtocolBuffers.m; sourceTree = "<group>"; };
|
||||||
8BD3981D14BE54220081D629 /* unittest_enormous_descriptor.proto */ = {isa = PBXFileReference; lastKnownFileType = text; name = unittest_enormous_descriptor.proto; path = ../../src/google/protobuf/unittest_enormous_descriptor.proto; sourceTree = "<group>"; };
|
8BD3981D14BE54220081D629 /* unittest_enormous_descriptor.proto */ = {isa = PBXFileReference; lastKnownFileType = text; name = unittest_enormous_descriptor.proto; path = ../../src/google/protobuf/unittest_enormous_descriptor.proto; sourceTree = "<group>"; };
|
||||||
8BD3981E14BE59D70081D629 /* GPBUnittestProtos.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBUnittestProtos.m; sourceTree = "<group>"; };
|
8BD3981E14BE59D70081D629 /* GPBUnittestProtos.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBUnittestProtos.m; sourceTree = "<group>"; };
|
||||||
8BD3982214BE5B0C0081D629 /* Descriptor.pbobjc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Descriptor.pbobjc.m; path = google/protobuf/Descriptor.pbobjc.m; sourceTree = SOURCE_ROOT; };
|
|
||||||
8BEB5AE01498033E0078BF9D /* GPBRuntimeTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPBRuntimeTypes.h; sourceTree = "<group>"; };
|
8BEB5AE01498033E0078BF9D /* GPBRuntimeTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPBRuntimeTypes.h; sourceTree = "<group>"; };
|
||||||
F401DC2A1A8D444600FCC765 /* GPBArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GPBArray.h; sourceTree = "<group>"; };
|
F401DC2A1A8D444600FCC765 /* GPBArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GPBArray.h; sourceTree = "<group>"; };
|
||||||
F401DC2B1A8D444600FCC765 /* GPBArray.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBArray.m; sourceTree = "<group>"; };
|
F401DC2B1A8D444600FCC765 /* GPBArray.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBArray.m; sourceTree = "<group>"; };
|
||||||
@ -300,9 +295,6 @@
|
|||||||
F4E675881B21D0000054530B /* Api.pbobjc.h */,
|
F4E675881B21D0000054530B /* Api.pbobjc.h */,
|
||||||
F4E675891B21D0000054530B /* Api.pbobjc.m */,
|
F4E675891B21D0000054530B /* Api.pbobjc.m */,
|
||||||
F4E675A71B21D05C0054530B /* api.proto */,
|
F4E675A71B21D05C0054530B /* api.proto */,
|
||||||
8B54585814DCC34E003D7338 /* Descriptor.pbobjc.h */,
|
|
||||||
8BD3982214BE5B0C0081D629 /* Descriptor.pbobjc.m */,
|
|
||||||
8B42494B1A92A16600BC1EC6 /* descriptor.proto */,
|
|
||||||
8B4248D31A92826400BC1EC6 /* Duration.pbobjc.h */,
|
8B4248D31A92826400BC1EC6 /* Duration.pbobjc.h */,
|
||||||
8B4248D41A92826400BC1EC6 /* Duration.pbobjc.m */,
|
8B4248D41A92826400BC1EC6 /* Duration.pbobjc.m */,
|
||||||
8B42494C1A92A16600BC1EC6 /* duration.proto */,
|
8B42494C1A92A16600BC1EC6 /* duration.proto */,
|
||||||
@ -634,7 +626,6 @@
|
|||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
2CFB390415C718CE00CBF84D /* Descriptor.pbobjc.m in Sources */,
|
|
||||||
7461B53C0F94FB4E00A0C422 /* GPBCodedInputStream.m in Sources */,
|
7461B53C0F94FB4E00A0C422 /* GPBCodedInputStream.m in Sources */,
|
||||||
F4E6759B1B21D0000054530B /* Empty.pbobjc.m in Sources */,
|
F4E6759B1B21D0000054530B /* Empty.pbobjc.m in Sources */,
|
||||||
7461B53D0F94FB4E00A0C422 /* GPBCodedOutputStream.m in Sources */,
|
7461B53D0F94FB4E00A0C422 /* GPBCodedOutputStream.m in Sources */,
|
||||||
@ -696,7 +687,6 @@
|
|||||||
8B79657D14992E3F002FFBFC /* GPBRootObject.m in Sources */,
|
8B79657D14992E3F002FFBFC /* GPBRootObject.m in Sources */,
|
||||||
8BD3981F14BE59D70081D629 /* GPBUnittestProtos.m in Sources */,
|
8BD3981F14BE59D70081D629 /* GPBUnittestProtos.m in Sources */,
|
||||||
F4E675B11B21D0A70054530B /* FieldMask.pbobjc.m in Sources */,
|
F4E675B11B21D0A70054530B /* FieldMask.pbobjc.m in Sources */,
|
||||||
8B96157514CA019D00A2AC0B /* Descriptor.pbobjc.m in Sources */,
|
|
||||||
8B8B615D17DF7056002EE618 /* GPBARCUnittestProtos.m in Sources */,
|
8B8B615D17DF7056002EE618 /* GPBARCUnittestProtos.m in Sources */,
|
||||||
F4E675AF1B21D0A70054530B /* Api.pbobjc.m in Sources */,
|
F4E675AF1B21D0A70054530B /* Api.pbobjc.m in Sources */,
|
||||||
);
|
);
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
2CFB390415C718CE00CBF84D /* Descriptor.pbobjc.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BD3982214BE5B0C0081D629 /* Descriptor.pbobjc.m */; };
|
|
||||||
5102DABC1891A073002037B6 /* GPBConcurrencyTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5102DABB1891A052002037B6 /* GPBConcurrencyTests.m */; };
|
5102DABC1891A073002037B6 /* GPBConcurrencyTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5102DABB1891A052002037B6 /* GPBConcurrencyTests.m */; };
|
||||||
7461B5360F94FB4600A0C422 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
|
7461B5360F94FB4600A0C422 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
|
||||||
7461B53C0F94FB4E00A0C422 /* GPBCodedInputStream.m in Sources */ = {isa = PBXBuildFile; fileRef = 7461B48F0F94F99000A0C422 /* GPBCodedInputStream.m */; };
|
7461B53C0F94FB4E00A0C422 /* GPBCodedInputStream.m in Sources */ = {isa = PBXBuildFile; fileRef = 7461B48F0F94F99000A0C422 /* GPBCodedInputStream.m */; };
|
||||||
@ -27,7 +26,6 @@
|
|||||||
8B79657D14992E3F002FFBFC /* GPBRootObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B79657914992E3E002FFBFC /* GPBRootObject.m */; };
|
8B79657D14992E3F002FFBFC /* GPBRootObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B79657914992E3E002FFBFC /* GPBRootObject.m */; };
|
||||||
8B8B615D17DF7056002EE618 /* GPBARCUnittestProtos.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B8B615C17DF7056002EE618 /* GPBARCUnittestProtos.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
|
8B8B615D17DF7056002EE618 /* GPBARCUnittestProtos.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B8B615C17DF7056002EE618 /* GPBARCUnittestProtos.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
|
||||||
8B96157414C8C38C00A2AC0B /* GPBDescriptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B96157314C8C38C00A2AC0B /* GPBDescriptor.m */; };
|
8B96157414C8C38C00A2AC0B /* GPBDescriptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B96157314C8C38C00A2AC0B /* GPBDescriptor.m */; };
|
||||||
8B96157514CA019D00A2AC0B /* Descriptor.pbobjc.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BD3982214BE5B0C0081D629 /* Descriptor.pbobjc.m */; };
|
|
||||||
8B9742331A89D19F00DCE92C /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8B9742321A89D19F00DCE92C /* LaunchScreen.xib */; };
|
8B9742331A89D19F00DCE92C /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8B9742321A89D19F00DCE92C /* LaunchScreen.xib */; };
|
||||||
8B9742431A8AAA7800DCE92C /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8B9742421A8AAA7800DCE92C /* CoreGraphics.framework */; };
|
8B9742431A8AAA7800DCE92C /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8B9742421A8AAA7800DCE92C /* CoreGraphics.framework */; };
|
||||||
8B9A5EA61831993600A9D33B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
|
8B9A5EA61831993600A9D33B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
|
||||||
@ -155,7 +153,6 @@
|
|||||||
8B4248E21A929C8900BC1EC6 /* GPBWellKnownTypes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBWellKnownTypes.m; sourceTree = "<group>"; };
|
8B4248E21A929C8900BC1EC6 /* GPBWellKnownTypes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBWellKnownTypes.m; sourceTree = "<group>"; };
|
||||||
8B4248E51A929C9900BC1EC6 /* GPBWellKnownTypesTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBWellKnownTypesTest.m; sourceTree = "<group>"; };
|
8B4248E51A929C9900BC1EC6 /* GPBWellKnownTypesTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBWellKnownTypesTest.m; sourceTree = "<group>"; };
|
||||||
8B4249481A92A02300BC1EC6 /* timestamp.proto */ = {isa = PBXFileReference; lastKnownFileType = text; name = timestamp.proto; path = ../src/google/protobuf/timestamp.proto; sourceTree = "<group>"; };
|
8B4249481A92A02300BC1EC6 /* timestamp.proto */ = {isa = PBXFileReference; lastKnownFileType = text; name = timestamp.proto; path = ../src/google/protobuf/timestamp.proto; sourceTree = "<group>"; };
|
||||||
8B4249491A92A0BA00BC1EC6 /* descriptor.proto */ = {isa = PBXFileReference; lastKnownFileType = text; name = descriptor.proto; path = ../src/google/protobuf/descriptor.proto; sourceTree = "<group>"; };
|
|
||||||
8B42494A1A92A0BA00BC1EC6 /* duration.proto */ = {isa = PBXFileReference; lastKnownFileType = text; name = duration.proto; path = ../src/google/protobuf/duration.proto; sourceTree = "<group>"; };
|
8B42494A1A92A0BA00BC1EC6 /* duration.proto */ = {isa = PBXFileReference; lastKnownFileType = text; name = duration.proto; path = ../src/google/protobuf/duration.proto; sourceTree = "<group>"; };
|
||||||
8B79657814992E3E002FFBFC /* GPBRootObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GPBRootObject.h; sourceTree = "<group>"; };
|
8B79657814992E3E002FFBFC /* GPBRootObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GPBRootObject.h; sourceTree = "<group>"; };
|
||||||
8B79657914992E3E002FFBFC /* GPBRootObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBRootObject.m; sourceTree = "<group>"; };
|
8B79657914992E3E002FFBFC /* GPBRootObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBRootObject.m; sourceTree = "<group>"; };
|
||||||
@ -183,7 +180,6 @@
|
|||||||
8BCF338814ED799900BC5317 /* GPBProtocolBuffers.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GPBProtocolBuffers.m; sourceTree = "<group>"; };
|
8BCF338814ED799900BC5317 /* GPBProtocolBuffers.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GPBProtocolBuffers.m; sourceTree = "<group>"; };
|
||||||
8BD3981D14BE54220081D629 /* unittest_enormous_descriptor.proto */ = {isa = PBXFileReference; lastKnownFileType = text; name = unittest_enormous_descriptor.proto; path = ../../src/google/protobuf/unittest_enormous_descriptor.proto; sourceTree = "<group>"; };
|
8BD3981D14BE54220081D629 /* unittest_enormous_descriptor.proto */ = {isa = PBXFileReference; lastKnownFileType = text; name = unittest_enormous_descriptor.proto; path = ../../src/google/protobuf/unittest_enormous_descriptor.proto; sourceTree = "<group>"; };
|
||||||
8BD3981E14BE59D70081D629 /* GPBUnittestProtos.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBUnittestProtos.m; sourceTree = "<group>"; };
|
8BD3981E14BE59D70081D629 /* GPBUnittestProtos.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBUnittestProtos.m; sourceTree = "<group>"; };
|
||||||
8BD3982214BE5B0C0081D629 /* Descriptor.pbobjc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Descriptor.pbobjc.m; path = google/protobuf/Descriptor.pbobjc.m; sourceTree = SOURCE_ROOT; };
|
|
||||||
8BEB5AE01498033E0078BF9D /* GPBRuntimeTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPBRuntimeTypes.h; sourceTree = "<group>"; };
|
8BEB5AE01498033E0078BF9D /* GPBRuntimeTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPBRuntimeTypes.h; sourceTree = "<group>"; };
|
||||||
F401DC341A8E5C6F00FCC765 /* GPBArrayTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBArrayTests.m; sourceTree = "<group>"; };
|
F401DC341A8E5C6F00FCC765 /* GPBArrayTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBArrayTests.m; sourceTree = "<group>"; };
|
||||||
F41C175C1833D3310064ED4D /* GPBPerfTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBPerfTests.m; sourceTree = "<group>"; };
|
F41C175C1833D3310064ED4D /* GPBPerfTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBPerfTests.m; sourceTree = "<group>"; };
|
||||||
@ -224,7 +220,6 @@
|
|||||||
F4E675B71B21D1440054530B /* Any.pbobjc.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = Any.pbobjc.m; path = google/protobuf/Any.pbobjc.m; sourceTree = "<group>"; };
|
F4E675B71B21D1440054530B /* Any.pbobjc.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = Any.pbobjc.m; path = google/protobuf/Any.pbobjc.m; sourceTree = "<group>"; };
|
||||||
F4E675B81B21D1440054530B /* Api.pbobjc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Api.pbobjc.h; path = google/protobuf/Api.pbobjc.h; sourceTree = "<group>"; };
|
F4E675B81B21D1440054530B /* Api.pbobjc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Api.pbobjc.h; path = google/protobuf/Api.pbobjc.h; sourceTree = "<group>"; };
|
||||||
F4E675B91B21D1440054530B /* Api.pbobjc.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = Api.pbobjc.m; path = google/protobuf/Api.pbobjc.m; sourceTree = "<group>"; };
|
F4E675B91B21D1440054530B /* Api.pbobjc.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = Api.pbobjc.m; path = google/protobuf/Api.pbobjc.m; sourceTree = "<group>"; };
|
||||||
F4E675BA1B21D1440054530B /* Descriptor.pbobjc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Descriptor.pbobjc.h; path = google/protobuf/Descriptor.pbobjc.h; sourceTree = "<group>"; };
|
|
||||||
F4E675BB1B21D1440054530B /* Empty.pbobjc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Empty.pbobjc.h; path = google/protobuf/Empty.pbobjc.h; sourceTree = "<group>"; };
|
F4E675BB1B21D1440054530B /* Empty.pbobjc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Empty.pbobjc.h; path = google/protobuf/Empty.pbobjc.h; sourceTree = "<group>"; };
|
||||||
F4E675BC1B21D1440054530B /* Empty.pbobjc.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = Empty.pbobjc.m; path = google/protobuf/Empty.pbobjc.m; sourceTree = "<group>"; };
|
F4E675BC1B21D1440054530B /* Empty.pbobjc.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = Empty.pbobjc.m; path = google/protobuf/Empty.pbobjc.m; sourceTree = "<group>"; };
|
||||||
F4E675BD1B21D1440054530B /* FieldMask.pbobjc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = FieldMask.pbobjc.h; path = google/protobuf/FieldMask.pbobjc.h; sourceTree = "<group>"; };
|
F4E675BD1B21D1440054530B /* FieldMask.pbobjc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = FieldMask.pbobjc.h; path = google/protobuf/FieldMask.pbobjc.h; sourceTree = "<group>"; };
|
||||||
@ -335,9 +330,6 @@
|
|||||||
F4E675B81B21D1440054530B /* Api.pbobjc.h */,
|
F4E675B81B21D1440054530B /* Api.pbobjc.h */,
|
||||||
F4E675B91B21D1440054530B /* Api.pbobjc.m */,
|
F4E675B91B21D1440054530B /* Api.pbobjc.m */,
|
||||||
F4E675D91B21D1DE0054530B /* api.proto */,
|
F4E675D91B21D1DE0054530B /* api.proto */,
|
||||||
F4E675BA1B21D1440054530B /* Descriptor.pbobjc.h */,
|
|
||||||
8BD3982214BE5B0C0081D629 /* Descriptor.pbobjc.m */,
|
|
||||||
8B4249491A92A0BA00BC1EC6 /* descriptor.proto */,
|
|
||||||
8B4248DD1A929C7D00BC1EC6 /* Duration.pbobjc.h */,
|
8B4248DD1A929C7D00BC1EC6 /* Duration.pbobjc.h */,
|
||||||
8B4248DE1A929C7D00BC1EC6 /* Duration.pbobjc.m */,
|
8B4248DE1A929C7D00BC1EC6 /* Duration.pbobjc.m */,
|
||||||
8B42494A1A92A0BA00BC1EC6 /* duration.proto */,
|
8B42494A1A92A0BA00BC1EC6 /* duration.proto */,
|
||||||
@ -722,7 +714,6 @@
|
|||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
2CFB390415C718CE00CBF84D /* Descriptor.pbobjc.m in Sources */,
|
|
||||||
7461B53C0F94FB4E00A0C422 /* GPBCodedInputStream.m in Sources */,
|
7461B53C0F94FB4E00A0C422 /* GPBCodedInputStream.m in Sources */,
|
||||||
F4E675D21B21D1620054530B /* Empty.pbobjc.m in Sources */,
|
F4E675D21B21D1620054530B /* Empty.pbobjc.m in Sources */,
|
||||||
F4487C731A9F906200531423 /* GPBArray.m in Sources */,
|
F4487C731A9F906200531423 /* GPBArray.m in Sources */,
|
||||||
@ -792,7 +783,6 @@
|
|||||||
8B79657D14992E3F002FFBFC /* GPBRootObject.m in Sources */,
|
8B79657D14992E3F002FFBFC /* GPBRootObject.m in Sources */,
|
||||||
8BD3981F14BE59D70081D629 /* GPBUnittestProtos.m in Sources */,
|
8BD3981F14BE59D70081D629 /* GPBUnittestProtos.m in Sources */,
|
||||||
F4E675CB1B21D1610054530B /* FieldMask.pbobjc.m in Sources */,
|
F4E675CB1B21D1610054530B /* FieldMask.pbobjc.m in Sources */,
|
||||||
8B96157514CA019D00A2AC0B /* Descriptor.pbobjc.m in Sources */,
|
|
||||||
8B8B615D17DF7056002EE618 /* GPBARCUnittestProtos.m in Sources */,
|
8B8B615D17DF7056002EE618 /* GPBARCUnittestProtos.m in Sources */,
|
||||||
F4E675C91B21D1610054530B /* Api.pbobjc.m in Sources */,
|
F4E675C91B21D1610054530B /* Api.pbobjc.m in Sources */,
|
||||||
);
|
);
|
||||||
|
@ -34,6 +34,11 @@
|
|||||||
|
|
||||||
// Makes sure all the generated headers compile with ARC on.
|
// Makes sure all the generated headers compile with ARC on.
|
||||||
|
|
||||||
|
// The unittest_custom_options.proto extends the messages in descriptor.proto
|
||||||
|
// so we build it in to test extending in general. The library doesn't provide
|
||||||
|
// a descriptor as it doesn't use the classes/enums.
|
||||||
|
#import "google/protobuf/Descriptor.pbobjc.h"
|
||||||
|
|
||||||
#import "google/protobuf/Unittest.pbobjc.h"
|
#import "google/protobuf/Unittest.pbobjc.h"
|
||||||
#import "google/protobuf/UnittestCustomOptions.pbobjc.h"
|
#import "google/protobuf/UnittestCustomOptions.pbobjc.h"
|
||||||
#import "google/protobuf/UnittestCycle.pbobjc.h"
|
#import "google/protobuf/UnittestCycle.pbobjc.h"
|
||||||
|
@ -153,19 +153,6 @@
|
|||||||
XCTAssertFalse([fieldDescriptor isValidEnumValue:-2]);
|
XCTAssertFalse([fieldDescriptor isValidEnumValue:-2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)testEnumDescriptorLookup {
|
|
||||||
GPBDescriptor *descriptor = [TestAllTypes descriptor];
|
|
||||||
GPBEnumDescriptor *enumDescriptor =
|
|
||||||
[descriptor enumWithName:@"TestAllTypes_NestedEnum"];
|
|
||||||
XCTAssertNotNil(enumDescriptor);
|
|
||||||
|
|
||||||
// Descriptor cannot find foreign or imported enums.
|
|
||||||
enumDescriptor = [descriptor enumWithName:@"ForeignEnumEnum"];
|
|
||||||
XCTAssertNil(enumDescriptor);
|
|
||||||
enumDescriptor = [descriptor enumWithName:@"ImportEnumEnum"];
|
|
||||||
XCTAssertNil(enumDescriptor);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)testOneofDescriptor {
|
- (void)testOneofDescriptor {
|
||||||
GPBDescriptor *descriptor = [TestOneof2 descriptor];
|
GPBDescriptor *descriptor = [TestOneof2 descriptor];
|
||||||
|
|
||||||
|
@ -31,6 +31,11 @@
|
|||||||
// Collects all the compiled protos into one file and compiles them to make sure
|
// Collects all the compiled protos into one file and compiles them to make sure
|
||||||
// the compiler is generating valid code.
|
// the compiler is generating valid code.
|
||||||
|
|
||||||
|
// The unittest_custom_options.proto extends the messages in descriptor.proto
|
||||||
|
// so we build it in to test extending in general. The library doesn't provide
|
||||||
|
// a descriptor as it doesn't use the classes/enums.
|
||||||
|
#import "google/protobuf/Descriptor.pbobjc.m"
|
||||||
|
|
||||||
#import "google/protobuf/MapProto2Unittest.pbobjc.m"
|
#import "google/protobuf/MapProto2Unittest.pbobjc.m"
|
||||||
#import "google/protobuf/MapUnittest.pbobjc.m"
|
#import "google/protobuf/MapUnittest.pbobjc.m"
|
||||||
#import "google/protobuf/Unittest.pbobjc.m"
|
#import "google/protobuf/Unittest.pbobjc.m"
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Run this script to regenerate descriptor.pbobjc.{h,m} after the protocol
|
# Run this script to regenerate *.pbobjc.{h,m} for the well known types after
|
||||||
# compiler changes.
|
# the protocol compiler changes.
|
||||||
|
|
||||||
# HINT: Flags passed to generate_descriptor_proto.sh will be passed directly
|
# HINT: Flags passed to generate_well_known_types.sh will be passed directly
|
||||||
# to make when building protoc. This is particularly useful for passing
|
# to make when building protoc. This is particularly useful for passing
|
||||||
# -j4 to run 4 jobs simultaneously.
|
# -j4 to run 4 jobs simultaneously.
|
||||||
|
|
||||||
@ -37,7 +37,6 @@ make $@ protoc
|
|||||||
declare -a RUNTIME_PROTO_FILES=( \
|
declare -a RUNTIME_PROTO_FILES=( \
|
||||||
google/protobuf/any.proto \
|
google/protobuf/any.proto \
|
||||||
google/protobuf/api.proto \
|
google/protobuf/api.proto \
|
||||||
google/protobuf/descriptor.proto \
|
|
||||||
google/protobuf/duration.proto \
|
google/protobuf/duration.proto \
|
||||||
google/protobuf/empty.proto \
|
google/protobuf/empty.proto \
|
||||||
google/protobuf/field_mask.proto \
|
google/protobuf/field_mask.proto \
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#import "GPBProtocolBuffers.h"
|
#import "GPBProtocolBuffers.h"
|
||||||
|
|
||||||
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30000
|
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30001
|
||||||
#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources.
|
#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -46,47 +46,36 @@ typedef struct GPBAny__storage_ {
|
|||||||
static GPBMessageFieldDescription fields[] = {
|
static GPBMessageFieldDescription fields[] = {
|
||||||
{
|
{
|
||||||
.name = "typeURL",
|
.name = "typeURL",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBAny_FieldNumber_TypeURL,
|
.number = GPBAny_FieldNumber_TypeURL,
|
||||||
.hasIndex = 0,
|
.hasIndex = 0,
|
||||||
|
.offset = (uint32_t)offsetof(GPBAny__storage_, typeURL),
|
||||||
.flags = GPBFieldOptional | GPBFieldTextFormatNameCustom,
|
.flags = GPBFieldOptional | GPBFieldTextFormatNameCustom,
|
||||||
.dataType = GPBDataTypeString,
|
.dataType = GPBDataTypeString,
|
||||||
.offset = offsetof(GPBAny__storage_, typeURL),
|
|
||||||
.defaultValue.valueString = nil,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "value",
|
.name = "value",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBAny_FieldNumber_Value,
|
.number = GPBAny_FieldNumber_Value,
|
||||||
.hasIndex = 1,
|
.hasIndex = 1,
|
||||||
|
.offset = (uint32_t)offsetof(GPBAny__storage_, value),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeBytes,
|
.dataType = GPBDataTypeBytes,
|
||||||
.offset = offsetof(GPBAny__storage_, value),
|
|
||||||
.defaultValue.valueData = nil,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
#if GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS
|
|
||||||
const char *extraTextFormatInfo = NULL;
|
|
||||||
#else
|
|
||||||
static const char *extraTextFormatInfo = "\001\001\004\241!!\000";
|
|
||||||
#endif // GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS
|
|
||||||
GPBDescriptor *localDescriptor =
|
GPBDescriptor *localDescriptor =
|
||||||
[GPBDescriptor allocDescriptorForClass:[GPBAny class]
|
[GPBDescriptor allocDescriptorForClass:[GPBAny class]
|
||||||
rootClass:[GPBAnyRoot class]
|
rootClass:[GPBAnyRoot class]
|
||||||
file:GPBAnyRoot_FileDescriptor()
|
file:GPBAnyRoot_FileDescriptor()
|
||||||
fields:fields
|
fields:fields
|
||||||
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||||||
oneofs:NULL
|
|
||||||
oneofCount:0
|
|
||||||
enums:NULL
|
|
||||||
enumCount:0
|
|
||||||
ranges:NULL
|
|
||||||
rangeCount:0
|
|
||||||
storageSize:sizeof(GPBAny__storage_)
|
storageSize:sizeof(GPBAny__storage_)
|
||||||
wireFormat:NO
|
flags:0];
|
||||||
extraTextFormatInfo:extraTextFormatInfo];
|
#if !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS
|
||||||
|
static const char *extraTextFormatInfo =
|
||||||
|
"\001\001\004\241!!\000";
|
||||||
|
[localDescriptor setupExtraTextInfo:extraTextFormatInfo];
|
||||||
|
#endif // !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS
|
||||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||||
descriptor = localDescriptor;
|
descriptor = localDescriptor;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#import "GPBProtocolBuffers.h"
|
#import "GPBProtocolBuffers.h"
|
||||||
|
|
||||||
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30000
|
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30001
|
||||||
#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources.
|
#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -71,80 +71,66 @@ typedef struct GPBApi__storage_ {
|
|||||||
static GPBMessageFieldDescription fields[] = {
|
static GPBMessageFieldDescription fields[] = {
|
||||||
{
|
{
|
||||||
.name = "name",
|
.name = "name",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBApi_FieldNumber_Name,
|
.number = GPBApi_FieldNumber_Name,
|
||||||
.hasIndex = 0,
|
.hasIndex = 0,
|
||||||
|
.offset = (uint32_t)offsetof(GPBApi__storage_, name),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeString,
|
.dataType = GPBDataTypeString,
|
||||||
.offset = offsetof(GPBApi__storage_, name),
|
|
||||||
.defaultValue.valueString = nil,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "methodsArray",
|
.name = "methodsArray",
|
||||||
|
.dataTypeSpecific.className = GPBStringifySymbol(GPBMethod),
|
||||||
.number = GPBApi_FieldNumber_MethodsArray,
|
.number = GPBApi_FieldNumber_MethodsArray,
|
||||||
.hasIndex = GPBNoHasBit,
|
.hasIndex = GPBNoHasBit,
|
||||||
|
.offset = (uint32_t)offsetof(GPBApi__storage_, methodsArray),
|
||||||
.flags = GPBFieldRepeated,
|
.flags = GPBFieldRepeated,
|
||||||
.dataType = GPBDataTypeMessage,
|
.dataType = GPBDataTypeMessage,
|
||||||
.offset = offsetof(GPBApi__storage_, methodsArray),
|
|
||||||
.defaultValue.valueMessage = nil,
|
|
||||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBMethod),
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "optionsArray",
|
.name = "optionsArray",
|
||||||
|
.dataTypeSpecific.className = GPBStringifySymbol(GPBOption),
|
||||||
.number = GPBApi_FieldNumber_OptionsArray,
|
.number = GPBApi_FieldNumber_OptionsArray,
|
||||||
.hasIndex = GPBNoHasBit,
|
.hasIndex = GPBNoHasBit,
|
||||||
|
.offset = (uint32_t)offsetof(GPBApi__storage_, optionsArray),
|
||||||
.flags = GPBFieldRepeated,
|
.flags = GPBFieldRepeated,
|
||||||
.dataType = GPBDataTypeMessage,
|
.dataType = GPBDataTypeMessage,
|
||||||
.offset = offsetof(GPBApi__storage_, optionsArray),
|
|
||||||
.defaultValue.valueMessage = nil,
|
|
||||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBOption),
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "version",
|
.name = "version",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBApi_FieldNumber_Version,
|
.number = GPBApi_FieldNumber_Version,
|
||||||
.hasIndex = 3,
|
.hasIndex = 1,
|
||||||
|
.offset = (uint32_t)offsetof(GPBApi__storage_, version),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeString,
|
.dataType = GPBDataTypeString,
|
||||||
.offset = offsetof(GPBApi__storage_, version),
|
|
||||||
.defaultValue.valueString = nil,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "sourceContext",
|
.name = "sourceContext",
|
||||||
|
.dataTypeSpecific.className = GPBStringifySymbol(GPBSourceContext),
|
||||||
.number = GPBApi_FieldNumber_SourceContext,
|
.number = GPBApi_FieldNumber_SourceContext,
|
||||||
.hasIndex = 4,
|
.hasIndex = 2,
|
||||||
|
.offset = (uint32_t)offsetof(GPBApi__storage_, sourceContext),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeMessage,
|
.dataType = GPBDataTypeMessage,
|
||||||
.offset = offsetof(GPBApi__storage_, sourceContext),
|
|
||||||
.defaultValue.valueMessage = nil,
|
|
||||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBSourceContext),
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "mixinsArray",
|
.name = "mixinsArray",
|
||||||
|
.dataTypeSpecific.className = GPBStringifySymbol(GPBMixin),
|
||||||
.number = GPBApi_FieldNumber_MixinsArray,
|
.number = GPBApi_FieldNumber_MixinsArray,
|
||||||
.hasIndex = GPBNoHasBit,
|
.hasIndex = GPBNoHasBit,
|
||||||
|
.offset = (uint32_t)offsetof(GPBApi__storage_, mixinsArray),
|
||||||
.flags = GPBFieldRepeated,
|
.flags = GPBFieldRepeated,
|
||||||
.dataType = GPBDataTypeMessage,
|
.dataType = GPBDataTypeMessage,
|
||||||
.offset = offsetof(GPBApi__storage_, mixinsArray),
|
|
||||||
.defaultValue.valueMessage = nil,
|
|
||||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBMixin),
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "syntax",
|
.name = "syntax",
|
||||||
|
.dataTypeSpecific.enumDescFunc = GPBSyntax_EnumDescriptor,
|
||||||
.number = GPBApi_FieldNumber_Syntax,
|
.number = GPBApi_FieldNumber_Syntax,
|
||||||
.hasIndex = 6,
|
.hasIndex = 3,
|
||||||
|
.offset = (uint32_t)offsetof(GPBApi__storage_, syntax),
|
||||||
.flags = GPBFieldOptional | GPBFieldHasEnumDescriptor,
|
.flags = GPBFieldOptional | GPBFieldHasEnumDescriptor,
|
||||||
.dataType = GPBDataTypeEnum,
|
.dataType = GPBDataTypeEnum,
|
||||||
.offset = offsetof(GPBApi__storage_, syntax),
|
|
||||||
.defaultValue.valueEnum = GPBSyntax_SyntaxProto2,
|
|
||||||
.dataTypeSpecific.enumDescFunc = GPBSyntax_EnumDescriptor,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
GPBDescriptor *localDescriptor =
|
GPBDescriptor *localDescriptor =
|
||||||
@ -152,15 +138,9 @@ typedef struct GPBApi__storage_ {
|
|||||||
rootClass:[GPBApiRoot class]
|
rootClass:[GPBApiRoot class]
|
||||||
file:GPBApiRoot_FileDescriptor()
|
file:GPBApiRoot_FileDescriptor()
|
||||||
fields:fields
|
fields:fields
|
||||||
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||||||
oneofs:NULL
|
|
||||||
oneofCount:0
|
|
||||||
enums:NULL
|
|
||||||
enumCount:0
|
|
||||||
ranges:NULL
|
|
||||||
rangeCount:0
|
|
||||||
storageSize:sizeof(GPBApi__storage_)
|
storageSize:sizeof(GPBApi__storage_)
|
||||||
wireFormat:NO];
|
flags:0];
|
||||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||||
descriptor = localDescriptor;
|
descriptor = localDescriptor;
|
||||||
}
|
}
|
||||||
@ -195,8 +175,6 @@ void SetGPBApi_Syntax_RawValue(GPBApi *message, int32_t value) {
|
|||||||
|
|
||||||
typedef struct GPBMethod__storage_ {
|
typedef struct GPBMethod__storage_ {
|
||||||
uint32_t _has_storage_[1];
|
uint32_t _has_storage_[1];
|
||||||
BOOL requestStreaming;
|
|
||||||
BOOL responseStreaming;
|
|
||||||
GPBSyntax syntax;
|
GPBSyntax syntax;
|
||||||
NSString *name;
|
NSString *name;
|
||||||
NSString *requestTypeURL;
|
NSString *requestTypeURL;
|
||||||
@ -212,102 +190,81 @@ typedef struct GPBMethod__storage_ {
|
|||||||
static GPBMessageFieldDescription fields[] = {
|
static GPBMessageFieldDescription fields[] = {
|
||||||
{
|
{
|
||||||
.name = "name",
|
.name = "name",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBMethod_FieldNumber_Name,
|
.number = GPBMethod_FieldNumber_Name,
|
||||||
.hasIndex = 0,
|
.hasIndex = 0,
|
||||||
|
.offset = (uint32_t)offsetof(GPBMethod__storage_, name),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeString,
|
.dataType = GPBDataTypeString,
|
||||||
.offset = offsetof(GPBMethod__storage_, name),
|
|
||||||
.defaultValue.valueString = nil,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "requestTypeURL",
|
.name = "requestTypeURL",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBMethod_FieldNumber_RequestTypeURL,
|
.number = GPBMethod_FieldNumber_RequestTypeURL,
|
||||||
.hasIndex = 1,
|
.hasIndex = 1,
|
||||||
|
.offset = (uint32_t)offsetof(GPBMethod__storage_, requestTypeURL),
|
||||||
.flags = GPBFieldOptional | GPBFieldTextFormatNameCustom,
|
.flags = GPBFieldOptional | GPBFieldTextFormatNameCustom,
|
||||||
.dataType = GPBDataTypeString,
|
.dataType = GPBDataTypeString,
|
||||||
.offset = offsetof(GPBMethod__storage_, requestTypeURL),
|
|
||||||
.defaultValue.valueString = nil,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "requestStreaming",
|
.name = "requestStreaming",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBMethod_FieldNumber_RequestStreaming,
|
.number = GPBMethod_FieldNumber_RequestStreaming,
|
||||||
.hasIndex = 2,
|
.hasIndex = 2,
|
||||||
|
.offset = 3, // Stored in _has_storage_ to save space.
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeBool,
|
.dataType = GPBDataTypeBool,
|
||||||
.offset = offsetof(GPBMethod__storage_, requestStreaming),
|
|
||||||
.defaultValue.valueBool = NO,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "responseTypeURL",
|
.name = "responseTypeURL",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBMethod_FieldNumber_ResponseTypeURL,
|
.number = GPBMethod_FieldNumber_ResponseTypeURL,
|
||||||
.hasIndex = 3,
|
.hasIndex = 4,
|
||||||
|
.offset = (uint32_t)offsetof(GPBMethod__storage_, responseTypeURL),
|
||||||
.flags = GPBFieldOptional | GPBFieldTextFormatNameCustom,
|
.flags = GPBFieldOptional | GPBFieldTextFormatNameCustom,
|
||||||
.dataType = GPBDataTypeString,
|
.dataType = GPBDataTypeString,
|
||||||
.offset = offsetof(GPBMethod__storage_, responseTypeURL),
|
|
||||||
.defaultValue.valueString = nil,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "responseStreaming",
|
.name = "responseStreaming",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBMethod_FieldNumber_ResponseStreaming,
|
.number = GPBMethod_FieldNumber_ResponseStreaming,
|
||||||
.hasIndex = 4,
|
.hasIndex = 5,
|
||||||
|
.offset = 6, // Stored in _has_storage_ to save space.
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeBool,
|
.dataType = GPBDataTypeBool,
|
||||||
.offset = offsetof(GPBMethod__storage_, responseStreaming),
|
|
||||||
.defaultValue.valueBool = NO,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "optionsArray",
|
.name = "optionsArray",
|
||||||
|
.dataTypeSpecific.className = GPBStringifySymbol(GPBOption),
|
||||||
.number = GPBMethod_FieldNumber_OptionsArray,
|
.number = GPBMethod_FieldNumber_OptionsArray,
|
||||||
.hasIndex = GPBNoHasBit,
|
.hasIndex = GPBNoHasBit,
|
||||||
|
.offset = (uint32_t)offsetof(GPBMethod__storage_, optionsArray),
|
||||||
.flags = GPBFieldRepeated,
|
.flags = GPBFieldRepeated,
|
||||||
.dataType = GPBDataTypeMessage,
|
.dataType = GPBDataTypeMessage,
|
||||||
.offset = offsetof(GPBMethod__storage_, optionsArray),
|
|
||||||
.defaultValue.valueMessage = nil,
|
|
||||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBOption),
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "syntax",
|
.name = "syntax",
|
||||||
|
.dataTypeSpecific.enumDescFunc = GPBSyntax_EnumDescriptor,
|
||||||
.number = GPBMethod_FieldNumber_Syntax,
|
.number = GPBMethod_FieldNumber_Syntax,
|
||||||
.hasIndex = 6,
|
.hasIndex = 7,
|
||||||
|
.offset = (uint32_t)offsetof(GPBMethod__storage_, syntax),
|
||||||
.flags = GPBFieldOptional | GPBFieldHasEnumDescriptor,
|
.flags = GPBFieldOptional | GPBFieldHasEnumDescriptor,
|
||||||
.dataType = GPBDataTypeEnum,
|
.dataType = GPBDataTypeEnum,
|
||||||
.offset = offsetof(GPBMethod__storage_, syntax),
|
|
||||||
.defaultValue.valueEnum = GPBSyntax_SyntaxProto2,
|
|
||||||
.dataTypeSpecific.enumDescFunc = GPBSyntax_EnumDescriptor,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
#if GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS
|
|
||||||
const char *extraTextFormatInfo = NULL;
|
|
||||||
#else
|
|
||||||
static const char *extraTextFormatInfo = "\002\002\007\244\241!!\000\004\010\244\241!!\000";
|
|
||||||
#endif // GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS
|
|
||||||
GPBDescriptor *localDescriptor =
|
GPBDescriptor *localDescriptor =
|
||||||
[GPBDescriptor allocDescriptorForClass:[GPBMethod class]
|
[GPBDescriptor allocDescriptorForClass:[GPBMethod class]
|
||||||
rootClass:[GPBApiRoot class]
|
rootClass:[GPBApiRoot class]
|
||||||
file:GPBApiRoot_FileDescriptor()
|
file:GPBApiRoot_FileDescriptor()
|
||||||
fields:fields
|
fields:fields
|
||||||
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||||||
oneofs:NULL
|
|
||||||
oneofCount:0
|
|
||||||
enums:NULL
|
|
||||||
enumCount:0
|
|
||||||
ranges:NULL
|
|
||||||
rangeCount:0
|
|
||||||
storageSize:sizeof(GPBMethod__storage_)
|
storageSize:sizeof(GPBMethod__storage_)
|
||||||
wireFormat:NO
|
flags:0];
|
||||||
extraTextFormatInfo:extraTextFormatInfo];
|
#if !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS
|
||||||
|
static const char *extraTextFormatInfo =
|
||||||
|
"\002\002\007\244\241!!\000\004\010\244\241!!\000";
|
||||||
|
[localDescriptor setupExtraTextInfo:extraTextFormatInfo];
|
||||||
|
#endif // !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS
|
||||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||||
descriptor = localDescriptor;
|
descriptor = localDescriptor;
|
||||||
}
|
}
|
||||||
@ -349,25 +306,21 @@ typedef struct GPBMixin__storage_ {
|
|||||||
static GPBMessageFieldDescription fields[] = {
|
static GPBMessageFieldDescription fields[] = {
|
||||||
{
|
{
|
||||||
.name = "name",
|
.name = "name",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBMixin_FieldNumber_Name,
|
.number = GPBMixin_FieldNumber_Name,
|
||||||
.hasIndex = 0,
|
.hasIndex = 0,
|
||||||
|
.offset = (uint32_t)offsetof(GPBMixin__storage_, name),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeString,
|
.dataType = GPBDataTypeString,
|
||||||
.offset = offsetof(GPBMixin__storage_, name),
|
|
||||||
.defaultValue.valueString = nil,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "root",
|
.name = "root",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBMixin_FieldNumber_Root,
|
.number = GPBMixin_FieldNumber_Root,
|
||||||
.hasIndex = 1,
|
.hasIndex = 1,
|
||||||
|
.offset = (uint32_t)offsetof(GPBMixin__storage_, root),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeString,
|
.dataType = GPBDataTypeString,
|
||||||
.offset = offsetof(GPBMixin__storage_, root),
|
|
||||||
.defaultValue.valueString = nil,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
GPBDescriptor *localDescriptor =
|
GPBDescriptor *localDescriptor =
|
||||||
@ -375,15 +328,9 @@ typedef struct GPBMixin__storage_ {
|
|||||||
rootClass:[GPBApiRoot class]
|
rootClass:[GPBApiRoot class]
|
||||||
file:GPBApiRoot_FileDescriptor()
|
file:GPBApiRoot_FileDescriptor()
|
||||||
fields:fields
|
fields:fields
|
||||||
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||||||
oneofs:NULL
|
|
||||||
oneofCount:0
|
|
||||||
enums:NULL
|
|
||||||
enumCount:0
|
|
||||||
ranges:NULL
|
|
||||||
rangeCount:0
|
|
||||||
storageSize:sizeof(GPBMixin__storage_)
|
storageSize:sizeof(GPBMixin__storage_)
|
||||||
wireFormat:NO];
|
flags:0];
|
||||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||||
descriptor = localDescriptor;
|
descriptor = localDescriptor;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#import "GPBProtocolBuffers.h"
|
#import "GPBProtocolBuffers.h"
|
||||||
|
|
||||||
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30000
|
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30001
|
||||||
#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources.
|
#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -46,25 +46,21 @@ typedef struct GPBDuration__storage_ {
|
|||||||
static GPBMessageFieldDescription fields[] = {
|
static GPBMessageFieldDescription fields[] = {
|
||||||
{
|
{
|
||||||
.name = "seconds",
|
.name = "seconds",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBDuration_FieldNumber_Seconds,
|
.number = GPBDuration_FieldNumber_Seconds,
|
||||||
.hasIndex = 0,
|
.hasIndex = 0,
|
||||||
|
.offset = (uint32_t)offsetof(GPBDuration__storage_, seconds),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeInt64,
|
.dataType = GPBDataTypeInt64,
|
||||||
.offset = offsetof(GPBDuration__storage_, seconds),
|
|
||||||
.defaultValue.valueInt64 = 0LL,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "nanos",
|
.name = "nanos",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBDuration_FieldNumber_Nanos,
|
.number = GPBDuration_FieldNumber_Nanos,
|
||||||
.hasIndex = 1,
|
.hasIndex = 1,
|
||||||
|
.offset = (uint32_t)offsetof(GPBDuration__storage_, nanos),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeInt32,
|
.dataType = GPBDataTypeInt32,
|
||||||
.offset = offsetof(GPBDuration__storage_, nanos),
|
|
||||||
.defaultValue.valueInt32 = 0,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
GPBDescriptor *localDescriptor =
|
GPBDescriptor *localDescriptor =
|
||||||
@ -72,15 +68,9 @@ typedef struct GPBDuration__storage_ {
|
|||||||
rootClass:[GPBDurationRoot class]
|
rootClass:[GPBDurationRoot class]
|
||||||
file:GPBDurationRoot_FileDescriptor()
|
file:GPBDurationRoot_FileDescriptor()
|
||||||
fields:fields
|
fields:fields
|
||||||
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||||||
oneofs:NULL
|
|
||||||
oneofCount:0
|
|
||||||
enums:NULL
|
|
||||||
enumCount:0
|
|
||||||
ranges:NULL
|
|
||||||
rangeCount:0
|
|
||||||
storageSize:sizeof(GPBDuration__storage_)
|
storageSize:sizeof(GPBDuration__storage_)
|
||||||
wireFormat:NO];
|
flags:0];
|
||||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||||
descriptor = localDescriptor;
|
descriptor = localDescriptor;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#import "GPBProtocolBuffers.h"
|
#import "GPBProtocolBuffers.h"
|
||||||
|
|
||||||
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30000
|
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30001
|
||||||
#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources.
|
#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ static GPBFileDescriptor *GPBEmptyRoot_FileDescriptor(void) {
|
|||||||
|
|
||||||
|
|
||||||
typedef struct GPBEmpty__storage_ {
|
typedef struct GPBEmpty__storage_ {
|
||||||
uint32_t _has_storage_[0];
|
uint32_t _has_storage_[1];
|
||||||
} GPBEmpty__storage_;
|
} GPBEmpty__storage_;
|
||||||
|
|
||||||
// This method is threadsafe because it is initially called
|
// This method is threadsafe because it is initially called
|
||||||
@ -45,14 +45,8 @@ typedef struct GPBEmpty__storage_ {
|
|||||||
file:GPBEmptyRoot_FileDescriptor()
|
file:GPBEmptyRoot_FileDescriptor()
|
||||||
fields:NULL
|
fields:NULL
|
||||||
fieldCount:0
|
fieldCount:0
|
||||||
oneofs:NULL
|
|
||||||
oneofCount:0
|
|
||||||
enums:NULL
|
|
||||||
enumCount:0
|
|
||||||
ranges:NULL
|
|
||||||
rangeCount:0
|
|
||||||
storageSize:sizeof(GPBEmpty__storage_)
|
storageSize:sizeof(GPBEmpty__storage_)
|
||||||
wireFormat:NO];
|
flags:0];
|
||||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||||
descriptor = localDescriptor;
|
descriptor = localDescriptor;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#import "GPBProtocolBuffers.h"
|
#import "GPBProtocolBuffers.h"
|
||||||
|
|
||||||
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30000
|
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30001
|
||||||
#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources.
|
#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -44,14 +44,12 @@ typedef struct GPBFieldMask__storage_ {
|
|||||||
static GPBMessageFieldDescription fields[] = {
|
static GPBMessageFieldDescription fields[] = {
|
||||||
{
|
{
|
||||||
.name = "pathsArray",
|
.name = "pathsArray",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBFieldMask_FieldNumber_PathsArray,
|
.number = GPBFieldMask_FieldNumber_PathsArray,
|
||||||
.hasIndex = GPBNoHasBit,
|
.hasIndex = GPBNoHasBit,
|
||||||
|
.offset = (uint32_t)offsetof(GPBFieldMask__storage_, pathsArray),
|
||||||
.flags = GPBFieldRepeated,
|
.flags = GPBFieldRepeated,
|
||||||
.dataType = GPBDataTypeString,
|
.dataType = GPBDataTypeString,
|
||||||
.offset = offsetof(GPBFieldMask__storage_, pathsArray),
|
|
||||||
.defaultValue.valueMessage = nil,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
GPBDescriptor *localDescriptor =
|
GPBDescriptor *localDescriptor =
|
||||||
@ -59,15 +57,9 @@ typedef struct GPBFieldMask__storage_ {
|
|||||||
rootClass:[GPBFieldMaskRoot class]
|
rootClass:[GPBFieldMaskRoot class]
|
||||||
file:GPBFieldMaskRoot_FileDescriptor()
|
file:GPBFieldMaskRoot_FileDescriptor()
|
||||||
fields:fields
|
fields:fields
|
||||||
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||||||
oneofs:NULL
|
|
||||||
oneofCount:0
|
|
||||||
enums:NULL
|
|
||||||
enumCount:0
|
|
||||||
ranges:NULL
|
|
||||||
rangeCount:0
|
|
||||||
storageSize:sizeof(GPBFieldMask__storage_)
|
storageSize:sizeof(GPBFieldMask__storage_)
|
||||||
wireFormat:NO];
|
flags:0];
|
||||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||||
descriptor = localDescriptor;
|
descriptor = localDescriptor;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#import "GPBProtocolBuffers.h"
|
#import "GPBProtocolBuffers.h"
|
||||||
|
|
||||||
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30000
|
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30001
|
||||||
#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources.
|
#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -44,14 +44,12 @@ typedef struct GPBSourceContext__storage_ {
|
|||||||
static GPBMessageFieldDescription fields[] = {
|
static GPBMessageFieldDescription fields[] = {
|
||||||
{
|
{
|
||||||
.name = "fileName",
|
.name = "fileName",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBSourceContext_FieldNumber_FileName,
|
.number = GPBSourceContext_FieldNumber_FileName,
|
||||||
.hasIndex = 0,
|
.hasIndex = 0,
|
||||||
|
.offset = (uint32_t)offsetof(GPBSourceContext__storage_, fileName),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeString,
|
.dataType = GPBDataTypeString,
|
||||||
.offset = offsetof(GPBSourceContext__storage_, fileName),
|
|
||||||
.defaultValue.valueString = nil,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
GPBDescriptor *localDescriptor =
|
GPBDescriptor *localDescriptor =
|
||||||
@ -59,15 +57,9 @@ typedef struct GPBSourceContext__storage_ {
|
|||||||
rootClass:[GPBSourceContextRoot class]
|
rootClass:[GPBSourceContextRoot class]
|
||||||
file:GPBSourceContextRoot_FileDescriptor()
|
file:GPBSourceContextRoot_FileDescriptor()
|
||||||
fields:fields
|
fields:fields
|
||||||
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||||||
oneofs:NULL
|
|
||||||
oneofCount:0
|
|
||||||
enums:NULL
|
|
||||||
enumCount:0
|
|
||||||
ranges:NULL
|
|
||||||
rangeCount:0
|
|
||||||
storageSize:sizeof(GPBSourceContext__storage_)
|
storageSize:sizeof(GPBSourceContext__storage_)
|
||||||
wireFormat:NO];
|
flags:0];
|
||||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||||
descriptor = localDescriptor;
|
descriptor = localDescriptor;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#import "GPBProtocolBuffers.h"
|
#import "GPBProtocolBuffers.h"
|
||||||
|
|
||||||
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30000
|
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30001
|
||||||
#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources.
|
#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -30,13 +30,20 @@ static GPBFileDescriptor *GPBStructRoot_FileDescriptor(void) {
|
|||||||
GPBEnumDescriptor *GPBNullValue_EnumDescriptor(void) {
|
GPBEnumDescriptor *GPBNullValue_EnumDescriptor(void) {
|
||||||
static GPBEnumDescriptor *descriptor = NULL;
|
static GPBEnumDescriptor *descriptor = NULL;
|
||||||
if (!descriptor) {
|
if (!descriptor) {
|
||||||
static GPBMessageEnumValueDescription values[] = {
|
static const char *valueNames =
|
||||||
{ .name = "NullValue", .number = GPBNullValue_NullValue },
|
"NullValue\000";
|
||||||
|
static const int32_t values[] = {
|
||||||
|
GPBNullValue_NullValue,
|
||||||
};
|
};
|
||||||
descriptor = [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GPBNullValue)
|
GPBEnumDescriptor *worker =
|
||||||
values:values
|
[GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GPBNullValue)
|
||||||
valueCount:sizeof(values) / sizeof(GPBMessageEnumValueDescription)
|
valueNames:valueNames
|
||||||
enumVerifier:GPBNullValue_IsValidValue];
|
values:values
|
||||||
|
count:(uint32_t)(sizeof(values) / sizeof(int32_t))
|
||||||
|
enumVerifier:GPBNullValue_IsValidValue];
|
||||||
|
if (!OSAtomicCompareAndSwapPtrBarrier(nil, worker, (void * volatile *)&descriptor)) {
|
||||||
|
[worker release];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return descriptor;
|
return descriptor;
|
||||||
}
|
}
|
||||||
@ -69,14 +76,12 @@ typedef struct GPBStruct__storage_ {
|
|||||||
static GPBMessageFieldDescription fields[] = {
|
static GPBMessageFieldDescription fields[] = {
|
||||||
{
|
{
|
||||||
.name = "fields",
|
.name = "fields",
|
||||||
|
.dataTypeSpecific.className = GPBStringifySymbol(GPBValue),
|
||||||
.number = GPBStruct_FieldNumber_Fields,
|
.number = GPBStruct_FieldNumber_Fields,
|
||||||
.hasIndex = GPBNoHasBit,
|
.hasIndex = GPBNoHasBit,
|
||||||
|
.offset = (uint32_t)offsetof(GPBStruct__storage_, fields),
|
||||||
.flags = GPBFieldMapKeyString,
|
.flags = GPBFieldMapKeyString,
|
||||||
.dataType = GPBDataTypeMessage,
|
.dataType = GPBDataTypeMessage,
|
||||||
.offset = offsetof(GPBStruct__storage_, fields),
|
|
||||||
.defaultValue.valueMessage = nil,
|
|
||||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBValue),
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
GPBDescriptor *localDescriptor =
|
GPBDescriptor *localDescriptor =
|
||||||
@ -84,15 +89,9 @@ typedef struct GPBStruct__storage_ {
|
|||||||
rootClass:[GPBStructRoot class]
|
rootClass:[GPBStructRoot class]
|
||||||
file:GPBStructRoot_FileDescriptor()
|
file:GPBStructRoot_FileDescriptor()
|
||||||
fields:fields
|
fields:fields
|
||||||
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||||||
oneofs:NULL
|
|
||||||
oneofCount:0
|
|
||||||
enums:NULL
|
|
||||||
enumCount:0
|
|
||||||
ranges:NULL
|
|
||||||
rangeCount:0
|
|
||||||
storageSize:sizeof(GPBStruct__storage_)
|
storageSize:sizeof(GPBStruct__storage_)
|
||||||
wireFormat:NO];
|
flags:0];
|
||||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||||
descriptor = localDescriptor;
|
descriptor = localDescriptor;
|
||||||
}
|
}
|
||||||
@ -115,7 +114,6 @@ typedef struct GPBStruct__storage_ {
|
|||||||
|
|
||||||
typedef struct GPBValue__storage_ {
|
typedef struct GPBValue__storage_ {
|
||||||
uint32_t _has_storage_[2];
|
uint32_t _has_storage_[2];
|
||||||
BOOL boolValue;
|
|
||||||
GPBNullValue nullValue;
|
GPBNullValue nullValue;
|
||||||
NSString *stringValue;
|
NSString *stringValue;
|
||||||
GPBStruct *structValue;
|
GPBStruct *structValue;
|
||||||
@ -128,78 +126,60 @@ typedef struct GPBValue__storage_ {
|
|||||||
+ (GPBDescriptor *)descriptor {
|
+ (GPBDescriptor *)descriptor {
|
||||||
static GPBDescriptor *descriptor = nil;
|
static GPBDescriptor *descriptor = nil;
|
||||||
if (!descriptor) {
|
if (!descriptor) {
|
||||||
static GPBMessageOneofDescription oneofs[] = {
|
|
||||||
{
|
|
||||||
.name = "kind",
|
|
||||||
.index = -1,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
static GPBMessageFieldDescription fields[] = {
|
static GPBMessageFieldDescription fields[] = {
|
||||||
{
|
{
|
||||||
.name = "nullValue",
|
.name = "nullValue",
|
||||||
|
.dataTypeSpecific.enumDescFunc = GPBNullValue_EnumDescriptor,
|
||||||
.number = GPBValue_FieldNumber_NullValue,
|
.number = GPBValue_FieldNumber_NullValue,
|
||||||
.hasIndex = -1,
|
.hasIndex = -1,
|
||||||
|
.offset = (uint32_t)offsetof(GPBValue__storage_, nullValue),
|
||||||
.flags = GPBFieldOptional | GPBFieldHasEnumDescriptor,
|
.flags = GPBFieldOptional | GPBFieldHasEnumDescriptor,
|
||||||
.dataType = GPBDataTypeEnum,
|
.dataType = GPBDataTypeEnum,
|
||||||
.offset = offsetof(GPBValue__storage_, nullValue),
|
|
||||||
.defaultValue.valueEnum = GPBNullValue_NullValue,
|
|
||||||
.dataTypeSpecific.enumDescFunc = GPBNullValue_EnumDescriptor,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "numberValue",
|
.name = "numberValue",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBValue_FieldNumber_NumberValue,
|
.number = GPBValue_FieldNumber_NumberValue,
|
||||||
.hasIndex = -1,
|
.hasIndex = -1,
|
||||||
|
.offset = (uint32_t)offsetof(GPBValue__storage_, numberValue),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeDouble,
|
.dataType = GPBDataTypeDouble,
|
||||||
.offset = offsetof(GPBValue__storage_, numberValue),
|
|
||||||
.defaultValue.valueDouble = 0,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "stringValue",
|
.name = "stringValue",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBValue_FieldNumber_StringValue,
|
.number = GPBValue_FieldNumber_StringValue,
|
||||||
.hasIndex = -1,
|
.hasIndex = -1,
|
||||||
|
.offset = (uint32_t)offsetof(GPBValue__storage_, stringValue),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeString,
|
.dataType = GPBDataTypeString,
|
||||||
.offset = offsetof(GPBValue__storage_, stringValue),
|
|
||||||
.defaultValue.valueString = nil,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "boolValue",
|
.name = "boolValue",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBValue_FieldNumber_BoolValue,
|
.number = GPBValue_FieldNumber_BoolValue,
|
||||||
.hasIndex = -1,
|
.hasIndex = -1,
|
||||||
|
.offset = 0, // Stored in _has_storage_ to save space.
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeBool,
|
.dataType = GPBDataTypeBool,
|
||||||
.offset = offsetof(GPBValue__storage_, boolValue),
|
|
||||||
.defaultValue.valueBool = NO,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "structValue",
|
.name = "structValue",
|
||||||
|
.dataTypeSpecific.className = GPBStringifySymbol(GPBStruct),
|
||||||
.number = GPBValue_FieldNumber_StructValue,
|
.number = GPBValue_FieldNumber_StructValue,
|
||||||
.hasIndex = -1,
|
.hasIndex = -1,
|
||||||
|
.offset = (uint32_t)offsetof(GPBValue__storage_, structValue),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeMessage,
|
.dataType = GPBDataTypeMessage,
|
||||||
.offset = offsetof(GPBValue__storage_, structValue),
|
|
||||||
.defaultValue.valueMessage = nil,
|
|
||||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBStruct),
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "listValue",
|
.name = "listValue",
|
||||||
|
.dataTypeSpecific.className = GPBStringifySymbol(GPBListValue),
|
||||||
.number = GPBValue_FieldNumber_ListValue,
|
.number = GPBValue_FieldNumber_ListValue,
|
||||||
.hasIndex = -1,
|
.hasIndex = -1,
|
||||||
|
.offset = (uint32_t)offsetof(GPBValue__storage_, listValue),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeMessage,
|
.dataType = GPBDataTypeMessage,
|
||||||
.offset = offsetof(GPBValue__storage_, listValue),
|
|
||||||
.defaultValue.valueMessage = nil,
|
|
||||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBListValue),
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
GPBDescriptor *localDescriptor =
|
GPBDescriptor *localDescriptor =
|
||||||
@ -207,15 +187,15 @@ typedef struct GPBValue__storage_ {
|
|||||||
rootClass:[GPBStructRoot class]
|
rootClass:[GPBStructRoot class]
|
||||||
file:GPBStructRoot_FileDescriptor()
|
file:GPBStructRoot_FileDescriptor()
|
||||||
fields:fields
|
fields:fields
|
||||||
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||||||
oneofs:oneofs
|
|
||||||
oneofCount:sizeof(oneofs) / sizeof(GPBMessageOneofDescription)
|
|
||||||
enums:NULL
|
|
||||||
enumCount:0
|
|
||||||
ranges:NULL
|
|
||||||
rangeCount:0
|
|
||||||
storageSize:sizeof(GPBValue__storage_)
|
storageSize:sizeof(GPBValue__storage_)
|
||||||
wireFormat:NO];
|
flags:0];
|
||||||
|
static const char *oneofs[] = {
|
||||||
|
"kind",
|
||||||
|
};
|
||||||
|
[localDescriptor setupOneofs:oneofs
|
||||||
|
count:(uint32_t)(sizeof(oneofs) / sizeof(char*))
|
||||||
|
firstHasIndex:-1];
|
||||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||||
descriptor = localDescriptor;
|
descriptor = localDescriptor;
|
||||||
}
|
}
|
||||||
@ -239,7 +219,7 @@ void SetGPBValue_NullValue_RawValue(GPBValue *message, int32_t value) {
|
|||||||
void GPBValue_ClearKindOneOfCase(GPBValue *message) {
|
void GPBValue_ClearKindOneOfCase(GPBValue *message) {
|
||||||
GPBDescriptor *descriptor = [message descriptor];
|
GPBDescriptor *descriptor = [message descriptor];
|
||||||
GPBOneofDescriptor *oneof = descriptor->oneofs_[0];
|
GPBOneofDescriptor *oneof = descriptor->oneofs_[0];
|
||||||
GPBMaybeClearOneof(message, oneof, 0);
|
GPBMaybeClearOneof(message, oneof, -1, 0);
|
||||||
}
|
}
|
||||||
#pragma mark - GPBListValue
|
#pragma mark - GPBListValue
|
||||||
|
|
||||||
@ -260,14 +240,12 @@ typedef struct GPBListValue__storage_ {
|
|||||||
static GPBMessageFieldDescription fields[] = {
|
static GPBMessageFieldDescription fields[] = {
|
||||||
{
|
{
|
||||||
.name = "valuesArray",
|
.name = "valuesArray",
|
||||||
|
.dataTypeSpecific.className = GPBStringifySymbol(GPBValue),
|
||||||
.number = GPBListValue_FieldNumber_ValuesArray,
|
.number = GPBListValue_FieldNumber_ValuesArray,
|
||||||
.hasIndex = GPBNoHasBit,
|
.hasIndex = GPBNoHasBit,
|
||||||
|
.offset = (uint32_t)offsetof(GPBListValue__storage_, valuesArray),
|
||||||
.flags = GPBFieldRepeated,
|
.flags = GPBFieldRepeated,
|
||||||
.dataType = GPBDataTypeMessage,
|
.dataType = GPBDataTypeMessage,
|
||||||
.offset = offsetof(GPBListValue__storage_, valuesArray),
|
|
||||||
.defaultValue.valueMessage = nil,
|
|
||||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBValue),
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
GPBDescriptor *localDescriptor =
|
GPBDescriptor *localDescriptor =
|
||||||
@ -275,15 +253,9 @@ typedef struct GPBListValue__storage_ {
|
|||||||
rootClass:[GPBStructRoot class]
|
rootClass:[GPBStructRoot class]
|
||||||
file:GPBStructRoot_FileDescriptor()
|
file:GPBStructRoot_FileDescriptor()
|
||||||
fields:fields
|
fields:fields
|
||||||
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||||||
oneofs:NULL
|
|
||||||
oneofCount:0
|
|
||||||
enums:NULL
|
|
||||||
enumCount:0
|
|
||||||
ranges:NULL
|
|
||||||
rangeCount:0
|
|
||||||
storageSize:sizeof(GPBListValue__storage_)
|
storageSize:sizeof(GPBListValue__storage_)
|
||||||
wireFormat:NO];
|
flags:0];
|
||||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||||
descriptor = localDescriptor;
|
descriptor = localDescriptor;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#import "GPBProtocolBuffers.h"
|
#import "GPBProtocolBuffers.h"
|
||||||
|
|
||||||
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30000
|
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30001
|
||||||
#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources.
|
#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -46,25 +46,21 @@ typedef struct GPBTimestamp__storage_ {
|
|||||||
static GPBMessageFieldDescription fields[] = {
|
static GPBMessageFieldDescription fields[] = {
|
||||||
{
|
{
|
||||||
.name = "seconds",
|
.name = "seconds",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBTimestamp_FieldNumber_Seconds,
|
.number = GPBTimestamp_FieldNumber_Seconds,
|
||||||
.hasIndex = 0,
|
.hasIndex = 0,
|
||||||
|
.offset = (uint32_t)offsetof(GPBTimestamp__storage_, seconds),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeInt64,
|
.dataType = GPBDataTypeInt64,
|
||||||
.offset = offsetof(GPBTimestamp__storage_, seconds),
|
|
||||||
.defaultValue.valueInt64 = 0LL,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "nanos",
|
.name = "nanos",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBTimestamp_FieldNumber_Nanos,
|
.number = GPBTimestamp_FieldNumber_Nanos,
|
||||||
.hasIndex = 1,
|
.hasIndex = 1,
|
||||||
|
.offset = (uint32_t)offsetof(GPBTimestamp__storage_, nanos),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeInt32,
|
.dataType = GPBDataTypeInt32,
|
||||||
.offset = offsetof(GPBTimestamp__storage_, nanos),
|
|
||||||
.defaultValue.valueInt32 = 0,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
GPBDescriptor *localDescriptor =
|
GPBDescriptor *localDescriptor =
|
||||||
@ -72,15 +68,9 @@ typedef struct GPBTimestamp__storage_ {
|
|||||||
rootClass:[GPBTimestampRoot class]
|
rootClass:[GPBTimestampRoot class]
|
||||||
file:GPBTimestampRoot_FileDescriptor()
|
file:GPBTimestampRoot_FileDescriptor()
|
||||||
fields:fields
|
fields:fields
|
||||||
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||||||
oneofs:NULL
|
|
||||||
oneofCount:0
|
|
||||||
enums:NULL
|
|
||||||
enumCount:0
|
|
||||||
ranges:NULL
|
|
||||||
rangeCount:0
|
|
||||||
storageSize:sizeof(GPBTimestamp__storage_)
|
storageSize:sizeof(GPBTimestamp__storage_)
|
||||||
wireFormat:NO];
|
flags:0];
|
||||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||||
descriptor = localDescriptor;
|
descriptor = localDescriptor;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#import "GPBProtocolBuffers.h"
|
#import "GPBProtocolBuffers.h"
|
||||||
|
|
||||||
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30000
|
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30001
|
||||||
#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources.
|
#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -45,14 +45,21 @@ static GPBFileDescriptor *GPBTypeRoot_FileDescriptor(void) {
|
|||||||
GPBEnumDescriptor *GPBSyntax_EnumDescriptor(void) {
|
GPBEnumDescriptor *GPBSyntax_EnumDescriptor(void) {
|
||||||
static GPBEnumDescriptor *descriptor = NULL;
|
static GPBEnumDescriptor *descriptor = NULL;
|
||||||
if (!descriptor) {
|
if (!descriptor) {
|
||||||
static GPBMessageEnumValueDescription values[] = {
|
static const char *valueNames =
|
||||||
{ .name = "SyntaxProto2", .number = GPBSyntax_SyntaxProto2 },
|
"SyntaxProto2\000SyntaxProto3\000";
|
||||||
{ .name = "SyntaxProto3", .number = GPBSyntax_SyntaxProto3 },
|
static const int32_t values[] = {
|
||||||
|
GPBSyntax_SyntaxProto2,
|
||||||
|
GPBSyntax_SyntaxProto3,
|
||||||
};
|
};
|
||||||
descriptor = [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GPBSyntax)
|
GPBEnumDescriptor *worker =
|
||||||
values:values
|
[GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GPBSyntax)
|
||||||
valueCount:sizeof(values) / sizeof(GPBMessageEnumValueDescription)
|
valueNames:valueNames
|
||||||
enumVerifier:GPBSyntax_IsValidValue];
|
values:values
|
||||||
|
count:(uint32_t)(sizeof(values) / sizeof(int32_t))
|
||||||
|
enumVerifier:GPBSyntax_IsValidValue];
|
||||||
|
if (!OSAtomicCompareAndSwapPtrBarrier(nil, worker, (void * volatile *)&descriptor)) {
|
||||||
|
[worker release];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return descriptor;
|
return descriptor;
|
||||||
}
|
}
|
||||||
@ -96,69 +103,57 @@ typedef struct GPBType__storage_ {
|
|||||||
static GPBMessageFieldDescription fields[] = {
|
static GPBMessageFieldDescription fields[] = {
|
||||||
{
|
{
|
||||||
.name = "name",
|
.name = "name",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBType_FieldNumber_Name,
|
.number = GPBType_FieldNumber_Name,
|
||||||
.hasIndex = 0,
|
.hasIndex = 0,
|
||||||
|
.offset = (uint32_t)offsetof(GPBType__storage_, name),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeString,
|
.dataType = GPBDataTypeString,
|
||||||
.offset = offsetof(GPBType__storage_, name),
|
|
||||||
.defaultValue.valueString = nil,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "fieldsArray",
|
.name = "fieldsArray",
|
||||||
|
.dataTypeSpecific.className = GPBStringifySymbol(GPBField),
|
||||||
.number = GPBType_FieldNumber_FieldsArray,
|
.number = GPBType_FieldNumber_FieldsArray,
|
||||||
.hasIndex = GPBNoHasBit,
|
.hasIndex = GPBNoHasBit,
|
||||||
|
.offset = (uint32_t)offsetof(GPBType__storage_, fieldsArray),
|
||||||
.flags = GPBFieldRepeated,
|
.flags = GPBFieldRepeated,
|
||||||
.dataType = GPBDataTypeMessage,
|
.dataType = GPBDataTypeMessage,
|
||||||
.offset = offsetof(GPBType__storage_, fieldsArray),
|
|
||||||
.defaultValue.valueMessage = nil,
|
|
||||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBField),
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "oneofsArray",
|
.name = "oneofsArray",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBType_FieldNumber_OneofsArray,
|
.number = GPBType_FieldNumber_OneofsArray,
|
||||||
.hasIndex = GPBNoHasBit,
|
.hasIndex = GPBNoHasBit,
|
||||||
|
.offset = (uint32_t)offsetof(GPBType__storage_, oneofsArray),
|
||||||
.flags = GPBFieldRepeated,
|
.flags = GPBFieldRepeated,
|
||||||
.dataType = GPBDataTypeString,
|
.dataType = GPBDataTypeString,
|
||||||
.offset = offsetof(GPBType__storage_, oneofsArray),
|
|
||||||
.defaultValue.valueMessage = nil,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "optionsArray",
|
.name = "optionsArray",
|
||||||
|
.dataTypeSpecific.className = GPBStringifySymbol(GPBOption),
|
||||||
.number = GPBType_FieldNumber_OptionsArray,
|
.number = GPBType_FieldNumber_OptionsArray,
|
||||||
.hasIndex = GPBNoHasBit,
|
.hasIndex = GPBNoHasBit,
|
||||||
|
.offset = (uint32_t)offsetof(GPBType__storage_, optionsArray),
|
||||||
.flags = GPBFieldRepeated,
|
.flags = GPBFieldRepeated,
|
||||||
.dataType = GPBDataTypeMessage,
|
.dataType = GPBDataTypeMessage,
|
||||||
.offset = offsetof(GPBType__storage_, optionsArray),
|
|
||||||
.defaultValue.valueMessage = nil,
|
|
||||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBOption),
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "sourceContext",
|
.name = "sourceContext",
|
||||||
|
.dataTypeSpecific.className = GPBStringifySymbol(GPBSourceContext),
|
||||||
.number = GPBType_FieldNumber_SourceContext,
|
.number = GPBType_FieldNumber_SourceContext,
|
||||||
.hasIndex = 4,
|
.hasIndex = 1,
|
||||||
|
.offset = (uint32_t)offsetof(GPBType__storage_, sourceContext),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeMessage,
|
.dataType = GPBDataTypeMessage,
|
||||||
.offset = offsetof(GPBType__storage_, sourceContext),
|
|
||||||
.defaultValue.valueMessage = nil,
|
|
||||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBSourceContext),
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "syntax",
|
.name = "syntax",
|
||||||
|
.dataTypeSpecific.enumDescFunc = GPBSyntax_EnumDescriptor,
|
||||||
.number = GPBType_FieldNumber_Syntax,
|
.number = GPBType_FieldNumber_Syntax,
|
||||||
.hasIndex = 5,
|
.hasIndex = 2,
|
||||||
|
.offset = (uint32_t)offsetof(GPBType__storage_, syntax),
|
||||||
.flags = GPBFieldOptional | GPBFieldHasEnumDescriptor,
|
.flags = GPBFieldOptional | GPBFieldHasEnumDescriptor,
|
||||||
.dataType = GPBDataTypeEnum,
|
.dataType = GPBDataTypeEnum,
|
||||||
.offset = offsetof(GPBType__storage_, syntax),
|
|
||||||
.defaultValue.valueEnum = GPBSyntax_SyntaxProto2,
|
|
||||||
.dataTypeSpecific.enumDescFunc = GPBSyntax_EnumDescriptor,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
GPBDescriptor *localDescriptor =
|
GPBDescriptor *localDescriptor =
|
||||||
@ -166,15 +161,9 @@ typedef struct GPBType__storage_ {
|
|||||||
rootClass:[GPBTypeRoot class]
|
rootClass:[GPBTypeRoot class]
|
||||||
file:GPBTypeRoot_FileDescriptor()
|
file:GPBTypeRoot_FileDescriptor()
|
||||||
fields:fields
|
fields:fields
|
||||||
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||||||
oneofs:NULL
|
|
||||||
oneofCount:0
|
|
||||||
enums:NULL
|
|
||||||
enumCount:0
|
|
||||||
ranges:NULL
|
|
||||||
rangeCount:0
|
|
||||||
storageSize:sizeof(GPBType__storage_)
|
storageSize:sizeof(GPBType__storage_)
|
||||||
wireFormat:NO];
|
flags:0];
|
||||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||||
descriptor = localDescriptor;
|
descriptor = localDescriptor;
|
||||||
}
|
}
|
||||||
@ -212,7 +201,6 @@ void SetGPBType_Syntax_RawValue(GPBType *message, int32_t value) {
|
|||||||
|
|
||||||
typedef struct GPBField__storage_ {
|
typedef struct GPBField__storage_ {
|
||||||
uint32_t _has_storage_[1];
|
uint32_t _has_storage_[1];
|
||||||
BOOL packed;
|
|
||||||
GPBField_Kind kind;
|
GPBField_Kind kind;
|
||||||
GPBField_Cardinality cardinality;
|
GPBField_Cardinality cardinality;
|
||||||
int32_t number;
|
int32_t number;
|
||||||
@ -232,139 +220,108 @@ typedef struct GPBField__storage_ {
|
|||||||
static GPBMessageFieldDescription fields[] = {
|
static GPBMessageFieldDescription fields[] = {
|
||||||
{
|
{
|
||||||
.name = "kind",
|
.name = "kind",
|
||||||
|
.dataTypeSpecific.enumDescFunc = GPBField_Kind_EnumDescriptor,
|
||||||
.number = GPBField_FieldNumber_Kind,
|
.number = GPBField_FieldNumber_Kind,
|
||||||
.hasIndex = 0,
|
.hasIndex = 0,
|
||||||
|
.offset = (uint32_t)offsetof(GPBField__storage_, kind),
|
||||||
.flags = GPBFieldOptional | GPBFieldHasEnumDescriptor,
|
.flags = GPBFieldOptional | GPBFieldHasEnumDescriptor,
|
||||||
.dataType = GPBDataTypeEnum,
|
.dataType = GPBDataTypeEnum,
|
||||||
.offset = offsetof(GPBField__storage_, kind),
|
|
||||||
.defaultValue.valueEnum = GPBField_Kind_TypeUnknown,
|
|
||||||
.dataTypeSpecific.enumDescFunc = GPBField_Kind_EnumDescriptor,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "cardinality",
|
.name = "cardinality",
|
||||||
|
.dataTypeSpecific.enumDescFunc = GPBField_Cardinality_EnumDescriptor,
|
||||||
.number = GPBField_FieldNumber_Cardinality,
|
.number = GPBField_FieldNumber_Cardinality,
|
||||||
.hasIndex = 1,
|
.hasIndex = 1,
|
||||||
|
.offset = (uint32_t)offsetof(GPBField__storage_, cardinality),
|
||||||
.flags = GPBFieldOptional | GPBFieldHasEnumDescriptor,
|
.flags = GPBFieldOptional | GPBFieldHasEnumDescriptor,
|
||||||
.dataType = GPBDataTypeEnum,
|
.dataType = GPBDataTypeEnum,
|
||||||
.offset = offsetof(GPBField__storage_, cardinality),
|
|
||||||
.defaultValue.valueEnum = GPBField_Cardinality_CardinalityUnknown,
|
|
||||||
.dataTypeSpecific.enumDescFunc = GPBField_Cardinality_EnumDescriptor,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "number",
|
.name = "number",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBField_FieldNumber_Number,
|
.number = GPBField_FieldNumber_Number,
|
||||||
.hasIndex = 2,
|
.hasIndex = 2,
|
||||||
|
.offset = (uint32_t)offsetof(GPBField__storage_, number),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeInt32,
|
.dataType = GPBDataTypeInt32,
|
||||||
.offset = offsetof(GPBField__storage_, number),
|
|
||||||
.defaultValue.valueInt32 = 0,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "name",
|
.name = "name",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBField_FieldNumber_Name,
|
.number = GPBField_FieldNumber_Name,
|
||||||
.hasIndex = 3,
|
.hasIndex = 3,
|
||||||
|
.offset = (uint32_t)offsetof(GPBField__storage_, name),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeString,
|
.dataType = GPBDataTypeString,
|
||||||
.offset = offsetof(GPBField__storage_, name),
|
|
||||||
.defaultValue.valueString = nil,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "typeURL",
|
.name = "typeURL",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBField_FieldNumber_TypeURL,
|
.number = GPBField_FieldNumber_TypeURL,
|
||||||
.hasIndex = 4,
|
.hasIndex = 4,
|
||||||
|
.offset = (uint32_t)offsetof(GPBField__storage_, typeURL),
|
||||||
.flags = GPBFieldOptional | GPBFieldTextFormatNameCustom,
|
.flags = GPBFieldOptional | GPBFieldTextFormatNameCustom,
|
||||||
.dataType = GPBDataTypeString,
|
.dataType = GPBDataTypeString,
|
||||||
.offset = offsetof(GPBField__storage_, typeURL),
|
|
||||||
.defaultValue.valueString = nil,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "oneofIndex",
|
.name = "oneofIndex",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBField_FieldNumber_OneofIndex,
|
.number = GPBField_FieldNumber_OneofIndex,
|
||||||
.hasIndex = 5,
|
.hasIndex = 5,
|
||||||
|
.offset = (uint32_t)offsetof(GPBField__storage_, oneofIndex),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeInt32,
|
.dataType = GPBDataTypeInt32,
|
||||||
.offset = offsetof(GPBField__storage_, oneofIndex),
|
|
||||||
.defaultValue.valueInt32 = 0,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "packed",
|
.name = "packed",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBField_FieldNumber_Packed,
|
.number = GPBField_FieldNumber_Packed,
|
||||||
.hasIndex = 6,
|
.hasIndex = 6,
|
||||||
|
.offset = 7, // Stored in _has_storage_ to save space.
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeBool,
|
.dataType = GPBDataTypeBool,
|
||||||
.offset = offsetof(GPBField__storage_, packed),
|
|
||||||
.defaultValue.valueBool = NO,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "optionsArray",
|
.name = "optionsArray",
|
||||||
|
.dataTypeSpecific.className = GPBStringifySymbol(GPBOption),
|
||||||
.number = GPBField_FieldNumber_OptionsArray,
|
.number = GPBField_FieldNumber_OptionsArray,
|
||||||
.hasIndex = GPBNoHasBit,
|
.hasIndex = GPBNoHasBit,
|
||||||
|
.offset = (uint32_t)offsetof(GPBField__storage_, optionsArray),
|
||||||
.flags = GPBFieldRepeated,
|
.flags = GPBFieldRepeated,
|
||||||
.dataType = GPBDataTypeMessage,
|
.dataType = GPBDataTypeMessage,
|
||||||
.offset = offsetof(GPBField__storage_, optionsArray),
|
|
||||||
.defaultValue.valueMessage = nil,
|
|
||||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBOption),
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "jsonName",
|
.name = "jsonName",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBField_FieldNumber_JsonName,
|
.number = GPBField_FieldNumber_JsonName,
|
||||||
.hasIndex = 8,
|
.hasIndex = 8,
|
||||||
|
.offset = (uint32_t)offsetof(GPBField__storage_, jsonName),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeString,
|
.dataType = GPBDataTypeString,
|
||||||
.offset = offsetof(GPBField__storage_, jsonName),
|
|
||||||
.defaultValue.valueString = nil,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "defaultValue",
|
.name = "defaultValue",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBField_FieldNumber_DefaultValue,
|
.number = GPBField_FieldNumber_DefaultValue,
|
||||||
.hasIndex = 9,
|
.hasIndex = 9,
|
||||||
|
.offset = (uint32_t)offsetof(GPBField__storage_, defaultValue),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeString,
|
.dataType = GPBDataTypeString,
|
||||||
.offset = offsetof(GPBField__storage_, defaultValue),
|
|
||||||
.defaultValue.valueString = nil,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
static GPBMessageEnumDescription enums[] = {
|
|
||||||
{ .enumDescriptorFunc = GPBField_Kind_EnumDescriptor },
|
|
||||||
{ .enumDescriptorFunc = GPBField_Cardinality_EnumDescriptor },
|
|
||||||
};
|
|
||||||
#if GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS
|
|
||||||
const char *extraTextFormatInfo = NULL;
|
|
||||||
#else
|
|
||||||
static const char *extraTextFormatInfo = "\001\006\004\241!!\000";
|
|
||||||
#endif // GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS
|
|
||||||
GPBDescriptor *localDescriptor =
|
GPBDescriptor *localDescriptor =
|
||||||
[GPBDescriptor allocDescriptorForClass:[GPBField class]
|
[GPBDescriptor allocDescriptorForClass:[GPBField class]
|
||||||
rootClass:[GPBTypeRoot class]
|
rootClass:[GPBTypeRoot class]
|
||||||
file:GPBTypeRoot_FileDescriptor()
|
file:GPBTypeRoot_FileDescriptor()
|
||||||
fields:fields
|
fields:fields
|
||||||
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||||||
oneofs:NULL
|
|
||||||
oneofCount:0
|
|
||||||
enums:enums
|
|
||||||
enumCount:sizeof(enums) / sizeof(GPBMessageEnumDescription)
|
|
||||||
ranges:NULL
|
|
||||||
rangeCount:0
|
|
||||||
storageSize:sizeof(GPBField__storage_)
|
storageSize:sizeof(GPBField__storage_)
|
||||||
wireFormat:NO
|
flags:0];
|
||||||
extraTextFormatInfo:extraTextFormatInfo];
|
#if !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS
|
||||||
|
static const char *extraTextFormatInfo =
|
||||||
|
"\001\006\004\241!!\000";
|
||||||
|
[localDescriptor setupExtraTextInfo:extraTextFormatInfo];
|
||||||
|
#endif // !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS
|
||||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||||
descriptor = localDescriptor;
|
descriptor = localDescriptor;
|
||||||
}
|
}
|
||||||
@ -402,31 +359,43 @@ void SetGPBField_Cardinality_RawValue(GPBField *message, int32_t value) {
|
|||||||
GPBEnumDescriptor *GPBField_Kind_EnumDescriptor(void) {
|
GPBEnumDescriptor *GPBField_Kind_EnumDescriptor(void) {
|
||||||
static GPBEnumDescriptor *descriptor = NULL;
|
static GPBEnumDescriptor *descriptor = NULL;
|
||||||
if (!descriptor) {
|
if (!descriptor) {
|
||||||
static GPBMessageEnumValueDescription values[] = {
|
static const char *valueNames =
|
||||||
{ .name = "TypeUnknown", .number = GPBField_Kind_TypeUnknown },
|
"TypeUnknown\000TypeDouble\000TypeFloat\000TypeInt"
|
||||||
{ .name = "TypeDouble", .number = GPBField_Kind_TypeDouble },
|
"64\000TypeUint64\000TypeInt32\000TypeFixed64\000Type"
|
||||||
{ .name = "TypeFloat", .number = GPBField_Kind_TypeFloat },
|
"Fixed32\000TypeBool\000TypeString\000TypeGroup\000Ty"
|
||||||
{ .name = "TypeInt64", .number = GPBField_Kind_TypeInt64 },
|
"peMessage\000TypeBytes\000TypeUint32\000TypeEnum\000"
|
||||||
{ .name = "TypeUint64", .number = GPBField_Kind_TypeUint64 },
|
"TypeSfixed32\000TypeSfixed64\000TypeSint32\000Typ"
|
||||||
{ .name = "TypeInt32", .number = GPBField_Kind_TypeInt32 },
|
"eSint64\000";
|
||||||
{ .name = "TypeFixed64", .number = GPBField_Kind_TypeFixed64 },
|
static const int32_t values[] = {
|
||||||
{ .name = "TypeFixed32", .number = GPBField_Kind_TypeFixed32 },
|
GPBField_Kind_TypeUnknown,
|
||||||
{ .name = "TypeBool", .number = GPBField_Kind_TypeBool },
|
GPBField_Kind_TypeDouble,
|
||||||
{ .name = "TypeString", .number = GPBField_Kind_TypeString },
|
GPBField_Kind_TypeFloat,
|
||||||
{ .name = "TypeGroup", .number = GPBField_Kind_TypeGroup },
|
GPBField_Kind_TypeInt64,
|
||||||
{ .name = "TypeMessage", .number = GPBField_Kind_TypeMessage },
|
GPBField_Kind_TypeUint64,
|
||||||
{ .name = "TypeBytes", .number = GPBField_Kind_TypeBytes },
|
GPBField_Kind_TypeInt32,
|
||||||
{ .name = "TypeUint32", .number = GPBField_Kind_TypeUint32 },
|
GPBField_Kind_TypeFixed64,
|
||||||
{ .name = "TypeEnum", .number = GPBField_Kind_TypeEnum },
|
GPBField_Kind_TypeFixed32,
|
||||||
{ .name = "TypeSfixed32", .number = GPBField_Kind_TypeSfixed32 },
|
GPBField_Kind_TypeBool,
|
||||||
{ .name = "TypeSfixed64", .number = GPBField_Kind_TypeSfixed64 },
|
GPBField_Kind_TypeString,
|
||||||
{ .name = "TypeSint32", .number = GPBField_Kind_TypeSint32 },
|
GPBField_Kind_TypeGroup,
|
||||||
{ .name = "TypeSint64", .number = GPBField_Kind_TypeSint64 },
|
GPBField_Kind_TypeMessage,
|
||||||
|
GPBField_Kind_TypeBytes,
|
||||||
|
GPBField_Kind_TypeUint32,
|
||||||
|
GPBField_Kind_TypeEnum,
|
||||||
|
GPBField_Kind_TypeSfixed32,
|
||||||
|
GPBField_Kind_TypeSfixed64,
|
||||||
|
GPBField_Kind_TypeSint32,
|
||||||
|
GPBField_Kind_TypeSint64,
|
||||||
};
|
};
|
||||||
descriptor = [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GPBField_Kind)
|
GPBEnumDescriptor *worker =
|
||||||
values:values
|
[GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GPBField_Kind)
|
||||||
valueCount:sizeof(values) / sizeof(GPBMessageEnumValueDescription)
|
valueNames:valueNames
|
||||||
enumVerifier:GPBField_Kind_IsValidValue];
|
values:values
|
||||||
|
count:(uint32_t)(sizeof(values) / sizeof(int32_t))
|
||||||
|
enumVerifier:GPBField_Kind_IsValidValue];
|
||||||
|
if (!OSAtomicCompareAndSwapPtrBarrier(nil, worker, (void * volatile *)&descriptor)) {
|
||||||
|
[worker release];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return descriptor;
|
return descriptor;
|
||||||
}
|
}
|
||||||
@ -463,16 +432,24 @@ BOOL GPBField_Kind_IsValidValue(int32_t value__) {
|
|||||||
GPBEnumDescriptor *GPBField_Cardinality_EnumDescriptor(void) {
|
GPBEnumDescriptor *GPBField_Cardinality_EnumDescriptor(void) {
|
||||||
static GPBEnumDescriptor *descriptor = NULL;
|
static GPBEnumDescriptor *descriptor = NULL;
|
||||||
if (!descriptor) {
|
if (!descriptor) {
|
||||||
static GPBMessageEnumValueDescription values[] = {
|
static const char *valueNames =
|
||||||
{ .name = "CardinalityUnknown", .number = GPBField_Cardinality_CardinalityUnknown },
|
"CardinalityUnknown\000CardinalityOptional\000C"
|
||||||
{ .name = "CardinalityOptional", .number = GPBField_Cardinality_CardinalityOptional },
|
"ardinalityRequired\000CardinalityRepeated\000";
|
||||||
{ .name = "CardinalityRequired", .number = GPBField_Cardinality_CardinalityRequired },
|
static const int32_t values[] = {
|
||||||
{ .name = "CardinalityRepeated", .number = GPBField_Cardinality_CardinalityRepeated },
|
GPBField_Cardinality_CardinalityUnknown,
|
||||||
|
GPBField_Cardinality_CardinalityOptional,
|
||||||
|
GPBField_Cardinality_CardinalityRequired,
|
||||||
|
GPBField_Cardinality_CardinalityRepeated,
|
||||||
};
|
};
|
||||||
descriptor = [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GPBField_Cardinality)
|
GPBEnumDescriptor *worker =
|
||||||
values:values
|
[GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GPBField_Cardinality)
|
||||||
valueCount:sizeof(values) / sizeof(GPBMessageEnumValueDescription)
|
valueNames:valueNames
|
||||||
enumVerifier:GPBField_Cardinality_IsValidValue];
|
values:values
|
||||||
|
count:(uint32_t)(sizeof(values) / sizeof(int32_t))
|
||||||
|
enumVerifier:GPBField_Cardinality_IsValidValue];
|
||||||
|
if (!OSAtomicCompareAndSwapPtrBarrier(nil, worker, (void * volatile *)&descriptor)) {
|
||||||
|
[worker release];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return descriptor;
|
return descriptor;
|
||||||
}
|
}
|
||||||
@ -516,58 +493,48 @@ typedef struct GPBEnum__storage_ {
|
|||||||
static GPBMessageFieldDescription fields[] = {
|
static GPBMessageFieldDescription fields[] = {
|
||||||
{
|
{
|
||||||
.name = "name",
|
.name = "name",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBEnum_FieldNumber_Name,
|
.number = GPBEnum_FieldNumber_Name,
|
||||||
.hasIndex = 0,
|
.hasIndex = 0,
|
||||||
|
.offset = (uint32_t)offsetof(GPBEnum__storage_, name),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeString,
|
.dataType = GPBDataTypeString,
|
||||||
.offset = offsetof(GPBEnum__storage_, name),
|
|
||||||
.defaultValue.valueString = nil,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "enumvalueArray",
|
.name = "enumvalueArray",
|
||||||
|
.dataTypeSpecific.className = GPBStringifySymbol(GPBEnumValue),
|
||||||
.number = GPBEnum_FieldNumber_EnumvalueArray,
|
.number = GPBEnum_FieldNumber_EnumvalueArray,
|
||||||
.hasIndex = GPBNoHasBit,
|
.hasIndex = GPBNoHasBit,
|
||||||
|
.offset = (uint32_t)offsetof(GPBEnum__storage_, enumvalueArray),
|
||||||
.flags = GPBFieldRepeated,
|
.flags = GPBFieldRepeated,
|
||||||
.dataType = GPBDataTypeMessage,
|
.dataType = GPBDataTypeMessage,
|
||||||
.offset = offsetof(GPBEnum__storage_, enumvalueArray),
|
|
||||||
.defaultValue.valueMessage = nil,
|
|
||||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBEnumValue),
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "optionsArray",
|
.name = "optionsArray",
|
||||||
|
.dataTypeSpecific.className = GPBStringifySymbol(GPBOption),
|
||||||
.number = GPBEnum_FieldNumber_OptionsArray,
|
.number = GPBEnum_FieldNumber_OptionsArray,
|
||||||
.hasIndex = GPBNoHasBit,
|
.hasIndex = GPBNoHasBit,
|
||||||
|
.offset = (uint32_t)offsetof(GPBEnum__storage_, optionsArray),
|
||||||
.flags = GPBFieldRepeated,
|
.flags = GPBFieldRepeated,
|
||||||
.dataType = GPBDataTypeMessage,
|
.dataType = GPBDataTypeMessage,
|
||||||
.offset = offsetof(GPBEnum__storage_, optionsArray),
|
|
||||||
.defaultValue.valueMessage = nil,
|
|
||||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBOption),
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "sourceContext",
|
.name = "sourceContext",
|
||||||
|
.dataTypeSpecific.className = GPBStringifySymbol(GPBSourceContext),
|
||||||
.number = GPBEnum_FieldNumber_SourceContext,
|
.number = GPBEnum_FieldNumber_SourceContext,
|
||||||
.hasIndex = 3,
|
.hasIndex = 1,
|
||||||
|
.offset = (uint32_t)offsetof(GPBEnum__storage_, sourceContext),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeMessage,
|
.dataType = GPBDataTypeMessage,
|
||||||
.offset = offsetof(GPBEnum__storage_, sourceContext),
|
|
||||||
.defaultValue.valueMessage = nil,
|
|
||||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBSourceContext),
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "syntax",
|
.name = "syntax",
|
||||||
|
.dataTypeSpecific.enumDescFunc = GPBSyntax_EnumDescriptor,
|
||||||
.number = GPBEnum_FieldNumber_Syntax,
|
.number = GPBEnum_FieldNumber_Syntax,
|
||||||
.hasIndex = 4,
|
.hasIndex = 2,
|
||||||
|
.offset = (uint32_t)offsetof(GPBEnum__storage_, syntax),
|
||||||
.flags = GPBFieldOptional | GPBFieldHasEnumDescriptor,
|
.flags = GPBFieldOptional | GPBFieldHasEnumDescriptor,
|
||||||
.dataType = GPBDataTypeEnum,
|
.dataType = GPBDataTypeEnum,
|
||||||
.offset = offsetof(GPBEnum__storage_, syntax),
|
|
||||||
.defaultValue.valueEnum = GPBSyntax_SyntaxProto2,
|
|
||||||
.dataTypeSpecific.enumDescFunc = GPBSyntax_EnumDescriptor,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
GPBDescriptor *localDescriptor =
|
GPBDescriptor *localDescriptor =
|
||||||
@ -575,15 +542,9 @@ typedef struct GPBEnum__storage_ {
|
|||||||
rootClass:[GPBTypeRoot class]
|
rootClass:[GPBTypeRoot class]
|
||||||
file:GPBTypeRoot_FileDescriptor()
|
file:GPBTypeRoot_FileDescriptor()
|
||||||
fields:fields
|
fields:fields
|
||||||
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||||||
oneofs:NULL
|
|
||||||
oneofCount:0
|
|
||||||
enums:NULL
|
|
||||||
enumCount:0
|
|
||||||
ranges:NULL
|
|
||||||
rangeCount:0
|
|
||||||
storageSize:sizeof(GPBEnum__storage_)
|
storageSize:sizeof(GPBEnum__storage_)
|
||||||
wireFormat:NO];
|
flags:0];
|
||||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||||
descriptor = localDescriptor;
|
descriptor = localDescriptor;
|
||||||
}
|
}
|
||||||
@ -627,36 +588,30 @@ typedef struct GPBEnumValue__storage_ {
|
|||||||
static GPBMessageFieldDescription fields[] = {
|
static GPBMessageFieldDescription fields[] = {
|
||||||
{
|
{
|
||||||
.name = "name",
|
.name = "name",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBEnumValue_FieldNumber_Name,
|
.number = GPBEnumValue_FieldNumber_Name,
|
||||||
.hasIndex = 0,
|
.hasIndex = 0,
|
||||||
|
.offset = (uint32_t)offsetof(GPBEnumValue__storage_, name),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeString,
|
.dataType = GPBDataTypeString,
|
||||||
.offset = offsetof(GPBEnumValue__storage_, name),
|
|
||||||
.defaultValue.valueString = nil,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "number",
|
.name = "number",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBEnumValue_FieldNumber_Number,
|
.number = GPBEnumValue_FieldNumber_Number,
|
||||||
.hasIndex = 1,
|
.hasIndex = 1,
|
||||||
|
.offset = (uint32_t)offsetof(GPBEnumValue__storage_, number),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeInt32,
|
.dataType = GPBDataTypeInt32,
|
||||||
.offset = offsetof(GPBEnumValue__storage_, number),
|
|
||||||
.defaultValue.valueInt32 = 0,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "optionsArray",
|
.name = "optionsArray",
|
||||||
|
.dataTypeSpecific.className = GPBStringifySymbol(GPBOption),
|
||||||
.number = GPBEnumValue_FieldNumber_OptionsArray,
|
.number = GPBEnumValue_FieldNumber_OptionsArray,
|
||||||
.hasIndex = GPBNoHasBit,
|
.hasIndex = GPBNoHasBit,
|
||||||
|
.offset = (uint32_t)offsetof(GPBEnumValue__storage_, optionsArray),
|
||||||
.flags = GPBFieldRepeated,
|
.flags = GPBFieldRepeated,
|
||||||
.dataType = GPBDataTypeMessage,
|
.dataType = GPBDataTypeMessage,
|
||||||
.offset = offsetof(GPBEnumValue__storage_, optionsArray),
|
|
||||||
.defaultValue.valueMessage = nil,
|
|
||||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBOption),
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
GPBDescriptor *localDescriptor =
|
GPBDescriptor *localDescriptor =
|
||||||
@ -664,15 +619,9 @@ typedef struct GPBEnumValue__storage_ {
|
|||||||
rootClass:[GPBTypeRoot class]
|
rootClass:[GPBTypeRoot class]
|
||||||
file:GPBTypeRoot_FileDescriptor()
|
file:GPBTypeRoot_FileDescriptor()
|
||||||
fields:fields
|
fields:fields
|
||||||
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||||||
oneofs:NULL
|
|
||||||
oneofCount:0
|
|
||||||
enums:NULL
|
|
||||||
enumCount:0
|
|
||||||
ranges:NULL
|
|
||||||
rangeCount:0
|
|
||||||
storageSize:sizeof(GPBEnumValue__storage_)
|
storageSize:sizeof(GPBEnumValue__storage_)
|
||||||
wireFormat:NO];
|
flags:0];
|
||||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||||
descriptor = localDescriptor;
|
descriptor = localDescriptor;
|
||||||
}
|
}
|
||||||
@ -702,25 +651,21 @@ typedef struct GPBOption__storage_ {
|
|||||||
static GPBMessageFieldDescription fields[] = {
|
static GPBMessageFieldDescription fields[] = {
|
||||||
{
|
{
|
||||||
.name = "name",
|
.name = "name",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBOption_FieldNumber_Name,
|
.number = GPBOption_FieldNumber_Name,
|
||||||
.hasIndex = 0,
|
.hasIndex = 0,
|
||||||
|
.offset = (uint32_t)offsetof(GPBOption__storage_, name),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeString,
|
.dataType = GPBDataTypeString,
|
||||||
.offset = offsetof(GPBOption__storage_, name),
|
|
||||||
.defaultValue.valueString = nil,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "value",
|
.name = "value",
|
||||||
|
.dataTypeSpecific.className = GPBStringifySymbol(GPBAny),
|
||||||
.number = GPBOption_FieldNumber_Value,
|
.number = GPBOption_FieldNumber_Value,
|
||||||
.hasIndex = 1,
|
.hasIndex = 1,
|
||||||
|
.offset = (uint32_t)offsetof(GPBOption__storage_, value),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeMessage,
|
.dataType = GPBDataTypeMessage,
|
||||||
.offset = offsetof(GPBOption__storage_, value),
|
|
||||||
.defaultValue.valueMessage = nil,
|
|
||||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBAny),
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
GPBDescriptor *localDescriptor =
|
GPBDescriptor *localDescriptor =
|
||||||
@ -728,15 +673,9 @@ typedef struct GPBOption__storage_ {
|
|||||||
rootClass:[GPBTypeRoot class]
|
rootClass:[GPBTypeRoot class]
|
||||||
file:GPBTypeRoot_FileDescriptor()
|
file:GPBTypeRoot_FileDescriptor()
|
||||||
fields:fields
|
fields:fields
|
||||||
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||||||
oneofs:NULL
|
|
||||||
oneofCount:0
|
|
||||||
enums:NULL
|
|
||||||
enumCount:0
|
|
||||||
ranges:NULL
|
|
||||||
rangeCount:0
|
|
||||||
storageSize:sizeof(GPBOption__storage_)
|
storageSize:sizeof(GPBOption__storage_)
|
||||||
wireFormat:NO];
|
flags:0];
|
||||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||||
descriptor = localDescriptor;
|
descriptor = localDescriptor;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#import "GPBProtocolBuffers.h"
|
#import "GPBProtocolBuffers.h"
|
||||||
|
|
||||||
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30000
|
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30001
|
||||||
#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources.
|
#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -44,14 +44,12 @@ typedef struct GPBDoubleValue__storage_ {
|
|||||||
static GPBMessageFieldDescription fields[] = {
|
static GPBMessageFieldDescription fields[] = {
|
||||||
{
|
{
|
||||||
.name = "value",
|
.name = "value",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBDoubleValue_FieldNumber_Value,
|
.number = GPBDoubleValue_FieldNumber_Value,
|
||||||
.hasIndex = 0,
|
.hasIndex = 0,
|
||||||
|
.offset = (uint32_t)offsetof(GPBDoubleValue__storage_, value),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeDouble,
|
.dataType = GPBDataTypeDouble,
|
||||||
.offset = offsetof(GPBDoubleValue__storage_, value),
|
|
||||||
.defaultValue.valueDouble = 0,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
GPBDescriptor *localDescriptor =
|
GPBDescriptor *localDescriptor =
|
||||||
@ -59,15 +57,9 @@ typedef struct GPBDoubleValue__storage_ {
|
|||||||
rootClass:[GPBWrappersRoot class]
|
rootClass:[GPBWrappersRoot class]
|
||||||
file:GPBWrappersRoot_FileDescriptor()
|
file:GPBWrappersRoot_FileDescriptor()
|
||||||
fields:fields
|
fields:fields
|
||||||
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||||||
oneofs:NULL
|
|
||||||
oneofCount:0
|
|
||||||
enums:NULL
|
|
||||||
enumCount:0
|
|
||||||
ranges:NULL
|
|
||||||
rangeCount:0
|
|
||||||
storageSize:sizeof(GPBDoubleValue__storage_)
|
storageSize:sizeof(GPBDoubleValue__storage_)
|
||||||
wireFormat:NO];
|
flags:0];
|
||||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||||
descriptor = localDescriptor;
|
descriptor = localDescriptor;
|
||||||
}
|
}
|
||||||
@ -95,14 +87,12 @@ typedef struct GPBFloatValue__storage_ {
|
|||||||
static GPBMessageFieldDescription fields[] = {
|
static GPBMessageFieldDescription fields[] = {
|
||||||
{
|
{
|
||||||
.name = "value",
|
.name = "value",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBFloatValue_FieldNumber_Value,
|
.number = GPBFloatValue_FieldNumber_Value,
|
||||||
.hasIndex = 0,
|
.hasIndex = 0,
|
||||||
|
.offset = (uint32_t)offsetof(GPBFloatValue__storage_, value),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeFloat,
|
.dataType = GPBDataTypeFloat,
|
||||||
.offset = offsetof(GPBFloatValue__storage_, value),
|
|
||||||
.defaultValue.valueFloat = 0,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
GPBDescriptor *localDescriptor =
|
GPBDescriptor *localDescriptor =
|
||||||
@ -110,15 +100,9 @@ typedef struct GPBFloatValue__storage_ {
|
|||||||
rootClass:[GPBWrappersRoot class]
|
rootClass:[GPBWrappersRoot class]
|
||||||
file:GPBWrappersRoot_FileDescriptor()
|
file:GPBWrappersRoot_FileDescriptor()
|
||||||
fields:fields
|
fields:fields
|
||||||
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||||||
oneofs:NULL
|
|
||||||
oneofCount:0
|
|
||||||
enums:NULL
|
|
||||||
enumCount:0
|
|
||||||
ranges:NULL
|
|
||||||
rangeCount:0
|
|
||||||
storageSize:sizeof(GPBFloatValue__storage_)
|
storageSize:sizeof(GPBFloatValue__storage_)
|
||||||
wireFormat:NO];
|
flags:0];
|
||||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||||
descriptor = localDescriptor;
|
descriptor = localDescriptor;
|
||||||
}
|
}
|
||||||
@ -146,14 +130,12 @@ typedef struct GPBInt64Value__storage_ {
|
|||||||
static GPBMessageFieldDescription fields[] = {
|
static GPBMessageFieldDescription fields[] = {
|
||||||
{
|
{
|
||||||
.name = "value",
|
.name = "value",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBInt64Value_FieldNumber_Value,
|
.number = GPBInt64Value_FieldNumber_Value,
|
||||||
.hasIndex = 0,
|
.hasIndex = 0,
|
||||||
|
.offset = (uint32_t)offsetof(GPBInt64Value__storage_, value),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeInt64,
|
.dataType = GPBDataTypeInt64,
|
||||||
.offset = offsetof(GPBInt64Value__storage_, value),
|
|
||||||
.defaultValue.valueInt64 = 0LL,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
GPBDescriptor *localDescriptor =
|
GPBDescriptor *localDescriptor =
|
||||||
@ -161,15 +143,9 @@ typedef struct GPBInt64Value__storage_ {
|
|||||||
rootClass:[GPBWrappersRoot class]
|
rootClass:[GPBWrappersRoot class]
|
||||||
file:GPBWrappersRoot_FileDescriptor()
|
file:GPBWrappersRoot_FileDescriptor()
|
||||||
fields:fields
|
fields:fields
|
||||||
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||||||
oneofs:NULL
|
|
||||||
oneofCount:0
|
|
||||||
enums:NULL
|
|
||||||
enumCount:0
|
|
||||||
ranges:NULL
|
|
||||||
rangeCount:0
|
|
||||||
storageSize:sizeof(GPBInt64Value__storage_)
|
storageSize:sizeof(GPBInt64Value__storage_)
|
||||||
wireFormat:NO];
|
flags:0];
|
||||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||||
descriptor = localDescriptor;
|
descriptor = localDescriptor;
|
||||||
}
|
}
|
||||||
@ -197,14 +173,12 @@ typedef struct GPBUInt64Value__storage_ {
|
|||||||
static GPBMessageFieldDescription fields[] = {
|
static GPBMessageFieldDescription fields[] = {
|
||||||
{
|
{
|
||||||
.name = "value",
|
.name = "value",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBUInt64Value_FieldNumber_Value,
|
.number = GPBUInt64Value_FieldNumber_Value,
|
||||||
.hasIndex = 0,
|
.hasIndex = 0,
|
||||||
|
.offset = (uint32_t)offsetof(GPBUInt64Value__storage_, value),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeUInt64,
|
.dataType = GPBDataTypeUInt64,
|
||||||
.offset = offsetof(GPBUInt64Value__storage_, value),
|
|
||||||
.defaultValue.valueUInt64 = 0ULL,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
GPBDescriptor *localDescriptor =
|
GPBDescriptor *localDescriptor =
|
||||||
@ -212,15 +186,9 @@ typedef struct GPBUInt64Value__storage_ {
|
|||||||
rootClass:[GPBWrappersRoot class]
|
rootClass:[GPBWrappersRoot class]
|
||||||
file:GPBWrappersRoot_FileDescriptor()
|
file:GPBWrappersRoot_FileDescriptor()
|
||||||
fields:fields
|
fields:fields
|
||||||
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||||||
oneofs:NULL
|
|
||||||
oneofCount:0
|
|
||||||
enums:NULL
|
|
||||||
enumCount:0
|
|
||||||
ranges:NULL
|
|
||||||
rangeCount:0
|
|
||||||
storageSize:sizeof(GPBUInt64Value__storage_)
|
storageSize:sizeof(GPBUInt64Value__storage_)
|
||||||
wireFormat:NO];
|
flags:0];
|
||||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||||
descriptor = localDescriptor;
|
descriptor = localDescriptor;
|
||||||
}
|
}
|
||||||
@ -248,14 +216,12 @@ typedef struct GPBInt32Value__storage_ {
|
|||||||
static GPBMessageFieldDescription fields[] = {
|
static GPBMessageFieldDescription fields[] = {
|
||||||
{
|
{
|
||||||
.name = "value",
|
.name = "value",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBInt32Value_FieldNumber_Value,
|
.number = GPBInt32Value_FieldNumber_Value,
|
||||||
.hasIndex = 0,
|
.hasIndex = 0,
|
||||||
|
.offset = (uint32_t)offsetof(GPBInt32Value__storage_, value),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeInt32,
|
.dataType = GPBDataTypeInt32,
|
||||||
.offset = offsetof(GPBInt32Value__storage_, value),
|
|
||||||
.defaultValue.valueInt32 = 0,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
GPBDescriptor *localDescriptor =
|
GPBDescriptor *localDescriptor =
|
||||||
@ -263,15 +229,9 @@ typedef struct GPBInt32Value__storage_ {
|
|||||||
rootClass:[GPBWrappersRoot class]
|
rootClass:[GPBWrappersRoot class]
|
||||||
file:GPBWrappersRoot_FileDescriptor()
|
file:GPBWrappersRoot_FileDescriptor()
|
||||||
fields:fields
|
fields:fields
|
||||||
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||||||
oneofs:NULL
|
|
||||||
oneofCount:0
|
|
||||||
enums:NULL
|
|
||||||
enumCount:0
|
|
||||||
ranges:NULL
|
|
||||||
rangeCount:0
|
|
||||||
storageSize:sizeof(GPBInt32Value__storage_)
|
storageSize:sizeof(GPBInt32Value__storage_)
|
||||||
wireFormat:NO];
|
flags:0];
|
||||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||||
descriptor = localDescriptor;
|
descriptor = localDescriptor;
|
||||||
}
|
}
|
||||||
@ -299,14 +259,12 @@ typedef struct GPBUInt32Value__storage_ {
|
|||||||
static GPBMessageFieldDescription fields[] = {
|
static GPBMessageFieldDescription fields[] = {
|
||||||
{
|
{
|
||||||
.name = "value",
|
.name = "value",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBUInt32Value_FieldNumber_Value,
|
.number = GPBUInt32Value_FieldNumber_Value,
|
||||||
.hasIndex = 0,
|
.hasIndex = 0,
|
||||||
|
.offset = (uint32_t)offsetof(GPBUInt32Value__storage_, value),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeUInt32,
|
.dataType = GPBDataTypeUInt32,
|
||||||
.offset = offsetof(GPBUInt32Value__storage_, value),
|
|
||||||
.defaultValue.valueUInt32 = 0U,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
GPBDescriptor *localDescriptor =
|
GPBDescriptor *localDescriptor =
|
||||||
@ -314,15 +272,9 @@ typedef struct GPBUInt32Value__storage_ {
|
|||||||
rootClass:[GPBWrappersRoot class]
|
rootClass:[GPBWrappersRoot class]
|
||||||
file:GPBWrappersRoot_FileDescriptor()
|
file:GPBWrappersRoot_FileDescriptor()
|
||||||
fields:fields
|
fields:fields
|
||||||
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||||||
oneofs:NULL
|
|
||||||
oneofCount:0
|
|
||||||
enums:NULL
|
|
||||||
enumCount:0
|
|
||||||
ranges:NULL
|
|
||||||
rangeCount:0
|
|
||||||
storageSize:sizeof(GPBUInt32Value__storage_)
|
storageSize:sizeof(GPBUInt32Value__storage_)
|
||||||
wireFormat:NO];
|
flags:0];
|
||||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||||
descriptor = localDescriptor;
|
descriptor = localDescriptor;
|
||||||
}
|
}
|
||||||
@ -339,7 +291,6 @@ typedef struct GPBUInt32Value__storage_ {
|
|||||||
|
|
||||||
typedef struct GPBBoolValue__storage_ {
|
typedef struct GPBBoolValue__storage_ {
|
||||||
uint32_t _has_storage_[1];
|
uint32_t _has_storage_[1];
|
||||||
BOOL value;
|
|
||||||
} GPBBoolValue__storage_;
|
} GPBBoolValue__storage_;
|
||||||
|
|
||||||
// This method is threadsafe because it is initially called
|
// This method is threadsafe because it is initially called
|
||||||
@ -350,14 +301,12 @@ typedef struct GPBBoolValue__storage_ {
|
|||||||
static GPBMessageFieldDescription fields[] = {
|
static GPBMessageFieldDescription fields[] = {
|
||||||
{
|
{
|
||||||
.name = "value",
|
.name = "value",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBBoolValue_FieldNumber_Value,
|
.number = GPBBoolValue_FieldNumber_Value,
|
||||||
.hasIndex = 0,
|
.hasIndex = 0,
|
||||||
|
.offset = 1, // Stored in _has_storage_ to save space.
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeBool,
|
.dataType = GPBDataTypeBool,
|
||||||
.offset = offsetof(GPBBoolValue__storage_, value),
|
|
||||||
.defaultValue.valueBool = NO,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
GPBDescriptor *localDescriptor =
|
GPBDescriptor *localDescriptor =
|
||||||
@ -365,15 +314,9 @@ typedef struct GPBBoolValue__storage_ {
|
|||||||
rootClass:[GPBWrappersRoot class]
|
rootClass:[GPBWrappersRoot class]
|
||||||
file:GPBWrappersRoot_FileDescriptor()
|
file:GPBWrappersRoot_FileDescriptor()
|
||||||
fields:fields
|
fields:fields
|
||||||
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||||||
oneofs:NULL
|
|
||||||
oneofCount:0
|
|
||||||
enums:NULL
|
|
||||||
enumCount:0
|
|
||||||
ranges:NULL
|
|
||||||
rangeCount:0
|
|
||||||
storageSize:sizeof(GPBBoolValue__storage_)
|
storageSize:sizeof(GPBBoolValue__storage_)
|
||||||
wireFormat:NO];
|
flags:0];
|
||||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||||
descriptor = localDescriptor;
|
descriptor = localDescriptor;
|
||||||
}
|
}
|
||||||
@ -401,14 +344,12 @@ typedef struct GPBStringValue__storage_ {
|
|||||||
static GPBMessageFieldDescription fields[] = {
|
static GPBMessageFieldDescription fields[] = {
|
||||||
{
|
{
|
||||||
.name = "value",
|
.name = "value",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBStringValue_FieldNumber_Value,
|
.number = GPBStringValue_FieldNumber_Value,
|
||||||
.hasIndex = 0,
|
.hasIndex = 0,
|
||||||
|
.offset = (uint32_t)offsetof(GPBStringValue__storage_, value),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeString,
|
.dataType = GPBDataTypeString,
|
||||||
.offset = offsetof(GPBStringValue__storage_, value),
|
|
||||||
.defaultValue.valueString = nil,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
GPBDescriptor *localDescriptor =
|
GPBDescriptor *localDescriptor =
|
||||||
@ -416,15 +357,9 @@ typedef struct GPBStringValue__storage_ {
|
|||||||
rootClass:[GPBWrappersRoot class]
|
rootClass:[GPBWrappersRoot class]
|
||||||
file:GPBWrappersRoot_FileDescriptor()
|
file:GPBWrappersRoot_FileDescriptor()
|
||||||
fields:fields
|
fields:fields
|
||||||
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||||||
oneofs:NULL
|
|
||||||
oneofCount:0
|
|
||||||
enums:NULL
|
|
||||||
enumCount:0
|
|
||||||
ranges:NULL
|
|
||||||
rangeCount:0
|
|
||||||
storageSize:sizeof(GPBStringValue__storage_)
|
storageSize:sizeof(GPBStringValue__storage_)
|
||||||
wireFormat:NO];
|
flags:0];
|
||||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||||
descriptor = localDescriptor;
|
descriptor = localDescriptor;
|
||||||
}
|
}
|
||||||
@ -452,14 +387,12 @@ typedef struct GPBBytesValue__storage_ {
|
|||||||
static GPBMessageFieldDescription fields[] = {
|
static GPBMessageFieldDescription fields[] = {
|
||||||
{
|
{
|
||||||
.name = "value",
|
.name = "value",
|
||||||
|
.dataTypeSpecific.className = NULL,
|
||||||
.number = GPBBytesValue_FieldNumber_Value,
|
.number = GPBBytesValue_FieldNumber_Value,
|
||||||
.hasIndex = 0,
|
.hasIndex = 0,
|
||||||
|
.offset = (uint32_t)offsetof(GPBBytesValue__storage_, value),
|
||||||
.flags = GPBFieldOptional,
|
.flags = GPBFieldOptional,
|
||||||
.dataType = GPBDataTypeBytes,
|
.dataType = GPBDataTypeBytes,
|
||||||
.offset = offsetof(GPBBytesValue__storage_, value),
|
|
||||||
.defaultValue.valueData = nil,
|
|
||||||
.dataTypeSpecific.className = NULL,
|
|
||||||
.fieldOptions = NULL,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
GPBDescriptor *localDescriptor =
|
GPBDescriptor *localDescriptor =
|
||||||
@ -467,15 +400,9 @@ typedef struct GPBBytesValue__storage_ {
|
|||||||
rootClass:[GPBWrappersRoot class]
|
rootClass:[GPBWrappersRoot class]
|
||||||
file:GPBWrappersRoot_FileDescriptor()
|
file:GPBWrappersRoot_FileDescriptor()
|
||||||
fields:fields
|
fields:fields
|
||||||
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||||||
oneofs:NULL
|
|
||||||
oneofCount:0
|
|
||||||
enums:NULL
|
|
||||||
enumCount:0
|
|
||||||
ranges:NULL
|
|
||||||
rangeCount:0
|
|
||||||
storageSize:sizeof(GPBBytesValue__storage_)
|
storageSize:sizeof(GPBBytesValue__storage_)
|
||||||
wireFormat:NO];
|
flags:0];
|
||||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||||
descriptor = localDescriptor;
|
descriptor = localDescriptor;
|
||||||
}
|
}
|
||||||
|
@ -122,16 +122,6 @@ void EnumGenerator::GenerateSource(io::Printer* printer) {
|
|||||||
"\n",
|
"\n",
|
||||||
"name", name_);
|
"name", name_);
|
||||||
|
|
||||||
printer->Print(
|
|
||||||
"GPBEnumDescriptor *$name$_EnumDescriptor(void) {\n"
|
|
||||||
" static GPBEnumDescriptor *descriptor = NULL;\n"
|
|
||||||
" if (!descriptor) {\n"
|
|
||||||
" static GPBMessageEnumValueDescription values[] = {\n",
|
|
||||||
"name", name_);
|
|
||||||
printer->Indent();
|
|
||||||
printer->Indent();
|
|
||||||
printer->Indent();
|
|
||||||
|
|
||||||
// Note: For the TextFormat decode info, we can't use the enum value as
|
// Note: For the TextFormat decode info, we can't use the enum value as
|
||||||
// the key because protocol buffer enums have 'allow_alias', which lets
|
// the key because protocol buffer enums have 'allow_alias', which lets
|
||||||
// a value be used more than once. Instead, the index into the list of
|
// a value be used more than once. Instead, the index into the list of
|
||||||
@ -139,41 +129,66 @@ void EnumGenerator::GenerateSource(io::Printer* printer) {
|
|||||||
// will be zero.
|
// will be zero.
|
||||||
TextFormatDecodeData text_format_decode_data;
|
TextFormatDecodeData text_format_decode_data;
|
||||||
int enum_value_description_key = -1;
|
int enum_value_description_key = -1;
|
||||||
|
string text_blob;
|
||||||
|
|
||||||
for (int i = 0; i < all_values_.size(); i++) {
|
for (int i = 0; i < all_values_.size(); i++) {
|
||||||
++enum_value_description_key;
|
++enum_value_description_key;
|
||||||
string short_name(EnumValueShortName(all_values_[i]));
|
string short_name(EnumValueShortName(all_values_[i]));
|
||||||
printer->Print("{ .name = \"$short_name$\", .number = $name$ },\n",
|
text_blob += short_name + '\0';
|
||||||
"short_name", short_name,
|
|
||||||
"name", EnumValueName(all_values_[i]));
|
|
||||||
if (UnCamelCaseEnumShortName(short_name) != all_values_[i]->name()) {
|
if (UnCamelCaseEnumShortName(short_name) != all_values_[i]->name()) {
|
||||||
text_format_decode_data.AddString(enum_value_description_key, short_name,
|
text_format_decode_data.AddString(enum_value_description_key, short_name,
|
||||||
all_values_[i]->name());
|
all_values_[i]->name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printer->Outdent();
|
|
||||||
printer->Outdent();
|
printer->Print(
|
||||||
printer->Outdent();
|
"GPBEnumDescriptor *$name$_EnumDescriptor(void) {\n"
|
||||||
|
" static GPBEnumDescriptor *descriptor = NULL;\n"
|
||||||
|
" if (!descriptor) {\n",
|
||||||
|
"name", name_);
|
||||||
|
|
||||||
|
static const int kBytesPerLine = 40; // allow for escaping
|
||||||
|
printer->Print(
|
||||||
|
" static const char *valueNames =");
|
||||||
|
for (int i = 0; i < text_blob.size(); i += kBytesPerLine) {
|
||||||
|
printer->Print(
|
||||||
|
"\n \"$data$\"",
|
||||||
|
"data", EscapeTrigraphs(CEscape(text_blob.substr(i, kBytesPerLine))));
|
||||||
|
}
|
||||||
|
printer->Print(
|
||||||
|
";\n"
|
||||||
|
" static const int32_t values[] = {\n");
|
||||||
|
for (int i = 0; i < all_values_.size(); i++) {
|
||||||
|
printer->Print(" $name$,\n", "name", EnumValueName(all_values_[i]));
|
||||||
|
}
|
||||||
printer->Print(" };\n");
|
printer->Print(" };\n");
|
||||||
|
|
||||||
if (text_format_decode_data.num_entries() == 0) {
|
if (text_format_decode_data.num_entries() == 0) {
|
||||||
printer->Print(
|
printer->Print(
|
||||||
" descriptor = [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol($name$)\n"
|
" GPBEnumDescriptor *worker =\n"
|
||||||
" values:values\n"
|
" [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol($name$)\n"
|
||||||
" valueCount:sizeof(values) / sizeof(GPBMessageEnumValueDescription)\n"
|
" valueNames:valueNames\n"
|
||||||
" enumVerifier:$name$_IsValidValue];\n",
|
" values:values\n"
|
||||||
|
" count:(uint32_t)(sizeof(values) / sizeof(int32_t))\n"
|
||||||
|
" enumVerifier:$name$_IsValidValue];\n",
|
||||||
"name", name_);
|
"name", name_);
|
||||||
} else {
|
} else {
|
||||||
printer->Print(
|
printer->Print(
|
||||||
" static const char *extraTextFormatInfo = \"$extraTextFormatInfo$\";\n"
|
" static const char *extraTextFormatInfo = \"$extraTextFormatInfo$\";\n"
|
||||||
" descriptor = [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol($name$)\n"
|
" GPBEnumDescriptor *worker =\n"
|
||||||
" values:values\n"
|
" [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol($name$)\n"
|
||||||
" valueCount:sizeof(values) / sizeof(GPBMessageEnumValueDescription)\n"
|
" valueNames:valueNames\n"
|
||||||
" enumVerifier:$name$_IsValidValue\n"
|
" values:values\n"
|
||||||
" extraTextFormatInfo:extraTextFormatInfo];\n",
|
" count:(uint32_t)(sizeof(values) / sizeof(int32_t))\n"
|
||||||
|
" enumVerifier:$name$_IsValidValue\n"
|
||||||
|
" extraTextFormatInfo:extraTextFormatInfo];\n",
|
||||||
"name", name_,
|
"name", name_,
|
||||||
"extraTextFormatInfo", CEscape(text_format_decode_data.Data()));
|
"extraTextFormatInfo", CEscape(text_format_decode_data.Data()));
|
||||||
}
|
}
|
||||||
printer->Print(
|
printer->Print(
|
||||||
|
" if (!OSAtomicCompareAndSwapPtrBarrier(nil, worker, (void * volatile *)&descriptor)) {\n"
|
||||||
|
" [worker release];\n"
|
||||||
|
" }\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" return descriptor;\n"
|
" return descriptor;\n"
|
||||||
"}\n\n");
|
"}\n\n");
|
||||||
|
@ -59,6 +59,9 @@ void SetEnumVariables(const FieldDescriptor* descriptor,
|
|||||||
(*variables)["enum_verifier"] = type + "_IsValidValue";
|
(*variables)["enum_verifier"] = type + "_IsValidValue";
|
||||||
(*variables)["enum_desc_func"] = type + "_EnumDescriptor";
|
(*variables)["enum_desc_func"] = type + "_EnumDescriptor";
|
||||||
|
|
||||||
|
(*variables)["dataTypeSpecific_name"] = "enumDescFunc";
|
||||||
|
(*variables)["dataTypeSpecific_value"] = (*variables)["enum_desc_func"];
|
||||||
|
|
||||||
const Descriptor* msg_descriptor = descriptor->containing_type();
|
const Descriptor* msg_descriptor = descriptor->containing_type();
|
||||||
(*variables)["owning_message_class"] = ClassName(msg_descriptor);
|
(*variables)["owning_message_class"] = ClassName(msg_descriptor);
|
||||||
}
|
}
|
||||||
@ -72,13 +75,6 @@ EnumFieldGenerator::EnumFieldGenerator(const FieldDescriptor* descriptor,
|
|||||||
|
|
||||||
EnumFieldGenerator::~EnumFieldGenerator() {}
|
EnumFieldGenerator::~EnumFieldGenerator() {}
|
||||||
|
|
||||||
void EnumFieldGenerator::GenerateFieldDescriptionTypeSpecific(
|
|
||||||
io::Printer* printer) const {
|
|
||||||
printer->Print(
|
|
||||||
variables_,
|
|
||||||
" .dataTypeSpecific.enumDescFunc = $enum_desc_func$,\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
void EnumFieldGenerator::GenerateCFunctionDeclarations(
|
void EnumFieldGenerator::GenerateCFunctionDeclarations(
|
||||||
io::Printer* printer) const {
|
io::Printer* printer) const {
|
||||||
if (!HasPreservingUnknownEnumSemantics(descriptor_->file())) {
|
if (!HasPreservingUnknownEnumSemantics(descriptor_->file())) {
|
||||||
@ -145,13 +141,6 @@ void RepeatedEnumFieldGenerator::FinishInitialization(void) {
|
|||||||
"// |" + variables_["name"] + "| contains |" + variables_["storage_type"] + "|\n";
|
"// |" + variables_["name"] + "| contains |" + variables_["storage_type"] + "|\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void RepeatedEnumFieldGenerator::GenerateFieldDescriptionTypeSpecific(
|
|
||||||
io::Printer* printer) const {
|
|
||||||
printer->Print(
|
|
||||||
variables_,
|
|
||||||
" .dataTypeSpecific.enumDescFunc = $enum_desc_func$,\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace objectivec
|
} // namespace objectivec
|
||||||
} // namespace compiler
|
} // namespace compiler
|
||||||
} // namespace protobuf
|
} // namespace protobuf
|
||||||
|
@ -45,7 +45,6 @@ class EnumFieldGenerator : public SingleFieldGenerator {
|
|||||||
const Options& options);
|
const Options& options);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void GenerateFieldDescriptionTypeSpecific(io::Printer* printer) const;
|
|
||||||
virtual void GenerateCFunctionDeclarations(io::Printer* printer) const;
|
virtual void GenerateCFunctionDeclarations(io::Printer* printer) const;
|
||||||
virtual void GenerateCFunctionImplementations(io::Printer* printer) const;
|
virtual void GenerateCFunctionImplementations(io::Printer* printer) const;
|
||||||
virtual void DetermineForwardDeclarations(set<string>* fwd_decls) const;
|
virtual void DetermineForwardDeclarations(set<string>* fwd_decls) const;
|
||||||
@ -64,7 +63,6 @@ class RepeatedEnumFieldGenerator : public RepeatedFieldGenerator {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void FinishInitialization();
|
virtual void FinishInitialization();
|
||||||
virtual void GenerateFieldDescriptionTypeSpecific(io::Printer* printer) const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
RepeatedEnumFieldGenerator(const FieldDescriptor* descriptor,
|
RepeatedEnumFieldGenerator(const FieldDescriptor* descriptor,
|
||||||
|
@ -114,14 +114,14 @@ void ExtensionGenerator::GenerateStaticVariablesInitialization(
|
|||||||
|
|
||||||
printer->Print(vars,
|
printer->Print(vars,
|
||||||
"{\n"
|
"{\n"
|
||||||
" .singletonName = GPBStringifySymbol($root_class_and_method_name$),\n"
|
|
||||||
" .dataType = $extension_type$,\n"
|
|
||||||
" .extendedClass = GPBStringifySymbol($extended_type$),\n"
|
|
||||||
" .fieldNumber = $number$,\n"
|
|
||||||
" .defaultValue.$default_name$ = $default$,\n"
|
" .defaultValue.$default_name$ = $default$,\n"
|
||||||
|
" .singletonName = GPBStringifySymbol($root_class_and_method_name$),\n"
|
||||||
|
" .extendedClass = GPBStringifySymbol($extended_type$),\n"
|
||||||
" .messageOrGroupClassName = $type$,\n"
|
" .messageOrGroupClassName = $type$,\n"
|
||||||
" .options = $options$,\n"
|
|
||||||
" .enumDescriptorFunc = $enum_desc_func_name$,\n"
|
" .enumDescriptorFunc = $enum_desc_func_name$,\n"
|
||||||
|
" .fieldNumber = $number$,\n"
|
||||||
|
" .dataType = $extension_type$,\n"
|
||||||
|
" .options = $options$,\n"
|
||||||
"},\n");
|
"},\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include <google/protobuf/compiler/objectivec/objectivec_field.h>
|
#include <google/protobuf/compiler/objectivec/objectivec_field.h>
|
||||||
#include <google/protobuf/compiler/objectivec/objectivec_helpers.h>
|
#include <google/protobuf/compiler/objectivec/objectivec_helpers.h>
|
||||||
#include <google/protobuf/compiler/objectivec/objectivec_enum_field.h>
|
#include <google/protobuf/compiler/objectivec/objectivec_enum_field.h>
|
||||||
@ -75,7 +77,6 @@ void SetCommonFieldVariables(const FieldDescriptor* descriptor,
|
|||||||
(*variables)["field_number_name"] =
|
(*variables)["field_number_name"] =
|
||||||
classname + "_FieldNumber_" + capitalized_name;
|
classname + "_FieldNumber_" + capitalized_name;
|
||||||
(*variables)["field_number"] = SimpleItoa(descriptor->number());
|
(*variables)["field_number"] = SimpleItoa(descriptor->number());
|
||||||
(*variables)["has_index"] = SimpleItoa(descriptor->index());
|
|
||||||
(*variables)["field_type"] = GetCapitalizedType(descriptor);
|
(*variables)["field_type"] = GetCapitalizedType(descriptor);
|
||||||
std::vector<string> field_flags;
|
std::vector<string> field_flags;
|
||||||
if (descriptor->is_repeated()) field_flags.push_back("GPBFieldRepeated");
|
if (descriptor->is_repeated()) field_flags.push_back("GPBFieldRepeated");
|
||||||
@ -99,18 +100,9 @@ void SetCommonFieldVariables(const FieldDescriptor* descriptor,
|
|||||||
(*variables)["dataTypeSpecific_name"] = "className";
|
(*variables)["dataTypeSpecific_name"] = "className";
|
||||||
(*variables)["dataTypeSpecific_value"] = "NULL";
|
(*variables)["dataTypeSpecific_value"] = "NULL";
|
||||||
|
|
||||||
string field_options = descriptor->options().SerializeAsString();
|
(*variables)["storage_offset_value"] =
|
||||||
// Must convert to a standard byte order for packing length into
|
"(uint32_t)offsetof(" + classname + "__storage_, " + camel_case_name + ")";
|
||||||
// a cstring.
|
(*variables)["storage_offset_comment"] = "";
|
||||||
uint32 length = ghtonl(field_options.length());
|
|
||||||
if (length > 0) {
|
|
||||||
string bytes((const char*)&length, sizeof(length));
|
|
||||||
bytes.append(field_options);
|
|
||||||
string options_str = "\"" + CEscape(bytes) + "\"";
|
|
||||||
(*variables)["fieldoptions"] = "\"" + CEscape(bytes) + "\"";
|
|
||||||
} else {
|
|
||||||
(*variables)["fieldoptions"] = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clear some common things so they can be set just when needed.
|
// Clear some common things so they can be set just when needed.
|
||||||
(*variables)["storage_attribute"] = "";
|
(*variables)["storage_attribute"] = "";
|
||||||
@ -190,52 +182,54 @@ void FieldGenerator::DetermineForwardDeclarations(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FieldGenerator::GenerateFieldDescription(
|
void FieldGenerator::GenerateFieldDescription(
|
||||||
io::Printer* printer) const {
|
io::Printer* printer, bool include_default) const {
|
||||||
printer->Print(
|
// Printed in the same order as the structure decl.
|
||||||
variables_,
|
if (include_default) {
|
||||||
"{\n"
|
|
||||||
" .name = \"$name$\",\n"
|
|
||||||
" .number = $field_number_name$,\n"
|
|
||||||
" .hasIndex = $has_index$,\n"
|
|
||||||
" .flags = $fieldflags$,\n"
|
|
||||||
" .dataType = GPBDataType$field_type$,\n"
|
|
||||||
" .offset = offsetof($classname$__storage_, $name$),\n"
|
|
||||||
" .defaultValue.$default_name$ = $default$,\n");
|
|
||||||
|
|
||||||
// TODO(thomasvl): It might be useful to add a CPP wrapper to support
|
|
||||||
// compiling away the EnumDescriptors. To do that, we'd need a #if here
|
|
||||||
// to control setting the descriptor vs. the validator, and above in
|
|
||||||
// SetCommonFieldVariables() we'd want to wrap how we add
|
|
||||||
// GPBFieldHasDefaultValue to the flags.
|
|
||||||
|
|
||||||
// " .dataTypeSpecific.value* = [something],"
|
|
||||||
GenerateFieldDescriptionTypeSpecific(printer);
|
|
||||||
|
|
||||||
const string& field_options(variables_.find("fieldoptions")->second);
|
|
||||||
if (field_options.empty()) {
|
|
||||||
printer->Print(" .fieldOptions = NULL,\n");
|
|
||||||
} else {
|
|
||||||
// Can't use PrintRaw() here to get the #if/#else/#endif lines completely
|
|
||||||
// outdented because the need for indent captured on the previous
|
|
||||||
// printing of a \n and there is no way to get the current indent level
|
|
||||||
// to call the right number of Outdent()/Indents() to maintain state.
|
|
||||||
printer->Print(
|
printer->Print(
|
||||||
variables_,
|
variables_,
|
||||||
"#if GPBOBJC_INCLUDE_FIELD_OPTIONS\n"
|
"{\n"
|
||||||
" .fieldOptions = $fieldoptions$,\n"
|
" .defaultValue.$default_name$ = $default$,\n"
|
||||||
"#else\n"
|
" .core.name = \"$name$\",\n"
|
||||||
" .fieldOptions = NULL,\n"
|
" .core.dataTypeSpecific.$dataTypeSpecific_name$ = $dataTypeSpecific_value$,\n"
|
||||||
"#endif // GPBOBJC_INCLUDE_FIELD_OPTIONS\n");
|
" .core.number = $field_number_name$,\n"
|
||||||
|
" .core.hasIndex = $has_index$,\n"
|
||||||
|
" .core.offset = $storage_offset_value$,$storage_offset_comment$\n"
|
||||||
|
" .core.flags = $fieldflags$,\n"
|
||||||
|
" .core.dataType = GPBDataType$field_type$,\n"
|
||||||
|
"},\n");
|
||||||
|
} else {
|
||||||
|
printer->Print(
|
||||||
|
variables_,
|
||||||
|
"{\n"
|
||||||
|
" .name = \"$name$\",\n"
|
||||||
|
" .dataTypeSpecific.$dataTypeSpecific_name$ = $dataTypeSpecific_value$,\n"
|
||||||
|
" .number = $field_number_name$,\n"
|
||||||
|
" .hasIndex = $has_index$,\n"
|
||||||
|
" .offset = $storage_offset_value$,$storage_offset_comment$\n"
|
||||||
|
" .flags = $fieldflags$,\n"
|
||||||
|
" .dataType = GPBDataType$field_type$,\n"
|
||||||
|
"},\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
printer->Print("},\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FieldGenerator::GenerateFieldDescriptionTypeSpecific(
|
void FieldGenerator::SetRuntimeHasBit(int has_index) {
|
||||||
io::Printer* printer) const {
|
variables_["has_index"] = SimpleItoa(has_index);
|
||||||
printer->Print(
|
}
|
||||||
variables_,
|
|
||||||
" .dataTypeSpecific.$dataTypeSpecific_name$ = $dataTypeSpecific_value$,\n");
|
void FieldGenerator::SetNoHasBit(void) {
|
||||||
|
variables_["has_index"] = "GPBNoHasBit";
|
||||||
|
}
|
||||||
|
|
||||||
|
int FieldGenerator::ExtraRuntimeHasBitsNeeded(void) const {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FieldGenerator::SetExtraRuntimeHasBitsBase(int index_base) {
|
||||||
|
// NOTE: src/google/protobuf/compiler/plugin.cc makes use of cerr for some
|
||||||
|
// error cases, so it seems to be ok to use as a back door for errors.
|
||||||
|
cerr << "Error: should have overriden SetExtraRuntimeHasBitsBase()." << endl;
|
||||||
|
cerr.flush();
|
||||||
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FieldGenerator::SetOneofIndexBase(int index_base) {
|
void FieldGenerator::SetOneofIndexBase(int index_base) {
|
||||||
@ -302,6 +296,14 @@ bool SingleFieldGenerator::WantsHasProperty(void) const {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SingleFieldGenerator::RuntimeUsesHasBit(void) const {
|
||||||
|
if (descriptor_->containing_oneof() != NULL) {
|
||||||
|
// The oneof tracks what is set instead.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
ObjCObjFieldGenerator::ObjCObjFieldGenerator(const FieldDescriptor* descriptor,
|
ObjCObjFieldGenerator::ObjCObjFieldGenerator(const FieldDescriptor* descriptor,
|
||||||
const Options& options)
|
const Options& options)
|
||||||
: SingleFieldGenerator(descriptor, options) {
|
: SingleFieldGenerator(descriptor, options) {
|
||||||
@ -347,8 +349,6 @@ void ObjCObjFieldGenerator::GeneratePropertyDeclaration(
|
|||||||
RepeatedFieldGenerator::RepeatedFieldGenerator(
|
RepeatedFieldGenerator::RepeatedFieldGenerator(
|
||||||
const FieldDescriptor* descriptor, const Options& options)
|
const FieldDescriptor* descriptor, const Options& options)
|
||||||
: ObjCObjFieldGenerator(descriptor, options) {
|
: ObjCObjFieldGenerator(descriptor, options) {
|
||||||
// Repeated fields don't use the has index.
|
|
||||||
variables_["has_index"] = "GPBNoHasBit";
|
|
||||||
// Default to no comment and let the cases needing it fill it in.
|
// Default to no comment and let the cases needing it fill it in.
|
||||||
variables_["array_comment"] = "";
|
variables_["array_comment"] = "";
|
||||||
}
|
}
|
||||||
@ -402,6 +402,10 @@ bool RepeatedFieldGenerator::WantsHasProperty(void) const {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RepeatedFieldGenerator::RuntimeUsesHasBit(void) const {
|
||||||
|
return false; // The array having anything is what is used.
|
||||||
|
}
|
||||||
|
|
||||||
FieldGeneratorMap::FieldGeneratorMap(const Descriptor* descriptor,
|
FieldGeneratorMap::FieldGeneratorMap(const Descriptor* descriptor,
|
||||||
const Options& options)
|
const Options& options)
|
||||||
: descriptor_(descriptor),
|
: descriptor_(descriptor),
|
||||||
@ -432,12 +436,40 @@ const FieldGenerator& FieldGeneratorMap::get_extension(int index) const {
|
|||||||
return *extension_generators_[index];
|
return *extension_generators_[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int FieldGeneratorMap::CalculateHasBits(void) {
|
||||||
|
int total_bits = 0;
|
||||||
|
for (int i = 0; i < descriptor_->field_count(); i++) {
|
||||||
|
if (field_generators_[i]->RuntimeUsesHasBit()) {
|
||||||
|
field_generators_[i]->SetRuntimeHasBit(total_bits);
|
||||||
|
++total_bits;
|
||||||
|
} else {
|
||||||
|
field_generators_[i]->SetNoHasBit();
|
||||||
|
}
|
||||||
|
int extra_bits = field_generators_[i]->ExtraRuntimeHasBitsNeeded();
|
||||||
|
if (extra_bits) {
|
||||||
|
field_generators_[i]->SetExtraRuntimeHasBitsBase(total_bits);
|
||||||
|
total_bits += extra_bits;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return total_bits;
|
||||||
|
}
|
||||||
|
|
||||||
void FieldGeneratorMap::SetOneofIndexBase(int index_base) {
|
void FieldGeneratorMap::SetOneofIndexBase(int index_base) {
|
||||||
for (int i = 0; i < descriptor_->field_count(); i++) {
|
for (int i = 0; i < descriptor_->field_count(); i++) {
|
||||||
field_generators_[i]->SetOneofIndexBase(index_base);
|
field_generators_[i]->SetOneofIndexBase(index_base);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FieldGeneratorMap::DoesAnyFieldHaveNonZeroDefault(void) const {
|
||||||
|
for (int i = 0; i < descriptor_->field_count(); i++) {
|
||||||
|
if (HasNonZeroDefaultValue(descriptor_->field(i))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace objectivec
|
} // namespace objectivec
|
||||||
} // namespace compiler
|
} // namespace compiler
|
||||||
} // namespace protobuf
|
} // namespace protobuf
|
||||||
|
@ -61,7 +61,6 @@ class FieldGenerator {
|
|||||||
|
|
||||||
// Called by GenerateFieldDescription, exposed for classes that need custom
|
// Called by GenerateFieldDescription, exposed for classes that need custom
|
||||||
// generation.
|
// generation.
|
||||||
virtual void GenerateFieldDescriptionTypeSpecific(io::Printer* printer) const;
|
|
||||||
|
|
||||||
// Exposed for subclasses to extend, base does nothing.
|
// Exposed for subclasses to extend, base does nothing.
|
||||||
virtual void GenerateCFunctionDeclarations(io::Printer* printer) const;
|
virtual void GenerateCFunctionDeclarations(io::Printer* printer) const;
|
||||||
@ -71,9 +70,16 @@ class FieldGenerator {
|
|||||||
virtual void DetermineForwardDeclarations(set<string>* fwd_decls) const;
|
virtual void DetermineForwardDeclarations(set<string>* fwd_decls) const;
|
||||||
|
|
||||||
// Used during generation, not intended to be extended by subclasses.
|
// Used during generation, not intended to be extended by subclasses.
|
||||||
void GenerateFieldDescription(io::Printer* printer) const;
|
void GenerateFieldDescription(
|
||||||
|
io::Printer* printer, bool include_default) const;
|
||||||
void GenerateFieldNumberConstant(io::Printer* printer) const;
|
void GenerateFieldNumberConstant(io::Printer* printer) const;
|
||||||
|
|
||||||
|
// Exposed to get and set the has bits information.
|
||||||
|
virtual bool RuntimeUsesHasBit(void) const = 0;
|
||||||
|
void SetRuntimeHasBit(int has_index);
|
||||||
|
void SetNoHasBit(void);
|
||||||
|
virtual int ExtraRuntimeHasBitsNeeded(void) const;
|
||||||
|
virtual void SetExtraRuntimeHasBitsBase(int index_base);
|
||||||
void SetOneofIndexBase(int index_base);
|
void SetOneofIndexBase(int index_base);
|
||||||
|
|
||||||
string variable(const char* key) const {
|
string variable(const char* key) const {
|
||||||
@ -109,6 +115,8 @@ class SingleFieldGenerator : public FieldGenerator {
|
|||||||
|
|
||||||
virtual void GeneratePropertyImplementation(io::Printer* printer) const;
|
virtual void GeneratePropertyImplementation(io::Printer* printer) const;
|
||||||
|
|
||||||
|
virtual bool RuntimeUsesHasBit(void) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SingleFieldGenerator(const FieldDescriptor* descriptor,
|
SingleFieldGenerator(const FieldDescriptor* descriptor,
|
||||||
const Options& options);
|
const Options& options);
|
||||||
@ -143,6 +151,8 @@ class RepeatedFieldGenerator : public ObjCObjFieldGenerator {
|
|||||||
|
|
||||||
virtual void GeneratePropertyImplementation(io::Printer* printer) const;
|
virtual void GeneratePropertyImplementation(io::Printer* printer) const;
|
||||||
|
|
||||||
|
virtual bool RuntimeUsesHasBit(void) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
RepeatedFieldGenerator(const FieldDescriptor* descriptor,
|
RepeatedFieldGenerator(const FieldDescriptor* descriptor,
|
||||||
const Options& options);
|
const Options& options);
|
||||||
@ -162,8 +172,14 @@ class FieldGeneratorMap {
|
|||||||
const FieldGenerator& get(const FieldDescriptor* field) const;
|
const FieldGenerator& get(const FieldDescriptor* field) const;
|
||||||
const FieldGenerator& get_extension(int index) const;
|
const FieldGenerator& get_extension(int index) const;
|
||||||
|
|
||||||
|
// Assigns the has bits and returns the number of bits needed.
|
||||||
|
int CalculateHasBits(void);
|
||||||
|
|
||||||
void SetOneofIndexBase(int index_base);
|
void SetOneofIndexBase(int index_base);
|
||||||
|
|
||||||
|
// Check if any field of this message has a non zero default.
|
||||||
|
bool DoesAnyFieldHaveNonZeroDefault(void) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Descriptor* descriptor_;
|
const Descriptor* descriptor_;
|
||||||
scoped_array<scoped_ptr<FieldGenerator> > field_generators_;
|
scoped_array<scoped_ptr<FieldGenerator> > field_generators_;
|
||||||
|
@ -45,7 +45,7 @@ namespace protobuf {
|
|||||||
// This is also found in GPBBootstrap.h, and needs to be kept in sync. It
|
// This is also found in GPBBootstrap.h, and needs to be kept in sync. It
|
||||||
// is the version check done to ensure generated code works with the current
|
// is the version check done to ensure generated code works with the current
|
||||||
// runtime being used.
|
// runtime being used.
|
||||||
const int32 GOOGLE_PROTOBUF_OBJC_GEN_VERSION = 30000;
|
const int32 GOOGLE_PROTOBUF_OBJC_GEN_VERSION = 30001;
|
||||||
|
|
||||||
namespace compiler {
|
namespace compiler {
|
||||||
namespace objectivec {
|
namespace objectivec {
|
||||||
|
@ -220,11 +220,6 @@ string NameFromFieldDescriptor(const FieldDescriptor* field) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Escape C++ trigraphs by escaping question marks to \?
|
|
||||||
string EscapeTrigraphs(const string& to_escape) {
|
|
||||||
return StringReplace(to_escape, "?", "\\?", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PathSplit(const string& path, string* directory, string* basename) {
|
void PathSplit(const string& path, string* directory, string* basename) {
|
||||||
string::size_type last_slash = path.rfind('/');
|
string::size_type last_slash = path.rfind('/');
|
||||||
if (last_slash == string::npos) {
|
if (last_slash == string::npos) {
|
||||||
@ -264,6 +259,11 @@ bool IsSpecialName(const string& name, const string* special_names,
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
// Escape C++ trigraphs by escaping question marks to \?
|
||||||
|
string EscapeTrigraphs(const string& to_escape) {
|
||||||
|
return StringReplace(to_escape, "?", "\\?", true);
|
||||||
|
}
|
||||||
|
|
||||||
string StripProto(const string& filename) {
|
string StripProto(const string& filename) {
|
||||||
if (HasSuffixString(filename, ".protodevel")) {
|
if (HasSuffixString(filename, ".protodevel")) {
|
||||||
return StripSuffixString(filename, ".protodevel");
|
return StripSuffixString(filename, ".protodevel");
|
||||||
@ -734,7 +734,7 @@ string DefaultValue(const FieldDescriptor* field) {
|
|||||||
uint32 length = ghtonl(default_string.length());
|
uint32 length = ghtonl(default_string.length());
|
||||||
string bytes((const char*)&length, sizeof(length));
|
string bytes((const char*)&length, sizeof(length));
|
||||||
bytes.append(default_string);
|
bytes.append(default_string);
|
||||||
return "(NSData*)\"" + CEscape(bytes) + "\"";
|
return "(NSData*)\"" + EscapeTrigraphs(CEscape(bytes)) + "\"";
|
||||||
} else {
|
} else {
|
||||||
return "@\"" + EscapeTrigraphs(CEscape(default_string)) + "\"";
|
return "@\"" + EscapeTrigraphs(CEscape(default_string)) + "\"";
|
||||||
}
|
}
|
||||||
@ -751,6 +751,50 @@ string DefaultValue(const FieldDescriptor* field) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HasNonZeroDefaultValue(const FieldDescriptor* field) {
|
||||||
|
// Repeated fields don't have defaults.
|
||||||
|
if (field->is_repeated()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!field->has_default_value()) {
|
||||||
|
// No custom default set in the proto file.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Some proto file set the default to the zero value, so make sure the value
|
||||||
|
// isn't the zero case.
|
||||||
|
switch (field->cpp_type()) {
|
||||||
|
case FieldDescriptor::CPPTYPE_INT32:
|
||||||
|
return field->default_value_int32() != 0;
|
||||||
|
case FieldDescriptor::CPPTYPE_UINT32:
|
||||||
|
return field->default_value_uint32() != 0U;
|
||||||
|
case FieldDescriptor::CPPTYPE_INT64:
|
||||||
|
return field->default_value_int64() != 0LL;
|
||||||
|
case FieldDescriptor::CPPTYPE_UINT64:
|
||||||
|
return field->default_value_uint64() != 0ULL;
|
||||||
|
case FieldDescriptor::CPPTYPE_DOUBLE:
|
||||||
|
return field->default_value_double() != 0.0;
|
||||||
|
case FieldDescriptor::CPPTYPE_FLOAT:
|
||||||
|
return field->default_value_float() != 0.0f;
|
||||||
|
case FieldDescriptor::CPPTYPE_BOOL:
|
||||||
|
return field->default_value_bool();
|
||||||
|
case FieldDescriptor::CPPTYPE_STRING: {
|
||||||
|
const string& default_string = field->default_value_string();
|
||||||
|
return default_string.length() != 0;
|
||||||
|
}
|
||||||
|
case FieldDescriptor::CPPTYPE_ENUM:
|
||||||
|
return field->default_value_enum()->number() != 0;
|
||||||
|
case FieldDescriptor::CPPTYPE_MESSAGE:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Some compilers report reaching end of function even though all cases of
|
||||||
|
// the enum are handed in the switch.
|
||||||
|
GOOGLE_LOG(FATAL) << "Can't get here.";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
string BuildFlagsString(const vector<string>& strings) {
|
string BuildFlagsString(const vector<string>& strings) {
|
||||||
if (strings.size() == 0) {
|
if (strings.size() == 0) {
|
||||||
return "0";
|
return "0";
|
||||||
|
@ -48,6 +48,9 @@ struct Options {
|
|||||||
string expected_prefixes_path;
|
string expected_prefixes_path;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Escape C++ trigraphs by escaping question marks to "\?".
|
||||||
|
string EscapeTrigraphs(const string& to_escape);
|
||||||
|
|
||||||
// Strips ".proto" or ".protodevel" from the end of a filename.
|
// Strips ".proto" or ".protodevel" from the end of a filename.
|
||||||
string StripProto(const string& filename);
|
string StripProto(const string& filename);
|
||||||
|
|
||||||
@ -143,6 +146,7 @@ bool IsReferenceType(const FieldDescriptor* field);
|
|||||||
|
|
||||||
string GPBGenericValueFieldName(const FieldDescriptor* field);
|
string GPBGenericValueFieldName(const FieldDescriptor* field);
|
||||||
string DefaultValue(const FieldDescriptor* field);
|
string DefaultValue(const FieldDescriptor* field);
|
||||||
|
bool HasNonZeroDefaultValue(const FieldDescriptor* field);
|
||||||
|
|
||||||
string BuildFlagsString(const vector<string>& strings);
|
string BuildFlagsString(const vector<string>& strings);
|
||||||
|
|
||||||
|
@ -140,13 +140,18 @@ MapFieldGenerator::MapFieldGenerator(const FieldDescriptor* descriptor,
|
|||||||
value_field_generator_->variable("storage_type") + "*>";
|
value_field_generator_->variable("storage_type") + "*>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variables_["dataTypeSpecific_name"] =
|
||||||
|
value_field_generator_->variable("dataTypeSpecific_name");
|
||||||
|
variables_["dataTypeSpecific_value"] =
|
||||||
|
value_field_generator_->variable("dataTypeSpecific_value");
|
||||||
}
|
}
|
||||||
|
|
||||||
MapFieldGenerator::~MapFieldGenerator() {}
|
MapFieldGenerator::~MapFieldGenerator() {}
|
||||||
|
|
||||||
void MapFieldGenerator::FinishInitialization(void) {
|
void MapFieldGenerator::FinishInitialization(void) {
|
||||||
RepeatedFieldGenerator::FinishInitialization();
|
RepeatedFieldGenerator::FinishInitialization();
|
||||||
// Use the array_comment suport in RepeatedFieldGenerator to output what the
|
// Use the array_comment support in RepeatedFieldGenerator to output what the
|
||||||
// values in the map are.
|
// values in the map are.
|
||||||
const FieldDescriptor* value_descriptor =
|
const FieldDescriptor* value_descriptor =
|
||||||
descriptor_->message_type()->FindFieldByName("value");
|
descriptor_->message_type()->FindFieldByName("value");
|
||||||
@ -156,13 +161,6 @@ void MapFieldGenerator::FinishInitialization(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapFieldGenerator::GenerateFieldDescriptionTypeSpecific(
|
|
||||||
io::Printer* printer) const {
|
|
||||||
// Relay it to the value generator to provide enum validator, message
|
|
||||||
// class, etc.
|
|
||||||
value_field_generator_->GenerateFieldDescriptionTypeSpecific(printer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapFieldGenerator::DetermineForwardDeclarations(
|
void MapFieldGenerator::DetermineForwardDeclarations(
|
||||||
set<string>* fwd_decls) const {
|
set<string>* fwd_decls) const {
|
||||||
RepeatedFieldGenerator::DetermineForwardDeclarations(fwd_decls);
|
RepeatedFieldGenerator::DetermineForwardDeclarations(fwd_decls);
|
||||||
|
@ -46,7 +46,6 @@ class MapFieldGenerator : public RepeatedFieldGenerator {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void FinishInitialization(void);
|
virtual void FinishInitialization(void);
|
||||||
virtual void GenerateFieldDescriptionTypeSpecific(io::Printer* printer) const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MapFieldGenerator(const FieldDescriptor* descriptor, const Options& options);
|
MapFieldGenerator(const FieldDescriptor* descriptor, const Options& options);
|
||||||
|
@ -66,11 +66,12 @@ int OrderGroupForFieldDescriptor(const FieldDescriptor* descriptor) {
|
|||||||
// The first item in the object structure is our uint32[] for has bits.
|
// The first item in the object structure is our uint32[] for has bits.
|
||||||
// We then want to order things to make the instances as small as
|
// We then want to order things to make the instances as small as
|
||||||
// possible. So we follow the has bits with:
|
// possible. So we follow the has bits with:
|
||||||
// 1. Bools (1 byte)
|
// 1. Anything always 4 bytes - float, *32, enums
|
||||||
// 2. Anything always 4 bytes - float, *32, enums
|
// 2. Anything that is always a pointer (they will be 8 bytes on 64 bit
|
||||||
// 3. Anything that is always a pointer (they will be 8 bytes on 64 bit
|
|
||||||
// builds and 4 bytes on 32bit builds.
|
// builds and 4 bytes on 32bit builds.
|
||||||
// 4. Anything always 8 bytes - double, *64
|
// 3. Anything always 8 bytes - double, *64
|
||||||
|
//
|
||||||
|
// NOTE: Bools aren't listed, they were stored in the has bits.
|
||||||
//
|
//
|
||||||
// Why? Using 64bit builds as an example, this means worse case, we have
|
// Why? Using 64bit builds as an example, this means worse case, we have
|
||||||
// enough bools that we overflow 1 byte from 4 byte alignment, so 3 bytes
|
// enough bools that we overflow 1 byte from 4 byte alignment, so 3 bytes
|
||||||
@ -115,9 +116,9 @@ int OrderGroupForFieldDescriptor(const FieldDescriptor* descriptor) {
|
|||||||
case FieldDescriptor::TYPE_ENUM:
|
case FieldDescriptor::TYPE_ENUM:
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
// 1 byte.
|
// 0 bytes. Stored in the has bits.
|
||||||
case FieldDescriptor::TYPE_BOOL:
|
case FieldDescriptor::TYPE_BOOL:
|
||||||
return 1;
|
return 99; // End of the list (doesn't really matter).
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some compilers report reaching end of function even though all cases of
|
// Some compilers report reaching end of function even though all cases of
|
||||||
@ -404,32 +405,28 @@ void MessageGenerator::GenerateSource(io::Printer* printer) {
|
|||||||
sort(sorted_extensions.begin(), sorted_extensions.end(),
|
sort(sorted_extensions.begin(), sorted_extensions.end(),
|
||||||
ExtensionRangeOrdering());
|
ExtensionRangeOrdering());
|
||||||
|
|
||||||
// TODO(thomasvl): Finish optimizing has bit. The current behavior is as
|
// Assign has bits:
|
||||||
// follows:
|
// 1. FieldGeneratorMap::CalculateHasBits() loops through the fields seeing
|
||||||
// 1. objectivec_field.cc's SetCommonFieldVariables() defaults the has_index
|
// who needs has bits and assigning them.
|
||||||
// to the field's index in the list of fields.
|
// 2. FieldGenerator::SetOneofIndexBase() overrides has_bit with a negative
|
||||||
// 2. RepeatedFieldGenerator::RepeatedFieldGenerator() sets has_index to
|
// index that groups all the elements in the oneof.
|
||||||
// GPBNoHasBit because repeated fields & map<> fields don't use the has
|
size_t num_has_bits = field_generators_.CalculateHasBits();
|
||||||
// bit.
|
|
||||||
// 3. FieldGenerator::SetOneofIndexBase() overrides has_bit with a negative
|
|
||||||
// index that groups all the elements on of the oneof.
|
|
||||||
// So in has_storage, we need enough bits for the single fields that aren't
|
|
||||||
// in any oneof, and then one int32 for each oneof (to store the field
|
|
||||||
// number). So we could save a little space by not using the field's index
|
|
||||||
// and instead make a second pass only assigning indexes for the fields
|
|
||||||
// that would need it. The only savings would come when messages have over
|
|
||||||
// a multiple of 32 fields with some number being repeated or in oneofs to
|
|
||||||
// drop the count below that 32 multiple; so it hasn't seemed worth doing
|
|
||||||
// at the moment.
|
|
||||||
size_t num_has_bits = descriptor_->field_count();
|
|
||||||
size_t sizeof_has_storage = (num_has_bits + 31) / 32;
|
size_t sizeof_has_storage = (num_has_bits + 31) / 32;
|
||||||
|
if (sizeof_has_storage == 0) {
|
||||||
|
// In the case where no field needs has bits, don't let the _has_storage_
|
||||||
|
// end up as zero length (zero length arrays are sort of a grey area
|
||||||
|
// since it has to be at the start of the struct). This also ensures a
|
||||||
|
// field with only oneofs keeps the required negative indices they need.
|
||||||
|
sizeof_has_storage = 1;
|
||||||
|
}
|
||||||
// Tell all the fields the oneof base.
|
// Tell all the fields the oneof base.
|
||||||
for (vector<OneofGenerator*>::iterator iter = oneof_generators_.begin();
|
for (vector<OneofGenerator*>::iterator iter = oneof_generators_.begin();
|
||||||
iter != oneof_generators_.end(); ++iter) {
|
iter != oneof_generators_.end(); ++iter) {
|
||||||
(*iter)->SetOneofIndexBase(sizeof_has_storage);
|
(*iter)->SetOneofIndexBase(sizeof_has_storage);
|
||||||
}
|
}
|
||||||
field_generators_.SetOneofIndexBase(sizeof_has_storage);
|
field_generators_.SetOneofIndexBase(sizeof_has_storage);
|
||||||
// Add an int32 for each oneof to store which is set.
|
// sizeof_has_storage needs enough bits for the single fields that aren't in
|
||||||
|
// any oneof, and then one int32 for each oneof (to store the field number).
|
||||||
sizeof_has_storage += descriptor_->oneof_decl_count();
|
sizeof_has_storage += descriptor_->oneof_decl_count();
|
||||||
|
|
||||||
printer->Print(
|
printer->Print(
|
||||||
@ -456,47 +453,26 @@ void MessageGenerator::GenerateSource(io::Printer* printer) {
|
|||||||
" static GPBDescriptor *descriptor = nil;\n"
|
" static GPBDescriptor *descriptor = nil;\n"
|
||||||
" if (!descriptor) {\n");
|
" if (!descriptor) {\n");
|
||||||
|
|
||||||
bool has_oneofs = oneof_generators_.size();
|
|
||||||
if (has_oneofs) {
|
|
||||||
printer->Print(
|
|
||||||
" static GPBMessageOneofDescription oneofs[] = {\n");
|
|
||||||
printer->Indent();
|
|
||||||
printer->Indent();
|
|
||||||
printer->Indent();
|
|
||||||
for (vector<OneofGenerator*>::iterator iter = oneof_generators_.begin();
|
|
||||||
iter != oneof_generators_.end(); ++iter) {
|
|
||||||
(*iter)->GenerateDescription(printer);
|
|
||||||
}
|
|
||||||
printer->Outdent();
|
|
||||||
printer->Outdent();
|
|
||||||
printer->Outdent();
|
|
||||||
printer->Print(
|
|
||||||
" };\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
TextFormatDecodeData text_format_decode_data;
|
TextFormatDecodeData text_format_decode_data;
|
||||||
bool has_fields = descriptor_->field_count() > 0;
|
bool has_fields = descriptor_->field_count() > 0;
|
||||||
|
bool need_defaults = field_generators_.DoesAnyFieldHaveNonZeroDefault();
|
||||||
|
string field_description_type;
|
||||||
|
if (need_defaults) {
|
||||||
|
field_description_type = "GPBMessageFieldDescriptionWithDefault";
|
||||||
|
} else {
|
||||||
|
field_description_type = "GPBMessageFieldDescription";
|
||||||
|
}
|
||||||
if (has_fields) {
|
if (has_fields) {
|
||||||
// TODO(thomasvl): The plugin's FieldGenerator::GenerateFieldDescription()
|
|
||||||
// wraps the fieldOptions's value of this structure in an CPP gate so
|
|
||||||
// they can be compiled away; but that still results in a const char* in
|
|
||||||
// the structure for a NULL pointer for every message field. If the
|
|
||||||
// fieldOptions are moved to a separate payload like the TextFormat extra
|
|
||||||
// data is, then it would shrink that static data shrinking the binaries
|
|
||||||
// a little more.
|
|
||||||
// TODO(thomasvl): proto3 syntax doens't need a defaultValue in the
|
|
||||||
// structure because primitive types are always zero. If we add a second
|
|
||||||
// structure and a different initializer, we can avoid the wasted static
|
|
||||||
// storage for every field in a proto3 message.
|
|
||||||
printer->Print(
|
printer->Print(
|
||||||
" static GPBMessageFieldDescription fields[] = {\n");
|
" static $field_description_type$ fields[] = {\n",
|
||||||
|
"field_description_type", field_description_type);
|
||||||
printer->Indent();
|
printer->Indent();
|
||||||
printer->Indent();
|
printer->Indent();
|
||||||
printer->Indent();
|
printer->Indent();
|
||||||
for (int i = 0; i < descriptor_->field_count(); ++i) {
|
for (int i = 0; i < descriptor_->field_count(); ++i) {
|
||||||
const FieldGenerator& field_generator =
|
const FieldGenerator& field_generator =
|
||||||
field_generators_.get(sorted_fields[i]);
|
field_generators_.get(sorted_fields[i]);
|
||||||
field_generator.GenerateFieldDescription(printer);
|
field_generator.GenerateFieldDescription(printer, need_defaults);
|
||||||
if (field_generator.needs_textformat_name_support()) {
|
if (field_generator.needs_textformat_name_support()) {
|
||||||
text_format_decode_data.AddString(sorted_fields[i]->number(),
|
text_format_decode_data.AddString(sorted_fields[i]->number(),
|
||||||
field_generator.generated_objc_name(),
|
field_generator.generated_objc_name(),
|
||||||
@ -510,111 +486,89 @@ void MessageGenerator::GenerateSource(io::Printer* printer) {
|
|||||||
" };\n");
|
" };\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool has_enums = enum_generators_.size();
|
|
||||||
if (has_enums) {
|
|
||||||
printer->Print(
|
|
||||||
" static GPBMessageEnumDescription enums[] = {\n");
|
|
||||||
printer->Indent();
|
|
||||||
printer->Indent();
|
|
||||||
printer->Indent();
|
|
||||||
for (vector<EnumGenerator*>::iterator iter = enum_generators_.begin();
|
|
||||||
iter != enum_generators_.end(); ++iter) {
|
|
||||||
printer->Print("{ .enumDescriptorFunc = $name$_EnumDescriptor },\n",
|
|
||||||
"name", (*iter)->name());
|
|
||||||
}
|
|
||||||
printer->Outdent();
|
|
||||||
printer->Outdent();
|
|
||||||
printer->Outdent();
|
|
||||||
printer->Print(
|
|
||||||
" };\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool has_extensions = sorted_extensions.size();
|
|
||||||
if (has_extensions) {
|
|
||||||
printer->Print(
|
|
||||||
" static GPBExtensionRange ranges[] = {\n");
|
|
||||||
printer->Indent();
|
|
||||||
printer->Indent();
|
|
||||||
printer->Indent();
|
|
||||||
for (int i = 0; i < sorted_extensions.size(); i++) {
|
|
||||||
printer->Print("{ .start = $start$, .end = $end$ },\n",
|
|
||||||
"start", SimpleItoa(sorted_extensions[i]->start),
|
|
||||||
"end", SimpleItoa(sorted_extensions[i]->end));
|
|
||||||
}
|
|
||||||
printer->Outdent();
|
|
||||||
printer->Outdent();
|
|
||||||
printer->Outdent();
|
|
||||||
printer->Print(
|
|
||||||
" };\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
map<string, string> vars;
|
map<string, string> vars;
|
||||||
vars["classname"] = class_name_;
|
vars["classname"] = class_name_;
|
||||||
vars["rootclassname"] = root_classname_;
|
vars["rootclassname"] = root_classname_;
|
||||||
vars["fields"] = has_fields ? "fields" : "NULL";
|
vars["fields"] = has_fields ? "fields" : "NULL";
|
||||||
vars["fields_count"] =
|
if (has_fields) {
|
||||||
has_fields ? "sizeof(fields) / sizeof(GPBMessageFieldDescription)" : "0";
|
vars["fields_count"] =
|
||||||
vars["oneofs"] = has_oneofs ? "oneofs" : "NULL";
|
"(uint32_t)(sizeof(fields) / sizeof(" + field_description_type + "))";
|
||||||
vars["oneof_count"] =
|
|
||||||
has_oneofs ? "sizeof(oneofs) / sizeof(GPBMessageOneofDescription)" : "0";
|
|
||||||
vars["enums"] = has_enums ? "enums" : "NULL";
|
|
||||||
vars["enum_count"] =
|
|
||||||
has_enums ? "sizeof(enums) / sizeof(GPBMessageEnumDescription)" : "0";
|
|
||||||
vars["ranges"] = has_extensions ? "ranges" : "NULL";
|
|
||||||
vars["range_count"] =
|
|
||||||
has_extensions ? "sizeof(ranges) / sizeof(GPBExtensionRange)" : "0";
|
|
||||||
vars["wireformat"] =
|
|
||||||
descriptor_->options().message_set_wire_format() ? "YES" : "NO";
|
|
||||||
|
|
||||||
if (text_format_decode_data.num_entries() == 0) {
|
|
||||||
printer->Print(
|
|
||||||
vars,
|
|
||||||
" GPBDescriptor *localDescriptor =\n"
|
|
||||||
" [GPBDescriptor allocDescriptorForClass:[$classname$ class]\n"
|
|
||||||
" rootClass:[$rootclassname$ class]\n"
|
|
||||||
" file:$rootclassname$_FileDescriptor()\n"
|
|
||||||
" fields:$fields$\n"
|
|
||||||
" fieldCount:$fields_count$\n"
|
|
||||||
" oneofs:$oneofs$\n"
|
|
||||||
" oneofCount:$oneof_count$\n"
|
|
||||||
" enums:$enums$\n"
|
|
||||||
" enumCount:$enum_count$\n"
|
|
||||||
" ranges:$ranges$\n"
|
|
||||||
" rangeCount:$range_count$\n"
|
|
||||||
" storageSize:sizeof($classname$__storage_)\n"
|
|
||||||
" wireFormat:$wireformat$];\n");
|
|
||||||
} else {
|
} else {
|
||||||
vars["extraTextFormatInfo"] = CEscape(text_format_decode_data.Data());
|
vars["fields_count"] = "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<string> init_flags;
|
||||||
|
if (need_defaults) {
|
||||||
|
init_flags.push_back("GPBDescriptorInitializationFlag_FieldsWithDefault");
|
||||||
|
}
|
||||||
|
if (descriptor_->options().message_set_wire_format()) {
|
||||||
|
init_flags.push_back("GPBDescriptorInitializationFlag_WireFormat");
|
||||||
|
}
|
||||||
|
vars["init_flags"] = BuildFlagsString(init_flags);
|
||||||
|
|
||||||
|
printer->Print(
|
||||||
|
vars,
|
||||||
|
" GPBDescriptor *localDescriptor =\n"
|
||||||
|
" [GPBDescriptor allocDescriptorForClass:[$classname$ class]\n"
|
||||||
|
" rootClass:[$rootclassname$ class]\n"
|
||||||
|
" file:$rootclassname$_FileDescriptor()\n"
|
||||||
|
" fields:$fields$\n"
|
||||||
|
" fieldCount:$fields_count$\n"
|
||||||
|
" storageSize:sizeof($classname$__storage_)\n"
|
||||||
|
" flags:$init_flags$];\n");
|
||||||
|
if (oneof_generators_.size() != 0) {
|
||||||
printer->Print(
|
printer->Print(
|
||||||
vars,
|
" static const char *oneofs[] = {\n");
|
||||||
"#if GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS\n"
|
for (vector<OneofGenerator*>::iterator iter = oneof_generators_.begin();
|
||||||
" const char *extraTextFormatInfo = NULL;\n"
|
iter != oneof_generators_.end(); ++iter) {
|
||||||
"#else\n"
|
printer->Print(
|
||||||
" static const char *extraTextFormatInfo = \"$extraTextFormatInfo$\";\n"
|
" \"$name$\",\n",
|
||||||
"#endif // GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS\n"
|
"name", (*iter)->DescriptorName());
|
||||||
" GPBDescriptor *localDescriptor =\n"
|
|
||||||
" [GPBDescriptor allocDescriptorForClass:[$classname$ class]\n"
|
|
||||||
" rootClass:[$rootclassname$ class]\n"
|
|
||||||
" file:$rootclassname$_FileDescriptor()\n"
|
|
||||||
" fields:$fields$\n"
|
|
||||||
" fieldCount:$fields_count$\n"
|
|
||||||
" oneofs:$oneofs$\n"
|
|
||||||
" oneofCount:$oneof_count$\n"
|
|
||||||
" enums:$enums$\n"
|
|
||||||
" enumCount:$enum_count$\n"
|
|
||||||
" ranges:$ranges$\n"
|
|
||||||
" rangeCount:$range_count$\n"
|
|
||||||
" storageSize:sizeof($classname$__storage_)\n"
|
|
||||||
" wireFormat:$wireformat$\n"
|
|
||||||
" extraTextFormatInfo:extraTextFormatInfo];\n");
|
|
||||||
}
|
}
|
||||||
printer->Print(
|
printer->Print(
|
||||||
" NSAssert(descriptor == nil, @\"Startup recursed!\");\n"
|
" };\n"
|
||||||
" descriptor = localDescriptor;\n"
|
" [localDescriptor setupOneofs:oneofs\n"
|
||||||
" }\n"
|
" count:(uint32_t)(sizeof(oneofs) / sizeof(char*))\n"
|
||||||
" return descriptor;\n"
|
" firstHasIndex:$first_has_index$];\n",
|
||||||
"}\n\n"
|
"first_has_index", oneof_generators_[0]->HasIndexAsString());
|
||||||
"@end\n\n");
|
}
|
||||||
|
if (text_format_decode_data.num_entries() != 0) {
|
||||||
|
const string text_format_data_str(text_format_decode_data.Data());
|
||||||
|
printer->Print(
|
||||||
|
"#if !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS\n"
|
||||||
|
" static const char *extraTextFormatInfo =");
|
||||||
|
static const int kBytesPerLine = 40; // allow for escaping
|
||||||
|
for (int i = 0; i < text_format_data_str.size(); i += kBytesPerLine) {
|
||||||
|
printer->Print(
|
||||||
|
"\n \"$data$\"",
|
||||||
|
"data", EscapeTrigraphs(
|
||||||
|
CEscape(text_format_data_str.substr(i, kBytesPerLine))));
|
||||||
|
}
|
||||||
|
printer->Print(
|
||||||
|
";\n"
|
||||||
|
" [localDescriptor setupExtraTextInfo:extraTextFormatInfo];\n"
|
||||||
|
"#endif // !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS\n");
|
||||||
|
}
|
||||||
|
if (sorted_extensions.size() != 0) {
|
||||||
|
printer->Print(
|
||||||
|
" static const GPBExtensionRange ranges[] = {\n");
|
||||||
|
for (int i = 0; i < sorted_extensions.size(); i++) {
|
||||||
|
printer->Print(" { .start = $start$, .end = $end$ },\n",
|
||||||
|
"start", SimpleItoa(sorted_extensions[i]->start),
|
||||||
|
"end", SimpleItoa(sorted_extensions[i]->end));
|
||||||
|
}
|
||||||
|
printer->Print(
|
||||||
|
" };\n"
|
||||||
|
" [localDescriptor setupExtensionRanges:ranges\n"
|
||||||
|
" count:(uint32_t)(sizeof(ranges) / sizeof(GPBExtensionRange))];\n");
|
||||||
|
}
|
||||||
|
printer->Print(
|
||||||
|
" NSAssert(descriptor == nil, @\"Startup recursed!\");\n"
|
||||||
|
" descriptor = localDescriptor;\n"
|
||||||
|
" }\n"
|
||||||
|
" return descriptor;\n"
|
||||||
|
"}\n\n"
|
||||||
|
"@end\n\n");
|
||||||
|
|
||||||
for (int i = 0; i < descriptor_->field_count(); i++) {
|
for (int i = 0; i < descriptor_->field_count(); i++) {
|
||||||
field_generators_.get(descriptor_->field(i))
|
field_generators_.get(descriptor_->field(i))
|
||||||
|
@ -120,17 +120,16 @@ void OneofGenerator::GenerateClearFunctionImplementation(io::Printer* printer) {
|
|||||||
"void $owning_message_class$_Clear$capitalized_name$OneOfCase($owning_message_class$ *message) {\n"
|
"void $owning_message_class$_Clear$capitalized_name$OneOfCase($owning_message_class$ *message) {\n"
|
||||||
" GPBDescriptor *descriptor = [message descriptor];\n"
|
" GPBDescriptor *descriptor = [message descriptor];\n"
|
||||||
" GPBOneofDescriptor *oneof = descriptor->oneofs_[$raw_index$];\n"
|
" GPBOneofDescriptor *oneof = descriptor->oneofs_[$raw_index$];\n"
|
||||||
" GPBMaybeClearOneof(message, oneof, 0);\n"
|
" GPBMaybeClearOneof(message, oneof, $index$, 0);\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OneofGenerator::GenerateDescription(io::Printer* printer) {
|
string OneofGenerator::DescriptorName(void) const {
|
||||||
printer->Print(
|
return variables_.find("name")->second;
|
||||||
variables_,
|
}
|
||||||
"{\n"
|
|
||||||
" .name = \"$name$\",\n"
|
string OneofGenerator::HasIndexAsString(void) const {
|
||||||
" .index = $index$,\n"
|
return variables_.find("index")->second;
|
||||||
"},\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace objectivec
|
} // namespace objectivec
|
||||||
|
@ -61,7 +61,9 @@ class OneofGenerator {
|
|||||||
|
|
||||||
void GeneratePropertyImplementation(io::Printer* printer);
|
void GeneratePropertyImplementation(io::Printer* printer);
|
||||||
void GenerateClearFunctionImplementation(io::Printer* printer);
|
void GenerateClearFunctionImplementation(io::Printer* printer);
|
||||||
void GenerateDescription(io::Printer* printer);
|
|
||||||
|
string DescriptorName(void) const;
|
||||||
|
string HasIndexAsString(void) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const OneofDescriptor* descriptor_;
|
const OneofDescriptor* descriptor_;
|
||||||
|
@ -134,6 +134,32 @@ PrimitiveFieldGenerator::PrimitiveFieldGenerator(
|
|||||||
|
|
||||||
PrimitiveFieldGenerator::~PrimitiveFieldGenerator() {}
|
PrimitiveFieldGenerator::~PrimitiveFieldGenerator() {}
|
||||||
|
|
||||||
|
void PrimitiveFieldGenerator::GenerateFieldStorageDeclaration(
|
||||||
|
io::Printer* printer) const {
|
||||||
|
if (GetObjectiveCType(descriptor_) == OBJECTIVECTYPE_BOOLEAN) {
|
||||||
|
// Nothing, BOOLs are stored in the has bits.
|
||||||
|
} else {
|
||||||
|
SingleFieldGenerator::GenerateFieldStorageDeclaration(printer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int PrimitiveFieldGenerator::ExtraRuntimeHasBitsNeeded(void) const {
|
||||||
|
if (GetObjectiveCType(descriptor_) == OBJECTIVECTYPE_BOOLEAN) {
|
||||||
|
// Reserve a bit for the storage of the boolean.
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PrimitiveFieldGenerator::SetExtraRuntimeHasBitsBase(int has_base) {
|
||||||
|
if (GetObjectiveCType(descriptor_) == OBJECTIVECTYPE_BOOLEAN) {
|
||||||
|
// Set into the offset the has bit to use for the actual value.
|
||||||
|
variables_["storage_offset_value"] = SimpleItoa(has_base);
|
||||||
|
variables_["storage_offset_comment"] =
|
||||||
|
" // Stored in _has_storage_ to save space.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PrimitiveObjFieldGenerator::PrimitiveObjFieldGenerator(
|
PrimitiveObjFieldGenerator::PrimitiveObjFieldGenerator(
|
||||||
const FieldDescriptor* descriptor, const Options& options)
|
const FieldDescriptor* descriptor, const Options& options)
|
||||||
: ObjCObjFieldGenerator(descriptor, options) {
|
: ObjCObjFieldGenerator(descriptor, options) {
|
||||||
|
@ -49,6 +49,11 @@ class PrimitiveFieldGenerator : public SingleFieldGenerator {
|
|||||||
const Options& options);
|
const Options& options);
|
||||||
virtual ~PrimitiveFieldGenerator();
|
virtual ~PrimitiveFieldGenerator();
|
||||||
|
|
||||||
|
virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const;
|
||||||
|
|
||||||
|
virtual int ExtraRuntimeHasBitsNeeded(void) const;
|
||||||
|
virtual void SetExtraRuntimeHasBitsBase(int index_base);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveFieldGenerator);
|
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveFieldGenerator);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user