Commit 2f46b8a5 authored by ussrhero's avatar ussrhero

added getScopeName method to TypeInfo

parent 8d28d97e
......@@ -201,7 +201,7 @@ typedef unsigned long DebugOptionsSet;
enum BreakpointAccess {
Read = 0x00000001,
Write = 0x00000002,
Execute = 0x00000004,
Execute = 0x00000004
};
......
......@@ -46,6 +46,7 @@ public:
virtual std::wstring str() = 0;
virtual std::wstring getName() = 0;
virtual std::wstring getScopeName() = 0;
virtual std::pair<std::wstring, std::wstring> splitName() = 0;
virtual size_t getSize() = 0;
......
......@@ -31,6 +31,10 @@ protected:
NOT_IMPLEMENTED();
}
virtual std::wstring getScopeName() {
NOT_IMPLEMENTED();
}
virtual std::pair<std::wstring, std::wstring> splitName() {
NOT_IMPLEMENTED();
}
......
......@@ -41,6 +41,10 @@ protected:
NOT_IMPLEMENTED();
}
virtual std::wstring getScopeName() {
throw TypeException( getName(), L"type has no scope name" );
}
virtual std::pair<std::wstring, std::wstring> splitName() {
return std::pair<std::wstring, std::wstring>(getName(), std::wstring());
}
......@@ -306,6 +310,7 @@ protected:
}
};
///////////////////////////////////////////////////////////////////////////////
class TypeInfoFields : public TypeInfoImp
......@@ -372,13 +377,30 @@ private:
///////////////////////////////////////////////////////////////////////////////
class TypeInfoUdt : public TypeInfoFields
class SymbolFields : public TypeInfoFields
{
public:
SymbolFields(SymbolPtr &symbol) :
TypeInfoFields( symbol->getName() ),
m_symbol(symbol)
{}
std::wstring getScopeName() {
return m_symbol->getScopeName();
}
protected:
SymbolPtr m_symbol;
};
class TypeInfoUdt : public SymbolFields
{
public:
TypeInfoUdt(SymbolPtr &symbol) :
TypeInfoFields( symbol->getName() ),
m_symbol( symbol )
SymbolFields( symbol )
{}
protected:
......@@ -420,8 +442,6 @@ protected:
protected:
SymbolPtr m_symbol;
virtual void getFields();
virtual void getVirtualDisplacement( const std::wstring& fieldName, MEMOFFSET_32 &virtualBasePtr, size_t &virtualDispIndex, size_t &virtualDispSize );
......@@ -442,13 +462,12 @@ protected:
///////////////////////////////////////////////////////////////////////////////
class TypeInfoEnum : public TypeInfoFields
class TypeInfoEnum : public SymbolFields
{
public:
TypeInfoEnum( SymbolPtr& symbol ) :
TypeInfoFields( symbol->getName() ),
m_symbol( symbol )
SymbolFields( symbol )
{}
virtual std::wstring str();
......@@ -567,6 +586,10 @@ protected:
return getPtrSize();
}
std::wstring getScopeName() {
return m_symbol->getScopeName();
}
private:
SymbolPtr m_symbol;
......@@ -729,6 +752,10 @@ public:
return L"VTable";
}
std::wstring getScopeName() {
return m_symbol->getScopeName();
}
virtual size_t getAlignReq() {
return getPtrSizeBySymbol( m_symbol );
}
......@@ -804,6 +831,10 @@ protected:
virtual TypeInfoPtr getClassParent();
std::wstring getScopeName() {
return m_symbol->getScopeName();
}
private:
SymbolPtr m_symbol;
......@@ -880,6 +911,10 @@ public:
m_symbol = symbol;
}
std::wstring getScopeName() {
return m_symbol->getScopeName();
}
protected:
SymbolPtr m_symbol;
......@@ -959,6 +994,10 @@ public:
m_symbol = symbol;
}
std::wstring getScopeName() {
return m_symbol->getScopeName();
}
protected:
SymbolPtr m_symbol;
......
......@@ -580,4 +580,15 @@ TEST_F(TypeInfoTest, GetTypeProviderFromPdb)
EXPECT_EQ( L"structTest", structType->getName() );
}
TEST_F(TypeInfoTest, GetScopeName)
{
EXPECT_EQ(L"targetapp", loadType(L"g_classChild")->getScopeName() );
EXPECT_EQ(L"targetapp", loadTypedVar(L"CdeclFuncPtr")->getType()->getScopeName() );
EXPECT_EQ(L"targetapp", loadType( L"g_structTestPtr" )->getScopeName() );
EXPECT_THROW(loadType(L"UInt4B")->getScopeName(), TypeException);
EXPECT_THROW(loadType(L"Void")->getScopeName(), TypeException);
EXPECT_THROW(loadType(L"Float*")->getScopeName(), TypeException);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment