OLD | NEW |
(Empty) | |
| 1 // -*- mode: ObjC -*- |
| 2 |
| 3 // This file is part of class-dump, a utility for examining the Objective-C seg
ment of Mach-O files. |
| 4 // Copyright (C) 1997-1998, 2000-2001, 2004-2010 Steve Nygard. |
| 5 |
| 6 #import "CDOCCategory.h" |
| 7 |
| 8 #import "CDClassDump.h" |
| 9 #import "CDOCMethod.h" |
| 10 #import "CDSymbolReferences.h" |
| 11 #import "NSArray-Extensions.h" |
| 12 #import "CDVisitor.h" |
| 13 #import "CDVisitorPropertyState.h" |
| 14 |
| 15 @implementation CDOCCategory |
| 16 |
| 17 - (void)dealloc; |
| 18 { |
| 19 [className release]; |
| 20 |
| 21 [super dealloc]; |
| 22 } |
| 23 |
| 24 - (NSString *)className; |
| 25 { |
| 26 return className; |
| 27 } |
| 28 |
| 29 - (void)setClassName:(NSString *)newClassName; |
| 30 { |
| 31 if (newClassName == className) |
| 32 return; |
| 33 |
| 34 [className release]; |
| 35 className = [newClassName retain]; |
| 36 } |
| 37 |
| 38 - (NSString *)sortableName; |
| 39 { |
| 40 return [NSString stringWithFormat:@"%@ (%@)", className, name]; |
| 41 } |
| 42 |
| 43 - (NSString *)findTag:(CDSymbolReferences *)symbolReferences; |
| 44 { |
| 45 NSMutableString *resultString = [NSMutableString string]; |
| 46 |
| 47 [resultString appendFormat:@"@interface %@ (%@)", className, name]; |
| 48 |
| 49 if ([protocols count] > 0) |
| 50 [resultString appendFormat:@" <%@>", [[protocols arrayByMappingSelector:
@selector(name)] componentsJoinedByString:@", "]]; |
| 51 |
| 52 return resultString; |
| 53 } |
| 54 |
| 55 - (void)recursivelyVisit:(CDVisitor *)aVisitor; |
| 56 { |
| 57 CDVisitorPropertyState *propertyState; |
| 58 |
| 59 if ([[aVisitor classDump] shouldMatchRegex] && [[aVisitor classDump] regexMa
tchesString:[self name]] == NO) |
| 60 return; |
| 61 |
| 62 // Wonderful. Need to typecast because there's also -[NSHTTPCookie initWith
Properties:] that takes a dictionary. |
| 63 propertyState = [(CDVisitorPropertyState *)[CDVisitorPropertyState alloc] in
itWithProperties:[self properties]]; |
| 64 |
| 65 [aVisitor willVisitCategory:self]; |
| 66 |
| 67 //[aVisitor willVisitPropertiesOfCategory:self]; |
| 68 //[self visitProperties:aVisitor]; |
| 69 //[aVisitor didVisitPropertiesOfCategory:self]; |
| 70 |
| 71 [self visitMethods:aVisitor propertyState:propertyState]; |
| 72 // This can happen when... the accessors are implemented on the main class.
Odd case, but we should still emit the remaining properties. |
| 73 // Should mostly be dynamic properties |
| 74 [aVisitor visitRemainingProperties:propertyState]; |
| 75 [aVisitor didVisitCategory:self]; |
| 76 |
| 77 [propertyState release]; |
| 78 } |
| 79 |
| 80 // |
| 81 // CDTopologicalSort protocol |
| 82 // |
| 83 |
| 84 - (NSString *)identifier; |
| 85 { |
| 86 return [self sortableName]; |
| 87 } |
| 88 |
| 89 - (NSArray *)dependancies; |
| 90 { |
| 91 if (className == nil) |
| 92 return [NSArray array]; |
| 93 |
| 94 return [NSArray arrayWithObject:className]; |
| 95 } |
| 96 |
| 97 @end |
OLD | NEW |