blob: 2615279282f7c79b7db56eb81bcd456371750dbd [file] [log] [blame]
// This file is part of class-dump, a utility for examining the Objective-C segment of Mach-O files.
// Copyright (C) 1997-1998, 2000-2001, 2004-2006 Steve Nygard
#import "CDOCCategory.h"
#import <Foundation/Foundation.h>
#import "CDClassDump.h"
#import "CDOCMethod.h"
#import "CDSymbolReferences.h"
#import "NSArray-Extensions.h"
@implementation CDOCCategory
- (void)dealloc;
{
[className release];
[super dealloc];
}
- (NSString *)className;
{
return className;
}
- (void)setClassName:(NSString *)newClassName;
{
if (newClassName == className)
return;
[className release];
className = [newClassName retain];
}
- (void)appendToString:(NSMutableString *)resultString classDump:(CDClassDump *)aClassDump symbolReferences:(CDSymbolReferences *)symbolReferences;
{
if ([aClassDump shouldMatchRegex] == YES && [aClassDump regexMatchesString:[self sortableName]] == NO)
return;
[resultString appendFormat:@"@interface %@ (%@)", className, name];
if ([protocols count] > 0) {
[resultString appendFormat:@" <%@>", [[protocols arrayByMappingSelector:@selector(name)] componentsJoinedByString:@", "]];
[symbolReferences addProtocolNamesFromArray:[protocols arrayByMappingSelector:@selector(name)]];
}
[resultString appendString:@"\n"];
[self appendMethodsToString:resultString classDump:aClassDump symbolReferences:symbolReferences];
[resultString appendString:@"@end\n\n"];
}
- (NSString *)sortableName;
{
return [NSString stringWithFormat:@"%@ (%@)", className, name];
}
//
// CDTopologicalSort protocol
//
- (NSString *)identifier;
{
return [self sortableName];
}
- (NSArray *)dependancies;
{
if (className == nil)
return [NSArray array];
return [NSArray arrayWithObject:className];
}
@end