OTICDPRecordSilentContext.m   [plain text]

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

#import "OTICDPRecordSilentContext.h"
#import <ProtocolBuffer/PBConstants.h>
#import <ProtocolBuffer/PBHashUtil.h>
#import <ProtocolBuffer/PBDataReader.h>

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

- (BOOL)hasCdpInfo
{
return _cdpInfo != nil;
}
@synthesize cdpInfo = _cdpInfo;
- (BOOL)hasAuthInfo
{
return _authInfo != nil;
}
@synthesize authInfo = _authInfo;

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

- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
if (self->_cdpInfo)
{
[dict setObject:[_cdpInfo dictionaryRepresentation] forKey:@"cdpInfo"];
}
if (self->_authInfo)
{
[dict setObject:[_authInfo dictionaryRepresentation] forKey:@"authInfo"];
}
return dict;
}

BOOL OTICDPRecordSilentContextReadFrom(__unsafe_unretained OTICDPRecordSilentContext *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 /* cdpInfo */:
{
OTCDPRecoveryInformation *new_cdpInfo = [[OTCDPRecoveryInformation alloc] init];
self->_cdpInfo = new_cdpInfo;
PBDataReaderMark mark_cdpInfo;
BOOL markError = !PBReaderPlaceMark(reader, &mark_cdpInfo);
if (markError)
{
return NO;
}
BOOL inError = !OTCDPRecoveryInformationReadFrom(new_cdpInfo, reader);
if (inError)
{
return NO;
}
PBReaderRecallMark(reader, &mark_cdpInfo);
}
break;
case 2 /* authInfo */:
{
OTEscrowAuthenticationInformation *new_authInfo = [[OTEscrowAuthenticationInformation alloc] init];
self->_authInfo = new_authInfo;
PBDataReaderMark mark_authInfo;
BOOL markError = !PBReaderPlaceMark(reader, &mark_authInfo);
if (markError)
{
return NO;
}
BOOL inError = !OTEscrowAuthenticationInformationReadFrom(new_authInfo, reader);
if (inError)
{
return NO;
}
PBReaderRecallMark(reader, &mark_authInfo);
}
break;
default:
if (!PBReaderSkipValueWithTag(reader, tag, aType))
return NO;
break;
}
}
return !PBReaderHasError(reader);
}

- (BOOL)readFrom:(PBDataReader *)reader
{
return OTICDPRecordSilentContextReadFrom(self, reader);
}
- (void)writeTo:(PBDataWriter *)writer
{
/* cdpInfo */
{
if (self->_cdpInfo != nil)
{
PBDataWriterWriteSubmessage(writer, self->_cdpInfo, 1);
}
}
/* authInfo */
{
if (self->_authInfo != nil)
{
PBDataWriterWriteSubmessage(writer, self->_authInfo, 2);
}
}
}

- (void)copyTo:(OTICDPRecordSilentContext *)other
{
if (_cdpInfo)
{
other.cdpInfo = _cdpInfo;
}
if (_authInfo)
{
other.authInfo = _authInfo;
}
}

- (id)copyWithZone:(NSZone *)zone
{
OTICDPRecordSilentContext *copy = [[[self class] allocWithZone:zone] init];
copy->_cdpInfo = [_cdpInfo copyWithZone:zone];
copy->_authInfo = [_authInfo copyWithZone:zone];
return copy;
}

- (BOOL)isEqual:(id)object
{
OTICDPRecordSilentContext *other = (OTICDPRecordSilentContext *)object;
return [other isMemberOfClass:[self class]]
&&
((!self->_cdpInfo && !other->_cdpInfo) || [self->_cdpInfo isEqual:other->_cdpInfo])
&&
((!self->_authInfo && !other->_authInfo) || [self->_authInfo isEqual:other->_authInfo])
;
}

- (NSUInteger)hash
{
return 0
^
[self->_cdpInfo hash]
^
[self->_authInfo hash]
;
}

- (void)mergeFrom:(OTICDPRecordSilentContext *)other
{
if (self->_cdpInfo && other->_cdpInfo)
{
[self->_cdpInfo mergeFrom:other->_cdpInfo];
}
else if (!self->_cdpInfo && other->_cdpInfo)
{
[self setCdpInfo:other->_cdpInfo];
}
if (self->_authInfo && other->_authInfo)
{
[self->_authInfo mergeFrom:other->_authInfo];
}
else if (!self->_authInfo && other->_authInfo)
{
[self setAuthInfo:other->_authInfo];
}
}

@end