Actually make it impossible to remove the default configuration. Various other small...
[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 @implementation Config {
11 NSMutableDictionary *entries;
12 }
13
14 @synthesize name;
15 @synthesize entries;
16
17 - (id)init {
18 if ((self = [super init])) {
19 entries = [[NSMutableDictionary alloc] init];
20 }
21 return self;
22 }
23
24 - (Target *)objectForKeyedSubscript:(JSAction *)action {
25 return action ? entries[action.uid] : nil;
26 }
27
28 - (void)setObject:(Target *)target forKeyedSubscript:(JSAction *)action {
29 if (action) {
30 if (target)
31 entries[action.uid] = target;
32 else
33 [entries removeObjectForKey:action.uid];
34 }
35 }
36
37 @end