OTSupportOctagonMessage.m   [plain text]

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

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

@synthesize supported = _supported;
- (OTSupportType)supported
{
return _has.supported ? _supported : OTSupportType_unknown;
}
- (void)setSupported:(OTSupportType)v
{
_has.supported = YES;
_supported = v;
}
- (void)setHasSupported:(BOOL)f
{
_has.supported = f;
}
- (BOOL)hasSupported
{
return _has.supported != 0;
}
- (NSString *)supportedAsString:(OTSupportType)value
{
return OTSupportTypeAsString(value);
}
- (OTSupportType)StringAsSupported:(NSString *)str
{
return StringAsOTSupportType(str);
}

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

- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
if (self->_has.supported)
{
[dict setObject:OTSupportTypeAsString(self->_supported) forKey:@"supported"];
}
return dict;
}

BOOL OTSupportOctagonMessageReadFrom(__unsafe_unretained OTSupportOctagonMessage *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 /* supported */:
{
self->_has.supported = YES;
self->_supported = PBReaderReadInt32(reader);
}
break;
default:
if (!PBReaderSkipValueWithTag(reader, tag, aType))
return NO;
break;
}
}
return !PBReaderHasError(reader);
}

- (BOOL)readFrom:(PBDataReader *)reader
{
return OTSupportOctagonMessageReadFrom(self, reader);
}
- (void)writeTo:(PBDataWriter *)writer
{
/* supported */
{
if (self->_has.supported)
{
PBDataWriterWriteInt32Field(writer, self->_supported, 1);
}
}
}

- (void)copyTo:(OTSupportOctagonMessage *)other
{
if (self->_has.supported)
{
other->_supported = _supported;
other->_has.supported = YES;
}
}

- (id)copyWithZone:(NSZone *)zone
{
OTSupportOctagonMessage *copy = [[[self class] allocWithZone:zone] init];
if (self->_has.supported)
{
copy->_supported = _supported;
copy->_has.supported = YES;
}
return copy;
}

- (BOOL)isEqual:(id)object
{
OTSupportOctagonMessage *other = (OTSupportOctagonMessage *)object;
return [other isMemberOfClass:[self class]]
&&
((self->_has.supported && other->_has.supported && self->_supported == other->_supported) || (!self->_has.supported && !other->_has.supported))
;
}

- (NSUInteger)hash
{
return 0
^
(self->_has.supported ? PBHashInt((NSUInteger)self->_supported) : 0)
;
}

- (void)mergeFrom:(OTSupportOctagonMessage *)other
{
if (other->_has.supported)
{
self->_supported = other->_supported;
self->_has.supported = YES;
}
}

@end