mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-29 11:53:23 +08:00
[0.2.x] added : added field name for TypeException "field not found"
git-svn-id: https://pykd.svn.codeplex.com/svn@82636 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
a69089a004
commit
9135fe36f5
@ -850,12 +850,12 @@ TypeInfoPtr EnumTypeInfo::getField( const std::string &fieldName )
|
||||
TypeInfoPtr EnumTypeInfo::getFieldByIndex( ULONG index )
|
||||
{
|
||||
if ( index >= m_dia->getChildCount() )
|
||||
throw TypeException( m_dia->getName(), ": field not found" );
|
||||
throw PyException( PyExc_IndexError, "index out of range" );
|
||||
|
||||
SymbolPtr field = m_dia->getChildByIndex(index);
|
||||
|
||||
if ( !field )
|
||||
throw TypeException( m_dia->getName(), ": field not found" );
|
||||
throw PyException( PyExc_IndexError, "index out of range" );
|
||||
|
||||
return TypeInfo::getTypeInfo( m_dia, field->getName() );
|
||||
}
|
||||
@ -865,12 +865,12 @@ TypeInfoPtr EnumTypeInfo::getFieldByIndex( ULONG index )
|
||||
std::string EnumTypeInfo::getFieldNameByIndex( ULONG index )
|
||||
{
|
||||
if ( index >= m_dia->getChildCount() )
|
||||
throw TypeException( m_dia->getName(), ": field not found" );
|
||||
throw PyException( PyExc_IndexError, "index out of range" );
|
||||
|
||||
SymbolPtr field = m_dia->getChildByIndex(index);
|
||||
|
||||
if ( !field )
|
||||
throw TypeException( m_dia->getName(), ": field not found" );
|
||||
throw PyException( PyExc_IndexError, "index out of range" );
|
||||
|
||||
return field->getName();
|
||||
}
|
||||
|
@ -407,6 +407,7 @@ protected:
|
||||
protected:
|
||||
|
||||
UdtTypeInfoBase(const std::string &typeName) :
|
||||
m_fields(typeName),
|
||||
m_name(typeName),
|
||||
m_fieldsGot( false )
|
||||
{}
|
||||
|
@ -32,7 +32,10 @@ const UdtFieldPtr& FieldCollection::lookup(const std::string &name) const
|
||||
return *it;
|
||||
}
|
||||
|
||||
throw TypeException( "", "field not found" );
|
||||
std::stringstream sstr;
|
||||
sstr << "field \"" << name << " not found";
|
||||
|
||||
throw TypeException( m_name, sstr.str() );
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -161,6 +161,10 @@ class FieldCollection
|
||||
{
|
||||
public:
|
||||
|
||||
FieldCollection( const std::string &name ) :
|
||||
m_name( name )
|
||||
{}
|
||||
|
||||
const UdtFieldPtr &lookup(ULONG index) const;
|
||||
const UdtFieldPtr &lookup(const std::string &name) const;
|
||||
|
||||
@ -179,6 +183,7 @@ private:
|
||||
|
||||
typedef std::vector<UdtFieldPtr> FieldList;
|
||||
FieldList m_fields;
|
||||
std::string m_name;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user