summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLKeyboardLayout.m
blob: 700bd26220e43870d8a2ff819d865b8a9a72bd7d (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
//  SDLKeyboardLayout.m
//


#import "SDLKeyboardLayout.h"

SDLKeyboardLayout *SDLKeyboardLayout_QWERTY = nil;
SDLKeyboardLayout *SDLKeyboardLayout_QWERTZ = nil;
SDLKeyboardLayout *SDLKeyboardLayout_AZERTY = nil;

NSArray *SDLKeyboardLayout_values = nil;

@implementation SDLKeyboardLayout

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

+ (NSArray *)values {
    if (SDLKeyboardLayout_values == nil) {
        SDLKeyboardLayout_values = @[
            SDLKeyboardLayout.QWERTY,
            SDLKeyboardLayout.QWERTZ,
            SDLKeyboardLayout.AZERTY,
        ];
    }
    return SDLKeyboardLayout_values;
}

+ (SDLKeyboardLayout *)QWERTY {
    if (SDLKeyboardLayout_QWERTY == nil) {
        SDLKeyboardLayout_QWERTY = [[SDLKeyboardLayout alloc] initWithValue:@"QWERTY"];
    }
    return SDLKeyboardLayout_QWERTY;
}

+ (SDLKeyboardLayout *)QWERTZ {
    if (SDLKeyboardLayout_QWERTZ == nil) {
        SDLKeyboardLayout_QWERTZ = [[SDLKeyboardLayout alloc] initWithValue:@"QWERTZ"];
    }
    return SDLKeyboardLayout_QWERTZ;
}

+ (SDLKeyboardLayout *)AZERTY {
    if (SDLKeyboardLayout_AZERTY == nil) {
        SDLKeyboardLayout_AZERTY = [[SDLKeyboardLayout alloc] initWithValue:@"AZERTY"];
    }
    return SDLKeyboardLayout_AZERTY;
}

@end