1 // This file was automatically generated by protocompiler
3 // Compiled from SecDbKeychainSerializedMetadataKey.proto
5 #import "SecDbKeychainSerializedMetadataKey.h"
6 #import <ProtocolBuffer/PBConstants.h>
7 #import <ProtocolBuffer/PBHashUtil.h>
8 #import <ProtocolBuffer/PBDataReader.h>
10 #if !__has_feature(objc_arc)
11 # error This generated file depends on ARC but it is not enabled; turn on ARC, or use 'objc_use_arc' option to generate non-ARC code.
14 @implementation SecDbKeychainSerializedMetadataKey
16 @synthesize keyclass = _keyclass;
17 - (void)setKeyclass:(int32_t)v
22 - (void)setHasKeyclass:(BOOL)f
28 return _has.keyclass != 0;
30 @synthesize actualKeyclass = _actualKeyclass;
31 - (void)setActualKeyclass:(int32_t)v
33 _has.actualKeyclass = YES;
36 - (void)setHasActualKeyclass:(BOOL)f
38 _has.actualKeyclass = f;
40 - (BOOL)hasActualKeyclass
42 return _has.actualKeyclass != 0;
46 return _baguuid != nil;
48 @synthesize baguuid = _baguuid;
49 - (BOOL)hasAkswrappedkey
51 return _akswrappedkey != nil;
53 @synthesize akswrappedkey = _akswrappedkey;
54 - (BOOL)hasBackupwrappedkey
56 return _backupwrappedkey != nil;
58 @synthesize backupwrappedkey = _backupwrappedkey;
60 - (NSString *)description
62 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
65 - (NSDictionary *)dictionaryRepresentation
67 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
68 if (self->_has.keyclass)
70 [dict setObject:[NSNumber numberWithInt:self->_keyclass] forKey:@"keyclass"];
72 if (self->_has.actualKeyclass)
74 [dict setObject:[NSNumber numberWithInt:self->_actualKeyclass] forKey:@"actualKeyclass"];
78 [dict setObject:self->_baguuid forKey:@"baguuid"];
80 if (self->_akswrappedkey)
82 [dict setObject:self->_akswrappedkey forKey:@"akswrappedkey"];
84 if (self->_backupwrappedkey)
86 [dict setObject:self->_backupwrappedkey forKey:@"backupwrappedkey"];
91 BOOL SecDbKeychainSerializedMetadataKeyReadFrom(__unsafe_unretained SecDbKeychainSerializedMetadataKey *self, __unsafe_unretained PBDataReader *reader) {
92 while (PBReaderHasMoreData(reader)) {
96 PBReaderReadTag32AndType(reader, &tag, &aType);
98 if (PBReaderHasError(reader))
101 if (aType == TYPE_END_GROUP) {
107 case 1 /* keyclass */:
109 self->_has.keyclass = YES;
110 self->_keyclass = PBReaderReadInt32(reader);
113 case 2 /* actualKeyclass */:
115 self->_has.actualKeyclass = YES;
116 self->_actualKeyclass = PBReaderReadInt32(reader);
119 case 3 /* baguuid */:
121 NSData *new_baguuid = PBReaderReadData(reader);
122 self->_baguuid = new_baguuid;
125 case 4 /* akswrappedkey */:
127 NSData *new_akswrappedkey = PBReaderReadData(reader);
128 self->_akswrappedkey = new_akswrappedkey;
131 case 5 /* backupwrappedkey */:
133 NSData *new_backupwrappedkey = PBReaderReadData(reader);
134 self->_backupwrappedkey = new_backupwrappedkey;
138 if (!PBReaderSkipValueWithTag(reader, tag, aType))
143 return !PBReaderHasError(reader);
146 - (BOOL)readFrom:(PBDataReader *)reader
148 return SecDbKeychainSerializedMetadataKeyReadFrom(self, reader);
150 - (void)writeTo:(PBDataWriter *)writer
154 if (self->_has.keyclass)
156 PBDataWriterWriteInt32Field(writer, self->_keyclass, 1);
161 if (self->_has.actualKeyclass)
163 PBDataWriterWriteInt32Field(writer, self->_actualKeyclass, 2);
170 PBDataWriterWriteDataField(writer, self->_baguuid, 3);
175 if (self->_akswrappedkey)
177 PBDataWriterWriteDataField(writer, self->_akswrappedkey, 4);
180 /* backupwrappedkey */
182 if (self->_backupwrappedkey)
184 PBDataWriterWriteDataField(writer, self->_backupwrappedkey, 5);
189 - (void)copyTo:(SecDbKeychainSerializedMetadataKey *)other
191 if (self->_has.keyclass)
193 other->_keyclass = _keyclass;
194 other->_has.keyclass = YES;
196 if (self->_has.actualKeyclass)
198 other->_actualKeyclass = _actualKeyclass;
199 other->_has.actualKeyclass = YES;
203 other.baguuid = _baguuid;
207 other.akswrappedkey = _akswrappedkey;
209 if (_backupwrappedkey)
211 other.backupwrappedkey = _backupwrappedkey;
215 - (id)copyWithZone:(NSZone *)zone
217 SecDbKeychainSerializedMetadataKey *copy = [[[self class] allocWithZone:zone] init];
218 if (self->_has.keyclass)
220 copy->_keyclass = _keyclass;
221 copy->_has.keyclass = YES;
223 if (self->_has.actualKeyclass)
225 copy->_actualKeyclass = _actualKeyclass;
226 copy->_has.actualKeyclass = YES;
228 copy->_baguuid = [_baguuid copyWithZone:zone];
229 copy->_akswrappedkey = [_akswrappedkey copyWithZone:zone];
230 copy->_backupwrappedkey = [_backupwrappedkey copyWithZone:zone];
234 - (BOOL)isEqual:(id)object
236 SecDbKeychainSerializedMetadataKey *other = (SecDbKeychainSerializedMetadataKey *)object;
237 return [other isMemberOfClass:[self class]]
239 ((self->_has.keyclass && other->_has.keyclass && self->_keyclass == other->_keyclass) || (!self->_has.keyclass && !other->_has.keyclass))
241 ((self->_has.actualKeyclass && other->_has.actualKeyclass && self->_actualKeyclass == other->_actualKeyclass) || (!self->_has.actualKeyclass && !other->_has.actualKeyclass))
243 ((!self->_baguuid && !other->_baguuid) || [self->_baguuid isEqual:other->_baguuid])
245 ((!self->_akswrappedkey && !other->_akswrappedkey) || [self->_akswrappedkey isEqual:other->_akswrappedkey])
247 ((!self->_backupwrappedkey && !other->_backupwrappedkey) || [self->_backupwrappedkey isEqual:other->_backupwrappedkey])
255 (self->_has.keyclass ? PBHashInt((NSUInteger)self->_keyclass) : 0)
257 (self->_has.actualKeyclass ? PBHashInt((NSUInteger)self->_actualKeyclass) : 0)
259 [self->_baguuid hash]
261 [self->_akswrappedkey hash]
263 [self->_backupwrappedkey hash]
267 - (void)mergeFrom:(SecDbKeychainSerializedMetadataKey *)other
269 if (other->_has.keyclass)
271 self->_keyclass = other->_keyclass;
272 self->_has.keyclass = YES;
274 if (other->_has.actualKeyclass)
276 self->_actualKeyclass = other->_actualKeyclass;
277 self->_has.actualKeyclass = YES;
281 [self setBaguuid:other->_baguuid];
283 if (other->_akswrappedkey)
285 [self setAkswrappedkey:other->_akswrappedkey];
287 if (other->_backupwrappedkey)
289 [self setBackupwrappedkey:other->_backupwrappedkey];