1
1
#import " SSYDictionaryDebugger.h"
2
2
3
+ #ifdef SSY_DEBUGGING_MUTABLE_DICTIONARY_INCLUDED
3
4
4
5
@implementation SSYDebuggingMutableDictionary
5
6
@@ -10,10 +11,59 @@ - (id) init
10
11
dic = [[NSMutableDictionary alloc ] init ] ;
11
12
12
13
}
14
+ #if SSY_DEBUGGING_MUTABLE_DICTIONARY_LOG_MEMORY_MANAGEMENT
15
+ NSLog (@" info %p has been initted" , self) ;
16
+ #endif
13
17
return self;
14
18
}
15
19
20
+ - (NSString *)description {
21
+ return [dic description ] ;
22
+ }
23
+
24
+ - (id )forwardingTargetForSelector : (SEL )sel {
25
+ return dic ;
26
+ }
27
+
28
+ - (void )setValue : (id )value
29
+ forUndefinedKey :key {
30
+ [dic setValue: value
31
+ forKey: key] ;;
32
+ }
16
33
34
+ - (void )dealloc {
35
+ #if SSY_DEBUGGING_MUTABLE_DICTIONARY_LOG_MEMORY_MANAGEMENT
36
+ NSLog (@" info %p is being deallocced" , self) ;
37
+ #endif
38
+ [dic release ] ;
39
+
40
+ [super dealloc ] ;
41
+ }
42
+
43
+ #if SSY_DEBUGGING_MUTABLE_DICTIONARY_LOG_MEMORY_MANAGEMENT
44
+
45
+ - (id )retain {
46
+ id x = [super retain ] ;
47
+ NSLog (@" info %p retained to %d by %@ " , self, [self retainCount ], SSYDebugCaller ()) ;
48
+ return x ;
49
+ }
50
+
51
+ - (id )autorelease {
52
+ id x = [super autorelease ] ;
53
+ NSLog (@" info %p autoreleased by %@ " , self, SSYDebugCaller ()) ;
54
+ return x ;
55
+ }
56
+
57
+ - (oneway void )release {
58
+ NSInteger rc = [self retainCount ] ;
59
+ [super release ] ;
60
+ NSLog (@" info %p released fr %d by %@ " , self, rc, SSYDebugCaller ()) ;
61
+ }
62
+
63
+ #endif
64
+
65
+
66
+ #if SSY_DEBUGGING_MUTABLE_DICTIONARY_LOG_CONTENTS_CHANGED
17
67
18
68
- (void )setValue : (id )value forKey : (NSString *)key {
19
69
NSLog (@" 12686-01 %s " , __PRETTY_FUNCTION__) ;
@@ -45,18 +95,9 @@ - (void)setObject:(id)anObject forKey:(id)aKey{
45
95
[dic setObject: anObject forKey: aKey] ;
46
96
}
47
97
48
- - (NSString *)description {
49
- return [dic description ] ;
50
- }
51
-
52
- - (id )forwardingTargetForSelector : (SEL )sel {
53
- return dic ;
54
- }
55
-
56
- - (void )dealloc {
57
- [dic release ];
98
+ #endif
58
99
59
- [super dealloc ];
60
- }
61
100
62
101
@end
102
+
103
+ #endif
0 commit comments