Show an error message if opening input devices fail. Move real vs. configuration...
[enjoyable.git] / Config.m
1 //
2 // Config.m
3 // Enjoy
4 //
5 // Created by Sam McCall on 4/05/09.
6 //
7
8 #import "Config.h"
9
10 #import "JSAction.h"
11
12 @implementation Config {
13 NSMutableDictionary *entries;
14 }
15
16 @synthesize name;
17 @synthesize entries;
18
19 - (id)init {
20 if ((self = [super init])) {
21 entries = [[NSMutableDictionary alloc] init];
22 }
23 return self;
24 }
25
26 - (Target *)objectForKeyedSubscript:(JSAction *)action {
27 return action ? entries[action.uid] : nil;
28 }
29
30 - (void)setObject:(Target *)target forKeyedSubscript:(JSAction *)action {
31 if (action) {
32 if (target)
33 entries[action.uid] = target;
34 else
35 [entries removeObjectForKey:action.uid];
36 }
37 }
38
39 @end