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