1 // This file was automatically generated by protocompiler
3 // Compiled from foo.proto
5 #import "SecDbKeychainSerializedItemV7.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 SecDbKeychainSerializedItemV7
16 @synthesize encryptedSecretData = _encryptedSecretData;
17 @synthesize encryptedMetadata = _encryptedMetadata;
18 @synthesize keyclass = _keyclass;
19 - (NSString *)keyclassAsString:(SecDbKeychainSerializedItemV7_Keyclass)value
21 return SecDbKeychainSerializedItemV7_KeyclassAsString(value);
23 - (SecDbKeychainSerializedItemV7_Keyclass)StringAsKeyclass:(NSString *)str
25 return StringAsSecDbKeychainSerializedItemV7_Keyclass(str);
28 - (NSString *)description
30 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
33 - (NSDictionary *)dictionaryRepresentation
35 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
36 if (self->_encryptedSecretData)
38 [dict setObject:self->_encryptedSecretData forKey:@"encryptedSecretData"];
40 if (self->_encryptedMetadata)
42 [dict setObject:self->_encryptedMetadata forKey:@"encryptedMetadata"];
44 [dict setObject:SecDbKeychainSerializedItemV7_KeyclassAsString(self->_keyclass) forKey:@"keyclass"];
48 BOOL SecDbKeychainSerializedItemV7ReadFrom(__unsafe_unretained SecDbKeychainSerializedItemV7 *self, __unsafe_unretained PBDataReader *reader) {
49 while (PBReaderHasMoreData(reader)) {
53 PBReaderReadTag32AndType(reader, &tag, &aType);
55 if (PBReaderHasError(reader))
58 if (aType == TYPE_END_GROUP) {
64 case 1 /* encryptedSecretData */:
66 NSData *new_encryptedSecretData = PBReaderReadData(reader);
67 self->_encryptedSecretData = new_encryptedSecretData;
70 case 2 /* encryptedMetadata */:
72 NSData *new_encryptedMetadata = PBReaderReadData(reader);
73 self->_encryptedMetadata = new_encryptedMetadata;
76 case 3 /* keyclass */:
78 self->_keyclass = PBReaderReadInt32(reader);
82 if (!PBReaderSkipValueWithTag(reader, tag, aType))
87 return !PBReaderHasError(reader);
90 - (BOOL)readFrom:(PBDataReader *)reader
92 return SecDbKeychainSerializedItemV7ReadFrom(self, reader);
94 - (void)writeTo:(PBDataWriter *)writer
96 /* encryptedSecretData */
98 assert(nil != self->_encryptedSecretData);
99 PBDataWriterWriteDataField(writer, self->_encryptedSecretData, 1);
101 /* encryptedMetadata */
103 assert(nil != self->_encryptedMetadata);
104 PBDataWriterWriteDataField(writer, self->_encryptedMetadata, 2);
108 PBDataWriterWriteInt32Field(writer, self->_keyclass, 3);
112 - (void)copyTo:(SecDbKeychainSerializedItemV7 *)other
114 other.encryptedSecretData = _encryptedSecretData;
115 other.encryptedMetadata = _encryptedMetadata;
116 other->_keyclass = _keyclass;
119 - (id)copyWithZone:(NSZone *)zone
121 SecDbKeychainSerializedItemV7 *copy = [[[self class] allocWithZone:zone] init];
122 copy->_encryptedSecretData = [_encryptedSecretData copyWithZone:zone];
123 copy->_encryptedMetadata = [_encryptedMetadata copyWithZone:zone];
124 copy->_keyclass = _keyclass;
128 - (BOOL)isEqual:(id)object
130 SecDbKeychainSerializedItemV7 *other = (SecDbKeychainSerializedItemV7 *)object;
131 return [other isMemberOfClass:[self class]]
133 ((!self->_encryptedSecretData && !other->_encryptedSecretData) || [self->_encryptedSecretData isEqual:other->_encryptedSecretData])
135 ((!self->_encryptedMetadata && !other->_encryptedMetadata) || [self->_encryptedMetadata isEqual:other->_encryptedMetadata])
137 self->_keyclass == other->_keyclass
145 [self->_encryptedSecretData hash]
147 [self->_encryptedMetadata hash]
149 PBHashInt((NSUInteger)_keyclass)
153 - (void)mergeFrom:(SecDbKeychainSerializedItemV7 *)other
155 if (other->_encryptedSecretData)
157 [self setEncryptedSecretData:other->_encryptedSecretData];
159 if (other->_encryptedMetadata)
161 [self setEncryptedMetadata:other->_encryptedMetadata];
163 self->_keyclass = other->_keyclass;