1 // This file was automatically generated by protocompiler
3 // Compiled from OTAccountMetadataClassC.proto
5 #import "OTAccountMetadataClassC.h"
6 #import <ProtocolBuffer/PBConstants.h>
7 #import <ProtocolBuffer/PBHashUtil.h>
8 #import <ProtocolBuffer/PBDataReader.h>
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.
14 @implementation OTAccountMetadataClassC
18 return _peerID != nil;
20 @synthesize peerID = _peerID;
21 @synthesize icloudAccountState = _icloudAccountState;
22 - (OTAccountMetadataClassC_AccountState)icloudAccountState
24 return _has.icloudAccountState ? _icloudAccountState : OTAccountMetadataClassC_AccountState_UNKNOWN;
26 - (void)setIcloudAccountState:(OTAccountMetadataClassC_AccountState)v
28 _has.icloudAccountState = YES;
29 _icloudAccountState = v;
31 - (void)setHasIcloudAccountState:(BOOL)f
33 _has.icloudAccountState = f;
35 - (BOOL)hasIcloudAccountState
37 return _has.icloudAccountState;
39 - (NSString *)icloudAccountStateAsString:(OTAccountMetadataClassC_AccountState)value
41 return OTAccountMetadataClassC_AccountStateAsString(value);
43 - (OTAccountMetadataClassC_AccountState)StringAsIcloudAccountState:(NSString *)str
45 return StringAsOTAccountMetadataClassC_AccountState(str);
47 @synthesize epoch = _epoch;
48 - (void)setEpoch:(int64_t)v
53 - (void)setHasEpoch:(BOOL)f
63 return _altDSID != nil;
65 @synthesize altDSID = _altDSID;
66 @synthesize trustState = _trustState;
67 - (OTAccountMetadataClassC_TrustState)trustState
69 return _has.trustState ? _trustState : OTAccountMetadataClassC_TrustState_UNKNOWN;
71 - (void)setTrustState:(OTAccountMetadataClassC_TrustState)v
73 _has.trustState = YES;
76 - (void)setHasTrustState:(BOOL)f
82 return _has.trustState;
84 - (NSString *)trustStateAsString:(OTAccountMetadataClassC_TrustState)value
86 return OTAccountMetadataClassC_TrustStateAsString(value);
88 - (OTAccountMetadataClassC_TrustState)StringAsTrustState:(NSString *)str
90 return StringAsOTAccountMetadataClassC_TrustState(str);
92 @synthesize lastHealthCheckup = _lastHealthCheckup;
93 - (void)setLastHealthCheckup:(uint64_t)v
95 _has.lastHealthCheckup = YES;
96 _lastHealthCheckup = v;
98 - (void)setHasLastHealthCheckup:(BOOL)f
100 _has.lastHealthCheckup = f;
102 - (BOOL)hasLastHealthCheckup
104 return _has.lastHealthCheckup;
106 @synthesize attemptedJoin = _attemptedJoin;
107 - (OTAccountMetadataClassC_AttemptedAJoinState)attemptedJoin
109 return _has.attemptedJoin ? _attemptedJoin : OTAccountMetadataClassC_AttemptedAJoinState_UNKNOWN;
111 - (void)setAttemptedJoin:(OTAccountMetadataClassC_AttemptedAJoinState)v
113 _has.attemptedJoin = YES;
116 - (void)setHasAttemptedJoin:(BOOL)f
118 _has.attemptedJoin = f;
120 - (BOOL)hasAttemptedJoin
122 return _has.attemptedJoin;
124 - (NSString *)attemptedJoinAsString:(OTAccountMetadataClassC_AttemptedAJoinState)value
126 return OTAccountMetadataClassC_AttemptedAJoinStateAsString(value);
128 - (OTAccountMetadataClassC_AttemptedAJoinState)StringAsAttemptedJoin:(NSString *)str
130 return StringAsOTAccountMetadataClassC_AttemptedAJoinState(str);
133 - (NSString *)description
135 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
138 - (NSDictionary *)dictionaryRepresentation
140 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
143 [dict setObject:self->_peerID forKey:@"peerID"];
145 if (self->_has.icloudAccountState)
147 [dict setObject:OTAccountMetadataClassC_AccountStateAsString(self->_icloudAccountState) forKey:@"icloudAccountState"];
149 if (self->_has.epoch)
151 [dict setObject:[NSNumber numberWithLongLong:self->_epoch] forKey:@"epoch"];
155 [dict setObject:self->_altDSID forKey:@"altDSID"];
157 if (self->_has.trustState)
159 [dict setObject:OTAccountMetadataClassC_TrustStateAsString(self->_trustState) forKey:@"trustState"];
161 if (self->_has.lastHealthCheckup)
163 [dict setObject:[NSNumber numberWithUnsignedLongLong:self->_lastHealthCheckup] forKey:@"lastHealthCheckup"];
165 if (self->_has.attemptedJoin)
167 [dict setObject:OTAccountMetadataClassC_AttemptedAJoinStateAsString(self->_attemptedJoin) forKey:@"attemptedJoin"];
172 BOOL OTAccountMetadataClassCReadFrom(__unsafe_unretained OTAccountMetadataClassC *self, __unsafe_unretained PBDataReader *reader) {
173 while (PBReaderHasMoreData(reader)) {
177 PBReaderReadTag32AndType(reader, &tag, &aType);
179 if (PBReaderHasError(reader))
182 if (aType == TYPE_END_GROUP) {
190 NSString *new_peerID = PBReaderReadString(reader);
191 self->_peerID = new_peerID;
194 case 2 /* icloudAccountState */:
196 self->_has.icloudAccountState = YES;
197 self->_icloudAccountState = PBReaderReadInt32(reader);
202 self->_has.epoch = YES;
203 self->_epoch = PBReaderReadInt64(reader);
206 case 4 /* altDSID */:
208 NSString *new_altDSID = PBReaderReadString(reader);
209 self->_altDSID = new_altDSID;
212 case 5 /* trustState */:
214 self->_has.trustState = YES;
215 self->_trustState = PBReaderReadInt32(reader);
218 case 6 /* lastHealthCheckup */:
220 self->_has.lastHealthCheckup = YES;
221 self->_lastHealthCheckup = PBReaderReadUint64(reader);
224 case 7 /* attemptedJoin */:
226 self->_has.attemptedJoin = YES;
227 self->_attemptedJoin = PBReaderReadInt32(reader);
231 if (!PBReaderSkipValueWithTag(reader, tag, aType))
236 return !PBReaderHasError(reader);
239 - (BOOL)readFrom:(PBDataReader *)reader
241 return OTAccountMetadataClassCReadFrom(self, reader);
243 - (void)writeTo:(PBDataWriter *)writer
249 PBDataWriterWriteStringField(writer, self->_peerID, 1);
252 /* icloudAccountState */
254 if (self->_has.icloudAccountState)
256 PBDataWriterWriteInt32Field(writer, self->_icloudAccountState, 2);
261 if (self->_has.epoch)
263 PBDataWriterWriteInt64Field(writer, self->_epoch, 3);
270 PBDataWriterWriteStringField(writer, self->_altDSID, 4);
275 if (self->_has.trustState)
277 PBDataWriterWriteInt32Field(writer, self->_trustState, 5);
280 /* lastHealthCheckup */
282 if (self->_has.lastHealthCheckup)
284 PBDataWriterWriteUint64Field(writer, self->_lastHealthCheckup, 6);
289 if (self->_has.attemptedJoin)
291 PBDataWriterWriteInt32Field(writer, self->_attemptedJoin, 7);
296 - (void)copyTo:(OTAccountMetadataClassC *)other
300 other.peerID = _peerID;
302 if (self->_has.icloudAccountState)
304 other->_icloudAccountState = _icloudAccountState;
305 other->_has.icloudAccountState = YES;
307 if (self->_has.epoch)
309 other->_epoch = _epoch;
310 other->_has.epoch = YES;
314 other.altDSID = _altDSID;
316 if (self->_has.trustState)
318 other->_trustState = _trustState;
319 other->_has.trustState = YES;
321 if (self->_has.lastHealthCheckup)
323 other->_lastHealthCheckup = _lastHealthCheckup;
324 other->_has.lastHealthCheckup = YES;
326 if (self->_has.attemptedJoin)
328 other->_attemptedJoin = _attemptedJoin;
329 other->_has.attemptedJoin = YES;
333 - (id)copyWithZone:(NSZone *)zone
335 OTAccountMetadataClassC *copy = [[[self class] allocWithZone:zone] init];
336 copy->_peerID = [_peerID copyWithZone:zone];
337 if (self->_has.icloudAccountState)
339 copy->_icloudAccountState = _icloudAccountState;
340 copy->_has.icloudAccountState = YES;
342 if (self->_has.epoch)
344 copy->_epoch = _epoch;
345 copy->_has.epoch = YES;
347 copy->_altDSID = [_altDSID copyWithZone:zone];
348 if (self->_has.trustState)
350 copy->_trustState = _trustState;
351 copy->_has.trustState = YES;
353 if (self->_has.lastHealthCheckup)
355 copy->_lastHealthCheckup = _lastHealthCheckup;
356 copy->_has.lastHealthCheckup = YES;
358 if (self->_has.attemptedJoin)
360 copy->_attemptedJoin = _attemptedJoin;
361 copy->_has.attemptedJoin = YES;
366 - (BOOL)isEqual:(id)object
368 OTAccountMetadataClassC *other = (OTAccountMetadataClassC *)object;
369 return [other isMemberOfClass:[self class]]
371 ((!self->_peerID && !other->_peerID) || [self->_peerID isEqual:other->_peerID])
373 ((self->_has.icloudAccountState && other->_has.icloudAccountState && self->_icloudAccountState == other->_icloudAccountState) || (!self->_has.icloudAccountState && !other->_has.icloudAccountState))
375 ((self->_has.epoch && other->_has.epoch && self->_epoch == other->_epoch) || (!self->_has.epoch && !other->_has.epoch))
377 ((!self->_altDSID && !other->_altDSID) || [self->_altDSID isEqual:other->_altDSID])
379 ((self->_has.trustState && other->_has.trustState && self->_trustState == other->_trustState) || (!self->_has.trustState && !other->_has.trustState))
381 ((self->_has.lastHealthCheckup && other->_has.lastHealthCheckup && self->_lastHealthCheckup == other->_lastHealthCheckup) || (!self->_has.lastHealthCheckup && !other->_has.lastHealthCheckup))
383 ((self->_has.attemptedJoin && other->_has.attemptedJoin && self->_attemptedJoin == other->_attemptedJoin) || (!self->_has.attemptedJoin && !other->_has.attemptedJoin))
393 (self->_has.icloudAccountState ? PBHashInt((NSUInteger)self->_icloudAccountState) : 0)
395 (self->_has.epoch ? PBHashInt((NSUInteger)self->_epoch) : 0)
397 [self->_altDSID hash]
399 (self->_has.trustState ? PBHashInt((NSUInteger)self->_trustState) : 0)
401 (self->_has.lastHealthCheckup ? PBHashInt((NSUInteger)self->_lastHealthCheckup) : 0)
403 (self->_has.attemptedJoin ? PBHashInt((NSUInteger)self->_attemptedJoin) : 0)
407 - (void)mergeFrom:(OTAccountMetadataClassC *)other
411 [self setPeerID:other->_peerID];
413 if (other->_has.icloudAccountState)
415 self->_icloudAccountState = other->_icloudAccountState;
416 self->_has.icloudAccountState = YES;
418 if (other->_has.epoch)
420 self->_epoch = other->_epoch;
421 self->_has.epoch = YES;
425 [self setAltDSID:other->_altDSID];
427 if (other->_has.trustState)
429 self->_trustState = other->_trustState;
430 self->_has.trustState = YES;
432 if (other->_has.lastHealthCheckup)
434 self->_lastHealthCheckup = other->_lastHealthCheckup;
435 self->_has.lastHealthCheckup = YES;
437 if (other->_has.attemptedJoin)
439 self->_attemptedJoin = other->_attemptedJoin;
440 self->_has.attemptedJoin = YES;