1 // This file was automatically generated by protocompiler
3 // Compiled from SOSAccountConfiguration.proto
5 #import "SOSAccountConfiguration.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 SOSAccountConfiguration
16 @synthesize pendingBackupPeers = _pendingBackupPeers;
17 - (void)clearPendingBackupPeers
19 [_pendingBackupPeers removeAllObjects];
21 - (void)addPendingBackupPeers:(NSString *)i
23 if (!_pendingBackupPeers)
25 _pendingBackupPeers = [[NSMutableArray alloc] init];
27 [_pendingBackupPeers addObject:i];
29 - (NSUInteger)pendingBackupPeersCount
31 return [_pendingBackupPeers count];
33 - (NSString *)pendingBackupPeersAtIndex:(NSUInteger)idx
35 return [_pendingBackupPeers objectAtIndex:idx];
37 + (Class)pendingBackupPeersType
39 return [NSString class];
41 @synthesize ringUpdateFlag = _ringUpdateFlag;
42 - (void)setRingUpdateFlag:(BOOL)v
44 _has.ringUpdateFlag = YES;
47 - (void)setHasRingUpdateFlag:(BOOL)f
49 _has.ringUpdateFlag = f;
51 - (BOOL)hasRingUpdateFlag
53 return _has.ringUpdateFlag;
56 - (NSString *)description
58 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
61 - (NSDictionary *)dictionaryRepresentation
63 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
64 if (self->_pendingBackupPeers)
66 [dict setObject:self->_pendingBackupPeers forKey:@"pendingBackupPeers"];
68 if (self->_has.ringUpdateFlag)
70 [dict setObject:[NSNumber numberWithBool:self->_ringUpdateFlag] forKey:@"ringUpdateFlag"];
75 BOOL SOSAccountConfigurationReadFrom(__unsafe_unretained SOSAccountConfiguration *self, __unsafe_unretained PBDataReader *reader) {
76 while (PBReaderHasMoreData(reader)) {
80 PBReaderReadTag32AndType(reader, &tag, &aType);
82 if (PBReaderHasError(reader))
85 if (aType == TYPE_END_GROUP) {
91 case 1 /* pendingBackupPeers */:
93 NSString *new_pendingBackupPeers = PBReaderReadString(reader);
94 if (new_pendingBackupPeers)
96 [self addPendingBackupPeers:new_pendingBackupPeers];
100 case 2 /* ringUpdateFlag */:
102 self->_has.ringUpdateFlag = YES;
103 self->_ringUpdateFlag = PBReaderReadBOOL(reader);
107 if (!PBReaderSkipValueWithTag(reader, tag, aType))
112 return !PBReaderHasError(reader);
115 - (BOOL)readFrom:(PBDataReader *)reader
117 return SOSAccountConfigurationReadFrom(self, reader);
119 - (void)writeTo:(PBDataWriter *)writer
121 /* pendingBackupPeers */
123 for (NSString *s_pendingBackupPeers in self->_pendingBackupPeers)
125 PBDataWriterWriteStringField(writer, s_pendingBackupPeers, 1);
130 if (self->_has.ringUpdateFlag)
132 PBDataWriterWriteBOOLField(writer, self->_ringUpdateFlag, 2);
137 - (void)copyTo:(SOSAccountConfiguration *)other
139 if ([self pendingBackupPeersCount])
141 [other clearPendingBackupPeers];
142 NSUInteger pendingBackupPeersCnt = [self pendingBackupPeersCount];
143 for (NSUInteger i = 0; i < pendingBackupPeersCnt; i++)
145 [other addPendingBackupPeers:[self pendingBackupPeersAtIndex:i]];
148 if (self->_has.ringUpdateFlag)
150 other->_ringUpdateFlag = _ringUpdateFlag;
151 other->_has.ringUpdateFlag = YES;
155 - (id)copyWithZone:(NSZone *)zone
157 SOSAccountConfiguration *copy = [[[self class] allocWithZone:zone] init];
158 for (NSString *v in _pendingBackupPeers)
160 NSString *vCopy = [v copyWithZone:zone];
161 [copy addPendingBackupPeers:vCopy];
163 if (self->_has.ringUpdateFlag)
165 copy->_ringUpdateFlag = _ringUpdateFlag;
166 copy->_has.ringUpdateFlag = YES;
171 - (BOOL)isEqual:(id)object
173 SOSAccountConfiguration *other = (SOSAccountConfiguration *)object;
174 return [other isMemberOfClass:[self class]]
176 ((!self->_pendingBackupPeers && !other->_pendingBackupPeers) || [self->_pendingBackupPeers isEqual:other->_pendingBackupPeers])
178 ((self->_has.ringUpdateFlag && other->_has.ringUpdateFlag && ((self->_ringUpdateFlag && other->_ringUpdateFlag) || (!self->_ringUpdateFlag && !other->_ringUpdateFlag))) || (!self->_has.ringUpdateFlag && !other->_has.ringUpdateFlag))
186 [self->_pendingBackupPeers hash]
188 (self->_has.ringUpdateFlag ? PBHashInt((NSUInteger)self->_ringUpdateFlag) : 0)
192 - (void)mergeFrom:(SOSAccountConfiguration *)other
194 for (NSString *iter_pendingBackupPeers in other->_pendingBackupPeers)
196 [self addPendingBackupPeers:iter_pendingBackupPeers];
198 if (other->_has.ringUpdateFlag)
200 self->_ringUpdateFlag = other->_ringUpdateFlag;
201 self->_has.ringUpdateFlag = YES;