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