CKKSSerializedKey.m [plain text]
// This file was automatically generated by protocompiler
// DO NOT EDIT!
// Compiled from CKKSSerializedKey.proto
#import "CKKSSerializedKey.h"
#import <ProtocolBuffer/PBConstants.h>
#import <ProtocolBuffer/PBHashUtil.h>
#import <ProtocolBuffer/PBDataReader.h>
#if !__has_feature(objc_arc)
# 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.
#endif
@implementation CKKSSerializedKey
@synthesize uuid = _uuid;
@synthesize zoneName = _zoneName;
@synthesize keyclass = _keyclass;
@synthesize key = _key;
- (NSString *)description
{
return [NSString stringWithFormat:@"}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
if (self->_uuid)
{
[dict setObject:self->_uuid forKey:@"uuid"];
}
if (self->_zoneName)
{
[dict setObject:self->_zoneName forKey:@"zoneName"];
}
if (self->_keyclass)
{
[dict setObject:self->_keyclass forKey:@"keyclass"];
}
if (self->_key)
{
[dict setObject:self->_key forKey:@"key"];
}
return dict;
}
BOOL CKKSSerializedKeyReadFrom(__unsafe_unretained CKKSSerializedKey *self, __unsafe_unretained PBDataReader *reader) {
while (PBReaderHasMoreData(reader)) {
uint32_t tag = 0;
uint8_t aType = 0;
PBReaderReadTag32AndType(reader, &tag, &aType);
if (PBReaderHasError(reader))
break;
if (aType == TYPE_END_GROUP) {
break;
}
switch (tag) {
case 1 /* uuid */:
{
NSString *new_uuid = PBReaderReadString(reader);
self->_uuid = new_uuid;
}
break;
case 2 /* zoneName */:
{
NSString *new_zoneName = PBReaderReadString(reader);
self->_zoneName = new_zoneName;
}
break;
case 3 /* keyclass */:
{
NSString *new_keyclass = PBReaderReadString(reader);
self->_keyclass = new_keyclass;
}
break;
case 4 /* key */:
{
NSData *new_key = PBReaderReadData(reader);
self->_key = new_key;
}
break;
default:
if (!PBReaderSkipValueWithTag(reader, tag, aType))
return NO;
break;
}
}
return !PBReaderHasError(reader);
}
- (BOOL)readFrom:(PBDataReader *)reader
{
return CKKSSerializedKeyReadFrom(self, reader);
}
- (void)writeTo:(PBDataWriter *)writer
{
/* uuid */
{
assert(nil != self->_uuid);
PBDataWriterWriteStringField(writer, self->_uuid, 1);
}
/* zoneName */
{
assert(nil != self->_zoneName);
PBDataWriterWriteStringField(writer, self->_zoneName, 2);
}
/* keyclass */
{
assert(nil != self->_keyclass);
PBDataWriterWriteStringField(writer, self->_keyclass, 3);
}
/* key */
{
assert(nil != self->_key);
PBDataWriterWriteDataField(writer, self->_key, 4);
}
}
- (void)copyTo:(CKKSSerializedKey *)other
{
other.uuid = _uuid;
other.zoneName = _zoneName;
other.keyclass = _keyclass;
other.key = _key;
}
- (id)copyWithZone:(NSZone *)zone
{
CKKSSerializedKey *copy = [[[self class] allocWithZone:zone] init];
copy->_uuid = [_uuid copyWithZone:zone];
copy->_zoneName = [_zoneName copyWithZone:zone];
copy->_keyclass = [_keyclass copyWithZone:zone];
copy->_key = [_key copyWithZone:zone];
return copy;
}
- (BOOL)isEqual:(id)object
{
CKKSSerializedKey *other = (CKKSSerializedKey *)object;
return [other isMemberOfClass:[self class]]
&&
((!self->_uuid && !other->_uuid) || [self->_uuid isEqual:other->_uuid])
&&
((!self->_zoneName && !other->_zoneName) || [self->_zoneName isEqual:other->_zoneName])
&&
((!self->_keyclass && !other->_keyclass) || [self->_keyclass isEqual:other->_keyclass])
&&
((!self->_key && !other->_key) || [self->_key isEqual:other->_key])
;
}
- (NSUInteger)hash
{
return 0
^
[self->_uuid hash]
^
[self->_zoneName hash]
^
[self->_keyclass hash]
^
[self->_key hash]
;
}
- (void)mergeFrom:(CKKSSerializedKey *)other
{
if (other->_uuid)
{
[self setUuid:other->_uuid];
}
if (other->_zoneName)
{
[self setZoneName:other->_zoneName];
}
if (other->_keyclass)
{
[self setKeyclass:other->_keyclass];
}
if (other->_key)
{
[self setKey:other->_key];
}
}
@end