1 // This file was automatically generated by protocompiler
5 #import <TargetConditionals.h>
8 #import "AWDKeychainCKKSRateLimiterTopWriters.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 AWDKeychainCKKSRateLimiterTopWriters
19 @synthesize timestamp = _timestamp;
20 - (void)setTimestamp:(uint64_t)v
25 - (void)setHasTimestamp:(BOOL)f
31 return _has.timestamp;
33 @synthesize writers = _writers;
36 [_writers removeAllObjects];
38 - (void)addWriter:(NSString *)i
42 _writers = [[NSMutableArray alloc] init];
44 [_writers addObject:i];
46 - (NSUInteger)writersCount
48 return [_writers count];
50 - (NSString *)writerAtIndex:(NSUInteger)idx
52 return [_writers objectAtIndex:idx];
56 return [NSString class];
58 - (BOOL)hasRatelimitertype
60 return _ratelimitertype != nil;
62 @synthesize ratelimitertype = _ratelimitertype;
64 - (NSString *)description
66 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
69 - (NSDictionary *)dictionaryRepresentation
71 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
72 if (self->_has.timestamp)
74 [dict setObject:[NSNumber numberWithUnsignedLongLong:self->_timestamp] forKey:@"timestamp"];
78 [dict setObject:self->_writers forKey:@"writer"];
80 if (self->_ratelimitertype)
82 [dict setObject:self->_ratelimitertype forKey:@"ratelimitertype"];
87 BOOL AWDKeychainCKKSRateLimiterTopWritersReadFrom(__unsafe_unretained AWDKeychainCKKSRateLimiterTopWriters *self, __unsafe_unretained PBDataReader *reader) {
88 while (PBReaderHasMoreData(reader)) {
92 PBReaderReadTag32AndType(reader, &tag, &aType);
94 if (PBReaderHasError(reader))
97 if (aType == TYPE_END_GROUP) {
103 case 1 /* timestamp */:
105 self->_has.timestamp = YES;
106 self->_timestamp = PBReaderReadUint64(reader);
109 case 2 /* writers */:
111 NSString *new_writers = PBReaderReadString(reader);
114 [self addWriter:new_writers];
118 case 3 /* ratelimitertype */:
120 NSString *new_ratelimitertype = PBReaderReadString(reader);
121 self->_ratelimitertype = new_ratelimitertype;
125 if (!PBReaderSkipValueWithTag(reader, tag, aType))
130 return !PBReaderHasError(reader);
133 - (BOOL)readFrom:(PBDataReader *)reader
135 return AWDKeychainCKKSRateLimiterTopWritersReadFrom(self, reader);
137 - (void)writeTo:(PBDataWriter *)writer
141 if (self->_has.timestamp)
143 PBDataWriterWriteUint64Field(writer, self->_timestamp, 1);
148 for (NSString *s_writers in self->_writers)
150 PBDataWriterWriteStringField(writer, s_writers, 2);
153 /* ratelimitertype */
155 if (self->_ratelimitertype)
157 PBDataWriterWriteStringField(writer, self->_ratelimitertype, 3);
162 - (void)copyTo:(AWDKeychainCKKSRateLimiterTopWriters *)other
164 if (self->_has.timestamp)
166 other->_timestamp = _timestamp;
167 other->_has.timestamp = YES;
169 if ([self writersCount])
171 [other clearWriters];
172 NSUInteger writersCnt = [self writersCount];
173 for (NSUInteger i = 0; i < writersCnt; i++)
175 [other addWriter:[self writerAtIndex:i]];
178 if (_ratelimitertype)
180 other.ratelimitertype = _ratelimitertype;
184 - (id)copyWithZone:(NSZone *)zone
186 AWDKeychainCKKSRateLimiterTopWriters *copy = [[[self class] allocWithZone:zone] init];
187 if (self->_has.timestamp)
189 copy->_timestamp = _timestamp;
190 copy->_has.timestamp = YES;
192 for (NSString *v in _writers)
194 NSString *vCopy = [v copyWithZone:zone];
195 [copy addWriter:vCopy];
197 copy->_ratelimitertype = [_ratelimitertype copyWithZone:zone];
201 - (BOOL)isEqual:(id)object
203 AWDKeychainCKKSRateLimiterTopWriters *other = (AWDKeychainCKKSRateLimiterTopWriters *)object;
204 return [other isMemberOfClass:[self class]]
206 ((self->_has.timestamp && other->_has.timestamp && self->_timestamp == other->_timestamp) || (!self->_has.timestamp && !other->_has.timestamp))
208 ((!self->_writers && !other->_writers) || [self->_writers isEqual:other->_writers])
210 ((!self->_ratelimitertype && !other->_ratelimitertype) || [self->_ratelimitertype isEqual:other->_ratelimitertype])
218 (self->_has.timestamp ? PBHashInt((NSUInteger)self->_timestamp) : 0)
220 [self->_writers hash]
222 [self->_ratelimitertype hash]
226 - (void)mergeFrom:(AWDKeychainCKKSRateLimiterTopWriters *)other
228 if (other->_has.timestamp)
230 self->_timestamp = other->_timestamp;
231 self->_has.timestamp = YES;
233 for (NSString *iter_writers in other->_writers)
235 [self addWriter:iter_writers];
237 if (other->_ratelimitertype)
239 [self setRatelimitertype:other->_ratelimitertype];