1 // This file was automatically generated by protocompiler
5 #import <TargetConditionals.h>
8 #import "AWDKeychainCKKSRateLimiterAggregatedScores.h"
9 #import <ProtocolBuffer/PBConstants.h>
10 #import <ProtocolBuffer/PBHashUtil.h>
11 #import <ProtocolBuffer/PBDataReader.h>
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.
17 @implementation AWDKeychainCKKSRateLimiterAggregatedScores
21 PBRepeatedUInt32Clear(&(self->_datas));
24 @synthesize timestamp = _timestamp;
25 - (void)setTimestamp:(uint64_t)v
30 - (void)setHasTimestamp:(BOOL)f
36 return _has.timestamp;
38 - (NSUInteger)datasCount
48 PBRepeatedUInt32Clear(&_datas);
50 - (void)addData:(uint32_t)i
52 PBRepeatedUInt32Add(&_datas, i);
54 - (uint32_t)dataAtIndex:(NSUInteger)idx
56 if (_datas.count <= idx)
58 [[NSException exceptionWithName:NSRangeException reason:[NSString stringWithFormat:@"idx (%tu) is out of range (%tu)", idx, _datas.count] userInfo:nil] raise];
60 return _datas.list[idx];
62 - (void)setDatas:(uint32_t *)list count:(NSUInteger)count
64 PBRepeatedUInt32Set(&_datas, list, count);
66 - (BOOL)hasRatelimitertype
68 return _ratelimitertype != nil;
70 @synthesize ratelimitertype = _ratelimitertype;
72 - (NSString *)description
74 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
77 - (NSDictionary *)dictionaryRepresentation
79 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
80 if (self->_has.timestamp)
82 [dict setObject:[NSNumber numberWithUnsignedLongLong:self->_timestamp] forKey:@"timestamp"];
84 [dict setObject:PBRepeatedUInt32NSArray(&(self->_datas)) forKey:@"data"];
85 if (self->_ratelimitertype)
87 [dict setObject:self->_ratelimitertype forKey:@"ratelimitertype"];
92 BOOL AWDKeychainCKKSRateLimiterAggregatedScoresReadFrom(__unsafe_unretained AWDKeychainCKKSRateLimiterAggregatedScores *self, __unsafe_unretained PBDataReader *reader) {
93 while (PBReaderHasMoreData(reader)) {
97 PBReaderReadTag32AndType(reader, &tag, &aType);
99 if (PBReaderHasError(reader))
102 if (aType == TYPE_END_GROUP) {
108 case 1 /* timestamp */:
110 self->_has.timestamp = YES;
111 self->_timestamp = PBReaderReadUint64(reader);
116 if (TYPE_LENGTH_DELIMITED == aType)
118 PBDataReaderMark mark_data;
119 BOOL markError = !PBReaderPlaceMark(reader, &mark_data);
124 while (PBReaderHasMoreData(reader))
126 uint32_t new_data = PBReaderReadUint32(reader);
127 PBRepeatedUInt32Add(&(self->_datas), new_data);
129 PBReaderRecallMark(reader, &mark_data);
133 PBRepeatedUInt32Add(&(self->_datas), PBReaderReadUint32(reader));
137 case 3 /* ratelimitertype */:
139 NSString *new_ratelimitertype = PBReaderReadString(reader);
140 self->_ratelimitertype = new_ratelimitertype;
144 if (!PBReaderSkipValueWithTag(reader, tag, aType))
149 return !PBReaderHasError(reader);
152 - (BOOL)readFrom:(PBDataReader *)reader
154 return AWDKeychainCKKSRateLimiterAggregatedScoresReadFrom(self, reader);
156 - (void)writeTo:(PBDataWriter *)writer
160 if (self->_has.timestamp)
162 PBDataWriterWriteUint64Field(writer, self->_timestamp, 1);
167 if (self->_datas.count)
170 for (i_datas = 0; i_datas < self->_datas.count; i_datas++)
172 PBDataWriterWriteUint32Field(writer, self->_datas.list[i_datas], 2);
176 /* ratelimitertype */
178 if (self->_ratelimitertype)
180 PBDataWriterWriteStringField(writer, self->_ratelimitertype, 3);
185 - (void)copyTo:(AWDKeychainCKKSRateLimiterAggregatedScores *)other
187 if (self->_has.timestamp)
189 other->_timestamp = _timestamp;
190 other->_has.timestamp = YES;
192 if ([self datasCount])
195 NSUInteger datasCnt = [self datasCount];
196 for (NSUInteger i = 0; i < datasCnt; i++)
198 [other addData:[self dataAtIndex:i]];
201 if (_ratelimitertype)
203 other.ratelimitertype = _ratelimitertype;
207 - (id)copyWithZone:(NSZone *)zone
209 AWDKeychainCKKSRateLimiterAggregatedScores *copy = [[[self class] allocWithZone:zone] init];
210 if (self->_has.timestamp)
212 copy->_timestamp = _timestamp;
213 copy->_has.timestamp = YES;
215 PBRepeatedUInt32Copy(&(copy->_datas), &_datas);
216 copy->_ratelimitertype = [_ratelimitertype copyWithZone:zone];
220 - (BOOL)isEqual:(id)object
222 AWDKeychainCKKSRateLimiterAggregatedScores *other = (AWDKeychainCKKSRateLimiterAggregatedScores *)object;
223 return [other isMemberOfClass:[self class]]
225 ((self->_has.timestamp && other->_has.timestamp && self->_timestamp == other->_timestamp) || (!self->_has.timestamp && !other->_has.timestamp))
227 PBRepeatedUInt32IsEqual(&(self->_datas), &(other->_datas))
229 ((!self->_ratelimitertype && !other->_ratelimitertype) || [self->_ratelimitertype isEqual:other->_ratelimitertype])
237 (self->_has.timestamp ? PBHashInt((NSUInteger)self->_timestamp) : 0)
239 PBRepeatedUInt32Hash(&(self->_datas))
241 [self->_ratelimitertype hash]
245 - (void)mergeFrom:(AWDKeychainCKKSRateLimiterAggregatedScores *)other
247 if (other->_has.timestamp)
249 self->_timestamp = other->_timestamp;
250 self->_has.timestamp = YES;
252 NSUInteger datasCnt = [other datasCount];
253 for (NSUInteger i = 0; i < datasCnt; i++)
255 [self addData:[other dataAtIndex:i]];
257 if (other->_ratelimitertype)
259 [self setRatelimitertype:other->_ratelimitertype];