summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLResetGlobalProperties.m
blob: e236363e5715f67038906723cb886fe54a7391d5 (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
//  SDLResetGlobalProperties.m
//


#import "SDLResetGlobalProperties.h"

#import "SDLGlobalProperty.h"
#import "SDLNames.h"

@implementation SDLResetGlobalProperties

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

- (instancetype)initWithProperties:(NSArray<SDLGlobalProperty> *)properties {
    self = [self init];
    if (!self) {
        return nil;
    }

    self.properties = [properties mutableCopy];

    return self;
}

- (void)setProperties:(NSMutableArray<SDLGlobalProperty> *)properties {
    if (properties != nil) {
        [parameters setObject:properties forKey:SDLNameProperties];
    } else {
        [parameters removeObjectForKey:SDLNameProperties];
    }
}

- (NSMutableArray<SDLGlobalProperty> *)properties {
    NSMutableArray<SDLGlobalProperty> *array = [parameters objectForKey:SDLNameProperties];
    if ([array count] < 1) {
        return array;
    } else {
        NSMutableArray<SDLGlobalProperty> *newList = [NSMutableArray arrayWithCapacity:[array count]];
        for (NSString *enumString in array) {
            [newList addObject:(SDLGlobalProperty)enumString];
        }
        return newList;
    }
}

@end