-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDataMember.cpp
102 lines (87 loc) · 1.84 KB
/
DataMember.cpp
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
#include "stdafx.h"
#include "DataMember.h"
#include "useful.h"
DataMember::DataMember()
{
}
DataMember::DataMember(CComPtr<IDiaSymbol> pIDiaSymbol) : Symbol(pIDiaSymbol)
{
DWORD tag;
checkResult(pIDiaSymbol->get_symTag(&tag));
if(SymTagData != tag)
{
throw 0;
}
}
DataMember::DataMember(const DataMember& other) : Symbol(other.Symbol)
{
}
DataMember& DataMember::operator= (const DataMember& other)
{
if(*this == other)
return *this;
Symbol = other.Symbol;
return *this;
}
bool DataMember::operator== (const DataMember& other)
{
return Symbol == other.Symbol;
}
CComPtr<IDiaSymbol> DataMember::sym() const
{
return Symbol;
}
std::wstring DataMember::getName() const
{
return ::getName(sym());
}
bool DataMember::pointerToFunction() const
{
CComPtr<IDiaSymbol> type;
checkResult(sym()->get_type(&type));
DWORD tag;
checkResult(type->get_symTag(&tag));
if(SymTagPointerType == tag)
{
CComPtr<IDiaSymbol> pointee;
checkResult(type->get_type(&pointee));
DWORD pointeeTag;
checkResult(pointee->get_symTag(&pointeeTag));
return (SymTagFunctionType == pointeeTag);//function pointer!
}
return false;
}
std::wstring DataMember::type() const
{
std::wstring ret;
CComPtr<IDiaSymbol> type;
checkResult(sym()->get_type(&type));
if(!!type)
{
ret += expandType(type,getName());//name needed for function defs
}
return ret;
}
std::wstring DataMember::typeSpecial() const
{
std::wstring ret;
CComPtr<IDiaSymbol> type;
checkResult(sym()->get_type(&type));
if(!!type)
{
ret += expandTypeSpecial(type);
}
return ret;
}
bool DataMember::isStatic() const
{
DWORD kind;
checkResult(sym()->get_dataKind(&kind));
return DataIsGlobal == kind;
}
CV_access_e DataMember::protection() const
{
DWORD access;
checkResult(sym()->get_access(&access));
return (CV_access_e)access;
}