]> git.saurik.com Git - apple/security.git/blob - keychain/SecureObjectSync/generated_source/SOSAccountConfiguration.m
Security-59306.101.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
42 - (NSString *)description
43 {
44 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
45 }
46
47 - (NSDictionary *)dictionaryRepresentation
48 {
49 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
50 if (self->_pendingBackupPeers)
51 {
52 [dict setObject:self->_pendingBackupPeers forKey:@"pendingBackupPeers"];
53 }
54 return dict;
55 }
56
57 BOOL SOSAccountConfigurationReadFrom(__unsafe_unretained SOSAccountConfiguration *self, __unsafe_unretained PBDataReader *reader) {
58 while (PBReaderHasMoreData(reader)) {
59 uint32_t tag = 0;
60 uint8_t aType = 0;
61
62 PBReaderReadTag32AndType(reader, &tag, &aType);
63
64 if (PBReaderHasError(reader))
65 break;
66
67 if (aType == TYPE_END_GROUP) {
68 break;
69 }
70
71 switch (tag) {
72
73 case 1 /* pendingBackupPeers */:
74 {
75 NSString *new_pendingBackupPeers = PBReaderReadString(reader);
76 if (new_pendingBackupPeers)
77 {
78 [self addPendingBackupPeers:new_pendingBackupPeers];
79 }
80 }
81 break;
82 default:
83 if (!PBReaderSkipValueWithTag(reader, tag, aType))
84 return NO;
85 break;
86 }
87 }
88 return !PBReaderHasError(reader);
89 }
90
91 - (BOOL)readFrom:(PBDataReader *)reader
92 {
93 return SOSAccountConfigurationReadFrom(self, reader);
94 }
95 - (void)writeTo:(PBDataWriter *)writer
96 {
97 /* pendingBackupPeers */
98 {
99 for (NSString *s_pendingBackupPeers in self->_pendingBackupPeers)
100 {
101 PBDataWriterWriteStringField(writer, s_pendingBackupPeers, 1);
102 }
103 }
104 }
105
106 - (void)copyTo:(SOSAccountConfiguration *)other
107 {
108 if ([self pendingBackupPeersCount])
109 {
110 [other clearPendingBackupPeers];
111 NSUInteger pendingBackupPeersCnt = [self pendingBackupPeersCount];
112 for (NSUInteger i = 0; i < pendingBackupPeersCnt; i++)
113 {
114 [other addPendingBackupPeers:[self pendingBackupPeersAtIndex:i]];
115 }
116 }
117 }
118
119 - (id)copyWithZone:(NSZone *)zone
120 {
121 SOSAccountConfiguration *copy = [[[self class] allocWithZone:zone] init];
122 for (NSString *v in _pendingBackupPeers)
123 {
124 NSString *vCopy = [v copyWithZone:zone];
125 [copy addPendingBackupPeers:vCopy];
126 }
127 return copy;
128 }
129
130 - (BOOL)isEqual:(id)object
131 {
132 SOSAccountConfiguration *other = (SOSAccountConfiguration *)object;
133 return [other isMemberOfClass:[self class]]
134 &&
135 ((!self->_pendingBackupPeers && !other->_pendingBackupPeers) || [self->_pendingBackupPeers isEqual:other->_pendingBackupPeers])
136 ;
137 }
138
139 - (NSUInteger)hash
140 {
141 return 0
142 ^
143 [self->_pendingBackupPeers hash]
144 ;
145 }
146
147 - (void)mergeFrom:(SOSAccountConfiguration *)other
148 {
149 for (NSString *iter_pendingBackupPeers in other->_pendingBackupPeers)
150 {
151 [self addPendingBackupPeers:iter_pendingBackupPeers];
152 }
153 }
154
155 @end
156