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];
42 - (NSString *)description
44 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
47 - (NSDictionary *)dictionaryRepresentation
49 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
50 if (self->_pendingBackupPeers)
52 [dict setObject:self->_pendingBackupPeers forKey:@"pendingBackupPeers"];
57 BOOL SOSAccountConfigurationReadFrom(__unsafe_unretained SOSAccountConfiguration *self, __unsafe_unretained PBDataReader *reader) {
58 while (PBReaderHasMoreData(reader)) {
62 PBReaderReadTag32AndType(reader, &tag, &aType);
64 if (PBReaderHasError(reader))
67 if (aType == TYPE_END_GROUP) {
73 case 1 /* pendingBackupPeers */:
75 NSString *new_pendingBackupPeers = PBReaderReadString(reader);
76 if (new_pendingBackupPeers)
78 [self addPendingBackupPeers:new_pendingBackupPeers];
83 if (!PBReaderSkipValueWithTag(reader, tag, aType))
88 return !PBReaderHasError(reader);
91 - (BOOL)readFrom:(PBDataReader *)reader
93 return SOSAccountConfigurationReadFrom(self, reader);
95 - (void)writeTo:(PBDataWriter *)writer
97 /* pendingBackupPeers */
99 for (NSString *s_pendingBackupPeers in self->_pendingBackupPeers)
101 PBDataWriterWriteStringField(writer, s_pendingBackupPeers, 1);
106 - (void)copyTo:(SOSAccountConfiguration *)other
108 if ([self pendingBackupPeersCount])
110 [other clearPendingBackupPeers];
111 NSUInteger pendingBackupPeersCnt = [self pendingBackupPeersCount];
112 for (NSUInteger i = 0; i < pendingBackupPeersCnt; i++)
114 [other addPendingBackupPeers:[self pendingBackupPeersAtIndex:i]];
119 - (id)copyWithZone:(NSZone *)zone
121 SOSAccountConfiguration *copy = [[[self class] allocWithZone:zone] init];
122 for (NSString *v in _pendingBackupPeers)
124 NSString *vCopy = [v copyWithZone:zone];
125 [copy addPendingBackupPeers:vCopy];
130 - (BOOL)isEqual:(id)object
132 SOSAccountConfiguration *other = (SOSAccountConfiguration *)object;
133 return [other isMemberOfClass:[self class]]
135 ((!self->_pendingBackupPeers && !other->_pendingBackupPeers) || [self->_pendingBackupPeers isEqual:other->_pendingBackupPeers])
143 [self->_pendingBackupPeers hash]
147 - (void)mergeFrom:(SOSAccountConfiguration *)other
149 for (NSString *iter_pendingBackupPeers in other->_pendingBackupPeers)
151 [self addPendingBackupPeers:iter_pendingBackupPeers];