1 // This file was automatically generated by protocompiler
3 // Compiled from C2Metric.proto
5 #import "SECC2MPServerInfo.h"
6 #import <ProtocolBuffer/PBConstants.h>
7 #import <ProtocolBuffer/PBHashUtil.h>
8 #import <ProtocolBuffer/PBDataReader.h>
10 #if !__has_feature(objc_arc)
11 # 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.
14 @implementation SECC2MPServerInfo
16 - (BOOL)hasServiceName
18 return _serviceName != nil;
20 @synthesize serviceName = _serviceName;
23 return _partition != nil;
25 @synthesize partition = _partition;
26 - (BOOL)hasServiceBuild
28 return _serviceBuild != nil;
30 @synthesize serviceBuild = _serviceBuild;
31 - (BOOL)hasServiceInstance
33 return _serviceInstance != nil;
35 @synthesize serviceInstance = _serviceInstance;
37 - (NSString *)description
39 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
42 - (NSDictionary *)dictionaryRepresentation
44 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
45 if (self->_serviceName)
47 [dict setObject:self->_serviceName forKey:@"service_name"];
51 [dict setObject:self->_partition forKey:@"partition"];
53 if (self->_serviceBuild)
55 [dict setObject:self->_serviceBuild forKey:@"service_build"];
57 if (self->_serviceInstance)
59 [dict setObject:self->_serviceInstance forKey:@"service_instance"];
64 BOOL SECC2MPServerInfoReadFrom(__unsafe_unretained SECC2MPServerInfo *self, __unsafe_unretained PBDataReader *reader) {
65 while (PBReaderHasMoreData(reader)) {
69 PBReaderReadTag32AndType(reader, &tag, &aType);
71 if (PBReaderHasError(reader))
74 if (aType == TYPE_END_GROUP) {
80 case 102 /* serviceName */:
82 NSString *new_serviceName = PBReaderReadString(reader);
83 self->_serviceName = new_serviceName;
86 case 103 /* partition */:
88 NSString *new_partition = PBReaderReadString(reader);
89 self->_partition = new_partition;
92 case 104 /* serviceBuild */:
94 NSString *new_serviceBuild = PBReaderReadString(reader);
95 self->_serviceBuild = new_serviceBuild;
98 case 105 /* serviceInstance */:
100 NSString *new_serviceInstance = PBReaderReadString(reader);
101 self->_serviceInstance = new_serviceInstance;
105 if (!PBReaderSkipValueWithTag(reader, tag, aType))
110 return !PBReaderHasError(reader);
113 - (BOOL)readFrom:(PBDataReader *)reader
115 return SECC2MPServerInfoReadFrom(self, reader);
117 - (void)writeTo:(PBDataWriter *)writer
121 if (self->_serviceName)
123 PBDataWriterWriteStringField(writer, self->_serviceName, 102);
128 if (self->_partition)
130 PBDataWriterWriteStringField(writer, self->_partition, 103);
135 if (self->_serviceBuild)
137 PBDataWriterWriteStringField(writer, self->_serviceBuild, 104);
140 /* serviceInstance */
142 if (self->_serviceInstance)
144 PBDataWriterWriteStringField(writer, self->_serviceInstance, 105);
149 - (void)copyTo:(SECC2MPServerInfo *)other
153 other.serviceName = _serviceName;
157 other.partition = _partition;
161 other.serviceBuild = _serviceBuild;
163 if (_serviceInstance)
165 other.serviceInstance = _serviceInstance;
169 - (id)copyWithZone:(NSZone *)zone
171 SECC2MPServerInfo *copy = [[[self class] allocWithZone:zone] init];
172 copy->_serviceName = [_serviceName copyWithZone:zone];
173 copy->_partition = [_partition copyWithZone:zone];
174 copy->_serviceBuild = [_serviceBuild copyWithZone:zone];
175 copy->_serviceInstance = [_serviceInstance copyWithZone:zone];
179 - (BOOL)isEqual:(id)object
181 SECC2MPServerInfo *other = (SECC2MPServerInfo *)object;
182 return [other isMemberOfClass:[self class]]
184 ((!self->_serviceName && !other->_serviceName) || [self->_serviceName isEqual:other->_serviceName])
186 ((!self->_partition && !other->_partition) || [self->_partition isEqual:other->_partition])
188 ((!self->_serviceBuild && !other->_serviceBuild) || [self->_serviceBuild isEqual:other->_serviceBuild])
190 ((!self->_serviceInstance && !other->_serviceInstance) || [self->_serviceInstance isEqual:other->_serviceInstance])
198 [self->_serviceName hash]
200 [self->_partition hash]
202 [self->_serviceBuild hash]
204 [self->_serviceInstance hash]
208 - (void)mergeFrom:(SECC2MPServerInfo *)other
210 if (other->_serviceName)
212 [self setServiceName:other->_serviceName];
214 if (other->_partition)
216 [self setPartition:other->_partition];
218 if (other->_serviceBuild)
220 [self setServiceBuild:other->_serviceBuild];
222 if (other->_serviceInstance)
224 [self setServiceInstance:other->_serviceInstance];