]> git.saurik.com Git - apple/security.git/blob - keychain/SecureObjectSync/generated_source/SOSAccountConfiguration.m
Security-59306.61.1.tar.gz
[apple/security.git] / keychain / SecureObjectSync / generated_source / SOSAccountConfiguration.m
1 // This file was automatically generated by protocompiler
2 // DO NOT EDIT!
3 // Compiled from SOSAccountConfiguration.proto
4
5 #import "SOSAccountConfiguration.h"
6 #import <ProtocolBuffer/PBConstants.h>
7 #import <ProtocolBuffer/PBHashUtil.h>
8 #import <ProtocolBuffer/PBDataReader.h>
9
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.
12 #endif
13
14 @implementation SOSAccountConfiguration
15
16 @synthesize pendingBackupPeers = _pendingBackupPeers;
17 - (void)clearPendingBackupPeers
18 {
19 [_pendingBackupPeers removeAllObjects];
20 }
21 - (void)addPendingBackupPeers:(NSString *)i
22 {
23 if (!_pendingBackupPeers)
24 {
25 _pendingBackupPeers = [[NSMutableArray alloc] init];
26 }
27 [_pendingBackupPeers addObject:i];
28 }
29 - (NSUInteger)pendingBackupPeersCount
30 {
31 return [_pendingBackupPeers count];
32 }
33 - (NSString *)pendingBackupPeersAtIndex:(NSUInteger)idx
34 {
35 return [_pendingBackupPeers objectAtIndex:idx];
36 }
37 + (Class)pendingBackupPeersType
38 {
39 return [NSString class];
40 }
41 @synthesize ringUpdateFlag = _ringUpdateFlag;
42 - (void)setRingUpdateFlag:(BOOL)v
43 {
44 _has.ringUpdateFlag = YES;
45 _ringUpdateFlag = v;
46 }
47 - (void)setHasRingUpdateFlag:(BOOL)f
48 {
49 _has.ringUpdateFlag = f;
50 }
51 - (BOOL)hasRingUpdateFlag
52 {
53 return _has.ringUpdateFlag;
54 }
55
56 - (NSString *)description
57 {
58 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
59 }
60
61 - (NSDictionary *)dictionaryRepresentation
62 {
63 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
64 if (self->_pendingBackupPeers)
65 {
66 [dict setObject:self->_pendingBackupPeers forKey:@"pendingBackupPeers"];
67 }
68 if (self->_has.ringUpdateFlag)
69 {
70 [dict setObject:[NSNumber numberWithBool:self->_ringUpdateFlag] forKey:@"ringUpdateFlag"];
71 }
72 return dict;
73 }
74
75 BOOL SOSAccountConfigurationReadFrom(__unsafe_unretained SOSAccountConfiguration *self, __unsafe_unretained PBDataReader *reader) {
76 while (PBReaderHasMoreData(reader)) {
77 uint32_t tag = 0;
78 uint8_t aType = 0;
79
80 PBReaderReadTag32AndType(reader, &tag, &aType);
81
82 if (PBReaderHasError(reader))
83 break;
84
85 if (aType == TYPE_END_GROUP) {
86 break;
87 }
88
89 switch (tag) {
90
91 case 1 /* pendingBackupPeers */:
92 {
93 NSString *new_pendingBackupPeers = PBReaderReadString(reader);
94 if (new_pendingBackupPeers)
95 {
96 [self addPendingBackupPeers:new_pendingBackupPeers];
97 }
98 }
99 break;
100 case 2 /* ringUpdateFlag */:
101 {
102 self->_has.ringUpdateFlag = YES;
103 self->_ringUpdateFlag = PBReaderReadBOOL(reader);
104 }
105 break;
106 default:
107 if (!PBReaderSkipValueWithTag(reader, tag, aType))
108 return NO;
109 break;
110 }
111 }
112 return !PBReaderHasError(reader);
113 }
114
115 - (BOOL)readFrom:(PBDataReader *)reader
116 {
117 return SOSAccountConfigurationReadFrom(self, reader);
118 }
119 - (void)writeTo:(PBDataWriter *)writer
120 {
121 /* pendingBackupPeers */
122 {
123 for (NSString *s_pendingBackupPeers in self->_pendingBackupPeers)
124 {
125 PBDataWriterWriteStringField(writer, s_pendingBackupPeers, 1);
126 }
127 }
128 /* ringUpdateFlag */
129 {
130 if (self->_has.ringUpdateFlag)
131 {
132 PBDataWriterWriteBOOLField(writer, self->_ringUpdateFlag, 2);
133 }
134 }
135 }
136
137 - (void)copyTo:(SOSAccountConfiguration *)other
138 {
139 if ([self pendingBackupPeersCount])
140 {
141 [other clearPendingBackupPeers];
142 NSUInteger pendingBackupPeersCnt = [self pendingBackupPeersCount];
143 for (NSUInteger i = 0; i < pendingBackupPeersCnt; i++)
144 {
145 [other addPendingBackupPeers:[self pendingBackupPeersAtIndex:i]];
146 }
147 }
148 if (self->_has.ringUpdateFlag)
149 {
150 other->_ringUpdateFlag = _ringUpdateFlag;
151 other->_has.ringUpdateFlag = YES;
152 }
153 }
154
155 - (id)copyWithZone:(NSZone *)zone
156 {
157 SOSAccountConfiguration *copy = [[[self class] allocWithZone:zone] init];
158 for (NSString *v in _pendingBackupPeers)
159 {
160 NSString *vCopy = [v copyWithZone:zone];
161 [copy addPendingBackupPeers:vCopy];
162 }
163 if (self->_has.ringUpdateFlag)
164 {
165 copy->_ringUpdateFlag = _ringUpdateFlag;
166 copy->_has.ringUpdateFlag = YES;
167 }
168 return copy;
169 }
170
171 - (BOOL)isEqual:(id)object
172 {
173 SOSAccountConfiguration *other = (SOSAccountConfiguration *)object;
174 return [other isMemberOfClass:[self class]]
175 &&
176 ((!self->_pendingBackupPeers && !other->_pendingBackupPeers) || [self->_pendingBackupPeers isEqual:other->_pendingBackupPeers])
177 &&
178 ((self->_has.ringUpdateFlag && other->_has.ringUpdateFlag && ((self->_ringUpdateFlag && other->_ringUpdateFlag) || (!self->_ringUpdateFlag && !other->_ringUpdateFlag))) || (!self->_has.ringUpdateFlag && !other->_has.ringUpdateFlag))
179 ;
180 }
181
182 - (NSUInteger)hash
183 {
184 return 0
185 ^
186 [self->_pendingBackupPeers hash]
187 ^
188 (self->_has.ringUpdateFlag ? PBHashInt((NSUInteger)self->_ringUpdateFlag) : 0)
189 ;
190 }
191
192 - (void)mergeFrom:(SOSAccountConfiguration *)other
193 {
194 for (NSString *iter_pendingBackupPeers in other->_pendingBackupPeers)
195 {
196 [self addPendingBackupPeers:iter_pendingBackupPeers];
197 }
198 if (other->_has.ringUpdateFlag)
199 {
200 self->_ringUpdateFlag = other->_ringUpdateFlag;
201 self->_has.ringUpdateFlag = YES;
202 }
203 }
204
205 @end
206