-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathObjCViz.m
93 lines (73 loc) · 1.43 KB
/
ObjCViz.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#import <Foundation/Foundation.h>
#import "OCVContext.h"
@interface Bu : NSObject {
NSString* superclassIvar;
}
@end
@implementation Bu
@end
@interface Meu : NSObject {
id obj;
}
@end
@implementation Meu
-(id)init
{
[super init];
obj = @"hello";
return self;
}
-(void)dealloc
{
[obj release];
[super dealloc];
}
@end
@interface Zo : Bu {
NSString* d;
id e;
}
@end
@implementation Zo
-(id)init
{
[super init];
e = [[NSScanner scannerWithString:@"scannedString"] retain];
return self;
}
@end
@interface Ga : NSObject {
NSString* strIvar;
NSMutableArray* arrayIvar;
NSMutableDictionary* dictIvar;
Zo* boIvar;
}
@end
@implementation Ga
-(id)init
{
[super init];
strIvar = @"aString";
boIvar = [[Zo alloc] init];
arrayIvar = [[NSArray alloc] initWithObjects:@"aStringInArray",[[[NSDate alloc] init] autorelease], nil];
dictIvar = [[NSMutableDictionary alloc] initWithObjectsAndKeys:boIvar,@"Key1",@"Obj2",@"Key2",nil];
return self;
}
-(void)dealloc
{
[strIvar release];
[boIvar release];
[arrayIvar release];
[dictIvar release];
[super dealloc];
}
@end
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
Ga* g = [[[Ga alloc] init] autorelease];
NSString* m = [g graphvizRepresentation];
NSLog(@"\n%@",m);
[m writeToFile:[NSString stringWithFormat:@"%@-%p.dot",[g class],g] atomically:TRUE];
[pool release];
return 0;
}