OTCDPRecoveryInformation.m   [plain text]

// This file was automatically generated by protocompiler
// DO NOT EDIT!
// Compiled from OTCDPRecoveryInformation.proto

#import "OTCDPRecoveryInformation.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 OTCDPRecoveryInformation

- (BOOL)hasRecoverySecret
{
return _recoverySecret != nil;
}
@synthesize recoverySecret = _recoverySecret;
@synthesize useCachedSecret = _useCachedSecret;
- (void)setUseCachedSecret:(BOOL)v
{
_has.useCachedSecret = YES;
_useCachedSecret = v;
}
- (void)setHasUseCachedSecret:(BOOL)f
{
_has.useCachedSecret = f;
}
- (BOOL)hasUseCachedSecret
{
return _has.useCachedSecret != 0;
}
- (BOOL)hasRecoveryKey
{
return _recoveryKey != nil;
}
@synthesize recoveryKey = _recoveryKey;
@synthesize usePreviouslyCachedRecoveryKey = _usePreviouslyCachedRecoveryKey;
- (void)setUsePreviouslyCachedRecoveryKey:(BOOL)v
{
_has.usePreviouslyCachedRecoveryKey = YES;
_usePreviouslyCachedRecoveryKey = v;
}
- (void)setHasUsePreviouslyCachedRecoveryKey:(BOOL)f
{
_has.usePreviouslyCachedRecoveryKey = f;
}
- (BOOL)hasUsePreviouslyCachedRecoveryKey
{
return _has.usePreviouslyCachedRecoveryKey != 0;
}
@synthesize silentRecoveryAttempt = _silentRecoveryAttempt;
- (void)setSilentRecoveryAttempt:(BOOL)v
{
_has.silentRecoveryAttempt = YES;
_silentRecoveryAttempt = v;
}
- (void)setHasSilentRecoveryAttempt:(BOOL)f
{
_has.silentRecoveryAttempt = f;
}
- (BOOL)hasSilentRecoveryAttempt
{
return _has.silentRecoveryAttempt != 0;
}
@synthesize containsIcdpData = _containsIcdpData;
- (void)setContainsIcdpData:(BOOL)v
{
_has.containsIcdpData = YES;
_containsIcdpData = v;
}
- (void)setHasContainsIcdpData:(BOOL)f
{
_has.containsIcdpData = f;
}
- (BOOL)hasContainsIcdpData
{
return _has.containsIcdpData != 0;
}
@synthesize usesMultipleIcsc = _usesMultipleIcsc;
- (void)setUsesMultipleIcsc:(BOOL)v
{
_has.usesMultipleIcsc = YES;
_usesMultipleIcsc = v;
}
- (void)setHasUsesMultipleIcsc:(BOOL)f
{
_has.usesMultipleIcsc = f;
}
- (BOOL)hasUsesMultipleIcsc
{
return _has.usesMultipleIcsc != 0;
}

- (NSString *)description
{
return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
}

- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
if (self->_recoverySecret)
{
[dict setObject:self->_recoverySecret forKey:@"recovery_secret"];
}
if (self->_has.useCachedSecret)
{
[dict setObject:[NSNumber numberWithBool:self->_useCachedSecret] forKey:@"use_cached_secret"];
}
if (self->_recoveryKey)
{
[dict setObject:self->_recoveryKey forKey:@"recovery_key"];
}
if (self->_has.usePreviouslyCachedRecoveryKey)
{
[dict setObject:[NSNumber numberWithBool:self->_usePreviouslyCachedRecoveryKey] forKey:@"use_previously_cached_recovery_key"];
}
if (self->_has.silentRecoveryAttempt)
{
[dict setObject:[NSNumber numberWithBool:self->_silentRecoveryAttempt] forKey:@"silent_recovery_attempt"];
}
if (self->_has.containsIcdpData)
{
[dict setObject:[NSNumber numberWithBool:self->_containsIcdpData] forKey:@"contains_icdp_data"];
}
if (self->_has.usesMultipleIcsc)
{
[dict setObject:[NSNumber numberWithBool:self->_usesMultipleIcsc] forKey:@"uses_multiple_icsc"];
}
return dict;
}

BOOL OTCDPRecoveryInformationReadFrom(__unsafe_unretained OTCDPRecoveryInformation *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 /* recoverySecret */:
{
NSString *new_recoverySecret = PBReaderReadString(reader);
self->_recoverySecret = new_recoverySecret;
}
break;
case 2 /* useCachedSecret */:
{
self->_has.useCachedSecret = YES;
self->_useCachedSecret = PBReaderReadBOOL(reader);
}
break;
case 3 /* recoveryKey */:
{
NSString *new_recoveryKey = PBReaderReadString(reader);
self->_recoveryKey = new_recoveryKey;
}
break;
case 4 /* usePreviouslyCachedRecoveryKey */:
{
self->_has.usePreviouslyCachedRecoveryKey = YES;
self->_usePreviouslyCachedRecoveryKey = PBReaderReadBOOL(reader);
}
break;
case 5 /* silentRecoveryAttempt */:
{
self->_has.silentRecoveryAttempt = YES;
self->_silentRecoveryAttempt = PBReaderReadBOOL(reader);
}
break;
case 6 /* containsIcdpData */:
{
self->_has.containsIcdpData = YES;
self->_containsIcdpData = PBReaderReadBOOL(reader);
}
break;
case 7 /* usesMultipleIcsc */:
{
self->_has.usesMultipleIcsc = YES;
self->_usesMultipleIcsc = PBReaderReadBOOL(reader);
}
break;
default:
if (!PBReaderSkipValueWithTag(reader, tag, aType))
return NO;
break;
}
}
return !PBReaderHasError(reader);
}

- (BOOL)readFrom:(PBDataReader *)reader
{
return OTCDPRecoveryInformationReadFrom(self, reader);
}
- (void)writeTo:(PBDataWriter *)writer
{
/* recoverySecret */
{
if (self->_recoverySecret)
{
PBDataWriterWriteStringField(writer, self->_recoverySecret, 1);
}
}
/* useCachedSecret */
{
if (self->_has.useCachedSecret)
{
PBDataWriterWriteBOOLField(writer, self->_useCachedSecret, 2);
}
}
/* recoveryKey */
{
if (self->_recoveryKey)
{
PBDataWriterWriteStringField(writer, self->_recoveryKey, 3);
}
}
/* usePreviouslyCachedRecoveryKey */
{
if (self->_has.usePreviouslyCachedRecoveryKey)
{
PBDataWriterWriteBOOLField(writer, self->_usePreviouslyCachedRecoveryKey, 4);
}
}
/* silentRecoveryAttempt */
{
if (self->_has.silentRecoveryAttempt)
{
PBDataWriterWriteBOOLField(writer, self->_silentRecoveryAttempt, 5);
}
}
/* containsIcdpData */
{
if (self->_has.containsIcdpData)
{
PBDataWriterWriteBOOLField(writer, self->_containsIcdpData, 6);
}
}
/* usesMultipleIcsc */
{
if (self->_has.usesMultipleIcsc)
{
PBDataWriterWriteBOOLField(writer, self->_usesMultipleIcsc, 7);
}
}
}

- (void)copyTo:(OTCDPRecoveryInformation *)other
{
if (_recoverySecret)
{
other.recoverySecret = _recoverySecret;
}
if (self->_has.useCachedSecret)
{
other->_useCachedSecret = _useCachedSecret;
other->_has.useCachedSecret = YES;
}
if (_recoveryKey)
{
other.recoveryKey = _recoveryKey;
}
if (self->_has.usePreviouslyCachedRecoveryKey)
{
other->_usePreviouslyCachedRecoveryKey = _usePreviouslyCachedRecoveryKey;
other->_has.usePreviouslyCachedRecoveryKey = YES;
}
if (self->_has.silentRecoveryAttempt)
{
other->_silentRecoveryAttempt = _silentRecoveryAttempt;
other->_has.silentRecoveryAttempt = YES;
}
if (self->_has.containsIcdpData)
{
other->_containsIcdpData = _containsIcdpData;
other->_has.containsIcdpData = YES;
}
if (self->_has.usesMultipleIcsc)
{
other->_usesMultipleIcsc = _usesMultipleIcsc;
other->_has.usesMultipleIcsc = YES;
}
}

- (id)copyWithZone:(NSZone *)zone
{
OTCDPRecoveryInformation *copy = [[[self class] allocWithZone:zone] init];
copy->_recoverySecret = [_recoverySecret copyWithZone:zone];
if (self->_has.useCachedSecret)
{
copy->_useCachedSecret = _useCachedSecret;
copy->_has.useCachedSecret = YES;
}
copy->_recoveryKey = [_recoveryKey copyWithZone:zone];
if (self->_has.usePreviouslyCachedRecoveryKey)
{
copy->_usePreviouslyCachedRecoveryKey = _usePreviouslyCachedRecoveryKey;
copy->_has.usePreviouslyCachedRecoveryKey = YES;
}
if (self->_has.silentRecoveryAttempt)
{
copy->_silentRecoveryAttempt = _silentRecoveryAttempt;
copy->_has.silentRecoveryAttempt = YES;
}
if (self->_has.containsIcdpData)
{
copy->_containsIcdpData = _containsIcdpData;
copy->_has.containsIcdpData = YES;
}
if (self->_has.usesMultipleIcsc)
{
copy->_usesMultipleIcsc = _usesMultipleIcsc;
copy->_has.usesMultipleIcsc = YES;
}
return copy;
}

- (BOOL)isEqual:(id)object
{
OTCDPRecoveryInformation *other = (OTCDPRecoveryInformation *)object;
return [other isMemberOfClass:[self class]]
&&
((!self->_recoverySecret && !other->_recoverySecret) || [self->_recoverySecret isEqual:other->_recoverySecret])
&&
((self->_has.useCachedSecret && other->_has.useCachedSecret && ((self->_useCachedSecret && other->_useCachedSecret) || (!self->_useCachedSecret && !other->_useCachedSecret))) || (!self->_has.useCachedSecret && !other->_has.useCachedSecret))
&&
((!self->_recoveryKey && !other->_recoveryKey) || [self->_recoveryKey isEqual:other->_recoveryKey])
&&
((self->_has.usePreviouslyCachedRecoveryKey && other->_has.usePreviouslyCachedRecoveryKey && ((self->_usePreviouslyCachedRecoveryKey && other->_usePreviouslyCachedRecoveryKey) || (!self->_usePreviouslyCachedRecoveryKey && !other->_usePreviouslyCachedRecoveryKey))) || (!self->_has.usePreviouslyCachedRecoveryKey && !other->_has.usePreviouslyCachedRecoveryKey))
&&
((self->_has.silentRecoveryAttempt && other->_has.silentRecoveryAttempt && ((self->_silentRecoveryAttempt && other->_silentRecoveryAttempt) || (!self->_silentRecoveryAttempt && !other->_silentRecoveryAttempt))) || (!self->_has.silentRecoveryAttempt && !other->_has.silentRecoveryAttempt))
&&
((self->_has.containsIcdpData && other->_has.containsIcdpData && ((self->_containsIcdpData && other->_containsIcdpData) || (!self->_containsIcdpData && !other->_containsIcdpData))) || (!self->_has.containsIcdpData && !other->_has.containsIcdpData))
&&
((self->_has.usesMultipleIcsc && other->_has.usesMultipleIcsc && ((self->_usesMultipleIcsc && other->_usesMultipleIcsc) || (!self->_usesMultipleIcsc && !other->_usesMultipleIcsc))) || (!self->_has.usesMultipleIcsc && !other->_has.usesMultipleIcsc))
;
}

- (NSUInteger)hash
{
return 0
^
[self->_recoverySecret hash]
^
(self->_has.useCachedSecret ? PBHashInt((NSUInteger)self->_useCachedSecret) : 0)
^
[self->_recoveryKey hash]
^
(self->_has.usePreviouslyCachedRecoveryKey ? PBHashInt((NSUInteger)self->_usePreviouslyCachedRecoveryKey) : 0)
^
(self->_has.silentRecoveryAttempt ? PBHashInt((NSUInteger)self->_silentRecoveryAttempt) : 0)
^
(self->_has.containsIcdpData ? PBHashInt((NSUInteger)self->_containsIcdpData) : 0)
^
(self->_has.usesMultipleIcsc ? PBHashInt((NSUInteger)self->_usesMultipleIcsc) : 0)
;
}

- (void)mergeFrom:(OTCDPRecoveryInformation *)other
{
if (other->_recoverySecret)
{
[self setRecoverySecret:other->_recoverySecret];
}
if (other->_has.useCachedSecret)
{
self->_useCachedSecret = other->_useCachedSecret;
self->_has.useCachedSecret = YES;
}
if (other->_recoveryKey)
{
[self setRecoveryKey:other->_recoveryKey];
}
if (other->_has.usePreviouslyCachedRecoveryKey)
{
self->_usePreviouslyCachedRecoveryKey = other->_usePreviouslyCachedRecoveryKey;
self->_has.usePreviouslyCachedRecoveryKey = YES;
}
if (other->_has.silentRecoveryAttempt)
{
self->_silentRecoveryAttempt = other->_silentRecoveryAttempt;
self->_has.silentRecoveryAttempt = YES;
}
if (other->_has.containsIcdpData)
{
self->_containsIcdpData = other->_containsIcdpData;
self->_has.containsIcdpData = YES;
}
if (other->_has.usesMultipleIcsc)
{
self->_usesMultipleIcsc = other->_usesMultipleIcsc;
self->_has.usesMultipleIcsc = YES;
}
}

@end