]> git.saurik.com Git - apple/security.git/blob - keychain/analytics/C2Metric/SECC2MPMetric.m
Security-59306.11.20.tar.gz
[apple/security.git] / keychain / analytics / C2Metric / SECC2MPMetric.m
1 // This file was automatically generated by protocompiler
2 // DO NOT EDIT!
3 // Compiled from C2Metric.proto
4
5 #import "SECC2MPMetric.h"
6 #import <ProtocolBuffer/PBConstants.h>
7 #import <ProtocolBuffer/PBHashUtil.h>
8 #import <ProtocolBuffer/PBDataReader.h>
9
10 #import "SECC2MPCloudKitInfo.h"
11 #import "SECC2MPDeviceInfo.h"
12 #import "SECC2MPGenericEvent.h"
13 #import "SECC2MPNetworkEvent.h"
14 #import "SECC2MPServerInfo.h"
15
16 #if !__has_feature(objc_arc)
17 # 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.
18 #endif
19
20 @implementation SECC2MPMetric
21
22 @synthesize metricType = _metricType;
23 - (SECC2MPMetric_Type)metricType
24 {
25 return _has.metricType ? _metricType : SECC2MPMetric_Type_none_type;
26 }
27 - (void)setMetricType:(SECC2MPMetric_Type)v
28 {
29 _has.metricType = YES;
30 _metricType = v;
31 }
32 - (void)setHasMetricType:(BOOL)f
33 {
34 _has.metricType = f;
35 }
36 - (BOOL)hasMetricType
37 {
38 return _has.metricType;
39 }
40 - (NSString *)metricTypeAsString:(SECC2MPMetric_Type)value
41 {
42 return SECC2MPMetric_TypeAsString(value);
43 }
44 - (SECC2MPMetric_Type)StringAsMetricType:(NSString *)str
45 {
46 return StringAsSECC2MPMetric_Type(str);
47 }
48 - (BOOL)hasDeviceInfo
49 {
50 return _deviceInfo != nil;
51 }
52 @synthesize deviceInfo = _deviceInfo;
53 - (BOOL)hasCloudkitInfo
54 {
55 return _cloudkitInfo != nil;
56 }
57 @synthesize cloudkitInfo = _cloudkitInfo;
58 - (BOOL)hasServerInfo
59 {
60 return _serverInfo != nil;
61 }
62 @synthesize serverInfo = _serverInfo;
63 @synthesize triggers = _triggers;
64 - (void)setTriggers:(uint64_t)v
65 {
66 _has.triggers = YES;
67 _triggers = v;
68 }
69 - (void)setHasTriggers:(BOOL)f
70 {
71 _has.triggers = f;
72 }
73 - (BOOL)hasTriggers
74 {
75 return _has.triggers;
76 }
77 @synthesize reportFrequency = _reportFrequency;
78 - (void)setReportFrequency:(uint64_t)v
79 {
80 _has.reportFrequency = YES;
81 _reportFrequency = v;
82 }
83 - (void)setHasReportFrequency:(BOOL)f
84 {
85 _has.reportFrequency = f;
86 }
87 - (BOOL)hasReportFrequency
88 {
89 return _has.reportFrequency;
90 }
91 @synthesize reportFrequencyBase = _reportFrequencyBase;
92 - (void)setReportFrequencyBase:(uint64_t)v
93 {
94 _has.reportFrequencyBase = YES;
95 _reportFrequencyBase = v;
96 }
97 - (void)setHasReportFrequencyBase:(BOOL)f
98 {
99 _has.reportFrequencyBase = f;
100 }
101 - (BOOL)hasReportFrequencyBase
102 {
103 return _has.reportFrequencyBase;
104 }
105 - (BOOL)hasNetworkEvent
106 {
107 return _networkEvent != nil;
108 }
109 @synthesize networkEvent = _networkEvent;
110 - (BOOL)hasGenericEvent
111 {
112 return _genericEvent != nil;
113 }
114 @synthesize genericEvent = _genericEvent;
115
116 - (NSString *)description
117 {
118 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
119 }
120
121 - (NSDictionary *)dictionaryRepresentation
122 {
123 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
124 if (self->_has.metricType)
125 {
126 [dict setObject:SECC2MPMetric_TypeAsString(self->_metricType) forKey:@"metric_type"];
127 }
128 if (self->_deviceInfo)
129 {
130 [dict setObject:[_deviceInfo dictionaryRepresentation] forKey:@"device_info"];
131 }
132 if (self->_cloudkitInfo)
133 {
134 [dict setObject:[_cloudkitInfo dictionaryRepresentation] forKey:@"cloudkit_info"];
135 }
136 if (self->_serverInfo)
137 {
138 [dict setObject:[_serverInfo dictionaryRepresentation] forKey:@"server_info"];
139 }
140 if (self->_has.triggers)
141 {
142 [dict setObject:[NSNumber numberWithUnsignedLongLong:self->_triggers] forKey:@"triggers"];
143 }
144 if (self->_has.reportFrequency)
145 {
146 [dict setObject:[NSNumber numberWithUnsignedLongLong:self->_reportFrequency] forKey:@"report_frequency"];
147 }
148 if (self->_has.reportFrequencyBase)
149 {
150 [dict setObject:[NSNumber numberWithUnsignedLongLong:self->_reportFrequencyBase] forKey:@"report_frequency_base"];
151 }
152 if (self->_networkEvent)
153 {
154 [dict setObject:[_networkEvent dictionaryRepresentation] forKey:@"network_event"];
155 }
156 if (self->_genericEvent)
157 {
158 [dict setObject:[_genericEvent dictionaryRepresentation] forKey:@"generic_event"];
159 }
160 return dict;
161 }
162
163 BOOL SECC2MPMetricReadFrom(__unsafe_unretained SECC2MPMetric *self, __unsafe_unretained PBDataReader *reader) {
164 while (PBReaderHasMoreData(reader)) {
165 uint32_t tag = 0;
166 uint8_t aType = 0;
167
168 PBReaderReadTag32AndType(reader, &tag, &aType);
169
170 if (PBReaderHasError(reader))
171 break;
172
173 if (aType == TYPE_END_GROUP) {
174 break;
175 }
176
177 switch (tag) {
178
179 case 1 /* metricType */:
180 {
181 self->_has.metricType = YES;
182 self->_metricType = PBReaderReadInt32(reader);
183 }
184 break;
185 case 2 /* deviceInfo */:
186 {
187 SECC2MPDeviceInfo *new_deviceInfo = [[SECC2MPDeviceInfo alloc] init];
188 self->_deviceInfo = new_deviceInfo;
189 PBDataReaderMark mark_deviceInfo;
190 BOOL markError = !PBReaderPlaceMark(reader, &mark_deviceInfo);
191 if (markError)
192 {
193 return NO;
194 }
195 BOOL inError = !SECC2MPDeviceInfoReadFrom(new_deviceInfo, reader);
196 if (inError)
197 {
198 return NO;
199 }
200 PBReaderRecallMark(reader, &mark_deviceInfo);
201 }
202 break;
203 case 3 /* cloudkitInfo */:
204 {
205 SECC2MPCloudKitInfo *new_cloudkitInfo = [[SECC2MPCloudKitInfo alloc] init];
206 self->_cloudkitInfo = new_cloudkitInfo;
207 PBDataReaderMark mark_cloudkitInfo;
208 BOOL markError = !PBReaderPlaceMark(reader, &mark_cloudkitInfo);
209 if (markError)
210 {
211 return NO;
212 }
213 BOOL inError = !SECC2MPCloudKitInfoReadFrom(new_cloudkitInfo, reader);
214 if (inError)
215 {
216 return NO;
217 }
218 PBReaderRecallMark(reader, &mark_cloudkitInfo);
219 }
220 break;
221 case 4 /* serverInfo */:
222 {
223 SECC2MPServerInfo *new_serverInfo = [[SECC2MPServerInfo alloc] init];
224 self->_serverInfo = new_serverInfo;
225 PBDataReaderMark mark_serverInfo;
226 BOOL markError = !PBReaderPlaceMark(reader, &mark_serverInfo);
227 if (markError)
228 {
229 return NO;
230 }
231 BOOL inError = !SECC2MPServerInfoReadFrom(new_serverInfo, reader);
232 if (inError)
233 {
234 return NO;
235 }
236 PBReaderRecallMark(reader, &mark_serverInfo);
237 }
238 break;
239 case 100 /* triggers */:
240 {
241 self->_has.triggers = YES;
242 self->_triggers = PBReaderReadUint64(reader);
243 }
244 break;
245 case 101 /* reportFrequency */:
246 {
247 self->_has.reportFrequency = YES;
248 self->_reportFrequency = PBReaderReadUint64(reader);
249 }
250 break;
251 case 102 /* reportFrequencyBase */:
252 {
253 self->_has.reportFrequencyBase = YES;
254 self->_reportFrequencyBase = PBReaderReadUint64(reader);
255 }
256 break;
257 case 200 /* networkEvent */:
258 {
259 SECC2MPNetworkEvent *new_networkEvent = [[SECC2MPNetworkEvent alloc] init];
260 self->_networkEvent = new_networkEvent;
261 PBDataReaderMark mark_networkEvent;
262 BOOL markError = !PBReaderPlaceMark(reader, &mark_networkEvent);
263 if (markError)
264 {
265 return NO;
266 }
267 BOOL inError = !SECC2MPNetworkEventReadFrom(new_networkEvent, reader);
268 if (inError)
269 {
270 return NO;
271 }
272 PBReaderRecallMark(reader, &mark_networkEvent);
273 }
274 break;
275 case 201 /* genericEvent */:
276 {
277 SECC2MPGenericEvent *new_genericEvent = [[SECC2MPGenericEvent alloc] init];
278 self->_genericEvent = new_genericEvent;
279 PBDataReaderMark mark_genericEvent;
280 BOOL markError = !PBReaderPlaceMark(reader, &mark_genericEvent);
281 if (markError)
282 {
283 return NO;
284 }
285 BOOL inError = !SECC2MPGenericEventReadFrom(new_genericEvent, reader);
286 if (inError)
287 {
288 return NO;
289 }
290 PBReaderRecallMark(reader, &mark_genericEvent);
291 }
292 break;
293 default:
294 if (!PBReaderSkipValueWithTag(reader, tag, aType))
295 return NO;
296 break;
297 }
298 }
299 return !PBReaderHasError(reader);
300 }
301
302 - (BOOL)readFrom:(PBDataReader *)reader
303 {
304 return SECC2MPMetricReadFrom(self, reader);
305 }
306 - (void)writeTo:(PBDataWriter *)writer
307 {
308 /* metricType */
309 {
310 if (self->_has.metricType)
311 {
312 PBDataWriterWriteInt32Field(writer, self->_metricType, 1);
313 }
314 }
315 /* deviceInfo */
316 {
317 if (self->_deviceInfo != nil)
318 {
319 PBDataWriterWriteSubmessage(writer, self->_deviceInfo, 2);
320 }
321 }
322 /* cloudkitInfo */
323 {
324 if (self->_cloudkitInfo != nil)
325 {
326 PBDataWriterWriteSubmessage(writer, self->_cloudkitInfo, 3);
327 }
328 }
329 /* serverInfo */
330 {
331 if (self->_serverInfo != nil)
332 {
333 PBDataWriterWriteSubmessage(writer, self->_serverInfo, 4);
334 }
335 }
336 /* triggers */
337 {
338 if (self->_has.triggers)
339 {
340 PBDataWriterWriteUint64Field(writer, self->_triggers, 100);
341 }
342 }
343 /* reportFrequency */
344 {
345 if (self->_has.reportFrequency)
346 {
347 PBDataWriterWriteUint64Field(writer, self->_reportFrequency, 101);
348 }
349 }
350 /* reportFrequencyBase */
351 {
352 if (self->_has.reportFrequencyBase)
353 {
354 PBDataWriterWriteUint64Field(writer, self->_reportFrequencyBase, 102);
355 }
356 }
357 /* networkEvent */
358 {
359 if (self->_networkEvent != nil)
360 {
361 PBDataWriterWriteSubmessage(writer, self->_networkEvent, 200);
362 }
363 }
364 /* genericEvent */
365 {
366 if (self->_genericEvent != nil)
367 {
368 PBDataWriterWriteSubmessage(writer, self->_genericEvent, 201);
369 }
370 }
371 }
372
373 - (void)copyTo:(SECC2MPMetric *)other
374 {
375 if (self->_has.metricType)
376 {
377 other->_metricType = _metricType;
378 other->_has.metricType = YES;
379 }
380 if (_deviceInfo)
381 {
382 other.deviceInfo = _deviceInfo;
383 }
384 if (_cloudkitInfo)
385 {
386 other.cloudkitInfo = _cloudkitInfo;
387 }
388 if (_serverInfo)
389 {
390 other.serverInfo = _serverInfo;
391 }
392 if (self->_has.triggers)
393 {
394 other->_triggers = _triggers;
395 other->_has.triggers = YES;
396 }
397 if (self->_has.reportFrequency)
398 {
399 other->_reportFrequency = _reportFrequency;
400 other->_has.reportFrequency = YES;
401 }
402 if (self->_has.reportFrequencyBase)
403 {
404 other->_reportFrequencyBase = _reportFrequencyBase;
405 other->_has.reportFrequencyBase = YES;
406 }
407 if (_networkEvent)
408 {
409 other.networkEvent = _networkEvent;
410 }
411 if (_genericEvent)
412 {
413 other.genericEvent = _genericEvent;
414 }
415 }
416
417 - (id)copyWithZone:(NSZone *)zone
418 {
419 SECC2MPMetric *copy = [[[self class] allocWithZone:zone] init];
420 if (self->_has.metricType)
421 {
422 copy->_metricType = _metricType;
423 copy->_has.metricType = YES;
424 }
425 copy->_deviceInfo = [_deviceInfo copyWithZone:zone];
426 copy->_cloudkitInfo = [_cloudkitInfo copyWithZone:zone];
427 copy->_serverInfo = [_serverInfo copyWithZone:zone];
428 if (self->_has.triggers)
429 {
430 copy->_triggers = _triggers;
431 copy->_has.triggers = YES;
432 }
433 if (self->_has.reportFrequency)
434 {
435 copy->_reportFrequency = _reportFrequency;
436 copy->_has.reportFrequency = YES;
437 }
438 if (self->_has.reportFrequencyBase)
439 {
440 copy->_reportFrequencyBase = _reportFrequencyBase;
441 copy->_has.reportFrequencyBase = YES;
442 }
443 copy->_networkEvent = [_networkEvent copyWithZone:zone];
444 copy->_genericEvent = [_genericEvent copyWithZone:zone];
445 return copy;
446 }
447
448 - (BOOL)isEqual:(id)object
449 {
450 SECC2MPMetric *other = (SECC2MPMetric *)object;
451 return [other isMemberOfClass:[self class]]
452 &&
453 ((self->_has.metricType && other->_has.metricType && self->_metricType == other->_metricType) || (!self->_has.metricType && !other->_has.metricType))
454 &&
455 ((!self->_deviceInfo && !other->_deviceInfo) || [self->_deviceInfo isEqual:other->_deviceInfo])
456 &&
457 ((!self->_cloudkitInfo && !other->_cloudkitInfo) || [self->_cloudkitInfo isEqual:other->_cloudkitInfo])
458 &&
459 ((!self->_serverInfo && !other->_serverInfo) || [self->_serverInfo isEqual:other->_serverInfo])
460 &&
461 ((self->_has.triggers && other->_has.triggers && self->_triggers == other->_triggers) || (!self->_has.triggers && !other->_has.triggers))
462 &&
463 ((self->_has.reportFrequency && other->_has.reportFrequency && self->_reportFrequency == other->_reportFrequency) || (!self->_has.reportFrequency && !other->_has.reportFrequency))
464 &&
465 ((self->_has.reportFrequencyBase && other->_has.reportFrequencyBase && self->_reportFrequencyBase == other->_reportFrequencyBase) || (!self->_has.reportFrequencyBase && !other->_has.reportFrequencyBase))
466 &&
467 ((!self->_networkEvent && !other->_networkEvent) || [self->_networkEvent isEqual:other->_networkEvent])
468 &&
469 ((!self->_genericEvent && !other->_genericEvent) || [self->_genericEvent isEqual:other->_genericEvent])
470 ;
471 }
472
473 - (NSUInteger)hash
474 {
475 return 0
476 ^
477 (self->_has.metricType ? PBHashInt((NSUInteger)self->_metricType) : 0)
478 ^
479 [self->_deviceInfo hash]
480 ^
481 [self->_cloudkitInfo hash]
482 ^
483 [self->_serverInfo hash]
484 ^
485 (self->_has.triggers ? PBHashInt((NSUInteger)self->_triggers) : 0)
486 ^
487 (self->_has.reportFrequency ? PBHashInt((NSUInteger)self->_reportFrequency) : 0)
488 ^
489 (self->_has.reportFrequencyBase ? PBHashInt((NSUInteger)self->_reportFrequencyBase) : 0)
490 ^
491 [self->_networkEvent hash]
492 ^
493 [self->_genericEvent hash]
494 ;
495 }
496
497 - (void)mergeFrom:(SECC2MPMetric *)other
498 {
499 if (other->_has.metricType)
500 {
501 self->_metricType = other->_metricType;
502 self->_has.metricType = YES;
503 }
504 if (self->_deviceInfo && other->_deviceInfo)
505 {
506 [self->_deviceInfo mergeFrom:other->_deviceInfo];
507 }
508 else if (!self->_deviceInfo && other->_deviceInfo)
509 {
510 [self setDeviceInfo:other->_deviceInfo];
511 }
512 if (self->_cloudkitInfo && other->_cloudkitInfo)
513 {
514 [self->_cloudkitInfo mergeFrom:other->_cloudkitInfo];
515 }
516 else if (!self->_cloudkitInfo && other->_cloudkitInfo)
517 {
518 [self setCloudkitInfo:other->_cloudkitInfo];
519 }
520 if (self->_serverInfo && other->_serverInfo)
521 {
522 [self->_serverInfo mergeFrom:other->_serverInfo];
523 }
524 else if (!self->_serverInfo && other->_serverInfo)
525 {
526 [self setServerInfo:other->_serverInfo];
527 }
528 if (other->_has.triggers)
529 {
530 self->_triggers = other->_triggers;
531 self->_has.triggers = YES;
532 }
533 if (other->_has.reportFrequency)
534 {
535 self->_reportFrequency = other->_reportFrequency;
536 self->_has.reportFrequency = YES;
537 }
538 if (other->_has.reportFrequencyBase)
539 {
540 self->_reportFrequencyBase = other->_reportFrequencyBase;
541 self->_has.reportFrequencyBase = YES;
542 }
543 if (self->_networkEvent && other->_networkEvent)
544 {
545 [self->_networkEvent mergeFrom:other->_networkEvent];
546 }
547 else if (!self->_networkEvent && other->_networkEvent)
548 {
549 [self setNetworkEvent:other->_networkEvent];
550 }
551 if (self->_genericEvent && other->_genericEvent)
552 {
553 [self->_genericEvent mergeFrom:other->_genericEvent];
554 }
555 else if (!self->_genericEvent && other->_genericEvent)
556 {
557 [self setGenericEvent:other->_genericEvent];
558 }
559 }
560
561 @end
562