summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLSoftButtonType.m
blob: 9add8edfecb72012b9a391be87a0222e8d69cf46 (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
//  SDLSoftButtonType.m
//


#import "SDLSoftButtonType.h"

SDLSoftButtonType *SDLSoftButtonType_TEXT = nil;
SDLSoftButtonType *SDLSoftButtonType_IMAGE = nil;
SDLSoftButtonType *SDLSoftButtonType_BOTH = nil;

NSArray *SDLSoftButtonType_values = nil;

@implementation SDLSoftButtonType

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

+ (NSArray *)values {
    if (SDLSoftButtonType_values == nil) {
        SDLSoftButtonType_values = @[
            SDLSoftButtonType.TEXT,
            SDLSoftButtonType.IMAGE,
            SDLSoftButtonType.BOTH,
        ];
    }
    return SDLSoftButtonType_values;
}

+ (SDLSoftButtonType *)TEXT {
    if (SDLSoftButtonType_TEXT == nil) {
        SDLSoftButtonType_TEXT = [[SDLSoftButtonType alloc] initWithValue:@"TEXT"];
    }
    return SDLSoftButtonType_TEXT;
}

+ (SDLSoftButtonType *)IMAGE {
    if (SDLSoftButtonType_IMAGE == nil) {
        SDLSoftButtonType_IMAGE = [[SDLSoftButtonType alloc] initWithValue:@"IMAGE"];
    }
    return SDLSoftButtonType_IMAGE;
}

+ (SDLSoftButtonType *)BOTH {
    if (SDLSoftButtonType_BOTH == nil) {
        SDLSoftButtonType_BOTH = [[SDLSoftButtonType alloc] initWithValue:@"BOTH"];
    }
    return SDLSoftButtonType_BOTH;
}

@end