]> git.saurik.com Git - apple/security.git/blob - keychain/securityd/SecDbKeychainV7-protobufs/generated_source/SecDbKeychainSerializedMetadataKey.m
Security-59754.60.13.tar.gz
[apple/security.git] / keychain / securityd / SecDbKeychainV7-protobufs / generated_source / SecDbKeychainSerializedMetadataKey.m
1 // This file was automatically generated by protocompiler
2 // DO NOT EDIT!
3 // Compiled from SecDbKeychainSerializedMetadataKey.proto
4
5 #import "SecDbKeychainSerializedMetadataKey.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 SecDbKeychainSerializedMetadataKey
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 != 0;
29 }
30 @synthesize actualKeyclass = _actualKeyclass;
31 - (void)setActualKeyclass:(int32_t)v
32 {
33 _has.actualKeyclass = YES;
34 _actualKeyclass = v;
35 }
36 - (void)setHasActualKeyclass:(BOOL)f
37 {
38 _has.actualKeyclass = f;
39 }
40 - (BOOL)hasActualKeyclass
41 {
42 return _has.actualKeyclass != 0;
43 }
44 - (BOOL)hasBaguuid
45 {
46 return _baguuid != nil;
47 }
48 @synthesize baguuid = _baguuid;
49 - (BOOL)hasAkswrappedkey
50 {
51 return _akswrappedkey != nil;
52 }
53 @synthesize akswrappedkey = _akswrappedkey;
54 - (BOOL)hasBackupwrappedkey
55 {
56 return _backupwrappedkey != nil;
57 }
58 @synthesize backupwrappedkey = _backupwrappedkey;
59
60 - (NSString *)description
61 {
62 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
63 }
64
65 - (NSDictionary *)dictionaryRepresentation
66 {
67 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
68 if (self->_has.keyclass)
69 {
70 [dict setObject:[NSNumber numberWithInt:self->_keyclass] forKey:@"keyclass"];
71 }
72 if (self->_has.actualKeyclass)
73 {
74 [dict setObject:[NSNumber numberWithInt:self->_actualKeyclass] forKey:@"actualKeyclass"];
75 }
76 if (self->_baguuid)
77 {
78 [dict setObject:self->_baguuid forKey:@"baguuid"];
79 }
80 if (self->_akswrappedkey)
81 {
82 [dict setObject:self->_akswrappedkey forKey:@"akswrappedkey"];
83 }
84 if (self->_backupwrappedkey)
85 {
86 [dict setObject:self->_backupwrappedkey forKey:@"backupwrappedkey"];
87 }
88 return dict;
89 }
90
91 BOOL SecDbKeychainSerializedMetadataKeyReadFrom(__unsafe_unretained SecDbKeychainSerializedMetadataKey *self, __unsafe_unretained PBDataReader *reader) {
92 while (PBReaderHasMoreData(reader)) {
93 uint32_t tag = 0;
94 uint8_t aType = 0;
95
96 PBReaderReadTag32AndType(reader, &tag, &aType);
97
98 if (PBReaderHasError(reader))
99 break;
100
101 if (aType == TYPE_END_GROUP) {
102 break;
103 }
104
105 switch (tag) {
106
107 case 1 /* keyclass */:
108 {
109 self->_has.keyclass = YES;
110 self->_keyclass = PBReaderReadInt32(reader);
111 }
112 break;
113 case 2 /* actualKeyclass */:
114 {
115 self->_has.actualKeyclass = YES;
116 self->_actualKeyclass = PBReaderReadInt32(reader);
117 }
118 break;
119 case 3 /* baguuid */:
120 {
121 NSData *new_baguuid = PBReaderReadData(reader);
122 self->_baguuid = new_baguuid;
123 }
124 break;
125 case 4 /* akswrappedkey */:
126 {
127 NSData *new_akswrappedkey = PBReaderReadData(reader);
128 self->_akswrappedkey = new_akswrappedkey;
129 }
130 break;
131 case 5 /* backupwrappedkey */:
132 {
133 NSData *new_backupwrappedkey = PBReaderReadData(reader);
134 self->_backupwrappedkey = new_backupwrappedkey;
135 }
136 break;
137 default:
138 if (!PBReaderSkipValueWithTag(reader, tag, aType))
139 return NO;
140 break;
141 }
142 }
143 return !PBReaderHasError(reader);
144 }
145
146 - (BOOL)readFrom:(PBDataReader *)reader
147 {
148 return SecDbKeychainSerializedMetadataKeyReadFrom(self, reader);
149 }
150 - (void)writeTo:(PBDataWriter *)writer
151 {
152 /* keyclass */
153 {
154 if (self->_has.keyclass)
155 {
156 PBDataWriterWriteInt32Field(writer, self->_keyclass, 1);
157 }
158 }
159 /* actualKeyclass */
160 {
161 if (self->_has.actualKeyclass)
162 {
163 PBDataWriterWriteInt32Field(writer, self->_actualKeyclass, 2);
164 }
165 }
166 /* baguuid */
167 {
168 if (self->_baguuid)
169 {
170 PBDataWriterWriteDataField(writer, self->_baguuid, 3);
171 }
172 }
173 /* akswrappedkey */
174 {
175 if (self->_akswrappedkey)
176 {
177 PBDataWriterWriteDataField(writer, self->_akswrappedkey, 4);
178 }
179 }
180 /* backupwrappedkey */
181 {
182 if (self->_backupwrappedkey)
183 {
184 PBDataWriterWriteDataField(writer, self->_backupwrappedkey, 5);
185 }
186 }
187 }
188
189 - (void)copyTo:(SecDbKeychainSerializedMetadataKey *)other
190 {
191 if (self->_has.keyclass)
192 {
193 other->_keyclass = _keyclass;
194 other->_has.keyclass = YES;
195 }
196 if (self->_has.actualKeyclass)
197 {
198 other->_actualKeyclass = _actualKeyclass;
199 other->_has.actualKeyclass = YES;
200 }
201 if (_baguuid)
202 {
203 other.baguuid = _baguuid;
204 }
205 if (_akswrappedkey)
206 {
207 other.akswrappedkey = _akswrappedkey;
208 }
209 if (_backupwrappedkey)
210 {
211 other.backupwrappedkey = _backupwrappedkey;
212 }
213 }
214
215 - (id)copyWithZone:(NSZone *)zone
216 {
217 SecDbKeychainSerializedMetadataKey *copy = [[[self class] allocWithZone:zone] init];
218 if (self->_has.keyclass)
219 {
220 copy->_keyclass = _keyclass;
221 copy->_has.keyclass = YES;
222 }
223 if (self->_has.actualKeyclass)
224 {
225 copy->_actualKeyclass = _actualKeyclass;
226 copy->_has.actualKeyclass = YES;
227 }
228 copy->_baguuid = [_baguuid copyWithZone:zone];
229 copy->_akswrappedkey = [_akswrappedkey copyWithZone:zone];
230 copy->_backupwrappedkey = [_backupwrappedkey copyWithZone:zone];
231 return copy;
232 }
233
234 - (BOOL)isEqual:(id)object
235 {
236 SecDbKeychainSerializedMetadataKey *other = (SecDbKeychainSerializedMetadataKey *)object;
237 return [other isMemberOfClass:[self class]]
238 &&
239 ((self->_has.keyclass && other->_has.keyclass && self->_keyclass == other->_keyclass) || (!self->_has.keyclass && !other->_has.keyclass))
240 &&
241 ((self->_has.actualKeyclass && other->_has.actualKeyclass && self->_actualKeyclass == other->_actualKeyclass) || (!self->_has.actualKeyclass && !other->_has.actualKeyclass))
242 &&
243 ((!self->_baguuid && !other->_baguuid) || [self->_baguuid isEqual:other->_baguuid])
244 &&
245 ((!self->_akswrappedkey && !other->_akswrappedkey) || [self->_akswrappedkey isEqual:other->_akswrappedkey])
246 &&
247 ((!self->_backupwrappedkey && !other->_backupwrappedkey) || [self->_backupwrappedkey isEqual:other->_backupwrappedkey])
248 ;
249 }
250
251 - (NSUInteger)hash
252 {
253 return 0
254 ^
255 (self->_has.keyclass ? PBHashInt((NSUInteger)self->_keyclass) : 0)
256 ^
257 (self->_has.actualKeyclass ? PBHashInt((NSUInteger)self->_actualKeyclass) : 0)
258 ^
259 [self->_baguuid hash]
260 ^
261 [self->_akswrappedkey hash]
262 ^
263 [self->_backupwrappedkey hash]
264 ;
265 }
266
267 - (void)mergeFrom:(SecDbKeychainSerializedMetadataKey *)other
268 {
269 if (other->_has.keyclass)
270 {
271 self->_keyclass = other->_keyclass;
272 self->_has.keyclass = YES;
273 }
274 if (other->_has.actualKeyclass)
275 {
276 self->_actualKeyclass = other->_actualKeyclass;
277 self->_has.actualKeyclass = YES;
278 }
279 if (other->_baguuid)
280 {
281 [self setBaguuid:other->_baguuid];
282 }
283 if (other->_akswrappedkey)
284 {
285 [self setAkswrappedkey:other->_akswrappedkey];
286 }
287 if (other->_backupwrappedkey)
288 {
289 [self setBackupwrappedkey:other->_backupwrappedkey];
290 }
291 }
292
293 @end
294