]> git.saurik.com Git - apple/security.git/blob - keychain/ot/proto/generated_source/OTSponsorToApplicantRound2M2.m
Security-59306.11.20.tar.gz
[apple/security.git] / keychain / ot / proto / generated_source / OTSponsorToApplicantRound2M2.m
1 // This file was automatically generated by protocompiler
2 // DO NOT EDIT!
3 // Compiled from OTPairingMessage.proto
4
5 #import "OTSponsorToApplicantRound2M2.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 OTSponsorToApplicantRound2M2
15
16 - (BOOL)hasVoucher
17 {
18 return _voucher != nil;
19 }
20 @synthesize voucher = _voucher;
21 - (BOOL)hasVoucherSignature
22 {
23 return _voucherSignature != nil;
24 }
25 @synthesize voucherSignature = _voucherSignature;
26 @synthesize preapprovedKeys = _preapprovedKeys;
27 - (void)clearPreapprovedKeys
28 {
29 [_preapprovedKeys removeAllObjects];
30 }
31 - (void)addPreapprovedKeys:(NSData *)i
32 {
33 if (!_preapprovedKeys)
34 {
35 _preapprovedKeys = [[NSMutableArray alloc] init];
36 }
37 [_preapprovedKeys addObject:i];
38 }
39 - (NSUInteger)preapprovedKeysCount
40 {
41 return [_preapprovedKeys count];
42 }
43 - (NSData *)preapprovedKeysAtIndex:(NSUInteger)idx
44 {
45 return [_preapprovedKeys objectAtIndex:idx];
46 }
47 + (Class)preapprovedKeysType
48 {
49 return [NSData class];
50 }
51
52 - (NSString *)description
53 {
54 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
55 }
56
57 - (NSDictionary *)dictionaryRepresentation
58 {
59 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
60 if (self->_voucher)
61 {
62 [dict setObject:self->_voucher forKey:@"voucher"];
63 }
64 if (self->_voucherSignature)
65 {
66 [dict setObject:self->_voucherSignature forKey:@"voucherSignature"];
67 }
68 if (self->_preapprovedKeys)
69 {
70 [dict setObject:self->_preapprovedKeys forKey:@"preapprovedKeys"];
71 }
72 return dict;
73 }
74
75 BOOL OTSponsorToApplicantRound2M2ReadFrom(__unsafe_unretained OTSponsorToApplicantRound2M2 *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 /* voucher */:
92 {
93 NSData *new_voucher = PBReaderReadData(reader);
94 self->_voucher = new_voucher;
95 }
96 break;
97 case 2 /* voucherSignature */:
98 {
99 NSData *new_voucherSignature = PBReaderReadData(reader);
100 self->_voucherSignature = new_voucherSignature;
101 }
102 break;
103 case 3 /* preapprovedKeys */:
104 {
105 NSData *new_preapprovedKeys = PBReaderReadData(reader);
106 if (new_preapprovedKeys)
107 {
108 [self addPreapprovedKeys:new_preapprovedKeys];
109 }
110 }
111 break;
112 default:
113 if (!PBReaderSkipValueWithTag(reader, tag, aType))
114 return NO;
115 break;
116 }
117 }
118 return !PBReaderHasError(reader);
119 }
120
121 - (BOOL)readFrom:(PBDataReader *)reader
122 {
123 return OTSponsorToApplicantRound2M2ReadFrom(self, reader);
124 }
125 - (void)writeTo:(PBDataWriter *)writer
126 {
127 /* voucher */
128 {
129 if (self->_voucher)
130 {
131 PBDataWriterWriteDataField(writer, self->_voucher, 1);
132 }
133 }
134 /* voucherSignature */
135 {
136 if (self->_voucherSignature)
137 {
138 PBDataWriterWriteDataField(writer, self->_voucherSignature, 2);
139 }
140 }
141 /* preapprovedKeys */
142 {
143 for (NSData *s_preapprovedKeys in self->_preapprovedKeys)
144 {
145 PBDataWriterWriteDataField(writer, s_preapprovedKeys, 3);
146 }
147 }
148 }
149
150 - (void)copyTo:(OTSponsorToApplicantRound2M2 *)other
151 {
152 if (_voucher)
153 {
154 other.voucher = _voucher;
155 }
156 if (_voucherSignature)
157 {
158 other.voucherSignature = _voucherSignature;
159 }
160 if ([self preapprovedKeysCount])
161 {
162 [other clearPreapprovedKeys];
163 NSUInteger preapprovedKeysCnt = [self preapprovedKeysCount];
164 for (NSUInteger i = 0; i < preapprovedKeysCnt; i++)
165 {
166 [other addPreapprovedKeys:[self preapprovedKeysAtIndex:i]];
167 }
168 }
169 }
170
171 - (id)copyWithZone:(NSZone *)zone
172 {
173 OTSponsorToApplicantRound2M2 *copy = [[[self class] allocWithZone:zone] init];
174 copy->_voucher = [_voucher copyWithZone:zone];
175 copy->_voucherSignature = [_voucherSignature copyWithZone:zone];
176 for (NSData *v in _preapprovedKeys)
177 {
178 NSData *vCopy = [v copyWithZone:zone];
179 [copy addPreapprovedKeys:vCopy];
180 }
181 return copy;
182 }
183
184 - (BOOL)isEqual:(id)object
185 {
186 OTSponsorToApplicantRound2M2 *other = (OTSponsorToApplicantRound2M2 *)object;
187 return [other isMemberOfClass:[self class]]
188 &&
189 ((!self->_voucher && !other->_voucher) || [self->_voucher isEqual:other->_voucher])
190 &&
191 ((!self->_voucherSignature && !other->_voucherSignature) || [self->_voucherSignature isEqual:other->_voucherSignature])
192 &&
193 ((!self->_preapprovedKeys && !other->_preapprovedKeys) || [self->_preapprovedKeys isEqual:other->_preapprovedKeys])
194 ;
195 }
196
197 - (NSUInteger)hash
198 {
199 return 0
200 ^
201 [self->_voucher hash]
202 ^
203 [self->_voucherSignature hash]
204 ^
205 [self->_preapprovedKeys hash]
206 ;
207 }
208
209 - (void)mergeFrom:(OTSponsorToApplicantRound2M2 *)other
210 {
211 if (other->_voucher)
212 {
213 [self setVoucher:other->_voucher];
214 }
215 if (other->_voucherSignature)
216 {
217 [self setVoucherSignature:other->_voucherSignature];
218 }
219 for (NSData *iter_preapprovedKeys in other->_preapprovedKeys)
220 {
221 [self addPreapprovedKeys:iter_preapprovedKeys];
222 }
223 }
224
225 @end
226