1 // This file was automatically generated by protocompiler
3 // Compiled from C2Metric.proto
5 #import "SECC2MPDeviceInfo.h"
6 #import <ProtocolBuffer/PBConstants.h>
7 #import <ProtocolBuffer/PBHashUtil.h>
8 #import <ProtocolBuffer/PBDataReader.h>
10 #import "SECC2MPInternalTestConfig.h"
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.
16 @implementation SECC2MPDeviceInfo
18 - (BOOL)hasProductName
20 return _productName != nil;
22 @synthesize productName = _productName;
23 - (BOOL)hasProductType
25 return _productType != nil;
27 @synthesize productType = _productType;
28 - (BOOL)hasProductVersion
30 return _productVersion != nil;
32 @synthesize productVersion = _productVersion;
33 - (BOOL)hasProductBuild
35 return _productBuild != nil;
37 @synthesize productBuild = _productBuild;
38 @synthesize isAppleInternal = _isAppleInternal;
39 - (void)setIsAppleInternal:(BOOL)v
41 _has.isAppleInternal = YES;
44 - (void)setHasIsAppleInternal:(BOOL)f
46 _has.isAppleInternal = f;
48 - (BOOL)hasIsAppleInternal
50 return _has.isAppleInternal;
52 - (BOOL)hasProcessName
54 return _processName != nil;
56 @synthesize processName = _processName;
57 - (BOOL)hasProcessVersion
59 return _processVersion != nil;
61 @synthesize processVersion = _processVersion;
62 - (BOOL)hasProcessUuid
64 return _processUuid != nil;
66 @synthesize processUuid = _processUuid;
67 - (BOOL)hasUserDefaultTestName
69 return _userDefaultTestName != nil;
71 @synthesize userDefaultTestName = _userDefaultTestName;
72 @synthesize internalTestConfigs = _internalTestConfigs;
73 - (void)clearInternalTestConfigs
75 [_internalTestConfigs removeAllObjects];
77 - (void)addInternalTestConfig:(SECC2MPInternalTestConfig *)i
79 if (!_internalTestConfigs)
81 _internalTestConfigs = [[NSMutableArray alloc] init];
83 [_internalTestConfigs addObject:i];
85 - (NSUInteger)internalTestConfigsCount
87 return [_internalTestConfigs count];
89 - (SECC2MPInternalTestConfig *)internalTestConfigAtIndex:(NSUInteger)idx
91 return [_internalTestConfigs objectAtIndex:idx];
93 + (Class)internalTestConfigType
95 return [SECC2MPInternalTestConfig class];
98 - (NSString *)description
100 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
103 - (NSDictionary *)dictionaryRepresentation
105 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
106 if (self->_productName)
108 [dict setObject:self->_productName forKey:@"product_name"];
110 if (self->_productType)
112 [dict setObject:self->_productType forKey:@"product_type"];
114 if (self->_productVersion)
116 [dict setObject:self->_productVersion forKey:@"product_version"];
118 if (self->_productBuild)
120 [dict setObject:self->_productBuild forKey:@"product_build"];
122 if (self->_has.isAppleInternal)
124 [dict setObject:[NSNumber numberWithBool:self->_isAppleInternal] forKey:@"is_apple_internal"];
126 if (self->_processName)
128 [dict setObject:self->_processName forKey:@"process_name"];
130 if (self->_processVersion)
132 [dict setObject:self->_processVersion forKey:@"process_version"];
134 if (self->_processUuid)
136 [dict setObject:self->_processUuid forKey:@"process_uuid"];
138 if (self->_userDefaultTestName)
140 [dict setObject:self->_userDefaultTestName forKey:@"user_default_test_name"];
142 if ([self->_internalTestConfigs count])
144 NSMutableArray *internalTestConfigsDictReprs = [[NSMutableArray alloc] initWithCapacity:[self->_internalTestConfigs count]];
145 for (SECC2MPInternalTestConfig *i_internalTestConfig in self->_internalTestConfigs)
147 [internalTestConfigsDictReprs addObject:[i_internalTestConfig dictionaryRepresentation]];
149 [dict setObject:internalTestConfigsDictReprs forKey:@"internal_test_config"];
154 BOOL SECC2MPDeviceInfoReadFrom(__unsafe_unretained SECC2MPDeviceInfo *self, __unsafe_unretained PBDataReader *reader) {
155 while (PBReaderHasMoreData(reader)) {
159 PBReaderReadTag32AndType(reader, &tag, &aType);
161 if (PBReaderHasError(reader))
164 if (aType == TYPE_END_GROUP) {
170 case 101 /* productName */:
172 NSString *new_productName = PBReaderReadString(reader);
173 self->_productName = new_productName;
176 case 102 /* productType */:
178 NSString *new_productType = PBReaderReadString(reader);
179 self->_productType = new_productType;
182 case 103 /* productVersion */:
184 NSString *new_productVersion = PBReaderReadString(reader);
185 self->_productVersion = new_productVersion;
188 case 104 /* productBuild */:
190 NSString *new_productBuild = PBReaderReadString(reader);
191 self->_productBuild = new_productBuild;
194 case 105 /* isAppleInternal */:
196 self->_has.isAppleInternal = YES;
197 self->_isAppleInternal = PBReaderReadBOOL(reader);
200 case 201 /* processName */:
202 NSString *new_processName = PBReaderReadString(reader);
203 self->_processName = new_processName;
206 case 202 /* processVersion */:
208 NSString *new_processVersion = PBReaderReadString(reader);
209 self->_processVersion = new_processVersion;
212 case 203 /* processUuid */:
214 NSString *new_processUuid = PBReaderReadString(reader);
215 self->_processUuid = new_processUuid;
218 case 301 /* userDefaultTestName */:
220 NSString *new_userDefaultTestName = PBReaderReadString(reader);
221 self->_userDefaultTestName = new_userDefaultTestName;
224 case 302 /* internalTestConfigs */:
226 SECC2MPInternalTestConfig *new_internalTestConfig = [[SECC2MPInternalTestConfig alloc] init];
227 [self addInternalTestConfig:new_internalTestConfig];
228 PBDataReaderMark mark_internalTestConfig;
229 BOOL markError = !PBReaderPlaceMark(reader, &mark_internalTestConfig);
234 BOOL inError = !SECC2MPInternalTestConfigReadFrom(new_internalTestConfig, reader);
239 PBReaderRecallMark(reader, &mark_internalTestConfig);
243 if (!PBReaderSkipValueWithTag(reader, tag, aType))
248 return !PBReaderHasError(reader);
251 - (BOOL)readFrom:(PBDataReader *)reader
253 return SECC2MPDeviceInfoReadFrom(self, reader);
255 - (void)writeTo:(PBDataWriter *)writer
259 if (self->_productName)
261 PBDataWriterWriteStringField(writer, self->_productName, 101);
266 if (self->_productType)
268 PBDataWriterWriteStringField(writer, self->_productType, 102);
273 if (self->_productVersion)
275 PBDataWriterWriteStringField(writer, self->_productVersion, 103);
280 if (self->_productBuild)
282 PBDataWriterWriteStringField(writer, self->_productBuild, 104);
285 /* isAppleInternal */
287 if (self->_has.isAppleInternal)
289 PBDataWriterWriteBOOLField(writer, self->_isAppleInternal, 105);
294 if (self->_processName)
296 PBDataWriterWriteStringField(writer, self->_processName, 201);
301 if (self->_processVersion)
303 PBDataWriterWriteStringField(writer, self->_processVersion, 202);
308 if (self->_processUuid)
310 PBDataWriterWriteStringField(writer, self->_processUuid, 203);
313 /* userDefaultTestName */
315 if (self->_userDefaultTestName)
317 PBDataWriterWriteStringField(writer, self->_userDefaultTestName, 301);
320 /* internalTestConfigs */
322 for (SECC2MPInternalTestConfig *i_internalTestConfig in self->_internalTestConfigs)
324 PBDataWriterWriteSubmessage(writer, i_internalTestConfig, 302);
329 - (void)copyTo:(SECC2MPDeviceInfo *)other
333 other.productName = _productName;
337 other.productType = _productType;
341 other.productVersion = _productVersion;
345 other.productBuild = _productBuild;
347 if (self->_has.isAppleInternal)
349 other->_isAppleInternal = _isAppleInternal;
350 other->_has.isAppleInternal = YES;
354 other.processName = _processName;
358 other.processVersion = _processVersion;
362 other.processUuid = _processUuid;
364 if (_userDefaultTestName)
366 other.userDefaultTestName = _userDefaultTestName;
368 if ([self internalTestConfigsCount])
370 [other clearInternalTestConfigs];
371 NSUInteger internalTestConfigsCnt = [self internalTestConfigsCount];
372 for (NSUInteger i = 0; i < internalTestConfigsCnt; i++)
374 [other addInternalTestConfig:[self internalTestConfigAtIndex:i]];
379 - (id)copyWithZone:(NSZone *)zone
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)
388 copy->_isAppleInternal = _isAppleInternal;
389 copy->_has.isAppleInternal = YES;
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)
397 SECC2MPInternalTestConfig *vCopy = [v copyWithZone:zone];
398 [copy addInternalTestConfig:vCopy];
403 - (BOOL)isEqual:(id)object
405 SECC2MPDeviceInfo *other = (SECC2MPDeviceInfo *)object;
406 return [other isMemberOfClass:[self class]]
408 ((!self->_productName && !other->_productName) || [self->_productName isEqual:other->_productName])
410 ((!self->_productType && !other->_productType) || [self->_productType isEqual:other->_productType])
412 ((!self->_productVersion && !other->_productVersion) || [self->_productVersion isEqual:other->_productVersion])
414 ((!self->_productBuild && !other->_productBuild) || [self->_productBuild isEqual:other->_productBuild])
416 ((self->_has.isAppleInternal && other->_has.isAppleInternal && ((self->_isAppleInternal && other->_isAppleInternal) || (!self->_isAppleInternal && !other->_isAppleInternal))) || (!self->_has.isAppleInternal && !other->_has.isAppleInternal))
418 ((!self->_processName && !other->_processName) || [self->_processName isEqual:other->_processName])
420 ((!self->_processVersion && !other->_processVersion) || [self->_processVersion isEqual:other->_processVersion])
422 ((!self->_processUuid && !other->_processUuid) || [self->_processUuid isEqual:other->_processUuid])
424 ((!self->_userDefaultTestName && !other->_userDefaultTestName) || [self->_userDefaultTestName isEqual:other->_userDefaultTestName])
426 ((!self->_internalTestConfigs && !other->_internalTestConfigs) || [self->_internalTestConfigs isEqual:other->_internalTestConfigs])
434 [self->_productName hash]
436 [self->_productType hash]
438 [self->_productVersion hash]
440 [self->_productBuild hash]
442 (self->_has.isAppleInternal ? PBHashInt((NSUInteger)self->_isAppleInternal) : 0)
444 [self->_processName hash]
446 [self->_processVersion hash]
448 [self->_processUuid hash]
450 [self->_userDefaultTestName hash]
452 [self->_internalTestConfigs hash]
456 - (void)mergeFrom:(SECC2MPDeviceInfo *)other
458 if (other->_productName)
460 [self setProductName:other->_productName];
462 if (other->_productType)
464 [self setProductType:other->_productType];
466 if (other->_productVersion)
468 [self setProductVersion:other->_productVersion];
470 if (other->_productBuild)
472 [self setProductBuild:other->_productBuild];
474 if (other->_has.isAppleInternal)
476 self->_isAppleInternal = other->_isAppleInternal;
477 self->_has.isAppleInternal = YES;
479 if (other->_processName)
481 [self setProcessName:other->_processName];
483 if (other->_processVersion)
485 [self setProcessVersion:other->_processVersion];
487 if (other->_processUuid)
489 [self setProcessUuid:other->_processUuid];
491 if (other->_userDefaultTestName)
493 [self setUserDefaultTestName:other->_userDefaultTestName];
495 for (SECC2MPInternalTestConfig *iter_internalTestConfigs in other->_internalTestConfigs)
497 [self addInternalTestConfig:iter_internalTestConfigs];