class-dump/CDOCModule.m
2007-03-14 07:22:21 +00:00

107 lines
2.2 KiB
Objective-C

// 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 "CDOCModule.h"
#import <Foundation/Foundation.h>
#import "CDObjCSegmentProcessor.h"
#import "CDOCSymtab.h"
@implementation CDOCModule
- (id)init;
{
if ([super init] == nil)
return nil;
version = 0;
name = nil;
symtab = nil;
return self;
}
- (void)dealloc;
{
[name release];
[symtab release];
[super dealloc];
}
- (unsigned long)version;
{
return version;
}
- (void)setVersion:(unsigned long)aVersion;
{
version = aVersion;
}
- (NSString *)name;
{
return name;
}
- (void)setName:(NSString *)newName;
{
if (newName == name)
return;
[name release];
name = [newName retain];
}
- (CDOCSymtab *)symtab;
{
return symtab;
}
- (void)setSymtab:(CDOCSymtab *)newSymtab;
{
if (newSymtab == symtab)
return;
[symtab release];
symtab = [newSymtab retain];
}
- (NSString *)description;
{
return [NSString stringWithFormat:@"[%@] name: %@, version: %d, symtab: %@", NSStringFromClass([self class]), name, version, symtab];
}
- (NSString *)formattedString;
{
return [NSString stringWithFormat:@"/*\n * %@\n */\n", name];
}
- (void)addToXMLElement:(NSXMLElement *)xmlElement classDump:(CDClassDump *)aClassDump;
{
NSXMLElement *moduleElement = [NSXMLElement elementWithName:@"module"];
[moduleElement addChild:[NSXMLElement elementWithName:@"name" stringValue:name]];
[symtab addToXMLElement:moduleElement classDump:aClassDump];
[xmlElement addChild:moduleElement];
}
- (void)appendToString:(NSMutableString *)resultString classDump:(CDClassDump *)aClassDump;
{
[resultString appendFormat:@"/*\n * %@\n */\n\n", name];
[symtab appendToString:resultString classDump:aClassDump];
}
- (void)registerClassesWithObject:(NSMutableDictionary *)aDictionary frameworkName:(NSString *)aFrameworkName;
{
[symtab registerClassesWithObject:aDictionary frameworkName:aFrameworkName];
}
- (void)generateSeparateHeadersClassDump:(CDClassDump *)aClassDump;
{
[symtab generateSeparateHeadersClassDump:aClassDump];
}
@end