727b8b01a5c730824519b3deda548cb77a949918
[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 protect, name, entries;
15
16 - (id)init {
17 if ((self = [super init])) {
18 entries = [[NSMutableDictionary alloc] init];
19 }
20 return self;
21 }
22
23 - (Target *)objectForKeyedSubscript:(JSAction *)action {
24 return action ? entries[action.uid] : nil;
25 }
26
27 - (void)setObject:(Target *)target forKeyedSubscript:(JSAction *)action {
28 if (action) {
29 if (target)
30 entries[action.uid] = target;
31 else
32 [entries removeObjectForKey:action.uid];
33 }
34 }
35
36 @end