summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLPutFile.m
blob: a9f6aaeac1428461961a8b6ab8e403e820d982fe (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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
//  SDLPutFile.m
//

#import "SDLPutFile.h"

#import "SDLFileType.h"
#import "SDLNames.h"


@implementation SDLPutFile

- (instancetype)init {
    if (self = [super initWithName:NAMES_PutFile]) {
    }
    return self;
}

- (instancetype)initWithDictionary:(NSMutableDictionary *)dict {
    if (self = [super initWithDictionary:dict]) {
    }
    return self;
}

- (instancetype)initWithFileName:(NSString *)fileName fileType:(SDLFileType *)fileType persistentFile:(BOOL)persistentFile {
    if (self = [self init]) {
        self.syncFileName = fileName;
        self.fileType = fileType;
        self.persistentFile = @(persistentFile);
    }
    return self;
}

- (void)setSyncFileName:(NSString *)syncFileName {
    if (syncFileName != nil) {
        [parameters setObject:syncFileName forKey:NAMES_syncFileName];
    } else {
        [parameters removeObjectForKey:NAMES_syncFileName];
    }
}

- (NSString *)syncFileName {
    return [parameters objectForKey:NAMES_syncFileName];
}

- (void)setFileType:(SDLFileType *)fileType {
    if (fileType != nil) {
        [parameters setObject:fileType forKey:NAMES_fileType];
    } else {
        [parameters removeObjectForKey:NAMES_fileType];
    }
}

- (SDLFileType *)fileType {
    NSObject *obj = [parameters objectForKey:NAMES_fileType];
    if (obj == nil || [obj isKindOfClass:SDLFileType.class]) {
        return (SDLFileType *)obj;
    } else {
        return [SDLFileType valueOf:(NSString *)obj];
    }
}

- (void)setPersistentFile:(NSNumber *)persistentFile {
    if (persistentFile != nil) {
        [parameters setObject:persistentFile forKey:NAMES_persistentFile];
    } else {
        [parameters removeObjectForKey:NAMES_persistentFile];
    }
}

- (NSNumber *)persistentFile {
    return [parameters objectForKey:NAMES_persistentFile];
}

- (void)setSystemFile:(NSNumber *)systemFile {
    if (systemFile != nil) {
        [parameters setObject:systemFile forKey:NAMES_systemFile];
    } else {
        [parameters removeObjectForKey:NAMES_systemFile];
    }
}

- (NSNumber *)systemFile {
    return [parameters objectForKey:NAMES_systemFile];
}

- (void)setOffset:(NSNumber *)offset {
    if (offset != nil) {
        [parameters setObject:offset forKey:NAMES_offset];
    } else {
        [parameters removeObjectForKey:NAMES_offset];
    }
}

- (NSNumber *)offset {
    return [parameters objectForKey:NAMES_offset];
}

- (void)setLength:(NSNumber *)length {
    if (length != nil) {
        [parameters setObject:length forKey:NAMES_length];
    } else {
        [parameters removeObjectForKey:NAMES_length];
    }
}

- (NSNumber *)length {
    return [parameters objectForKey:NAMES_length];
}

@end