2003-12-09 01:50:32 +00:00
|
|
|
#import "CDOCMethod.h"
|
|
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
2003-12-12 04:01:38 +00:00
|
|
|
#import "CDTypeParser.h"
|
2003-12-09 01:50:32 +00:00
|
|
|
|
|
|
|
@implementation CDOCMethod
|
|
|
|
|
|
|
|
// TODO (2003-12-07): Reject unused -init method
|
|
|
|
|
|
|
|
- (id)initWithName:(NSString *)aName type:(NSString *)aType imp:(unsigned long)anImp;
|
|
|
|
{
|
|
|
|
if ([super init] == nil)
|
|
|
|
return nil;
|
|
|
|
|
|
|
|
name = [aName retain];
|
|
|
|
type = [aType retain];
|
|
|
|
imp = anImp;
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)dealloc;
|
|
|
|
{
|
|
|
|
[name release];
|
|
|
|
[type release];
|
|
|
|
|
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *)name;
|
|
|
|
{
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *)type;
|
|
|
|
{
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (unsigned long)imp;
|
|
|
|
{
|
|
|
|
return imp;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *)description;
|
|
|
|
{
|
|
|
|
return [NSString stringWithFormat:@"[%@] name: %@, type: %@, imp: 0x%08x",
|
|
|
|
|
|
|
|
NSStringFromClass([self class]), name, type, imp];
|
|
|
|
}
|
|
|
|
|
2003-12-10 04:55:08 +00:00
|
|
|
- (NSString *)formattedString;
|
|
|
|
{
|
|
|
|
return [NSString stringWithFormat:@"- %@", name];
|
|
|
|
}
|
|
|
|
|
2003-12-10 06:21:50 +00:00
|
|
|
- (void)appendToString:(NSMutableString *)resultString;
|
|
|
|
{
|
2003-12-12 04:01:38 +00:00
|
|
|
CDTypeParser *typeParser;
|
|
|
|
NSString *formattedString;
|
|
|
|
|
|
|
|
//[resultString appendFormat:@"%@", name];
|
|
|
|
typeParser = [[CDTypeParser alloc] init];
|
|
|
|
formattedString = [typeParser parseMethodName:name type:type];
|
|
|
|
//NSLog(@"%s, formattedString: '%@'", _cmd, formattedString);
|
|
|
|
if (formattedString != nil)
|
|
|
|
[resultString appendString:formattedString];
|
|
|
|
else
|
|
|
|
[resultString appendFormat:@" // Error parsing type: %@, name: %@", type, name];
|
|
|
|
[typeParser release];
|
2003-12-10 06:21:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSComparisonResult)ascendingCompareByName:(CDOCMethod *)otherMethod;
|
|
|
|
{
|
|
|
|
return [name compare:[otherMethod name]];
|
|
|
|
}
|
|
|
|
|
2003-12-09 01:50:32 +00:00
|
|
|
@end
|