]> git.saurik.com Git - apple/security.git/blob - keychain/analytics/C2Metric/SECC2MPInternalTestConfig.m
Security-59754.80.3.tar.gz
[apple/security.git] / keychain / analytics / C2Metric / SECC2MPInternalTestConfig.m
1 // This file was automatically generated by protocompiler
2 // DO NOT EDIT!
3 // Compiled from C2Metric.proto
4
5 #import "SECC2MPInternalTestConfig.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 SECC2MPInternalTestConfig
15
16 - (BOOL)hasKey
17 {
18 return _key != nil;
19 }
20 @synthesize key = _key;
21 - (BOOL)hasValue
22 {
23 return _value != nil;
24 }
25 @synthesize value = _value;
26
27 - (NSString *)description
28 {
29 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
30 }
31
32 - (NSDictionary *)dictionaryRepresentation
33 {
34 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
35 if (self->_key)
36 {
37 [dict setObject:self->_key forKey:@"key"];
38 }
39 if (self->_value)
40 {
41 [dict setObject:self->_value forKey:@"value"];
42 }
43 return dict;
44 }
45
46 BOOL SECC2MPInternalTestConfigReadFrom(__unsafe_unretained SECC2MPInternalTestConfig *self, __unsafe_unretained PBDataReader *reader) {
47 while (PBReaderHasMoreData(reader)) {
48 uint32_t tag = 0;
49 uint8_t aType = 0;
50
51 PBReaderReadTag32AndType(reader, &tag, &aType);
52
53 if (PBReaderHasError(reader))
54 break;
55
56 if (aType == TYPE_END_GROUP) {
57 break;
58 }
59
60 switch (tag) {
61
62 case 101 /* key */:
63 {
64 NSString *new_key = PBReaderReadString(reader);
65 self->_key = new_key;
66 }
67 break;
68 case 102 /* value */:
69 {
70 NSString *new_value = PBReaderReadString(reader);
71 self->_value = new_value;
72 }
73 break;
74 default:
75 if (!PBReaderSkipValueWithTag(reader, tag, aType))
76 return NO;
77 break;
78 }
79 }
80 return !PBReaderHasError(reader);
81 }
82
83 - (BOOL)readFrom:(PBDataReader *)reader
84 {
85 return SECC2MPInternalTestConfigReadFrom(self, reader);
86 }
87 - (void)writeTo:(PBDataWriter *)writer
88 {
89 /* key */
90 {
91 if (self->_key)
92 {
93 PBDataWriterWriteStringField(writer, self->_key, 101);
94 }
95 }
96 /* value */
97 {
98 if (self->_value)
99 {
100 PBDataWriterWriteStringField(writer, self->_value, 102);
101 }
102 }
103 }
104
105 - (void)copyTo:(SECC2MPInternalTestConfig *)other
106 {
107 if (_key)
108 {
109 other.key = _key;
110 }
111 if (_value)
112 {
113 other.value = _value;
114 }
115 }
116
117 - (id)copyWithZone:(NSZone *)zone
118 {
119 SECC2MPInternalTestConfig *copy = [[[self class] allocWithZone:zone] init];
120 copy->_key = [_key copyWithZone:zone];
121 copy->_value = [_value copyWithZone:zone];
122 return copy;
123 }
124
125 - (BOOL)isEqual:(id)object
126 {
127 SECC2MPInternalTestConfig *other = (SECC2MPInternalTestConfig *)object;
128 return [other isMemberOfClass:[self class]]
129 &&
130 ((!self->_key && !other->_key) || [self->_key isEqual:other->_key])
131 &&
132 ((!self->_value && !other->_value) || [self->_value isEqual:other->_value])
133 ;
134 }
135
136 - (NSUInteger)hash
137 {
138 return 0
139 ^
140 [self->_key hash]
141 ^
142 [self->_value hash]
143 ;
144 }
145
146 - (void)mergeFrom:(SECC2MPInternalTestConfig *)other
147 {
148 if (other->_key)
149 {
150 [self setKey:other->_key];
151 }
152 if (other->_value)
153 {
154 [self setValue:other->_value];
155 }
156 }
157
158 @end
159