-
Notifications
You must be signed in to change notification settings - Fork 28
/
CDOCClass.m
109 lines (82 loc) · 2.67 KB
/
CDOCClass.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// -*- mode: ObjC -*-
// This file is part of class-dump, a utility for examining the Objective-C segment of Mach-O files.
// Copyright (C) 1997-2019 Steve Nygard.
#import "CDOCClass.h"
#import "CDClassDump.h"
#import "CDOCInstanceVariable.h"
#import "CDOCMethod.h"
#import "CDType.h"
#import "CDTypeController.h"
#import "CDTypeParser.h"
#import "CDVisitor.h"
#import "CDVisitorPropertyState.h"
#import "CDOCClassReference.h"
@implementation CDOCClass
{
NSArray *_instanceVariables;
BOOL _isExported;
}
- (id)init;
{
if ((self = [super init])) {
_isExported = YES;
}
return self;
}
#pragma mark - Debugging
- (NSString *)description;
{
return [NSString stringWithFormat:@"%@, exported: %@", [super description], self.isExported ? @"YES" : @"NO"];
}
#pragma mark -
- (NSString *)superClassName;
{
return [_superClassRef className];
}
- (void)registerTypesWithObject:(CDTypeController *)typeController phase:(NSUInteger)phase;
{
[super registerTypesWithObject:typeController phase:phase];
for (CDOCInstanceVariable *instanceVariable in self.instanceVariables) {
[instanceVariable.type phase:phase registerTypesWithObject:typeController usedInMethod:NO];
}
}
- (NSString *)methodSearchContext;
{
NSMutableString *resultString = [NSMutableString string];
[resultString appendFormat:@"@interface %@", self.name];
if (self.superClassName != nil)
[resultString appendFormat:@" : %@", self.superClassName];
if ([self.protocols count] > 0)
[resultString appendFormat:@" <%@>", self.protocolsString];
return resultString;
}
- (void)recursivelyVisit:(CDVisitor *)visitor;
{
if ([visitor.classDump shouldShowName:self.name]) {
CDVisitorPropertyState *propertyState = [[CDVisitorPropertyState alloc] initWithProperties:self.properties];
[visitor willVisitClass:self];
[visitor willVisitIvarsOfClass:self];
for (CDOCInstanceVariable *instanceVariable in self.instanceVariables)
[visitor visitIvar:instanceVariable];
[visitor didVisitIvarsOfClass:self];
//[visitor willVisitPropertiesOfClass:self];
//[self visitProperties:visitor];
//[visitor didVisitPropertiesOfClass:self];
[self visitMethods:visitor propertyState:propertyState];
// Should mostly be dynamic properties
[visitor visitRemainingProperties:propertyState];
[visitor didVisitClass:self];
}
}
#pragma mark - CDTopologicalSort protocol
- (NSString *)identifier;
{
return self.name;
}
- (NSArray *)dependancies;
{
if (self.superClassName == nil)
return @[];
return @[self.superClassName];
}
@end