OTBottle.m   [plain text]

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

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

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

- (BOOL)hasPeerID
{
return _peerID != nil;
}
@synthesize peerID = _peerID;
- (BOOL)hasBottleID
{
return _bottleID != nil;
}
@synthesize bottleID = _bottleID;
- (BOOL)hasReserved3
{
return _reserved3 != nil;
}
@synthesize reserved3 = _reserved3;
- (BOOL)hasReserved4
{
return _reserved4 != nil;
}
@synthesize reserved4 = _reserved4;
- (BOOL)hasReserved5
{
return _reserved5 != nil;
}
@synthesize reserved5 = _reserved5;
- (BOOL)hasReserved6
{
return _reserved6 != nil;
}
@synthesize reserved6 = _reserved6;
- (BOOL)hasEscrowedSigningSPKI
{
return _escrowedSigningSPKI != nil;
}
@synthesize escrowedSigningSPKI = _escrowedSigningSPKI;
- (BOOL)hasEscrowedEncryptionSPKI
{
return _escrowedEncryptionSPKI != nil;
}
@synthesize escrowedEncryptionSPKI = _escrowedEncryptionSPKI;
- (BOOL)hasPeerSigningSPKI
{
return _peerSigningSPKI != nil;
}
@synthesize peerSigningSPKI = _peerSigningSPKI;
- (BOOL)hasPeerEncryptionSPKI
{
return _peerEncryptionSPKI != nil;
}
@synthesize peerEncryptionSPKI = _peerEncryptionSPKI;
- (BOOL)hasReserved7
{
return _reserved7 != nil;
}
@synthesize reserved7 = _reserved7;
- (BOOL)hasContents
{
return _contents != nil;
}
@synthesize contents = _contents;

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

- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
if (self->_peerID)
{
[dict setObject:self->_peerID forKey:@"peerID"];
}
if (self->_bottleID)
{
[dict setObject:self->_bottleID forKey:@"bottleID"];
}
if (self->_reserved3)
{
[dict setObject:self->_reserved3 forKey:@"reserved3"];
}
if (self->_reserved4)
{
[dict setObject:self->_reserved4 forKey:@"reserved4"];
}
if (self->_reserved5)
{
[dict setObject:self->_reserved5 forKey:@"reserved5"];
}
if (self->_reserved6)
{
[dict setObject:self->_reserved6 forKey:@"reserved6"];
}
if (self->_escrowedSigningSPKI)
{
[dict setObject:self->_escrowedSigningSPKI forKey:@"escrowedSigningSPKI"];
}
if (self->_escrowedEncryptionSPKI)
{
[dict setObject:self->_escrowedEncryptionSPKI forKey:@"escrowedEncryptionSPKI"];
}
if (self->_peerSigningSPKI)
{
[dict setObject:self->_peerSigningSPKI forKey:@"peerSigningSPKI"];
}
if (self->_peerEncryptionSPKI)
{
[dict setObject:self->_peerEncryptionSPKI forKey:@"peerEncryptionSPKI"];
}
if (self->_reserved7)
{
[dict setObject:self->_reserved7 forKey:@"reserved7"];
}
if (self->_contents)
{
[dict setObject:[_contents dictionaryRepresentation] forKey:@"contents"];
}
return dict;
}

BOOL OTBottleReadFrom(__unsafe_unretained OTBottle *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 /* bottleID */:
{
NSString *new_bottleID = PBReaderReadString(reader);
self->_bottleID = new_bottleID;
}
break;
case 3 /* reserved3 */:
{
NSData *new_reserved3 = PBReaderReadData(reader);
self->_reserved3 = new_reserved3;
}
break;
case 4 /* reserved4 */:
{
NSData *new_reserved4 = PBReaderReadData(reader);
self->_reserved4 = new_reserved4;
}
break;
case 5 /* reserved5 */:
{
NSData *new_reserved5 = PBReaderReadData(reader);
self->_reserved5 = new_reserved5;
}
break;
case 6 /* reserved6 */:
{
NSData *new_reserved6 = PBReaderReadData(reader);
self->_reserved6 = new_reserved6;
}
break;
case 7 /* reserved7 */:
{
NSData *new_reserved7 = PBReaderReadData(reader);
self->_reserved7 = new_reserved7;
}
break;
case 8 /* escrowedSigningSPKI */:
{
NSData *new_escrowedSigningSPKI = PBReaderReadData(reader);
self->_escrowedSigningSPKI = new_escrowedSigningSPKI;
}
break;
case 9 /* escrowedEncryptionSPKI */:
{
NSData *new_escrowedEncryptionSPKI = PBReaderReadData(reader);
self->_escrowedEncryptionSPKI = new_escrowedEncryptionSPKI;
}
break;
case 10 /* peerSigningSPKI */:
{
NSData *new_peerSigningSPKI = PBReaderReadData(reader);
self->_peerSigningSPKI = new_peerSigningSPKI;
}
break;
case 11 /* peerEncryptionSPKI */:
{
NSData *new_peerEncryptionSPKI = PBReaderReadData(reader);
self->_peerEncryptionSPKI = new_peerEncryptionSPKI;
}
break;
case 12 /* contents */:
{
OTAuthenticatedCiphertext *new_contents = [[OTAuthenticatedCiphertext alloc] init];
self->_contents = new_contents;
PBDataReaderMark mark_contents;
BOOL markError = !PBReaderPlaceMark(reader, &mark_contents);
if (markError)
{
return NO;
}
BOOL inError = !OTAuthenticatedCiphertextReadFrom(new_contents, reader);
if (inError)
{
return NO;
}
PBReaderRecallMark(reader, &mark_contents);
}
break;
default:
if (!PBReaderSkipValueWithTag(reader, tag, aType))
return NO;
break;
}
}
return !PBReaderHasError(reader);
}

- (BOOL)readFrom:(PBDataReader *)reader
{
return OTBottleReadFrom(self, reader);
}
- (void)writeTo:(PBDataWriter *)writer
{
/* peerID */
{
if (self->_peerID)
{
PBDataWriterWriteStringField(writer, self->_peerID, 1);
}
}
/* bottleID */
{
if (self->_bottleID)
{
PBDataWriterWriteStringField(writer, self->_bottleID, 2);
}
}
/* reserved3 */
{
if (self->_reserved3)
{
PBDataWriterWriteDataField(writer, self->_reserved3, 3);
}
}
/* reserved4 */
{
if (self->_reserved4)
{
PBDataWriterWriteDataField(writer, self->_reserved4, 4);
}
}
/* reserved5 */
{
if (self->_reserved5)
{
PBDataWriterWriteDataField(writer, self->_reserved5, 5);
}
}
/* reserved6 */
{
if (self->_reserved6)
{
PBDataWriterWriteDataField(writer, self->_reserved6, 6);
}
}
/* reserved7 */
{
if (self->_reserved7)
{
PBDataWriterWriteDataField(writer, self->_reserved7, 7);
}
}
/* escrowedSigningSPKI */
{
if (self->_escrowedSigningSPKI)
{
PBDataWriterWriteDataField(writer, self->_escrowedSigningSPKI, 8);
}
}
/* escrowedEncryptionSPKI */
{
if (self->_escrowedEncryptionSPKI)
{
PBDataWriterWriteDataField(writer, self->_escrowedEncryptionSPKI, 9);
}
}
/* peerSigningSPKI */
{
if (self->_peerSigningSPKI)
{
PBDataWriterWriteDataField(writer, self->_peerSigningSPKI, 10);
}
}
/* peerEncryptionSPKI */
{
if (self->_peerEncryptionSPKI)
{
PBDataWriterWriteDataField(writer, self->_peerEncryptionSPKI, 11);
}
}
/* contents */
{
if (self->_contents != nil)
{
PBDataWriterWriteSubmessage(writer, self->_contents, 12);
}
}
}

- (void)copyTo:(OTBottle *)other
{
if (_peerID)
{
other.peerID = _peerID;
}
if (_bottleID)
{
other.bottleID = _bottleID;
}
if (_reserved3)
{
other.reserved3 = _reserved3;
}
if (_reserved4)
{
other.reserved4 = _reserved4;
}
if (_reserved5)
{
other.reserved5 = _reserved5;
}
if (_reserved6)
{
other.reserved6 = _reserved6;
}
if (_reserved7)
{
other.reserved7 = _reserved7;
}
if (_escrowedSigningSPKI)
{
other.escrowedSigningSPKI = _escrowedSigningSPKI;
}
if (_escrowedEncryptionSPKI)
{
other.escrowedEncryptionSPKI = _escrowedEncryptionSPKI;
}
if (_peerSigningSPKI)
{
other.peerSigningSPKI = _peerSigningSPKI;
}
if (_peerEncryptionSPKI)
{
other.peerEncryptionSPKI = _peerEncryptionSPKI;
}
if (_contents)
{
other.contents = _contents;
}
}

- (id)copyWithZone:(NSZone *)zone
{
OTBottle *copy = [[[self class] allocWithZone:zone] init];
copy->_peerID = [_peerID copyWithZone:zone];
copy->_bottleID = [_bottleID copyWithZone:zone];
copy->_reserved3 = [_reserved3 copyWithZone:zone];
copy->_reserved4 = [_reserved4 copyWithZone:zone];
copy->_reserved5 = [_reserved5 copyWithZone:zone];
copy->_reserved6 = [_reserved6 copyWithZone:zone];
copy->_reserved7 = [_reserved7 copyWithZone:zone];
copy->_escrowedSigningSPKI = [_escrowedSigningSPKI copyWithZone:zone];
copy->_escrowedEncryptionSPKI = [_escrowedEncryptionSPKI copyWithZone:zone];
copy->_peerSigningSPKI = [_peerSigningSPKI copyWithZone:zone];
copy->_peerEncryptionSPKI = [_peerEncryptionSPKI copyWithZone:zone];
copy->_contents = [_contents copyWithZone:zone];
return copy;
}

- (BOOL)isEqual:(id)object
{
OTBottle *other = (OTBottle *)object;
return [other isMemberOfClass:[self class]]
&&
((!self->_peerID && !other->_peerID) || [self->_peerID isEqual:other->_peerID])
&&
((!self->_bottleID && !other->_bottleID) || [self->_bottleID isEqual:other->_bottleID])
&&
((!self->_reserved3 && !other->_reserved3) || [self->_reserved3 isEqual:other->_reserved3])
&&
((!self->_reserved4 && !other->_reserved4) || [self->_reserved4 isEqual:other->_reserved4])
&&
((!self->_reserved5 && !other->_reserved5) || [self->_reserved5 isEqual:other->_reserved5])
&&
((!self->_reserved6 && !other->_reserved6) || [self->_reserved6 isEqual:other->_reserved6])
&&
((!self->_reserved7 && !other->_reserved7) || [self->_reserved7 isEqual:other->_reserved7])
&&
((!self->_escrowedSigningSPKI && !other->_escrowedSigningSPKI) || [self->_escrowedSigningSPKI isEqual:other->_escrowedSigningSPKI])
&&
((!self->_escrowedEncryptionSPKI && !other->_escrowedEncryptionSPKI) || [self->_escrowedEncryptionSPKI isEqual:other->_escrowedEncryptionSPKI])
&&
((!self->_peerSigningSPKI && !other->_peerSigningSPKI) || [self->_peerSigningSPKI isEqual:other->_peerSigningSPKI])
&&
((!self->_peerEncryptionSPKI && !other->_peerEncryptionSPKI) || [self->_peerEncryptionSPKI isEqual:other->_peerEncryptionSPKI])
&&
((!self->_contents && !other->_contents) || [self->_contents isEqual:other->_contents])
;
}

- (NSUInteger)hash
{
return 0
^
[self->_peerID hash]
^
[self->_bottleID hash]
^
[self->_reserved3 hash]
^
[self->_reserved4 hash]
^
[self->_reserved5 hash]
^
[self->_reserved6 hash]
^
[self->_reserved7 hash]
^
[self->_escrowedSigningSPKI hash]
^
[self->_escrowedEncryptionSPKI hash]
^
[self->_peerSigningSPKI hash]
^
[self->_peerEncryptionSPKI hash]
^
[self->_contents hash]
;
}

- (void)mergeFrom:(OTBottle *)other
{
if (other->_peerID)
{
[self setPeerID:other->_peerID];
}
if (other->_bottleID)
{
[self setBottleID:other->_bottleID];
}
if (other->_reserved3)
{
[self setReserved3:other->_reserved3];
}
if (other->_reserved4)
{
[self setReserved4:other->_reserved4];
}
if (other->_reserved5)
{
[self setReserved5:other->_reserved5];
}
if (other->_reserved6)
{
[self setReserved6:other->_reserved6];
}
if (other->_reserved7)
{
[self setReserved7:other->_reserved7];
}
if (other->_escrowedSigningSPKI)
{
[self setEscrowedSigningSPKI:other->_escrowedSigningSPKI];
}
if (other->_escrowedEncryptionSPKI)
{
[self setEscrowedEncryptionSPKI:other->_escrowedEncryptionSPKI];
}
if (other->_peerSigningSPKI)
{
[self setPeerSigningSPKI:other->_peerSigningSPKI];
}
if (other->_peerEncryptionSPKI)
{
[self setPeerEncryptionSPKI:other->_peerEncryptionSPKI];
}
if (self->_contents && other->_contents)
{
[self->_contents mergeFrom:other->_contents];
}
else if (!self->_contents && other->_contents)
{
[self setContents:other->_contents];
}
}

@end