-
Notifications
You must be signed in to change notification settings - Fork 245
/
TFNTwitterThriftGoldAnotherException.m
106 lines (93 loc) · 2.73 KB
/
TFNTwitterThriftGoldAnotherException.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/**
* Generated by Scrooge
* version: ?
* rev: ?
* built at: ?
*/
#import "TFNTwitterThriftGoldAnotherException.h"
@import ApacheThrift;
@implementation TFNTwitterThriftGoldAnotherException
- (NSString*)description
{
NSMutableString* ms = [NSMutableString stringWithString:@"TFNTwitterThriftGoldAnotherException( "];
[ms appendString:@"errorCode:"];
[ms appendFormat:@"%@ ", @(_errorCode)];
[ms appendString:@")"];
return [NSString stringWithString:ms];
}
- (instancetype)initWithErrorCode:(int32_t)errorCode
{
if (self = [super init]) {
[self setErrorCode:errorCode];
}
return self;
}
- (instancetype)initWithCoder:(NSCoder*)decoder
{
if (self = [super init]) {
if ([decoder containsValueForKey:@"1"]) {
[self setErrorCode:(int32_t)[decoder decodeInt32ForKey:@"1"]];
}
}
return self;
}
- (void)encodeWithCoder:(NSCoder*)encoder
{
if (_errorCodeIsSet) {
[encoder encodeInt32:_errorCode forKey:@"1"];
}
}
- (void)setErrorCode:(int32_t)errorCode
{
_errorCode = errorCode;
_errorCodeIsSet = YES;
}
- (void)read:(id <TProtocol>)inProtocol
{
NSString* fieldName;
int fieldType;
int fieldID;
[inProtocol readStructBeginReturningName:nil];
while (true) {
[inProtocol readFieldBeginReturningName:&fieldName type:&fieldType fieldID:&fieldID];
if (fieldType == TType_STOP) {
break;
}
switch (fieldID) {
case 1:
if (fieldType == TType_I32) {
int32_t errorCode_item;
errorCode_item = [inProtocol readI32];
[self setErrorCode:errorCode_item];
} else {
NSLog(@"%s: field ID %i has unexpected type %i. Skipping.", __PRETTY_FUNCTION__, fieldID, fieldType);
[TProtocolUtil skipType:fieldType onProtocol:inProtocol];
}
break;
default:
NSLog(@"%s: unexpected field ID %i with type %i. Skipping.", __PRETTY_FUNCTION__, fieldID, fieldType);
[TProtocolUtil skipType:fieldType onProtocol:inProtocol];
break;
}
[inProtocol readFieldEnd];
}
[inProtocol readStructEnd];
[self validate];
}
- (void)write:(id <TProtocol>)outProtocol
{
[self validate];
[outProtocol writeStructBeginWithName:@"TFNTwitterThriftGoldAnotherException"];
if (_errorCodeIsSet) {
[outProtocol writeFieldBeginWithName:@"errorCode" type:TType_I32 fieldID:1];
int32_t errorCode_item = _errorCode;
[outProtocol writeI32:errorCode_item];
[outProtocol writeFieldEnd];
}
[outProtocol writeFieldStop];
[outProtocol writeStructEnd];
}
- (void)validate
{
}
@end