1 // This file was automatically generated by protocompiler
3 // Compiled from SecDbBackupRecoverySet.proto
5 #import "SecDbBackupMetadataClassKey.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 SecDbBackupMetadataClassKey
16 @synthesize keyClass = _keyClass;
17 - (void)setKeyClass:(int32_t)v
22 - (void)setHasKeyClass:(BOOL)f
30 - (BOOL)hasBackupWrappedMetadataKey
32 return _backupWrappedMetadataKey != nil;
34 @synthesize backupWrappedMetadataKey = _backupWrappedMetadataKey;
36 - (NSString *)description
38 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
41 - (NSDictionary *)dictionaryRepresentation
43 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
44 if (self->_has.keyClass)
46 [dict setObject:[NSNumber numberWithInt:self->_keyClass] forKey:@"keyClass"];
48 if (self->_backupWrappedMetadataKey)
50 [dict setObject:self->_backupWrappedMetadataKey forKey:@"backupWrappedMetadataKey"];
55 BOOL SecDbBackupMetadataClassKeyReadFrom(__unsafe_unretained SecDbBackupMetadataClassKey *self, __unsafe_unretained PBDataReader *reader) {
56 while (PBReaderHasMoreData(reader)) {
60 PBReaderReadTag32AndType(reader, &tag, &aType);
62 if (PBReaderHasError(reader))
65 if (aType == TYPE_END_GROUP) {
71 case 1 /* keyClass */:
73 self->_has.keyClass = YES;
74 self->_keyClass = PBReaderReadInt32(reader);
77 case 2 /* backupWrappedMetadataKey */:
79 NSData *new_backupWrappedMetadataKey = PBReaderReadData(reader);
80 self->_backupWrappedMetadataKey = new_backupWrappedMetadataKey;
84 if (!PBReaderSkipValueWithTag(reader, tag, aType))
89 return !PBReaderHasError(reader);
92 - (BOOL)readFrom:(PBDataReader *)reader
94 return SecDbBackupMetadataClassKeyReadFrom(self, reader);
96 - (void)writeTo:(PBDataWriter *)writer
100 if (self->_has.keyClass)
102 PBDataWriterWriteInt32Field(writer, self->_keyClass, 1);
105 /* backupWrappedMetadataKey */
107 if (self->_backupWrappedMetadataKey)
109 PBDataWriterWriteDataField(writer, self->_backupWrappedMetadataKey, 2);
114 - (void)copyTo:(SecDbBackupMetadataClassKey *)other
116 if (self->_has.keyClass)
118 other->_keyClass = _keyClass;
119 other->_has.keyClass = YES;
121 if (_backupWrappedMetadataKey)
123 other.backupWrappedMetadataKey = _backupWrappedMetadataKey;
127 - (id)copyWithZone:(NSZone *)zone
129 SecDbBackupMetadataClassKey *copy = [[[self class] allocWithZone:zone] init];
130 if (self->_has.keyClass)
132 copy->_keyClass = _keyClass;
133 copy->_has.keyClass = YES;
135 copy->_backupWrappedMetadataKey = [_backupWrappedMetadataKey copyWithZone:zone];
139 - (BOOL)isEqual:(id)object
141 SecDbBackupMetadataClassKey *other = (SecDbBackupMetadataClassKey *)object;
142 return [other isMemberOfClass:[self class]]
144 ((self->_has.keyClass && other->_has.keyClass && self->_keyClass == other->_keyClass) || (!self->_has.keyClass && !other->_has.keyClass))
146 ((!self->_backupWrappedMetadataKey && !other->_backupWrappedMetadataKey) || [self->_backupWrappedMetadataKey isEqual:other->_backupWrappedMetadataKey])
154 (self->_has.keyClass ? PBHashInt((NSUInteger)self->_keyClass) : 0)
156 [self->_backupWrappedMetadataKey hash]
160 - (void)mergeFrom:(SecDbBackupMetadataClassKey *)other
162 if (other->_has.keyClass)
164 self->_keyClass = other->_keyClass;
165 self->_has.keyClass = YES;
167 if (other->_backupWrappedMetadataKey)
169 [self setBackupWrappedMetadataKey:other->_backupWrappedMetadataKey];