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 "CDTypeName.h" |
| 7 |
| 8 @implementation CDTypeName |
| 9 |
| 10 - (id)init; |
| 11 { |
| 12 if ([super init] == nil) |
| 13 return nil; |
| 14 |
| 15 name = nil; |
| 16 templateTypes = [[NSMutableArray alloc] init]; |
| 17 suffix = nil; |
| 18 |
| 19 return self; |
| 20 } |
| 21 |
| 22 - (void)dealloc; |
| 23 { |
| 24 [name release]; |
| 25 [templateTypes release]; |
| 26 [suffix release]; |
| 27 |
| 28 [super dealloc]; |
| 29 } |
| 30 |
| 31 @synthesize name; |
| 32 |
| 33 - (NSArray *)templateTypes; |
| 34 { |
| 35 return templateTypes; |
| 36 } |
| 37 |
| 38 - (void)addTemplateType:(CDTypeName *)aTemplateType; |
| 39 { |
| 40 [templateTypes addObject:aTemplateType]; |
| 41 } |
| 42 |
| 43 @synthesize suffix; |
| 44 |
| 45 - (NSString *)description; |
| 46 { |
| 47 if ([templateTypes count] == 0) |
| 48 return name; |
| 49 |
| 50 if (suffix != nil) |
| 51 return [NSString stringWithFormat:@"%@<%@>%@", name, [templateTypes comp
onentsJoinedByString:@", "], suffix]; |
| 52 |
| 53 return [NSString stringWithFormat:@"%@<%@>", name, [templateTypes components
JoinedByString:@", "]]; |
| 54 } |
| 55 |
| 56 - (BOOL)isTemplateType; |
| 57 { |
| 58 return [templateTypes count] > 0; |
| 59 } |
| 60 |
| 61 - (BOOL)isEqual:(id)otherObject; |
| 62 { |
| 63 if ([otherObject isKindOfClass:[self class]] == NO) |
| 64 return NO; |
| 65 |
| 66 return [[self description] isEqual:[otherObject description]]; |
| 67 } |
| 68 |
| 69 - (id)copyWithZone:(NSZone *)zone; |
| 70 { |
| 71 CDTypeName *copy; |
| 72 |
| 73 copy = [[CDTypeName alloc] init]; |
| 74 [copy setName:name]; |
| 75 [copy setSuffix:suffix]; |
| 76 |
| 77 for (CDTypeName *subtype in templateTypes) { |
| 78 CDTypeName *subcopy; |
| 79 |
| 80 subcopy = [subtype copy]; |
| 81 [copy addTemplateType:subcopy]; |
| 82 [subcopy release]; |
| 83 } |
| 84 |
| 85 return copy; |
| 86 } |
| 87 |
| 88 @end |
OLD | NEW |