+12
-5
lines changedFilter options
+12
-5
lines changed Original file line number Diff line number Diff line change
@@ -173,7 +173,8 @@ __attribute__((objc_subclassing_restricted))
173
173
/** Whether this field is required. Only valid for proto2 fields. */
174
174
@property(nonatomic, readonly, getter=isRequired) BOOL required;
175
175
/** Whether this field is optional. */
176
-
@property(nonatomic, readonly, getter=isOptional) BOOL optional;
176
+
@property(nonatomic, readonly, getter=isOptional) BOOL optional DEPRECATED_MSG_ATTRIBUTE(
177
+
"Check if fieldType is GPBFieldTypeSingle and that it is NOT required.");
177
178
/** Type of field (single, repeated, map). */
178
179
@property(nonatomic, readonly) GPBFieldType fieldType;
179
180
/** Type of the key if the field is a map. The value's type is -dataType. */
Original file line number Diff line number Diff line change
@@ -142,11 +142,14 @@ + (instancetype)allocDescriptorForClass:(Class)messageClass
142
142
#if defined(DEBUG) && DEBUG && !defined(NS_BLOCK_ASSERTIONS)
143
143
// No real value in checking all the fields individually, just check the combined flags at the
144
144
// end.
145
+
#pragma clang diagnostic push
146
+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
145
147
GPBFieldFlags unknownFieldFlags =
146
148
(GPBFieldFlags)(~(GPBFieldRequired | GPBFieldRepeated | GPBFieldPacked | GPBFieldOptional |
147
149
GPBFieldHasDefaultValue | GPBFieldClearHasIvarOnZero |
148
150
GPBFieldTextFormatNameCustom | GPBFieldMapKeyMask));
149
151
NSAssert((mergedFieldFlags & unknownFieldFlags) == 0, @"Internal error: unknown field flags set");
152
+
#pragma clang diagnostic pop
150
153
#endif // defined(DEBUG) && DEBUG
151
154
152
155
BOOL wireFormat = (flags & GPBDescriptorInitializationFlag_WireFormat) != 0;
@@ -611,9 +614,12 @@ - (BOOL)isRequired {
611
614
return (description_->flags & GPBFieldRequired) != 0;
612
615
}
613
616
617
+
#pragma clang diagnostic push
618
+
#pragma clang diagnostic ignored "-Wdeprecated-implementations"
614
619
- (BOOL)isOptional {
615
-
return (description_->flags & GPBFieldOptional) != 0;
620
+
return self.fieldType == GPBFieldTypeSingle && !self.isRequired;
616
621
}
622
+
#pragma clang diagnostic pop
617
623
618
624
- (GPBFieldType)fieldType {
619
625
GPBFieldFlags flags = description_->flags;
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ typedef NS_OPTIONS(uint16_t, GPBFieldFlags) {
19
19
GPBFieldRequired = 1 << 0,
20
20
GPBFieldRepeated = 1 << 1,
21
21
GPBFieldPacked = 1 << 2,
22
-
GPBFieldOptional = 1 << 3,
22
+
GPBFieldOptional __attribute__((deprecated)) = 1 << 3,
23
23
GPBFieldHasDefaultValue = 1 << 4,
24
24
25
25
// Indicate that the field should "clear" when set to zero value. This is the
Original file line number Diff line number Diff line change
@@ -1428,8 +1428,6 @@ - (BOOL)isInitialized {
1428
1428
return NO;
1429
1429
}
1430
1430
} else {
1431
-
NSAssert(field.isOptional, @"%@: Single message field %@ not required or optional?",
1432
-
[self class], field.name);
1433
1431
if (GPBGetHasIvarField(self, field)) {
1434
1432
GPBMessage *message = GPBGetMessageMessageField(self, field);
1435
1433
if (!message.initialized) {
Original file line number Diff line number Diff line change
@@ -138,6 +138,7 @@ typedef GPB_ENUM(Message30007_SubMessage_FieldNumber) {
138
138
NS_ASSUME_NONNULL_END
139
139
140
140
#pragma clang diagnostic push
141
+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
141
142
#pragma clang diagnostic ignored "-Wdollar-in-identifier-extension"
142
143
143
144
GPBObjCClassDeclaration(Message30007);
Original file line number Diff line number Diff line change
@@ -137,6 +137,7 @@ typedef GPB_ENUM(Message40310_SubMessage_FieldNumber) {
137
137
NS_ASSUME_NONNULL_END
138
138
139
139
#pragma clang diagnostic push
140
+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
140
141
#pragma clang diagnostic ignored "-Wdollar-in-identifier-extension"
141
142
142
143
GPBObjCClassDeclaration(Message40310);
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4