1 // This file was automatically generated by protocompiler
3 // Compiled from C2Metric.proto
5 #import "SECC2MPGenericEventMetric.h"
6 #import <ProtocolBuffer/PBConstants.h>
7 #import <ProtocolBuffer/PBHashUtil.h>
8 #import <ProtocolBuffer/PBDataReader.h>
10 #import "SECC2MPGenericEventMetricValue.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 SECC2MPGenericEventMetric
22 @synthesize key = _key;
27 @synthesize value = _value;
29 - (NSString *)description
31 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
34 - (NSDictionary *)dictionaryRepresentation
36 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
39 [dict setObject:self->_key forKey:@"key"];
43 [dict setObject:[_value dictionaryRepresentation] forKey:@"value"];
48 BOOL SECC2MPGenericEventMetricReadFrom(__unsafe_unretained SECC2MPGenericEventMetric *self, __unsafe_unretained PBDataReader *reader) {
49 while (PBReaderHasMoreData(reader)) {
53 PBReaderReadTag32AndType(reader, &tag, &aType);
55 if (PBReaderHasError(reader))
58 if (aType == TYPE_END_GROUP) {
66 NSString *new_key = PBReaderReadString(reader);
72 SECC2MPGenericEventMetricValue *new_value = [[SECC2MPGenericEventMetricValue alloc] init];
73 self->_value = new_value;
74 PBDataReaderMark mark_value;
75 BOOL markError = !PBReaderPlaceMark(reader, &mark_value);
80 BOOL inError = !SECC2MPGenericEventMetricValueReadFrom(new_value, reader);
85 PBReaderRecallMark(reader, &mark_value);
89 if (!PBReaderSkipValueWithTag(reader, tag, aType))
94 return !PBReaderHasError(reader);
97 - (BOOL)readFrom:(PBDataReader *)reader
99 return SECC2MPGenericEventMetricReadFrom(self, reader);
101 - (void)writeTo:(PBDataWriter *)writer
107 PBDataWriterWriteStringField(writer, self->_key, 101);
112 if (self->_value != nil)
114 PBDataWriterWriteSubmessage(writer, self->_value, 201);
119 - (void)copyTo:(SECC2MPGenericEventMetric *)other
127 other.value = _value;
131 - (id)copyWithZone:(NSZone *)zone
133 SECC2MPGenericEventMetric *copy = [[[self class] allocWithZone:zone] init];
134 copy->_key = [_key copyWithZone:zone];
135 copy->_value = [_value copyWithZone:zone];
139 - (BOOL)isEqual:(id)object
141 SECC2MPGenericEventMetric *other = (SECC2MPGenericEventMetric *)object;
142 return [other isMemberOfClass:[self class]]
144 ((!self->_key && !other->_key) || [self->_key isEqual:other->_key])
146 ((!self->_value && !other->_value) || [self->_value isEqual:other->_value])
160 - (void)mergeFrom:(SECC2MPGenericEventMetric *)other
164 [self setKey:other->_key];
166 if (self->_value && other->_value)
168 [self->_value mergeFrom:other->_value];
170 else if (!self->_value && other->_value)
172 [self setValue:other->_value];