AWDKeychainCKKSRateLimiterAggregatedScores.m   [plain text]


// This file was automatically generated by protocompiler
// DO NOT EDIT!
// Compiled from stdin

#import <TargetConditionals.h>
#if !TARGET_OS_BRIDGE

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

- (void)dealloc
{
    PBRepeatedUInt32Clear(&(self->_datas));
}

@synthesize timestamp = _timestamp;
- (void)setTimestamp:(uint64_t)v
{
    _has.timestamp = YES;
    _timestamp = v;
}
- (void)setHasTimestamp:(BOOL)f
{
    _has.timestamp = f;
}
- (BOOL)hasTimestamp
{
    return _has.timestamp;
}
- (NSUInteger)datasCount
{
    return _datas.count;
}
- (uint32_t *)datas
{
    return _datas.list;
}
- (void)clearDatas
{
    PBRepeatedUInt32Clear(&_datas);
}
- (void)addData:(uint32_t)i
{
    PBRepeatedUInt32Add(&_datas, i);
}
- (uint32_t)dataAtIndex:(NSUInteger)idx
{
    if (_datas.count <= idx)
    {
        [[NSException exceptionWithName:NSRangeException reason:[NSString stringWithFormat:@"idx (%tu) is out of range (%tu)", idx, _datas.count] userInfo:nil] raise];
    }
    return _datas.list[idx];
}
- (void)setDatas:(uint32_t *)list count:(NSUInteger)count
{
    PBRepeatedUInt32Set(&_datas, list, count);
}
- (BOOL)hasRatelimitertype
{
    return _ratelimitertype != nil;
}
@synthesize ratelimitertype = _ratelimitertype;

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

- (NSDictionary *)dictionaryRepresentation
{
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    if (self->_has.timestamp)
    {
        [dict setObject:[NSNumber numberWithUnsignedLongLong:self->_timestamp] forKey:@"timestamp"];
    }
    [dict setObject:PBRepeatedUInt32NSArray(&(self->_datas)) forKey:@"data"];
    if (self->_ratelimitertype)
    {
        [dict setObject:self->_ratelimitertype forKey:@"ratelimitertype"];
    }
    return dict;
}

BOOL AWDKeychainCKKSRateLimiterAggregatedScoresReadFrom(__unsafe_unretained AWDKeychainCKKSRateLimiterAggregatedScores *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 /* timestamp */:
            {
                self->_has.timestamp = YES;
                self->_timestamp = PBReaderReadUint64(reader);
            }
            break;
            case 2 /* datas */:
            {
                if (TYPE_LENGTH_DELIMITED == aType)
                {
                    PBDataReaderMark mark_data;
                    BOOL markError = !PBReaderPlaceMark(reader, &mark_data);
                    if (markError)
                    {
                        return NO;
                    }
                    while (PBReaderHasMoreData(reader))
                    {
                        uint32_t new_data = PBReaderReadUint32(reader);
                        PBRepeatedUInt32Add(&(self->_datas), new_data);
                    }
                    PBReaderRecallMark(reader, &mark_data);
                }
                else
                {
                    PBRepeatedUInt32Add(&(self->_datas), PBReaderReadUint32(reader));
                }
            }
            break;
            case 3 /* ratelimitertype */:
            {
                NSString *new_ratelimitertype = PBReaderReadString(reader);
                self->_ratelimitertype = new_ratelimitertype;
            }
            break;
            default:
                if (!PBReaderSkipValueWithTag(reader, tag, aType))
                    return NO;
                break;
        }
    }
    return !PBReaderHasError(reader);
}

- (BOOL)readFrom:(PBDataReader *)reader
{
    return AWDKeychainCKKSRateLimiterAggregatedScoresReadFrom(self, reader);
}
- (void)writeTo:(PBDataWriter *)writer
{
    /* timestamp */
    {
        if (self->_has.timestamp)
        {
            PBDataWriterWriteUint64Field(writer, self->_timestamp, 1);
        }
    }
    /* datas */
    {
        if (self->_datas.count)
        {
            NSUInteger i_datas;
            for (i_datas = 0; i_datas < self->_datas.count; i_datas++)
            {
                PBDataWriterWriteUint32Field(writer, self->_datas.list[i_datas], 2);
            }
        }
    }
    /* ratelimitertype */
    {
        if (self->_ratelimitertype)
        {
            PBDataWriterWriteStringField(writer, self->_ratelimitertype, 3);
        }
    }
}

- (void)copyTo:(AWDKeychainCKKSRateLimiterAggregatedScores *)other
{
    if (self->_has.timestamp)
    {
        other->_timestamp = _timestamp;
        other->_has.timestamp = YES;
    }
    if ([self datasCount])
    {
        [other clearDatas];
        NSUInteger datasCnt = [self datasCount];
        for (NSUInteger i = 0; i < datasCnt; i++)
        {
            [other addData:[self dataAtIndex:i]];
        }
    }
    if (_ratelimitertype)
    {
        other.ratelimitertype = _ratelimitertype;
    }
}

- (id)copyWithZone:(NSZone *)zone
{
    AWDKeychainCKKSRateLimiterAggregatedScores *copy = [[[self class] allocWithZone:zone] init];
    if (self->_has.timestamp)
    {
        copy->_timestamp = _timestamp;
        copy->_has.timestamp = YES;
    }
    PBRepeatedUInt32Copy(&(copy->_datas), &_datas);
    copy->_ratelimitertype = [_ratelimitertype copyWithZone:zone];
    return copy;
}

- (BOOL)isEqual:(id)object
{
    AWDKeychainCKKSRateLimiterAggregatedScores *other = (AWDKeychainCKKSRateLimiterAggregatedScores *)object;
    return [other isMemberOfClass:[self class]]
    &&
    ((self->_has.timestamp && other->_has.timestamp && self->_timestamp == other->_timestamp) || (!self->_has.timestamp && !other->_has.timestamp))
    &&
    PBRepeatedUInt32IsEqual(&(self->_datas), &(other->_datas))
    &&
    ((!self->_ratelimitertype && !other->_ratelimitertype) || [self->_ratelimitertype isEqual:other->_ratelimitertype])
    ;
}

- (NSUInteger)hash
{
    return 0
    ^
    (self->_has.timestamp ? PBHashInt((NSUInteger)self->_timestamp) : 0)
    ^
    PBRepeatedUInt32Hash(&(self->_datas))
    ^
    [self->_ratelimitertype hash]
    ;
}

- (void)mergeFrom:(AWDKeychainCKKSRateLimiterAggregatedScores *)other
{
    if (other->_has.timestamp)
    {
        self->_timestamp = other->_timestamp;
        self->_has.timestamp = YES;
    }
    NSUInteger datasCnt = [other datasCount];
    for (NSUInteger i = 0; i < datasCnt; i++)
    {
        [self addData:[other dataAtIndex:i]];
    }
    if (other->_ratelimitertype)
    {
        [self setRatelimitertype:other->_ratelimitertype];
    }
}

@end
#endif