]> git.saurik.com Git - apple/security.git/blob - keychain/analytics/awd/AWDKeychainCKKSRateLimiterAggregatedScores.m
Security-58286.1.32.tar.gz
[apple/security.git] / keychain / analytics / awd / AWDKeychainCKKSRateLimiterAggregatedScores.m
1 // This file was automatically generated by protocompiler
2 // DO NOT EDIT!
3 // Compiled from stdin
4
5 #import <TargetConditionals.h>
6 #if !TARGET_OS_BRIDGE
7
8 #import "AWDKeychainCKKSRateLimiterAggregatedScores.h"
9 #import <ProtocolBuffer/PBConstants.h>
10 #import <ProtocolBuffer/PBHashUtil.h>
11 #import <ProtocolBuffer/PBDataReader.h>
12
13 #if !__has_feature(objc_arc)
14 # 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.
15 #endif
16
17 @implementation AWDKeychainCKKSRateLimiterAggregatedScores
18
19 - (void)dealloc
20 {
21 PBRepeatedUInt32Clear(&(self->_datas));
22 }
23
24 @synthesize timestamp = _timestamp;
25 - (void)setTimestamp:(uint64_t)v
26 {
27 _has.timestamp = YES;
28 _timestamp = v;
29 }
30 - (void)setHasTimestamp:(BOOL)f
31 {
32 _has.timestamp = f;
33 }
34 - (BOOL)hasTimestamp
35 {
36 return _has.timestamp;
37 }
38 - (NSUInteger)datasCount
39 {
40 return _datas.count;
41 }
42 - (uint32_t *)datas
43 {
44 return _datas.list;
45 }
46 - (void)clearDatas
47 {
48 PBRepeatedUInt32Clear(&_datas);
49 }
50 - (void)addData:(uint32_t)i
51 {
52 PBRepeatedUInt32Add(&_datas, i);
53 }
54 - (uint32_t)dataAtIndex:(NSUInteger)idx
55 {
56 if (_datas.count <= idx)
57 {
58 [[NSException exceptionWithName:NSRangeException reason:[NSString stringWithFormat:@"idx (%tu) is out of range (%tu)", idx, _datas.count] userInfo:nil] raise];
59 }
60 return _datas.list[idx];
61 }
62 - (void)setDatas:(uint32_t *)list count:(NSUInteger)count
63 {
64 PBRepeatedUInt32Set(&_datas, list, count);
65 }
66 - (BOOL)hasRatelimitertype
67 {
68 return _ratelimitertype != nil;
69 }
70 @synthesize ratelimitertype = _ratelimitertype;
71
72 - (NSString *)description
73 {
74 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
75 }
76
77 - (NSDictionary *)dictionaryRepresentation
78 {
79 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
80 if (self->_has.timestamp)
81 {
82 [dict setObject:[NSNumber numberWithUnsignedLongLong:self->_timestamp] forKey:@"timestamp"];
83 }
84 [dict setObject:PBRepeatedUInt32NSArray(&(self->_datas)) forKey:@"data"];
85 if (self->_ratelimitertype)
86 {
87 [dict setObject:self->_ratelimitertype forKey:@"ratelimitertype"];
88 }
89 return dict;
90 }
91
92 BOOL AWDKeychainCKKSRateLimiterAggregatedScoresReadFrom(__unsafe_unretained AWDKeychainCKKSRateLimiterAggregatedScores *self, __unsafe_unretained PBDataReader *reader) {
93 while (PBReaderHasMoreData(reader)) {
94 uint32_t tag = 0;
95 uint8_t aType = 0;
96
97 PBReaderReadTag32AndType(reader, &tag, &aType);
98
99 if (PBReaderHasError(reader))
100 break;
101
102 if (aType == TYPE_END_GROUP) {
103 break;
104 }
105
106 switch (tag) {
107
108 case 1 /* timestamp */:
109 {
110 self->_has.timestamp = YES;
111 self->_timestamp = PBReaderReadUint64(reader);
112 }
113 break;
114 case 2 /* datas */:
115 {
116 if (TYPE_LENGTH_DELIMITED == aType)
117 {
118 PBDataReaderMark mark_data;
119 BOOL markError = !PBReaderPlaceMark(reader, &mark_data);
120 if (markError)
121 {
122 return NO;
123 }
124 while (PBReaderHasMoreData(reader))
125 {
126 uint32_t new_data = PBReaderReadUint32(reader);
127 PBRepeatedUInt32Add(&(self->_datas), new_data);
128 }
129 PBReaderRecallMark(reader, &mark_data);
130 }
131 else
132 {
133 PBRepeatedUInt32Add(&(self->_datas), PBReaderReadUint32(reader));
134 }
135 }
136 break;
137 case 3 /* ratelimitertype */:
138 {
139 NSString *new_ratelimitertype = PBReaderReadString(reader);
140 self->_ratelimitertype = new_ratelimitertype;
141 }
142 break;
143 default:
144 if (!PBReaderSkipValueWithTag(reader, tag, aType))
145 return NO;
146 break;
147 }
148 }
149 return !PBReaderHasError(reader);
150 }
151
152 - (BOOL)readFrom:(PBDataReader *)reader
153 {
154 return AWDKeychainCKKSRateLimiterAggregatedScoresReadFrom(self, reader);
155 }
156 - (void)writeTo:(PBDataWriter *)writer
157 {
158 /* timestamp */
159 {
160 if (self->_has.timestamp)
161 {
162 PBDataWriterWriteUint64Field(writer, self->_timestamp, 1);
163 }
164 }
165 /* datas */
166 {
167 if (self->_datas.count)
168 {
169 NSUInteger i_datas;
170 for (i_datas = 0; i_datas < self->_datas.count; i_datas++)
171 {
172 PBDataWriterWriteUint32Field(writer, self->_datas.list[i_datas], 2);
173 }
174 }
175 }
176 /* ratelimitertype */
177 {
178 if (self->_ratelimitertype)
179 {
180 PBDataWriterWriteStringField(writer, self->_ratelimitertype, 3);
181 }
182 }
183 }
184
185 - (void)copyTo:(AWDKeychainCKKSRateLimiterAggregatedScores *)other
186 {
187 if (self->_has.timestamp)
188 {
189 other->_timestamp = _timestamp;
190 other->_has.timestamp = YES;
191 }
192 if ([self datasCount])
193 {
194 [other clearDatas];
195 NSUInteger datasCnt = [self datasCount];
196 for (NSUInteger i = 0; i < datasCnt; i++)
197 {
198 [other addData:[self dataAtIndex:i]];
199 }
200 }
201 if (_ratelimitertype)
202 {
203 other.ratelimitertype = _ratelimitertype;
204 }
205 }
206
207 - (id)copyWithZone:(NSZone *)zone
208 {
209 AWDKeychainCKKSRateLimiterAggregatedScores *copy = [[[self class] allocWithZone:zone] init];
210 if (self->_has.timestamp)
211 {
212 copy->_timestamp = _timestamp;
213 copy->_has.timestamp = YES;
214 }
215 PBRepeatedUInt32Copy(&(copy->_datas), &_datas);
216 copy->_ratelimitertype = [_ratelimitertype copyWithZone:zone];
217 return copy;
218 }
219
220 - (BOOL)isEqual:(id)object
221 {
222 AWDKeychainCKKSRateLimiterAggregatedScores *other = (AWDKeychainCKKSRateLimiterAggregatedScores *)object;
223 return [other isMemberOfClass:[self class]]
224 &&
225 ((self->_has.timestamp && other->_has.timestamp && self->_timestamp == other->_timestamp) || (!self->_has.timestamp && !other->_has.timestamp))
226 &&
227 PBRepeatedUInt32IsEqual(&(self->_datas), &(other->_datas))
228 &&
229 ((!self->_ratelimitertype && !other->_ratelimitertype) || [self->_ratelimitertype isEqual:other->_ratelimitertype])
230 ;
231 }
232
233 - (NSUInteger)hash
234 {
235 return 0
236 ^
237 (self->_has.timestamp ? PBHashInt((NSUInteger)self->_timestamp) : 0)
238 ^
239 PBRepeatedUInt32Hash(&(self->_datas))
240 ^
241 [self->_ratelimitertype hash]
242 ;
243 }
244
245 - (void)mergeFrom:(AWDKeychainCKKSRateLimiterAggregatedScores *)other
246 {
247 if (other->_has.timestamp)
248 {
249 self->_timestamp = other->_timestamp;
250 self->_has.timestamp = YES;
251 }
252 NSUInteger datasCnt = [other datasCount];
253 for (NSUInteger i = 0; i < datasCnt; i++)
254 {
255 [self addData:[other dataAtIndex:i]];
256 }
257 if (other->_ratelimitertype)
258 {
259 [self setRatelimitertype:other->_ratelimitertype];
260 }
261 }
262
263 @end
264 #endif