blob: 6067810706f92b1ce34a04d72d514ba2417c70a9 (
plain)
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
|
// SDLRPCResponse.m
//
#import "SDLRPCResponse.h"
#import "SDLNames.h"
#import "SDLResult.h"
@implementation SDLRPCResponse
- (instancetype)initWithName:(NSString *)name {
self = [super initWithName:name];
if (!self) {
return nil;
}
messageType = NAMES_response;
[store setObject:function forKey:messageType];
return self;
}
- (instancetype)initWithDictionary:(NSMutableDictionary *)dict {
self = [super initWithDictionary:dict];
if (!self) {
return nil;
}
messageType = NAMES_response;
[store setObject:function forKey:messageType];
return self;
}
- (NSNumber *)correlationID {
return [function objectForKey:NAMES_correlationID];
}
- (void)setCorrelationID:(NSNumber *)corrID {
if (corrID != nil) {
[function setObject:corrID forKey:NAMES_correlationID];
} else {
[function removeObjectForKey:NAMES_correlationID];
}
}
- (void)setSuccess:(NSNumber *)success {
if (success != nil) {
[parameters setObject:success forKey:NAMES_success];
} else {
[parameters removeObjectForKey:NAMES_success];
}
}
- (NSNumber *)success {
return [parameters objectForKey:NAMES_success];
}
- (void)setResultCode:(SDLResult *)resultCode {
if (resultCode != nil) {
[parameters setObject:resultCode forKey:NAMES_resultCode];
} else {
[parameters removeObjectForKey:NAMES_resultCode];
}
}
- (SDLResult *)resultCode {
NSObject *obj = [parameters objectForKey:NAMES_resultCode];
if (obj == nil || [obj isKindOfClass:SDLResult.class]) {
return (SDLResult *)obj;
} else {
return [SDLResult valueOf:(NSString *)obj];
}
}
- (void)setInfo:(NSString *)info {
if (info != nil) {
[parameters setObject:info forKey:NAMES_info];
} else {
[parameters removeObjectForKey:NAMES_info];
}
}
- (NSString *)info {
return [parameters objectForKey:NAMES_info];
}
@end
|