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;
163 @synthesize syncingViews = _syncingViews;
164 - (void)clearSyncingViews
166 [_syncingViews removeAllObjects];
168 - (void)addSyncingView:(NSString *)i
172 _syncingViews = [[NSMutableArray alloc] init];
174 [_syncingViews addObject:i];
176 - (NSUInteger)syncingViewsCount
178 return [_syncingViews count];
180 - (NSString *)syncingViewAtIndex:(NSUInteger)idx
182 return [_syncingViews objectAtIndex:idx];
184 + (Class)syncingViewType
186 return [NSString class];
189 - (NSString *)description
191 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
194 - (NSDictionary *)dictionaryRepresentation
196 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
199 [dict setObject:self->_peerID forKey:@"peerID"];
201 if (self->_has.icloudAccountState)
203 [dict setObject:OTAccountMetadataClassC_AccountStateAsString(self->_icloudAccountState) forKey:@"icloudAccountState"];
205 if (self->_has.epoch)
207 [dict setObject:[NSNumber numberWithLongLong:self->_epoch] forKey:@"epoch"];
211 [dict setObject:self->_altDSID forKey:@"altDSID"];
213 if (self->_has.trustState)
215 [dict setObject:OTAccountMetadataClassC_TrustStateAsString(self->_trustState) forKey:@"trustState"];
217 if (self->_has.lastHealthCheckup)
219 [dict setObject:[NSNumber numberWithUnsignedLongLong:self->_lastHealthCheckup] forKey:@"lastHealthCheckup"];
221 if (self->_has.attemptedJoin)
223 [dict setObject:OTAccountMetadataClassC_AttemptedAJoinStateAsString(self->_attemptedJoin) forKey:@"attemptedJoin"];
225 if (self->_has.cdpState)
227 [dict setObject:OTAccountMetadataClassC_CDPStateAsString(self->_cdpState) forKey:@"cdpState"];
229 if (self->_syncingPolicy)
231 [dict setObject:self->_syncingPolicy forKey:@"syncingPolicy"];
233 if (self->_syncingViews)
235 [dict setObject:self->_syncingViews forKey:@"syncingView"];
240 BOOL OTAccountMetadataClassCReadFrom(__unsafe_unretained OTAccountMetadataClassC *self, __unsafe_unretained PBDataReader *reader) {
241 while (PBReaderHasMoreData(reader)) {
245 PBReaderReadTag32AndType(reader, &tag, &aType);
247 if (PBReaderHasError(reader))
250 if (aType == TYPE_END_GROUP) {
258 NSString *new_peerID = PBReaderReadString(reader);
259 self->_peerID = new_peerID;
262 case 2 /* icloudAccountState */:
264 self->_has.icloudAccountState = YES;
265 self->_icloudAccountState = PBReaderReadInt32(reader);
270 self->_has.epoch = YES;
271 self->_epoch = PBReaderReadInt64(reader);
274 case 4 /* altDSID */:
276 NSString *new_altDSID = PBReaderReadString(reader);
277 self->_altDSID = new_altDSID;
280 case 5 /* trustState */:
282 self->_has.trustState = YES;
283 self->_trustState = PBReaderReadInt32(reader);
286 case 6 /* lastHealthCheckup */:
288 self->_has.lastHealthCheckup = YES;
289 self->_lastHealthCheckup = PBReaderReadUint64(reader);
292 case 7 /* attemptedJoin */:
294 self->_has.attemptedJoin = YES;
295 self->_attemptedJoin = PBReaderReadInt32(reader);
298 case 8 /* cdpState */:
300 self->_has.cdpState = YES;
301 self->_cdpState = PBReaderReadInt32(reader);
304 case 9 /* syncingPolicy */:
306 NSData *new_syncingPolicy = PBReaderReadData(reader);
307 self->_syncingPolicy = new_syncingPolicy;
310 case 10 /* syncingViews */:
312 NSString *new_syncingViews = PBReaderReadString(reader);
313 if (new_syncingViews)
315 [self addSyncingView:new_syncingViews];
320 if (!PBReaderSkipValueWithTag(reader, tag, aType))
325 return !PBReaderHasError(reader);
328 - (BOOL)readFrom:(PBDataReader *)reader
330 return OTAccountMetadataClassCReadFrom(self, reader);
332 - (void)writeTo:(PBDataWriter *)writer
338 PBDataWriterWriteStringField(writer, self->_peerID, 1);
341 /* icloudAccountState */
343 if (self->_has.icloudAccountState)
345 PBDataWriterWriteInt32Field(writer, self->_icloudAccountState, 2);
350 if (self->_has.epoch)
352 PBDataWriterWriteInt64Field(writer, self->_epoch, 3);
359 PBDataWriterWriteStringField(writer, self->_altDSID, 4);
364 if (self->_has.trustState)
366 PBDataWriterWriteInt32Field(writer, self->_trustState, 5);
369 /* lastHealthCheckup */
371 if (self->_has.lastHealthCheckup)
373 PBDataWriterWriteUint64Field(writer, self->_lastHealthCheckup, 6);
378 if (self->_has.attemptedJoin)
380 PBDataWriterWriteInt32Field(writer, self->_attemptedJoin, 7);
385 if (self->_has.cdpState)
387 PBDataWriterWriteInt32Field(writer, self->_cdpState, 8);
392 if (self->_syncingPolicy)
394 PBDataWriterWriteDataField(writer, self->_syncingPolicy, 9);
399 for (NSString *s_syncingViews in self->_syncingViews)
401 PBDataWriterWriteStringField(writer, s_syncingViews, 10);
406 - (void)copyTo:(OTAccountMetadataClassC *)other
410 other.peerID = _peerID;
412 if (self->_has.icloudAccountState)
414 other->_icloudAccountState = _icloudAccountState;
415 other->_has.icloudAccountState = YES;
417 if (self->_has.epoch)
419 other->_epoch = _epoch;
420 other->_has.epoch = YES;
424 other.altDSID = _altDSID;
426 if (self->_has.trustState)
428 other->_trustState = _trustState;
429 other->_has.trustState = YES;
431 if (self->_has.lastHealthCheckup)
433 other->_lastHealthCheckup = _lastHealthCheckup;
434 other->_has.lastHealthCheckup = YES;
436 if (self->_has.attemptedJoin)
438 other->_attemptedJoin = _attemptedJoin;
439 other->_has.attemptedJoin = YES;
441 if (self->_has.cdpState)
443 other->_cdpState = _cdpState;
444 other->_has.cdpState = YES;
448 other.syncingPolicy = _syncingPolicy;
450 if ([self syncingViewsCount])
452 [other clearSyncingViews];
453 NSUInteger syncingViewsCnt = [self syncingViewsCount];
454 for (NSUInteger i = 0; i < syncingViewsCnt; i++)
456 [other addSyncingView:[self syncingViewAtIndex:i]];
461 - (id)copyWithZone:(NSZone *)zone
463 OTAccountMetadataClassC *copy = [[[self class] allocWithZone:zone] init];
464 copy->_peerID = [_peerID copyWithZone:zone];
465 if (self->_has.icloudAccountState)
467 copy->_icloudAccountState = _icloudAccountState;
468 copy->_has.icloudAccountState = YES;
470 if (self->_has.epoch)
472 copy->_epoch = _epoch;
473 copy->_has.epoch = YES;
475 copy->_altDSID = [_altDSID copyWithZone:zone];
476 if (self->_has.trustState)
478 copy->_trustState = _trustState;
479 copy->_has.trustState = YES;
481 if (self->_has.lastHealthCheckup)
483 copy->_lastHealthCheckup = _lastHealthCheckup;
484 copy->_has.lastHealthCheckup = YES;
486 if (self->_has.attemptedJoin)
488 copy->_attemptedJoin = _attemptedJoin;
489 copy->_has.attemptedJoin = YES;
491 if (self->_has.cdpState)
493 copy->_cdpState = _cdpState;
494 copy->_has.cdpState = YES;
496 copy->_syncingPolicy = [_syncingPolicy copyWithZone:zone];
497 for (NSString *v in _syncingViews)
499 NSString *vCopy = [v copyWithZone:zone];
500 [copy addSyncingView:vCopy];
505 - (BOOL)isEqual:(id)object
507 OTAccountMetadataClassC *other = (OTAccountMetadataClassC *)object;
508 return [other isMemberOfClass:[self class]]
510 ((!self->_peerID && !other->_peerID) || [self->_peerID isEqual:other->_peerID])
512 ((self->_has.icloudAccountState && other->_has.icloudAccountState && self->_icloudAccountState == other->_icloudAccountState) || (!self->_has.icloudAccountState && !other->_has.icloudAccountState))
514 ((self->_has.epoch && other->_has.epoch && self->_epoch == other->_epoch) || (!self->_has.epoch && !other->_has.epoch))
516 ((!self->_altDSID && !other->_altDSID) || [self->_altDSID isEqual:other->_altDSID])
518 ((self->_has.trustState && other->_has.trustState && self->_trustState == other->_trustState) || (!self->_has.trustState && !other->_has.trustState))
520 ((self->_has.lastHealthCheckup && other->_has.lastHealthCheckup && self->_lastHealthCheckup == other->_lastHealthCheckup) || (!self->_has.lastHealthCheckup && !other->_has.lastHealthCheckup))
522 ((self->_has.attemptedJoin && other->_has.attemptedJoin && self->_attemptedJoin == other->_attemptedJoin) || (!self->_has.attemptedJoin && !other->_has.attemptedJoin))
524 ((self->_has.cdpState && other->_has.cdpState && self->_cdpState == other->_cdpState) || (!self->_has.cdpState && !other->_has.cdpState))
526 ((!self->_syncingPolicy && !other->_syncingPolicy) || [self->_syncingPolicy isEqual:other->_syncingPolicy])
528 ((!self->_syncingViews && !other->_syncingViews) || [self->_syncingViews isEqual:other->_syncingViews])
538 (self->_has.icloudAccountState ? PBHashInt((NSUInteger)self->_icloudAccountState) : 0)
540 (self->_has.epoch ? PBHashInt((NSUInteger)self->_epoch) : 0)
542 [self->_altDSID hash]
544 (self->_has.trustState ? PBHashInt((NSUInteger)self->_trustState) : 0)
546 (self->_has.lastHealthCheckup ? PBHashInt((NSUInteger)self->_lastHealthCheckup) : 0)
548 (self->_has.attemptedJoin ? PBHashInt((NSUInteger)self->_attemptedJoin) : 0)
550 (self->_has.cdpState ? PBHashInt((NSUInteger)self->_cdpState) : 0)
552 [self->_syncingPolicy hash]
554 [self->_syncingViews hash]
558 - (void)mergeFrom:(OTAccountMetadataClassC *)other
562 [self setPeerID:other->_peerID];
564 if (other->_has.icloudAccountState)
566 self->_icloudAccountState = other->_icloudAccountState;
567 self->_has.icloudAccountState = YES;
569 if (other->_has.epoch)
571 self->_epoch = other->_epoch;
572 self->_has.epoch = YES;
576 [self setAltDSID:other->_altDSID];
578 if (other->_has.trustState)
580 self->_trustState = other->_trustState;
581 self->_has.trustState = YES;
583 if (other->_has.lastHealthCheckup)
585 self->_lastHealthCheckup = other->_lastHealthCheckup;
586 self->_has.lastHealthCheckup = YES;
588 if (other->_has.attemptedJoin)
590 self->_attemptedJoin = other->_attemptedJoin;
591 self->_has.attemptedJoin = YES;
593 if (other->_has.cdpState)
595 self->_cdpState = other->_cdpState;
596 self->_has.cdpState = YES;
598 if (other->_syncingPolicy)
600 [self setSyncingPolicy:other->_syncingPolicy];
602 for (NSString *iter_syncingViews in other->_syncingViews)
604 [self addSyncingView:iter_syncingViews];