-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSymWrap.h
194 lines (167 loc) · 3.73 KB
/
SymWrap.h
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
///////////////////////////////////////////////////////////////////////////////
// FileName: SymWrap.h
// Created: 2009/07/17
// Author: titilima
// CopyRight: Titi Studio (?) 2001-2009
//-----------------------------------------------------------------------------
// Information: IDiaSymbol 各辅助类
///////////////////////////////////////////////////////////////////////////////
#pragma once
typedef BOOL (*EnumProc)(IDiaSymbol* curSym, PVOID param);
class CSym
{
protected:
CSym(__in IDiaSymbol* sym);
~CSym(void);
public:
// 获取符号的声明格式
virtual void Declare(__out CString* str, __in PCWSTR lpName);
// 销毁一个符号
static void Delete(__in CSym* sym);
// 枚举指定类别的符号
static IDiaSymbol* Enum(__in IDiaSymbol* symParent,
__in enum SymTagEnum enTag, __in EnumProc cbEnum,
__in_opt PVOID param);
// 格式化符号
virtual BOOL Format(__out CString* str);
// 获取头部
virtual BOOL GetHeader(__out CString* str);
// 获取符号的类型名
virtual BOOL GetType(__out CString* str);
// 创建一个符号
static CSym* NewSym(__in IDiaSymbol* sym);
// 获取符号的 typedef 信息
virtual void TypeDefine(__out CString* str, __in PCWSTR lpType);
protected:
IDiaSymbol* m_sym;
};
class CSymFunction : public CSym
{
friend class CSym;
protected:
CSymFunction(__in IDiaSymbol* sym) : CSym(sym)
{
/* Nothing */
}
public:
BOOL Format(__out CString* str);
};
class CSymData : public CSym
{
friend class CSym;
protected:
CSymData(__in IDiaSymbol* sym) : CSym(sym)
{
/* Nothing */
}
public:
BOOL Format(__out CString* str);
};
class CSymUDT : public CSym
{
friend class CSym;
struct SymAccess
{
CString strPublic;
CString strProtected;
CString strPrivate;
};
protected:
CSymUDT(__in IDiaSymbol* sym) : CSym(sym)
{
/* Nothing */
}
public:
BOOL Format(__out CString* str);
BOOL GetHeader(__out CString* str);
BOOL GetType(__out CString* str);
private:
static BOOL EnumBase(IDiaSymbol* sym, PVOID param);
static BOOL EnumMember(IDiaSymbol* sym, PVOID param);
};
class CSymEnum : public CSym
{
friend class CSym;
protected:
CSymEnum(__in IDiaSymbol* sym) : CSym(sym)
{
/* Nothing */
}
public:
BOOL Format(__out CString* str);
BOOL GetHeader(__out CString* str);
BOOL GetType(__out CString* str);
private:
static BOOL OnEnum(IDiaSymbol* sym, PVOID param);
};
class CSymFunctionType : public CSym
{
friend class CSym;
protected:
CSymFunctionType(__in IDiaSymbol* sym) : CSym(sym)
{
/* Nothing */
}
public:
void Declare(__out CString* str, __in PCWSTR lpName);
static PCWSTR GetCallType(IDiaSymbol* sym);
private:
static BOOL EnumArg(IDiaSymbol* sym, PVOID param);
};
class CSymPointerType : public CSym
{
friend class CSym;
protected:
CSymPointerType(__in IDiaSymbol* sym) : CSym(sym)
{
/* Nothing */
}
public:
void Declare(__out CString* str, __in PCWSTR lpName);
BOOL GetType(__out CString* str);
void TypeDefine(__out CString* str, __in PCWSTR lpType);
};
class CSymArrayType : public CSym
{
friend class CSym;
protected:
CSymArrayType(__in IDiaSymbol* sym) : CSym(sym)
{
/* Nothing */
}
public:
void Declare(__out CString* str, __in PCWSTR lpName);
};
class CSymBaseType : public CSym
{
friend class CSym;
protected:
CSymBaseType(__in IDiaSymbol* sym) : CSym(sym)
{
/* Nothing */
}
public:
BOOL GetType(__out CString* str);
};
class CSymTypedef : public CSym
{
friend class CSym;
protected:
CSymTypedef(__in IDiaSymbol* sym) : CSym(sym)
{
/* Nothing */
}
public:
BOOL Format(__out CString* str);
};
class CSymFunctionArgType : public CSym
{
friend class CSym;
protected:
CSymFunctionArgType(__in IDiaSymbol* sym) : CSym(sym)
{
/* Nothing */
}
public:
BOOL Format(__out CString* str);
};