summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLButtonEventMode.m
blob: 1dcc1363588662e1e307bbd9d872301b762f4341 (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
//  SDLButtonEventMode.m
//


#import "SDLButtonEventMode.h"

SDLButtonEventMode *SDLButtonEventMode_BUTTONUP = nil;
SDLButtonEventMode *SDLButtonEventMode_BUTTONDOWN = nil;

NSArray *SDLButtonEventMode_values = nil;

@implementation SDLButtonEventMode

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

+ (NSArray *)values {
    if (SDLButtonEventMode_values == nil) {
        SDLButtonEventMode_values = @[
            SDLButtonEventMode.BUTTONUP,
            SDLButtonEventMode.BUTTONDOWN,
        ];
    }
    return SDLButtonEventMode_values;
}

+ (SDLButtonEventMode *)BUTTONUP {
    if (SDLButtonEventMode_BUTTONUP == nil) {
        SDLButtonEventMode_BUTTONUP = [[SDLButtonEventMode alloc] initWithValue:@"BUTTONUP"];
    }
    return SDLButtonEventMode_BUTTONUP;
}

+ (SDLButtonEventMode *)BUTTONDOWN {
    if (SDLButtonEventMode_BUTTONDOWN == nil) {
        SDLButtonEventMode_BUTTONDOWN = [[SDLButtonEventMode alloc] initWithValue:@"BUTTONDOWN"];
    }
    return SDLButtonEventMode_BUTTONDOWN;
}

@end