summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLSystemAction.m
blob: 15b34b08b59e1c8b3b05f7967e5fcd45ec7f5566 (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
//  SDLSystemAction.m
//


#import "SDLSystemAction.h"

SDLSystemAction *SDLSystemAction_DEFAULT_ACTION = nil;
SDLSystemAction *SDLSystemAction_STEAL_FOCUS = nil;
SDLSystemAction *SDLSystemAction_KEEP_CONTEXT = nil;

NSArray *SDLSystemAction_values = nil;

@implementation SDLSystemAction

+ (SDLSystemAction *)valueOf:(NSString *)value {
    for (SDLSystemAction *item in SDLSystemAction.values) {
        if ([item.value isEqualToString:value]) {
            return item;
        }
    }
    return nil;
}

+ (NSArray *)values {
    if (SDLSystemAction_values == nil) {
        SDLSystemAction_values = @[
            SDLSystemAction.DEFAULT_ACTION,
            SDLSystemAction.STEAL_FOCUS,
            SDLSystemAction.KEEP_CONTEXT,
        ];
    }
    return SDLSystemAction_values;
}

+ (SDLSystemAction *)DEFAULT_ACTION {
    if (SDLSystemAction_DEFAULT_ACTION == nil) {
        SDLSystemAction_DEFAULT_ACTION = [[SDLSystemAction alloc] initWithValue:@"DEFAULT_ACTION"];
    }
    return SDLSystemAction_DEFAULT_ACTION;
}

+ (SDLSystemAction *)STEAL_FOCUS {
    if (SDLSystemAction_STEAL_FOCUS == nil) {
        SDLSystemAction_STEAL_FOCUS = [[SDLSystemAction alloc] initWithValue:@"STEAL_FOCUS"];
    }
    return SDLSystemAction_STEAL_FOCUS;
}

+ (SDLSystemAction *)KEEP_CONTEXT {
    if (SDLSystemAction_KEEP_CONTEXT == nil) {
        SDLSystemAction_KEEP_CONTEXT = [[SDLSystemAction alloc] initWithValue:@"KEEP_CONTEXT"];
    }
    return SDLSystemAction_KEEP_CONTEXT;
}

@end