]> git.saurik.com Git - apple/security.git/blob - keychain/analytics/awd/AWDKeychainCKKSRateLimiterTopWriters.m
Security-58286.20.16.tar.gz
[apple/security.git] / keychain / analytics / awd / AWDKeychainCKKSRateLimiterTopWriters.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 "AWDKeychainCKKSRateLimiterTopWriters.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 AWDKeychainCKKSRateLimiterTopWriters
18
19 @synthesize timestamp = _timestamp;
20 - (void)setTimestamp:(uint64_t)v
21 {
22 _has.timestamp = YES;
23 _timestamp = v;
24 }
25 - (void)setHasTimestamp:(BOOL)f
26 {
27 _has.timestamp = f;
28 }
29 - (BOOL)hasTimestamp
30 {
31 return _has.timestamp;
32 }
33 @synthesize writers = _writers;
34 - (void)clearWriters
35 {
36 [_writers removeAllObjects];
37 }
38 - (void)addWriter:(NSString *)i
39 {
40 if (!_writers)
41 {
42 _writers = [[NSMutableArray alloc] init];
43 }
44 [_writers addObject:i];
45 }
46 - (NSUInteger)writersCount
47 {
48 return [_writers count];
49 }
50 - (NSString *)writerAtIndex:(NSUInteger)idx
51 {
52 return [_writers objectAtIndex:idx];
53 }
54 + (Class)writerType
55 {
56 return [NSString class];
57 }
58 - (BOOL)hasRatelimitertype
59 {
60 return _ratelimitertype != nil;
61 }
62 @synthesize ratelimitertype = _ratelimitertype;
63
64 - (NSString *)description
65 {
66 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
67 }
68
69 - (NSDictionary *)dictionaryRepresentation
70 {
71 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
72 if (self->_has.timestamp)
73 {
74 [dict setObject:[NSNumber numberWithUnsignedLongLong:self->_timestamp] forKey:@"timestamp"];
75 }
76 if (self->_writers)
77 {
78 [dict setObject:self->_writers forKey:@"writer"];
79 }
80 if (self->_ratelimitertype)
81 {
82 [dict setObject:self->_ratelimitertype forKey:@"ratelimitertype"];
83 }
84 return dict;
85 }
86
87 BOOL AWDKeychainCKKSRateLimiterTopWritersReadFrom(__unsafe_unretained AWDKeychainCKKSRateLimiterTopWriters *self, __unsafe_unretained PBDataReader *reader) {
88 while (PBReaderHasMoreData(reader)) {
89 uint32_t tag = 0;
90 uint8_t aType = 0;
91
92 PBReaderReadTag32AndType(reader, &tag, &aType);
93
94 if (PBReaderHasError(reader))
95 break;
96
97 if (aType == TYPE_END_GROUP) {
98 break;
99 }
100
101 switch (tag) {
102
103 case 1 /* timestamp */:
104 {
105 self->_has.timestamp = YES;
106 self->_timestamp = PBReaderReadUint64(reader);
107 }
108 break;
109 case 2 /* writers */:
110 {
111 NSString *new_writers = PBReaderReadString(reader);
112 if (new_writers)
113 {
114 [self addWriter:new_writers];
115 }
116 }
117 break;
118 case 3 /* ratelimitertype */:
119 {
120 NSString *new_ratelimitertype = PBReaderReadString(reader);
121 self->_ratelimitertype = new_ratelimitertype;
122 }
123 break;
124 default:
125 if (!PBReaderSkipValueWithTag(reader, tag, aType))
126 return NO;
127 break;
128 }
129 }
130 return !PBReaderHasError(reader);
131 }
132
133 - (BOOL)readFrom:(PBDataReader *)reader
134 {
135 return AWDKeychainCKKSRateLimiterTopWritersReadFrom(self, reader);
136 }
137 - (void)writeTo:(PBDataWriter *)writer
138 {
139 /* timestamp */
140 {
141 if (self->_has.timestamp)
142 {
143 PBDataWriterWriteUint64Field(writer, self->_timestamp, 1);
144 }
145 }
146 /* writers */
147 {
148 for (NSString *s_writers in self->_writers)
149 {
150 PBDataWriterWriteStringField(writer, s_writers, 2);
151 }
152 }
153 /* ratelimitertype */
154 {
155 if (self->_ratelimitertype)
156 {
157 PBDataWriterWriteStringField(writer, self->_ratelimitertype, 3);
158 }
159 }
160 }
161
162 - (void)copyTo:(AWDKeychainCKKSRateLimiterTopWriters *)other
163 {
164 if (self->_has.timestamp)
165 {
166 other->_timestamp = _timestamp;
167 other->_has.timestamp = YES;
168 }
169 if ([self writersCount])
170 {
171 [other clearWriters];
172 NSUInteger writersCnt = [self writersCount];
173 for (NSUInteger i = 0; i < writersCnt; i++)
174 {
175 [other addWriter:[self writerAtIndex:i]];
176 }
177 }
178 if (_ratelimitertype)
179 {
180 other.ratelimitertype = _ratelimitertype;
181 }
182 }
183
184 - (id)copyWithZone:(NSZone *)zone
185 {
186 AWDKeychainCKKSRateLimiterTopWriters *copy = [[[self class] allocWithZone:zone] init];
187 if (self->_has.timestamp)
188 {
189 copy->_timestamp = _timestamp;
190 copy->_has.timestamp = YES;
191 }
192 for (NSString *v in _writers)
193 {
194 NSString *vCopy = [v copyWithZone:zone];
195 [copy addWriter:vCopy];
196 }
197 copy->_ratelimitertype = [_ratelimitertype copyWithZone:zone];
198 return copy;
199 }
200
201 - (BOOL)isEqual:(id)object
202 {
203 AWDKeychainCKKSRateLimiterTopWriters *other = (AWDKeychainCKKSRateLimiterTopWriters *)object;
204 return [other isMemberOfClass:[self class]]
205 &&
206 ((self->_has.timestamp && other->_has.timestamp && self->_timestamp == other->_timestamp) || (!self->_has.timestamp && !other->_has.timestamp))
207 &&
208 ((!self->_writers && !other->_writers) || [self->_writers isEqual:other->_writers])
209 &&
210 ((!self->_ratelimitertype && !other->_ratelimitertype) || [self->_ratelimitertype isEqual:other->_ratelimitertype])
211 ;
212 }
213
214 - (NSUInteger)hash
215 {
216 return 0
217 ^
218 (self->_has.timestamp ? PBHashInt((NSUInteger)self->_timestamp) : 0)
219 ^
220 [self->_writers hash]
221 ^
222 [self->_ratelimitertype hash]
223 ;
224 }
225
226 - (void)mergeFrom:(AWDKeychainCKKSRateLimiterTopWriters *)other
227 {
228 if (other->_has.timestamp)
229 {
230 self->_timestamp = other->_timestamp;
231 self->_has.timestamp = YES;
232 }
233 for (NSString *iter_writers in other->_writers)
234 {
235 [self addWriter:iter_writers];
236 }
237 if (other->_ratelimitertype)
238 {
239 [self setRatelimitertype:other->_ratelimitertype];
240 }
241 }
242
243 @end
244 #endif