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 != 0;
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
59 return _has.epoch != 0;
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 != 0;
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 != 0;
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 != 0;
124 - (NSString *)attemptedJoinAsString:(OTAccountMetadataClassC_AttemptedAJoinState)value
126 return OTAccountMetadataClassC_AttemptedAJoinStateAsString(value);
128 - (OTAccountMetadataClassC_AttemptedAJoinState)StringAsAttemptedJoin:(NSString *)str
130 return StringAsOTAccountMetadataClassC_AttemptedAJoinState(str);
132 @synthesize cdpState = _cdpState;
133 - (OTAccountMetadataClassC_CDPState)cdpState
135 return _has.cdpState ? _cdpState : OTAccountMetadataClassC_CDPState_UNKNOWN;
137 - (void)setCdpState:(OTAccountMetadataClassC_CDPState)v
142 - (void)setHasCdpState:(BOOL)f
148 return _has.cdpState != 0;
150 - (NSString *)cdpStateAsString:(OTAccountMetadataClassC_CDPState)value
152 return OTAccountMetadataClassC_CDPStateAsString(value);
154 - (OTAccountMetadataClassC_CDPState)StringAsCdpState:(NSString *)str
156 return StringAsOTAccountMetadataClassC_CDPState(str);
158 - (BOOL)hasSyncingPolicy
160 return _syncingPolicy != nil;
162 @synthesize syncingPolicy = _syncingPolicy;
165 return _voucher != nil;
167 @synthesize voucher = _voucher;
168 - (BOOL)hasVoucherSignature
170 return _voucherSignature != nil;
172 @synthesize voucherSignature = _voucherSignature;
174 - (NSString *)description
176 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
179 - (NSDictionary *)dictionaryRepresentation
181 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
184 [dict setObject:self->_peerID forKey:@"peerID"];
186 if (self->_has.icloudAccountState)
188 [dict setObject:OTAccountMetadataClassC_AccountStateAsString(self->_icloudAccountState) forKey:@"icloudAccountState"];
190 if (self->_has.epoch)
192 [dict setObject:[NSNumber numberWithLongLong:self->_epoch] forKey:@"epoch"];
196 [dict setObject:self->_altDSID forKey:@"altDSID"];
198 if (self->_has.trustState)
200 [dict setObject:OTAccountMetadataClassC_TrustStateAsString(self->_trustState) forKey:@"trustState"];
202 if (self->_has.lastHealthCheckup)
204 [dict setObject:[NSNumber numberWithUnsignedLongLong:self->_lastHealthCheckup] forKey:@"lastHealthCheckup"];
206 if (self->_has.attemptedJoin)
208 [dict setObject:OTAccountMetadataClassC_AttemptedAJoinStateAsString(self->_attemptedJoin) forKey:@"attemptedJoin"];
210 if (self->_has.cdpState)
212 [dict setObject:OTAccountMetadataClassC_CDPStateAsString(self->_cdpState) forKey:@"cdpState"];
214 if (self->_syncingPolicy)
216 [dict setObject:self->_syncingPolicy forKey:@"syncingPolicy"];
220 [dict setObject:self->_voucher forKey:@"voucher"];
222 if (self->_voucherSignature)
224 [dict setObject:self->_voucherSignature forKey:@"voucherSignature"];
229 BOOL OTAccountMetadataClassCReadFrom(__unsafe_unretained OTAccountMetadataClassC *self, __unsafe_unretained PBDataReader *reader) {
230 while (PBReaderHasMoreData(reader)) {
234 PBReaderReadTag32AndType(reader, &tag, &aType);
236 if (PBReaderHasError(reader))
239 if (aType == TYPE_END_GROUP) {
247 NSString *new_peerID = PBReaderReadString(reader);
248 self->_peerID = new_peerID;
251 case 2 /* icloudAccountState */:
253 self->_has.icloudAccountState = YES;
254 self->_icloudAccountState = PBReaderReadInt32(reader);
259 self->_has.epoch = YES;
260 self->_epoch = PBReaderReadInt64(reader);
263 case 4 /* altDSID */:
265 NSString *new_altDSID = PBReaderReadString(reader);
266 self->_altDSID = new_altDSID;
269 case 5 /* trustState */:
271 self->_has.trustState = YES;
272 self->_trustState = PBReaderReadInt32(reader);
275 case 6 /* lastHealthCheckup */:
277 self->_has.lastHealthCheckup = YES;
278 self->_lastHealthCheckup = PBReaderReadUint64(reader);
281 case 7 /* attemptedJoin */:
283 self->_has.attemptedJoin = YES;
284 self->_attemptedJoin = PBReaderReadInt32(reader);
287 case 8 /* cdpState */:
289 self->_has.cdpState = YES;
290 self->_cdpState = PBReaderReadInt32(reader);
293 case 11 /* syncingPolicy */:
295 NSData *new_syncingPolicy = PBReaderReadData(reader);
296 self->_syncingPolicy = new_syncingPolicy;
299 case 12 /* voucher */:
301 NSData *new_voucher = PBReaderReadData(reader);
302 self->_voucher = new_voucher;
305 case 13 /* voucherSignature */:
307 NSData *new_voucherSignature = PBReaderReadData(reader);
308 self->_voucherSignature = new_voucherSignature;
312 if (!PBReaderSkipValueWithTag(reader, tag, aType))
317 return !PBReaderHasError(reader);
320 - (BOOL)readFrom:(PBDataReader *)reader
322 return OTAccountMetadataClassCReadFrom(self, reader);
324 - (void)writeTo:(PBDataWriter *)writer
330 PBDataWriterWriteStringField(writer, self->_peerID, 1);
333 /* icloudAccountState */
335 if (self->_has.icloudAccountState)
337 PBDataWriterWriteInt32Field(writer, self->_icloudAccountState, 2);
342 if (self->_has.epoch)
344 PBDataWriterWriteInt64Field(writer, self->_epoch, 3);
351 PBDataWriterWriteStringField(writer, self->_altDSID, 4);
356 if (self->_has.trustState)
358 PBDataWriterWriteInt32Field(writer, self->_trustState, 5);
361 /* lastHealthCheckup */
363 if (self->_has.lastHealthCheckup)
365 PBDataWriterWriteUint64Field(writer, self->_lastHealthCheckup, 6);
370 if (self->_has.attemptedJoin)
372 PBDataWriterWriteInt32Field(writer, self->_attemptedJoin, 7);
377 if (self->_has.cdpState)
379 PBDataWriterWriteInt32Field(writer, self->_cdpState, 8);
384 if (self->_syncingPolicy)
386 PBDataWriterWriteDataField(writer, self->_syncingPolicy, 11);
393 PBDataWriterWriteDataField(writer, self->_voucher, 12);
396 /* voucherSignature */
398 if (self->_voucherSignature)
400 PBDataWriterWriteDataField(writer, self->_voucherSignature, 13);
405 - (void)copyTo:(OTAccountMetadataClassC *)other
409 other.peerID = _peerID;
411 if (self->_has.icloudAccountState)
413 other->_icloudAccountState = _icloudAccountState;
414 other->_has.icloudAccountState = YES;
416 if (self->_has.epoch)
418 other->_epoch = _epoch;
419 other->_has.epoch = YES;
423 other.altDSID = _altDSID;
425 if (self->_has.trustState)
427 other->_trustState = _trustState;
428 other->_has.trustState = YES;
430 if (self->_has.lastHealthCheckup)
432 other->_lastHealthCheckup = _lastHealthCheckup;
433 other->_has.lastHealthCheckup = YES;
435 if (self->_has.attemptedJoin)
437 other->_attemptedJoin = _attemptedJoin;
438 other->_has.attemptedJoin = YES;
440 if (self->_has.cdpState)
442 other->_cdpState = _cdpState;
443 other->_has.cdpState = YES;
447 other.syncingPolicy = _syncingPolicy;
451 other.voucher = _voucher;
453 if (_voucherSignature)
455 other.voucherSignature = _voucherSignature;
459 - (id)copyWithZone:(NSZone *)zone
461 OTAccountMetadataClassC *copy = [[[self class] allocWithZone:zone] init];
462 copy->_peerID = [_peerID copyWithZone:zone];
463 if (self->_has.icloudAccountState)
465 copy->_icloudAccountState = _icloudAccountState;
466 copy->_has.icloudAccountState = YES;
468 if (self->_has.epoch)
470 copy->_epoch = _epoch;
471 copy->_has.epoch = YES;
473 copy->_altDSID = [_altDSID copyWithZone:zone];
474 if (self->_has.trustState)
476 copy->_trustState = _trustState;
477 copy->_has.trustState = YES;
479 if (self->_has.lastHealthCheckup)
481 copy->_lastHealthCheckup = _lastHealthCheckup;
482 copy->_has.lastHealthCheckup = YES;
484 if (self->_has.attemptedJoin)
486 copy->_attemptedJoin = _attemptedJoin;
487 copy->_has.attemptedJoin = YES;
489 if (self->_has.cdpState)
491 copy->_cdpState = _cdpState;
492 copy->_has.cdpState = YES;
494 copy->_syncingPolicy = [_syncingPolicy copyWithZone:zone];
495 copy->_voucher = [_voucher copyWithZone:zone];
496 copy->_voucherSignature = [_voucherSignature copyWithZone:zone];
500 - (BOOL)isEqual:(id)object
502 OTAccountMetadataClassC *other = (OTAccountMetadataClassC *)object;
503 return [other isMemberOfClass:[self class]]
505 ((!self->_peerID && !other->_peerID) || [self->_peerID isEqual:other->_peerID])
507 ((self->_has.icloudAccountState && other->_has.icloudAccountState && self->_icloudAccountState == other->_icloudAccountState) || (!self->_has.icloudAccountState && !other->_has.icloudAccountState))
509 ((self->_has.epoch && other->_has.epoch && self->_epoch == other->_epoch) || (!self->_has.epoch && !other->_has.epoch))
511 ((!self->_altDSID && !other->_altDSID) || [self->_altDSID isEqual:other->_altDSID])
513 ((self->_has.trustState && other->_has.trustState && self->_trustState == other->_trustState) || (!self->_has.trustState && !other->_has.trustState))
515 ((self->_has.lastHealthCheckup && other->_has.lastHealthCheckup && self->_lastHealthCheckup == other->_lastHealthCheckup) || (!self->_has.lastHealthCheckup && !other->_has.lastHealthCheckup))
517 ((self->_has.attemptedJoin && other->_has.attemptedJoin && self->_attemptedJoin == other->_attemptedJoin) || (!self->_has.attemptedJoin && !other->_has.attemptedJoin))
519 ((self->_has.cdpState && other->_has.cdpState && self->_cdpState == other->_cdpState) || (!self->_has.cdpState && !other->_has.cdpState))
521 ((!self->_syncingPolicy && !other->_syncingPolicy) || [self->_syncingPolicy isEqual:other->_syncingPolicy])
523 ((!self->_voucher && !other->_voucher) || [self->_voucher isEqual:other->_voucher])
525 ((!self->_voucherSignature && !other->_voucherSignature) || [self->_voucherSignature isEqual:other->_voucherSignature])
535 (self->_has.icloudAccountState ? PBHashInt((NSUInteger)self->_icloudAccountState) : 0)
537 (self->_has.epoch ? PBHashInt((NSUInteger)self->_epoch) : 0)
539 [self->_altDSID hash]
541 (self->_has.trustState ? PBHashInt((NSUInteger)self->_trustState) : 0)
543 (self->_has.lastHealthCheckup ? PBHashInt((NSUInteger)self->_lastHealthCheckup) : 0)
545 (self->_has.attemptedJoin ? PBHashInt((NSUInteger)self->_attemptedJoin) : 0)
547 (self->_has.cdpState ? PBHashInt((NSUInteger)self->_cdpState) : 0)
549 [self->_syncingPolicy hash]
551 [self->_voucher hash]
553 [self->_voucherSignature hash]
557 - (void)mergeFrom:(OTAccountMetadataClassC *)other
561 [self setPeerID:other->_peerID];
563 if (other->_has.icloudAccountState)
565 self->_icloudAccountState = other->_icloudAccountState;
566 self->_has.icloudAccountState = YES;
568 if (other->_has.epoch)
570 self->_epoch = other->_epoch;
571 self->_has.epoch = YES;
575 [self setAltDSID:other->_altDSID];
577 if (other->_has.trustState)
579 self->_trustState = other->_trustState;
580 self->_has.trustState = YES;
582 if (other->_has.lastHealthCheckup)
584 self->_lastHealthCheckup = other->_lastHealthCheckup;
585 self->_has.lastHealthCheckup = YES;
587 if (other->_has.attemptedJoin)
589 self->_attemptedJoin = other->_attemptedJoin;
590 self->_has.attemptedJoin = YES;
592 if (other->_has.cdpState)
594 self->_cdpState = other->_cdpState;
595 self->_has.cdpState = YES;
597 if (other->_syncingPolicy)
599 [self setSyncingPolicy:other->_syncingPolicy];
603 [self setVoucher:other->_voucher];
605 if (other->_voucherSignature)
607 [self setVoucherSignature:other->_voucherSignature];