]> git.saurik.com Git - apple/security.git/blob - tests/secdmockaks/generated_source/MockAKSRefKey.m
Security-59306.61.1.tar.gz
[apple/security.git] / tests / secdmockaks / generated_source / MockAKSRefKey.m
1 // This file was automatically generated by protocompiler
2 // DO NOT EDIT!
3 // Compiled from MockAKSRefKey.proto
4
5 #import "MockAKSRefKey.h"
6 #import <ProtocolBuffer/PBConstants.h>
7 #import <ProtocolBuffer/PBHashUtil.h>
8 #import <ProtocolBuffer/PBDataReader.h>
9
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.
12 #endif
13
14 @implementation MockAKSRefKey
15
16 - (BOOL)hasKey
17 {
18 return _key != nil;
19 }
20 @synthesize key = _key;
21 - (BOOL)hasOptionalParams
22 {
23 return _optionalParams != nil;
24 }
25 @synthesize optionalParams = _optionalParams;
26
27 - (NSString *)description
28 {
29 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
30 }
31
32 - (NSDictionary *)dictionaryRepresentation
33 {
34 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
35 if (self->_key)
36 {
37 [dict setObject:self->_key forKey:@"key"];
38 }
39 if (self->_optionalParams)
40 {
41 [dict setObject:self->_optionalParams forKey:@"optional_params"];
42 }
43 return dict;
44 }
45
46 BOOL MockAKSRefKeyReadFrom(__unsafe_unretained MockAKSRefKey *self, __unsafe_unretained PBDataReader *reader) {
47 while (PBReaderHasMoreData(reader)) {
48 uint32_t tag = 0;
49 uint8_t aType = 0;
50
51 PBReaderReadTag32AndType(reader, &tag, &aType);
52
53 if (PBReaderHasError(reader))
54 break;
55
56 if (aType == TYPE_END_GROUP) {
57 break;
58 }
59
60 switch (tag) {
61
62 case 1 /* key */:
63 {
64 NSData *new_key = PBReaderReadData(reader);
65 self->_key = new_key;
66 }
67 break;
68 case 2 /* optionalParams */:
69 {
70 NSData *new_optionalParams = PBReaderReadData(reader);
71 self->_optionalParams = new_optionalParams;
72 }
73 break;
74 default:
75 if (!PBReaderSkipValueWithTag(reader, tag, aType))
76 return NO;
77 break;
78 }
79 }
80 return !PBReaderHasError(reader);
81 }
82
83 - (BOOL)readFrom:(PBDataReader *)reader
84 {
85 return MockAKSRefKeyReadFrom(self, reader);
86 }
87 - (void)writeTo:(PBDataWriter *)writer
88 {
89 /* key */
90 {
91 if (self->_key)
92 {
93 PBDataWriterWriteDataField(writer, self->_key, 1);
94 }
95 }
96 /* optionalParams */
97 {
98 if (self->_optionalParams)
99 {
100 PBDataWriterWriteDataField(writer, self->_optionalParams, 2);
101 }
102 }
103 }
104
105 - (void)copyTo:(MockAKSRefKey *)other
106 {
107 if (_key)
108 {
109 other.key = _key;
110 }
111 if (_optionalParams)
112 {
113 other.optionalParams = _optionalParams;
114 }
115 }
116
117 - (id)copyWithZone:(NSZone *)zone
118 {
119 MockAKSRefKey *copy = [[[self class] allocWithZone:zone] init];
120 copy->_key = [_key copyWithZone:zone];
121 copy->_optionalParams = [_optionalParams copyWithZone:zone];
122 return copy;
123 }
124
125 - (BOOL)isEqual:(id)object
126 {
127 MockAKSRefKey *other = (MockAKSRefKey *)object;
128 return [other isMemberOfClass:[self class]]
129 &&
130 ((!self->_key && !other->_key) || [self->_key isEqual:other->_key])
131 &&
132 ((!self->_optionalParams && !other->_optionalParams) || [self->_optionalParams isEqual:other->_optionalParams])
133 ;
134 }
135
136 - (NSUInteger)hash
137 {
138 return 0
139 ^
140 [self->_key hash]
141 ^
142 [self->_optionalParams hash]
143 ;
144 }
145
146 - (void)mergeFrom:(MockAKSRefKey *)other
147 {
148 if (other->_key)
149 {
150 [self setKey:other->_key];
151 }
152 if (other->_optionalParams)
153 {
154 [self setOptionalParams:other->_optionalParams];
155 }
156 }
157
158 @end
159