1 // This file was automatically generated by protocompiler
3 // Compiled from CKKSSerializedKey.proto
5 #import "CKKSSerializedKey.h"
6 #import <ProtocolBuffer/PBConstants.h>
7 #import <ProtocolBuffer/PBHashUtil.h>
8 #import <ProtocolBuffer/PBDataReader.h>
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.
14 @implementation CKKSSerializedKey
16 @synthesize uuid = _uuid;
17 @synthesize zoneName = _zoneName;
18 @synthesize keyclass = _keyclass;
19 @synthesize key = _key;
21 - (NSString *)description
23 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
26 - (NSDictionary *)dictionaryRepresentation
28 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
31 [dict setObject:self->_uuid forKey:@"uuid"];
35 [dict setObject:self->_zoneName forKey:@"zoneName"];
39 [dict setObject:self->_keyclass forKey:@"keyclass"];
43 [dict setObject:self->_key forKey:@"key"];
48 BOOL CKKSSerializedKeyReadFrom(__unsafe_unretained CKKSSerializedKey *self, __unsafe_unretained PBDataReader *reader) {
49 while (PBReaderHasMoreData(reader)) {
53 PBReaderReadTag32AndType(reader, &tag, &aType);
55 if (PBReaderHasError(reader))
58 if (aType == TYPE_END_GROUP) {
66 NSString *new_uuid = PBReaderReadString(reader);
67 self->_uuid = new_uuid;
70 case 2 /* zoneName */:
72 NSString *new_zoneName = PBReaderReadString(reader);
73 self->_zoneName = new_zoneName;
76 case 3 /* keyclass */:
78 NSString *new_keyclass = PBReaderReadString(reader);
79 self->_keyclass = new_keyclass;
84 NSData *new_key = PBReaderReadData(reader);
89 if (!PBReaderSkipValueWithTag(reader, tag, aType))
94 return !PBReaderHasError(reader);
97 - (BOOL)readFrom:(PBDataReader *)reader
99 return CKKSSerializedKeyReadFrom(self, reader);
101 - (void)writeTo:(PBDataWriter *)writer
105 assert(nil != self->_uuid);
106 PBDataWriterWriteStringField(writer, self->_uuid, 1);
110 assert(nil != self->_zoneName);
111 PBDataWriterWriteStringField(writer, self->_zoneName, 2);
115 assert(nil != self->_keyclass);
116 PBDataWriterWriteStringField(writer, self->_keyclass, 3);
120 assert(nil != self->_key);
121 PBDataWriterWriteDataField(writer, self->_key, 4);
125 - (void)copyTo:(CKKSSerializedKey *)other
128 other.zoneName = _zoneName;
129 other.keyclass = _keyclass;
133 - (id)copyWithZone:(NSZone *)zone
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];
143 - (BOOL)isEqual:(id)object
145 CKKSSerializedKey *other = (CKKSSerializedKey *)object;
146 return [other isMemberOfClass:[self class]]
148 ((!self->_uuid && !other->_uuid) || [self->_uuid isEqual:other->_uuid])
150 ((!self->_zoneName && !other->_zoneName) || [self->_zoneName isEqual:other->_zoneName])
152 ((!self->_keyclass && !other->_keyclass) || [self->_keyclass isEqual:other->_keyclass])
154 ((!self->_key && !other->_key) || [self->_key isEqual:other->_key])
164 [self->_zoneName hash]
166 [self->_keyclass hash]
172 - (void)mergeFrom:(CKKSSerializedKey *)other
176 [self setUuid:other->_uuid];
178 if (other->_zoneName)
180 [self setZoneName:other->_zoneName];
182 if (other->_keyclass)
184 [self setKeyclass:other->_keyclass];
188 [self setKey:other->_key];