projects
/
enjoyable.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Clean up TargetController formatting and public API.
[enjoyable.git]
/
Config.m
diff --git
a/Config.m
b/Config.m
index
f62c40f
..
84e6c32
100644
(file)
--- a/
Config.m
+++ b/
Config.m
@@
-7,9
+7,14
@@
#import "Config.h"
#import "Config.h"
-@implementation Config
+#import "JSAction.h"
-@synthesize protect, name, entries;
+@implementation Config {
+ NSMutableDictionary *entries;
+}
+
+@synthesize name;
+@synthesize entries;
- (id)init {
if ((self = [super init])) {
- (id)init {
if ((self = [super init])) {
@@
-18,12
+23,17
@@
return self;
}
return self;
}
-- (
void)setTarget:(Target *)target forAction:(JSAction *)jsa
{
-
entries[[jsa stringify]] = target
;
+- (
Target *)objectForKeyedSubscript:(JSAction *)action
{
+
return action ? entries[action.uid] : nil
;
}
}
-- (Target *)getTargetForAction:(JSAction *)jsa {
- return entries[[jsa stringify]];
+- (void)setObject:(Target *)target forKeyedSubscript:(JSAction *)action {
+ if (action) {
+ if (target)
+ entries[action.uid] = target;
+ else
+ [entries removeObjectForKey:action.uid];
+ }
}
@end
}
@end