]> git.saurik.com Git - apple/security.git/blob - keychain/TrustedPeersHelper/proto/generated_source/OTRecovery.m
Security-59306.11.20.tar.gz
[apple/security.git] / keychain / TrustedPeersHelper / proto / generated_source / OTRecovery.m
1 // This file was automatically generated by protocompiler
2 // DO NOT EDIT!
3 // Compiled from OTRecovery.proto
4
5 #import "OTRecovery.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 OTRecovery
15
16 - (BOOL)hasPeerID
17 {
18 return _peerID != nil;
19 }
20 @synthesize peerID = _peerID;
21 - (BOOL)hasSigningSPKI
22 {
23 return _signingSPKI != nil;
24 }
25 @synthesize signingSPKI = _signingSPKI;
26 - (BOOL)hasEncryptionSPKI
27 {
28 return _encryptionSPKI != nil;
29 }
30 @synthesize encryptionSPKI = _encryptionSPKI;
31
32 - (NSString *)description
33 {
34 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
35 }
36
37 - (NSDictionary *)dictionaryRepresentation
38 {
39 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
40 if (self->_peerID)
41 {
42 [dict setObject:self->_peerID forKey:@"peerID"];
43 }
44 if (self->_signingSPKI)
45 {
46 [dict setObject:self->_signingSPKI forKey:@"signingSPKI"];
47 }
48 if (self->_encryptionSPKI)
49 {
50 [dict setObject:self->_encryptionSPKI forKey:@"encryptionSPKI"];
51 }
52 return dict;
53 }
54
55 BOOL OTRecoveryReadFrom(__unsafe_unretained OTRecovery *self, __unsafe_unretained PBDataReader *reader) {
56 while (PBReaderHasMoreData(reader)) {
57 uint32_t tag = 0;
58 uint8_t aType = 0;
59
60 PBReaderReadTag32AndType(reader, &tag, &aType);
61
62 if (PBReaderHasError(reader))
63 break;
64
65 if (aType == TYPE_END_GROUP) {
66 break;
67 }
68
69 switch (tag) {
70
71 case 1 /* peerID */:
72 {
73 NSString *new_peerID = PBReaderReadString(reader);
74 self->_peerID = new_peerID;
75 }
76 break;
77 case 2 /* signingSPKI */:
78 {
79 NSData *new_signingSPKI = PBReaderReadData(reader);
80 self->_signingSPKI = new_signingSPKI;
81 }
82 break;
83 case 3 /* encryptionSPKI */:
84 {
85 NSData *new_encryptionSPKI = PBReaderReadData(reader);
86 self->_encryptionSPKI = new_encryptionSPKI;
87 }
88 break;
89 default:
90 if (!PBReaderSkipValueWithTag(reader, tag, aType))
91 return NO;
92 break;
93 }
94 }
95 return !PBReaderHasError(reader);
96 }
97
98 - (BOOL)readFrom:(PBDataReader *)reader
99 {
100 return OTRecoveryReadFrom(self, reader);
101 }
102 - (void)writeTo:(PBDataWriter *)writer
103 {
104 /* peerID */
105 {
106 if (self->_peerID)
107 {
108 PBDataWriterWriteStringField(writer, self->_peerID, 1);
109 }
110 }
111 /* signingSPKI */
112 {
113 if (self->_signingSPKI)
114 {
115 PBDataWriterWriteDataField(writer, self->_signingSPKI, 2);
116 }
117 }
118 /* encryptionSPKI */
119 {
120 if (self->_encryptionSPKI)
121 {
122 PBDataWriterWriteDataField(writer, self->_encryptionSPKI, 3);
123 }
124 }
125 }
126
127 - (void)copyTo:(OTRecovery *)other
128 {
129 if (_peerID)
130 {
131 other.peerID = _peerID;
132 }
133 if (_signingSPKI)
134 {
135 other.signingSPKI = _signingSPKI;
136 }
137 if (_encryptionSPKI)
138 {
139 other.encryptionSPKI = _encryptionSPKI;
140 }
141 }
142
143 - (id)copyWithZone:(NSZone *)zone
144 {
145 OTRecovery *copy = [[[self class] allocWithZone:zone] init];
146 copy->_peerID = [_peerID copyWithZone:zone];
147 copy->_signingSPKI = [_signingSPKI copyWithZone:zone];
148 copy->_encryptionSPKI = [_encryptionSPKI copyWithZone:zone];
149 return copy;
150 }
151
152 - (BOOL)isEqual:(id)object
153 {
154 OTRecovery *other = (OTRecovery *)object;
155 return [other isMemberOfClass:[self class]]
156 &&
157 ((!self->_peerID && !other->_peerID) || [self->_peerID isEqual:other->_peerID])
158 &&
159 ((!self->_signingSPKI && !other->_signingSPKI) || [self->_signingSPKI isEqual:other->_signingSPKI])
160 &&
161 ((!self->_encryptionSPKI && !other->_encryptionSPKI) || [self->_encryptionSPKI isEqual:other->_encryptionSPKI])
162 ;
163 }
164
165 - (NSUInteger)hash
166 {
167 return 0
168 ^
169 [self->_peerID hash]
170 ^
171 [self->_signingSPKI hash]
172 ^
173 [self->_encryptionSPKI hash]
174 ;
175 }
176
177 - (void)mergeFrom:(OTRecovery *)other
178 {
179 if (other->_peerID)
180 {
181 [self setPeerID:other->_peerID];
182 }
183 if (other->_signingSPKI)
184 {
185 [self setSigningSPKI:other->_signingSPKI];
186 }
187 if (other->_encryptionSPKI)
188 {
189 [self setEncryptionSPKI:other->_encryptionSPKI];
190 }
191 }
192
193 @end
194