Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(484)

Side by Side Diff: class-dump/src/CDFindMethodVisitor.m

Issue 7793008: Add the 3.3.3 sources for class-dump. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « class-dump/src/CDFindMethodVisitor.h ('k') | class-dump/src/CDLCDyldInfo.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // -*- mode: ObjC -*-
2
3 // This file is part of class-dump, a utility for examining the Objective-C seg ment of Mach-O files.
4 // Copyright (C) 1997-1998, 2000-2001, 2004-2010 Steve Nygard.
5
6 #import "CDFindMethodVisitor.h"
7
8 #import "NSArray-Extensions.h"
9 #import "CDClassDump.h"
10 #import "CDObjectiveC1Processor.h"
11 #import "CDMachOFile.h"
12 #import "CDOCProtocol.h"
13 #import "CDLCDylib.h"
14 #import "CDOCClass.h"
15 #import "CDOCCategory.h"
16 #import "CDOCMethod.h"
17 #import "CDTypeController.h"
18
19 @implementation CDFindMethodVisitor
20
21 - (id)init;
22 {
23 if ([super init] == nil)
24 return nil;
25
26 findString = nil;
27 resultString = [[NSMutableString alloc] init];
28 context = nil;
29 hasShownContext = NO;
30
31 return self;
32 }
33
34 - (void)dealloc;
35 {
36 [findString release];
37 [resultString release];
38 [context release];
39
40 [super dealloc];
41 }
42
43 - (NSString *)findString;
44 {
45 return findString;
46 }
47
48 - (void)setFindString:(NSString *)newFindString;
49 {
50 if (newFindString == findString)
51 return;
52
53 [findString release];
54 findString = [newFindString retain];
55 }
56
57 - (void)setContext:(CDOCProtocol *)newContext;
58 {
59 if (newContext == context)
60 return;
61
62 [context release];
63 context = [newContext retain];
64
65 hasShownContext = NO;
66 }
67
68 - (void)showContextIfNecessary;
69 {
70 if (hasShownContext == NO) {
71 [resultString appendString:[context findTag:nil]];
72 [resultString appendString:@"\n"];
73 hasShownContext = YES;
74 }
75 }
76
77 - (void)willBeginVisiting;
78 {
79 [classDump appendHeaderToString:resultString];
80
81 if ([classDump containsObjectiveCData] || [classDump hasEncryptedFiles]) {
82 //[[classDump typeController] appendStructuresToString:resultString symb olReferences:nil];
83 //[resultString appendString:@"// [structures go here]\n"];
84 } else {
85 [resultString appendString:@"This file does not contain any Objective-C runtime information.\n"];
86 }
87 }
88
89 - (void)didEndVisiting;
90 {
91 [self writeResultToStandardOutput];
92 }
93
94 - (void)writeResultToStandardOutput;
95 {
96 NSData *data;
97
98 data = [resultString dataUsingEncoding:NSUTF8StringEncoding];
99 [(NSFileHandle *)[NSFileHandle fileHandleWithStandardOutput] writeData:data] ;
100 }
101
102 - (void)willVisitProtocol:(CDOCProtocol *)aProtocol;
103 {
104 [self setContext:aProtocol];
105 }
106
107 - (void)didVisitProtocol:(CDOCProtocol *)aProtocol;
108 {
109 if (hasShownContext)
110 [resultString appendString:@"\n"];
111 }
112
113 - (void)willVisitClass:(CDOCClass *)aClass;
114 {
115 [self setContext:aClass];
116 }
117
118 - (void)didVisitClass:(CDOCClass *)aClass;
119 {
120 if (hasShownContext)
121 [resultString appendString:@"\n"];
122 }
123
124 - (void)willVisitIvarsOfClass:(CDOCClass *)aClass;
125 {
126 }
127
128 - (void)didVisitIvarsOfClass:(CDOCClass *)aClass;
129 {
130 }
131
132 - (void)willVisitCategory:(CDOCCategory *)aCategory;
133 {
134 [self setContext:aCategory];
135 }
136
137 - (void)didVisitCategory:(CDOCCategory *)aCategory;
138 {
139 if (hasShownContext)
140 [resultString appendString:@"\n"];
141 }
142
143 - (void)visitClassMethod:(CDOCMethod *)aMethod;
144 {
145 NSRange range;
146
147 range = [[aMethod name] rangeOfString:findString];
148 if (range.length > 0) {
149 [self showContextIfNecessary];
150
151 [resultString appendString:@"+ "];
152 [aMethod appendToString:resultString typeController:[classDump typeContr oller] symbolReferences:nil];
153 [resultString appendString:@"\n"];
154 }
155 }
156
157 - (void)visitInstanceMethod:(CDOCMethod *)aMethod propertyState:(CDVisitorProper tyState *)propertyState;
158 {
159 NSRange range;
160
161 range = [[aMethod name] rangeOfString:findString];
162 if (range.length > 0) {
163 [self showContextIfNecessary];
164
165 [resultString appendString:@"- "];
166 [aMethod appendToString:resultString typeController:[classDump typeContr oller] symbolReferences:nil];
167 [resultString appendString:@"\n"];
168 }
169 }
170
171 - (void)visitIvar:(CDOCIvar *)anIvar;
172 {
173 }
174
175 @end
OLDNEW
« no previous file with comments | « class-dump/src/CDFindMethodVisitor.h ('k') | class-dump/src/CDLCDyldInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698