// This file was automatically generated by protocompiler
// DO NOT EDIT!
// Compiled from OTRecovery.proto
#import "OTRecovery.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 OTRecovery
- (BOOL)hasPeerID
{
return _peerID != nil;
}
@synthesize peerID = _peerID;
- (BOOL)hasSigningSPKI
{
return _signingSPKI != nil;
}
@synthesize signingSPKI = _signingSPKI;
- (BOOL)hasEncryptionSPKI
{
return _encryptionSPKI != nil;
}
@synthesize encryptionSPKI = _encryptionSPKI;
- (NSString *)description
{
return [NSString stringWithFormat:@"}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
if (self->_peerID)
{
[dict setObject:self->_peerID forKey:@"peerID"];
}
if (self->_signingSPKI)
{
[dict setObject:self->_signingSPKI forKey:@"signingSPKI"];
}
if (self->_encryptionSPKI)
{
[dict setObject:self->_encryptionSPKI forKey:@"encryptionSPKI"];
}
return dict;
}
BOOL OTRecoveryReadFrom(__unsafe_unretained OTRecovery *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 /* peerID */:
{
NSString *new_peerID = PBReaderReadString(reader);
self->_peerID = new_peerID;
}
break;
case 2 /* signingSPKI */:
{
NSData *new_signingSPKI = PBReaderReadData(reader);
self->_signingSPKI = new_signingSPKI;
}
break;
case 3 /* encryptionSPKI */:
{
NSData *new_encryptionSPKI = PBReaderReadData(reader);
self->_encryptionSPKI = new_encryptionSPKI;
}
break;
default:
if (!PBReaderSkipValueWithTag(reader, tag, aType))
return NO;
break;
}
}
return !PBReaderHasError(reader);
}
- (BOOL)readFrom:(PBDataReader *)reader
{
return OTRecoveryReadFrom(self, reader);
}
- (void)writeTo:(PBDataWriter *)writer
{
/* peerID */
{
if (self->_peerID)
{
PBDataWriterWriteStringField(writer, self->_peerID, 1);
}
}
/* signingSPKI */
{
if (self->_signingSPKI)
{
PBDataWriterWriteDataField(writer, self->_signingSPKI, 2);
}
}
/* encryptionSPKI */
{
if (self->_encryptionSPKI)
{
PBDataWriterWriteDataField(writer, self->_encryptionSPKI, 3);
}
}
}
- (void)copyTo:(OTRecovery *)other
{
if (_peerID)
{
other.peerID = _peerID;
}
if (_signingSPKI)
{
other.signingSPKI = _signingSPKI;
}
if (_encryptionSPKI)
{
other.encryptionSPKI = _encryptionSPKI;
}
}
- (id)copyWithZone:(NSZone *)zone
{
OTRecovery *copy = [[[self class] allocWithZone:zone] init];
copy->_peerID = [_peerID copyWithZone:zone];
copy->_signingSPKI = [_signingSPKI copyWithZone:zone];
copy->_encryptionSPKI = [_encryptionSPKI copyWithZone:zone];
return copy;
}
- (BOOL)isEqual:(id)object
{
OTRecovery *other = (OTRecovery *)object;
return [other isMemberOfClass:[self class]]
&&
((!self->_peerID && !other->_peerID) || [self->_peerID isEqual:other->_peerID])
&&
((!self->_signingSPKI && !other->_signingSPKI) || [self->_signingSPKI isEqual:other->_signingSPKI])
&&
((!self->_encryptionSPKI && !other->_encryptionSPKI) || [self->_encryptionSPKI isEqual:other->_encryptionSPKI])
;
}
- (NSUInteger)hash
{
return 0
^
[self->_peerID hash]
^
[self->_signingSPKI hash]
^
[self->_encryptionSPKI hash]
;
}
- (void)mergeFrom:(OTRecovery *)other
{
if (other->_peerID)
{
[self setPeerID:other->_peerID];
}
if (other->_signingSPKI)
{
[self setSigningSPKI:other->_signingSPKI];
}
if (other->_encryptionSPKI)
{
[self setEncryptionSPKI:other->_encryptionSPKI];
}
}
@end