]> git.saurik.com Git - apple/security.git/blob - keychain/analytics/C2Metric/SECC2MPDeviceInfo.m
Security-59306.11.20.tar.gz
[apple/security.git] / keychain / analytics / C2Metric / SECC2MPDeviceInfo.m
1 // This file was automatically generated by protocompiler
2 // DO NOT EDIT!
3 // Compiled from C2Metric.proto
4
5 #import "SECC2MPDeviceInfo.h"
6 #import <ProtocolBuffer/PBConstants.h>
7 #import <ProtocolBuffer/PBHashUtil.h>
8 #import <ProtocolBuffer/PBDataReader.h>
9
10 #import "SECC2MPInternalTestConfig.h"
11
12 #if !__has_feature(objc_arc)
13 # 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 #endif
15
16 @implementation SECC2MPDeviceInfo
17
18 - (BOOL)hasProductName
19 {
20 return _productName != nil;
21 }
22 @synthesize productName = _productName;
23 - (BOOL)hasProductType
24 {
25 return _productType != nil;
26 }
27 @synthesize productType = _productType;
28 - (BOOL)hasProductVersion
29 {
30 return _productVersion != nil;
31 }
32 @synthesize productVersion = _productVersion;
33 - (BOOL)hasProductBuild
34 {
35 return _productBuild != nil;
36 }
37 @synthesize productBuild = _productBuild;
38 @synthesize isAppleInternal = _isAppleInternal;
39 - (void)setIsAppleInternal:(BOOL)v
40 {
41 _has.isAppleInternal = YES;
42 _isAppleInternal = v;
43 }
44 - (void)setHasIsAppleInternal:(BOOL)f
45 {
46 _has.isAppleInternal = f;
47 }
48 - (BOOL)hasIsAppleInternal
49 {
50 return _has.isAppleInternal;
51 }
52 - (BOOL)hasProcessName
53 {
54 return _processName != nil;
55 }
56 @synthesize processName = _processName;
57 - (BOOL)hasProcessVersion
58 {
59 return _processVersion != nil;
60 }
61 @synthesize processVersion = _processVersion;
62 - (BOOL)hasProcessUuid
63 {
64 return _processUuid != nil;
65 }
66 @synthesize processUuid = _processUuid;
67 - (BOOL)hasUserDefaultTestName
68 {
69 return _userDefaultTestName != nil;
70 }
71 @synthesize userDefaultTestName = _userDefaultTestName;
72 @synthesize internalTestConfigs = _internalTestConfigs;
73 - (void)clearInternalTestConfigs
74 {
75 [_internalTestConfigs removeAllObjects];
76 }
77 - (void)addInternalTestConfig:(SECC2MPInternalTestConfig *)i
78 {
79 if (!_internalTestConfigs)
80 {
81 _internalTestConfigs = [[NSMutableArray alloc] init];
82 }
83 [_internalTestConfigs addObject:i];
84 }
85 - (NSUInteger)internalTestConfigsCount
86 {
87 return [_internalTestConfigs count];
88 }
89 - (SECC2MPInternalTestConfig *)internalTestConfigAtIndex:(NSUInteger)idx
90 {
91 return [_internalTestConfigs objectAtIndex:idx];
92 }
93 + (Class)internalTestConfigType
94 {
95 return [SECC2MPInternalTestConfig class];
96 }
97
98 - (NSString *)description
99 {
100 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
101 }
102
103 - (NSDictionary *)dictionaryRepresentation
104 {
105 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
106 if (self->_productName)
107 {
108 [dict setObject:self->_productName forKey:@"product_name"];
109 }
110 if (self->_productType)
111 {
112 [dict setObject:self->_productType forKey:@"product_type"];
113 }
114 if (self->_productVersion)
115 {
116 [dict setObject:self->_productVersion forKey:@"product_version"];
117 }
118 if (self->_productBuild)
119 {
120 [dict setObject:self->_productBuild forKey:@"product_build"];
121 }
122 if (self->_has.isAppleInternal)
123 {
124 [dict setObject:[NSNumber numberWithBool:self->_isAppleInternal] forKey:@"is_apple_internal"];
125 }
126 if (self->_processName)
127 {
128 [dict setObject:self->_processName forKey:@"process_name"];
129 }
130 if (self->_processVersion)
131 {
132 [dict setObject:self->_processVersion forKey:@"process_version"];
133 }
134 if (self->_processUuid)
135 {
136 [dict setObject:self->_processUuid forKey:@"process_uuid"];
137 }
138 if (self->_userDefaultTestName)
139 {
140 [dict setObject:self->_userDefaultTestName forKey:@"user_default_test_name"];
141 }
142 if ([self->_internalTestConfigs count])
143 {
144 NSMutableArray *internalTestConfigsDictReprs = [[NSMutableArray alloc] initWithCapacity:[self->_internalTestConfigs count]];
145 for (SECC2MPInternalTestConfig *i_internalTestConfig in self->_internalTestConfigs)
146 {
147 [internalTestConfigsDictReprs addObject:[i_internalTestConfig dictionaryRepresentation]];
148 }
149 [dict setObject:internalTestConfigsDictReprs forKey:@"internal_test_config"];
150 }
151 return dict;
152 }
153
154 BOOL SECC2MPDeviceInfoReadFrom(__unsafe_unretained SECC2MPDeviceInfo *self, __unsafe_unretained PBDataReader *reader) {
155 while (PBReaderHasMoreData(reader)) {
156 uint32_t tag = 0;
157 uint8_t aType = 0;
158
159 PBReaderReadTag32AndType(reader, &tag, &aType);
160
161 if (PBReaderHasError(reader))
162 break;
163
164 if (aType == TYPE_END_GROUP) {
165 break;
166 }
167
168 switch (tag) {
169
170 case 101 /* productName */:
171 {
172 NSString *new_productName = PBReaderReadString(reader);
173 self->_productName = new_productName;
174 }
175 break;
176 case 102 /* productType */:
177 {
178 NSString *new_productType = PBReaderReadString(reader);
179 self->_productType = new_productType;
180 }
181 break;
182 case 103 /* productVersion */:
183 {
184 NSString *new_productVersion = PBReaderReadString(reader);
185 self->_productVersion = new_productVersion;
186 }
187 break;
188 case 104 /* productBuild */:
189 {
190 NSString *new_productBuild = PBReaderReadString(reader);
191 self->_productBuild = new_productBuild;
192 }
193 break;
194 case 105 /* isAppleInternal */:
195 {
196 self->_has.isAppleInternal = YES;
197 self->_isAppleInternal = PBReaderReadBOOL(reader);
198 }
199 break;
200 case 201 /* processName */:
201 {
202 NSString *new_processName = PBReaderReadString(reader);
203 self->_processName = new_processName;
204 }
205 break;
206 case 202 /* processVersion */:
207 {
208 NSString *new_processVersion = PBReaderReadString(reader);
209 self->_processVersion = new_processVersion;
210 }
211 break;
212 case 203 /* processUuid */:
213 {
214 NSString *new_processUuid = PBReaderReadString(reader);
215 self->_processUuid = new_processUuid;
216 }
217 break;
218 case 301 /* userDefaultTestName */:
219 {
220 NSString *new_userDefaultTestName = PBReaderReadString(reader);
221 self->_userDefaultTestName = new_userDefaultTestName;
222 }
223 break;
224 case 302 /* internalTestConfigs */:
225 {
226 SECC2MPInternalTestConfig *new_internalTestConfig = [[SECC2MPInternalTestConfig alloc] init];
227 [self addInternalTestConfig:new_internalTestConfig];
228 PBDataReaderMark mark_internalTestConfig;
229 BOOL markError = !PBReaderPlaceMark(reader, &mark_internalTestConfig);
230 if (markError)
231 {
232 return NO;
233 }
234 BOOL inError = !SECC2MPInternalTestConfigReadFrom(new_internalTestConfig, reader);
235 if (inError)
236 {
237 return NO;
238 }
239 PBReaderRecallMark(reader, &mark_internalTestConfig);
240 }
241 break;
242 default:
243 if (!PBReaderSkipValueWithTag(reader, tag, aType))
244 return NO;
245 break;
246 }
247 }
248 return !PBReaderHasError(reader);
249 }
250
251 - (BOOL)readFrom:(PBDataReader *)reader
252 {
253 return SECC2MPDeviceInfoReadFrom(self, reader);
254 }
255 - (void)writeTo:(PBDataWriter *)writer
256 {
257 /* productName */
258 {
259 if (self->_productName)
260 {
261 PBDataWriterWriteStringField(writer, self->_productName, 101);
262 }
263 }
264 /* productType */
265 {
266 if (self->_productType)
267 {
268 PBDataWriterWriteStringField(writer, self->_productType, 102);
269 }
270 }
271 /* productVersion */
272 {
273 if (self->_productVersion)
274 {
275 PBDataWriterWriteStringField(writer, self->_productVersion, 103);
276 }
277 }
278 /* productBuild */
279 {
280 if (self->_productBuild)
281 {
282 PBDataWriterWriteStringField(writer, self->_productBuild, 104);
283 }
284 }
285 /* isAppleInternal */
286 {
287 if (self->_has.isAppleInternal)
288 {
289 PBDataWriterWriteBOOLField(writer, self->_isAppleInternal, 105);
290 }
291 }
292 /* processName */
293 {
294 if (self->_processName)
295 {
296 PBDataWriterWriteStringField(writer, self->_processName, 201);
297 }
298 }
299 /* processVersion */
300 {
301 if (self->_processVersion)
302 {
303 PBDataWriterWriteStringField(writer, self->_processVersion, 202);
304 }
305 }
306 /* processUuid */
307 {
308 if (self->_processUuid)
309 {
310 PBDataWriterWriteStringField(writer, self->_processUuid, 203);
311 }
312 }
313 /* userDefaultTestName */
314 {
315 if (self->_userDefaultTestName)
316 {
317 PBDataWriterWriteStringField(writer, self->_userDefaultTestName, 301);
318 }
319 }
320 /* internalTestConfigs */
321 {
322 for (SECC2MPInternalTestConfig *i_internalTestConfig in self->_internalTestConfigs)
323 {
324 PBDataWriterWriteSubmessage(writer, i_internalTestConfig, 302);
325 }
326 }
327 }
328
329 - (void)copyTo:(SECC2MPDeviceInfo *)other
330 {
331 if (_productName)
332 {
333 other.productName = _productName;
334 }
335 if (_productType)
336 {
337 other.productType = _productType;
338 }
339 if (_productVersion)
340 {
341 other.productVersion = _productVersion;
342 }
343 if (_productBuild)
344 {
345 other.productBuild = _productBuild;
346 }
347 if (self->_has.isAppleInternal)
348 {
349 other->_isAppleInternal = _isAppleInternal;
350 other->_has.isAppleInternal = YES;
351 }
352 if (_processName)
353 {
354 other.processName = _processName;
355 }
356 if (_processVersion)
357 {
358 other.processVersion = _processVersion;
359 }
360 if (_processUuid)
361 {
362 other.processUuid = _processUuid;
363 }
364 if (_userDefaultTestName)
365 {
366 other.userDefaultTestName = _userDefaultTestName;
367 }
368 if ([self internalTestConfigsCount])
369 {
370 [other clearInternalTestConfigs];
371 NSUInteger internalTestConfigsCnt = [self internalTestConfigsCount];
372 for (NSUInteger i = 0; i < internalTestConfigsCnt; i++)
373 {
374 [other addInternalTestConfig:[self internalTestConfigAtIndex:i]];
375 }
376 }
377 }
378
379 - (id)copyWithZone:(NSZone *)zone
380 {
381 SECC2MPDeviceInfo *copy = [[[self class] allocWithZone:zone] init];
382 copy->_productName = [_productName copyWithZone:zone];
383 copy->_productType = [_productType copyWithZone:zone];
384 copy->_productVersion = [_productVersion copyWithZone:zone];
385 copy->_productBuild = [_productBuild copyWithZone:zone];
386 if (self->_has.isAppleInternal)
387 {
388 copy->_isAppleInternal = _isAppleInternal;
389 copy->_has.isAppleInternal = YES;
390 }
391 copy->_processName = [_processName copyWithZone:zone];
392 copy->_processVersion = [_processVersion copyWithZone:zone];
393 copy->_processUuid = [_processUuid copyWithZone:zone];
394 copy->_userDefaultTestName = [_userDefaultTestName copyWithZone:zone];
395 for (SECC2MPInternalTestConfig *v in _internalTestConfigs)
396 {
397 SECC2MPInternalTestConfig *vCopy = [v copyWithZone:zone];
398 [copy addInternalTestConfig:vCopy];
399 }
400 return copy;
401 }
402
403 - (BOOL)isEqual:(id)object
404 {
405 SECC2MPDeviceInfo *other = (SECC2MPDeviceInfo *)object;
406 return [other isMemberOfClass:[self class]]
407 &&
408 ((!self->_productName && !other->_productName) || [self->_productName isEqual:other->_productName])
409 &&
410 ((!self->_productType && !other->_productType) || [self->_productType isEqual:other->_productType])
411 &&
412 ((!self->_productVersion && !other->_productVersion) || [self->_productVersion isEqual:other->_productVersion])
413 &&
414 ((!self->_productBuild && !other->_productBuild) || [self->_productBuild isEqual:other->_productBuild])
415 &&
416 ((self->_has.isAppleInternal && other->_has.isAppleInternal && ((self->_isAppleInternal && other->_isAppleInternal) || (!self->_isAppleInternal && !other->_isAppleInternal))) || (!self->_has.isAppleInternal && !other->_has.isAppleInternal))
417 &&
418 ((!self->_processName && !other->_processName) || [self->_processName isEqual:other->_processName])
419 &&
420 ((!self->_processVersion && !other->_processVersion) || [self->_processVersion isEqual:other->_processVersion])
421 &&
422 ((!self->_processUuid && !other->_processUuid) || [self->_processUuid isEqual:other->_processUuid])
423 &&
424 ((!self->_userDefaultTestName && !other->_userDefaultTestName) || [self->_userDefaultTestName isEqual:other->_userDefaultTestName])
425 &&
426 ((!self->_internalTestConfigs && !other->_internalTestConfigs) || [self->_internalTestConfigs isEqual:other->_internalTestConfigs])
427 ;
428 }
429
430 - (NSUInteger)hash
431 {
432 return 0
433 ^
434 [self->_productName hash]
435 ^
436 [self->_productType hash]
437 ^
438 [self->_productVersion hash]
439 ^
440 [self->_productBuild hash]
441 ^
442 (self->_has.isAppleInternal ? PBHashInt((NSUInteger)self->_isAppleInternal) : 0)
443 ^
444 [self->_processName hash]
445 ^
446 [self->_processVersion hash]
447 ^
448 [self->_processUuid hash]
449 ^
450 [self->_userDefaultTestName hash]
451 ^
452 [self->_internalTestConfigs hash]
453 ;
454 }
455
456 - (void)mergeFrom:(SECC2MPDeviceInfo *)other
457 {
458 if (other->_productName)
459 {
460 [self setProductName:other->_productName];
461 }
462 if (other->_productType)
463 {
464 [self setProductType:other->_productType];
465 }
466 if (other->_productVersion)
467 {
468 [self setProductVersion:other->_productVersion];
469 }
470 if (other->_productBuild)
471 {
472 [self setProductBuild:other->_productBuild];
473 }
474 if (other->_has.isAppleInternal)
475 {
476 self->_isAppleInternal = other->_isAppleInternal;
477 self->_has.isAppleInternal = YES;
478 }
479 if (other->_processName)
480 {
481 [self setProcessName:other->_processName];
482 }
483 if (other->_processVersion)
484 {
485 [self setProcessVersion:other->_processVersion];
486 }
487 if (other->_processUuid)
488 {
489 [self setProcessUuid:other->_processUuid];
490 }
491 if (other->_userDefaultTestName)
492 {
493 [self setUserDefaultTestName:other->_userDefaultTestName];
494 }
495 for (SECC2MPInternalTestConfig *iter_internalTestConfigs in other->_internalTestConfigs)
496 {
497 [self addInternalTestConfig:iter_internalTestConfigs];
498 }
499 }
500
501 @end
502