]> git.saurik.com Git - apple/security.git/blob - OSX/sec/securityd/SecDbBackupManager-protobufs/generated_source/SecDbBackupMetadataClassKey.m
Security-59306.11.20.tar.gz
[apple/security.git] / OSX / sec / securityd / SecDbBackupManager-protobufs / generated_source / SecDbBackupMetadataClassKey.m
1 // This file was automatically generated by protocompiler
2 // DO NOT EDIT!
3 // Compiled from SecDbBackupRecoverySet.proto
4
5 #import "SecDbBackupMetadataClassKey.h"
6 #import <ProtocolBuffer/PBConstants.h>
7 #import <ProtocolBuffer/PBHashUtil.h>
8 #import <ProtocolBuffer/PBDataReader.h>
9
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.
12 #endif
13
14 @implementation SecDbBackupMetadataClassKey
15
16 @synthesize keyClass = _keyClass;
17 - (void)setKeyClass:(int32_t)v
18 {
19 _has.keyClass = YES;
20 _keyClass = v;
21 }
22 - (void)setHasKeyClass:(BOOL)f
23 {
24 _has.keyClass = f;
25 }
26 - (BOOL)hasKeyClass
27 {
28 return _has.keyClass;
29 }
30 - (BOOL)hasBackupWrappedMetadataKey
31 {
32 return _backupWrappedMetadataKey != nil;
33 }
34 @synthesize backupWrappedMetadataKey = _backupWrappedMetadataKey;
35
36 - (NSString *)description
37 {
38 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
39 }
40
41 - (NSDictionary *)dictionaryRepresentation
42 {
43 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
44 if (self->_has.keyClass)
45 {
46 [dict setObject:[NSNumber numberWithInt:self->_keyClass] forKey:@"keyClass"];
47 }
48 if (self->_backupWrappedMetadataKey)
49 {
50 [dict setObject:self->_backupWrappedMetadataKey forKey:@"backupWrappedMetadataKey"];
51 }
52 return dict;
53 }
54
55 BOOL SecDbBackupMetadataClassKeyReadFrom(__unsafe_unretained SecDbBackupMetadataClassKey *self, __unsafe_unretained PBDataReader *reader) {
56 while (PBReaderHasMoreData(reader)) {
57 uint32_t tag = 0;
58 uint8_t aType = 0;
59
60 PBReaderReadTag32AndType(reader, &tag, &aType);
61
62 if (PBReaderHasError(reader))
63 break;
64
65 if (aType == TYPE_END_GROUP) {
66 break;
67 }
68
69 switch (tag) {
70
71 case 1 /* keyClass */:
72 {
73 self->_has.keyClass = YES;
74 self->_keyClass = PBReaderReadInt32(reader);
75 }
76 break;
77 case 2 /* backupWrappedMetadataKey */:
78 {
79 NSData *new_backupWrappedMetadataKey = PBReaderReadData(reader);
80 self->_backupWrappedMetadataKey = new_backupWrappedMetadataKey;
81 }
82 break;
83 default:
84 if (!PBReaderSkipValueWithTag(reader, tag, aType))
85 return NO;
86 break;
87 }
88 }
89 return !PBReaderHasError(reader);
90 }
91
92 - (BOOL)readFrom:(PBDataReader *)reader
93 {
94 return SecDbBackupMetadataClassKeyReadFrom(self, reader);
95 }
96 - (void)writeTo:(PBDataWriter *)writer
97 {
98 /* keyClass */
99 {
100 if (self->_has.keyClass)
101 {
102 PBDataWriterWriteInt32Field(writer, self->_keyClass, 1);
103 }
104 }
105 /* backupWrappedMetadataKey */
106 {
107 if (self->_backupWrappedMetadataKey)
108 {
109 PBDataWriterWriteDataField(writer, self->_backupWrappedMetadataKey, 2);
110 }
111 }
112 }
113
114 - (void)copyTo:(SecDbBackupMetadataClassKey *)other
115 {
116 if (self->_has.keyClass)
117 {
118 other->_keyClass = _keyClass;
119 other->_has.keyClass = YES;
120 }
121 if (_backupWrappedMetadataKey)
122 {
123 other.backupWrappedMetadataKey = _backupWrappedMetadataKey;
124 }
125 }
126
127 - (id)copyWithZone:(NSZone *)zone
128 {
129 SecDbBackupMetadataClassKey *copy = [[[self class] allocWithZone:zone] init];
130 if (self->_has.keyClass)
131 {
132 copy->_keyClass = _keyClass;
133 copy->_has.keyClass = YES;
134 }
135 copy->_backupWrappedMetadataKey = [_backupWrappedMetadataKey copyWithZone:zone];
136 return copy;
137 }
138
139 - (BOOL)isEqual:(id)object
140 {
141 SecDbBackupMetadataClassKey *other = (SecDbBackupMetadataClassKey *)object;
142 return [other isMemberOfClass:[self class]]
143 &&
144 ((self->_has.keyClass && other->_has.keyClass && self->_keyClass == other->_keyClass) || (!self->_has.keyClass && !other->_has.keyClass))
145 &&
146 ((!self->_backupWrappedMetadataKey && !other->_backupWrappedMetadataKey) || [self->_backupWrappedMetadataKey isEqual:other->_backupWrappedMetadataKey])
147 ;
148 }
149
150 - (NSUInteger)hash
151 {
152 return 0
153 ^
154 (self->_has.keyClass ? PBHashInt((NSUInteger)self->_keyClass) : 0)
155 ^
156 [self->_backupWrappedMetadataKey hash]
157 ;
158 }
159
160 - (void)mergeFrom:(SecDbBackupMetadataClassKey *)other
161 {
162 if (other->_has.keyClass)
163 {
164 self->_keyClass = other->_keyClass;
165 self->_has.keyClass = YES;
166 }
167 if (other->_backupWrappedMetadataKey)
168 {
169 [self setBackupWrappedMetadataKey:other->_backupWrappedMetadataKey];
170 }
171 }
172
173 @end
174