IDiaEnumSymbols
Note
This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here
Enumerates the various symbols contained in the data source.
IDiaEnumSymbols : IUnknown
The following table shows the methods of IDiaEnumSymbols
.
Method | Description |
---|---|
IDiaEnumSymbols::get__NewEnum | Retrieves the IEnumVARIANT Interface version of this enumerator. |
IDiaEnumSymbols::get_Count | Retrieves the number of symbols. |
IDiaEnumSymbols::Item | Retrieves a symbol by means of an index. |
IDiaEnumSymbols::Next | Retrieves a specified number of symbols in the enumeration sequence. |
IDiaEnumSymbols::Skip | Skips a specified number of symbols in an enumeration sequence. |
IDiaEnumSymbols::Reset | Resets an enumeration sequence to the beginning. |
IDiaEnumSymbols::Clone | Creates an enumerator that contains the same enumeration state as the current enumerator. |
This interface provides symbols grouped by a specific type of symbol, for example, SymTagUDT
(user-defined types) or SymTagBaseClass
. To work with symbols grouped by address, use the IDiaEnumSymbolsByAddr interface.
Obtain this interface by calling the following methods:
This example shows how to obtain the IDiaEnumSymbols
interface and then use that enumeration to list user-defined types (UDTs).
Note
CDiaBSTR
is a class that wraps a BSTR
and automatically handles freeing the string when the instantiation goes out of scope.
void ShowUDTs(IDiaSymbol *pGlobals)
{
CComPtr<IDiaEnumSymbols> pEnum;
CComPtr<IDiaSymbol> pSymbol;
HRESULT hr;
hr = pGlobals->findChildren(SymTagUDT,
NULL,
nsfCaseInsensitive | nsfUndecoratedName,
&pEnum);
if (hr == S_OK)
{
while ( SUCCEEDED( hr = pEnum->Next( 1, &pSymbol, &celt ) ) &&
celt == 1 )
{
CDiaBSTR name;
if ( pSymbol->get_name( &name ) != S_OK )
Fatal( "get_name" );
printf( "Found UDT: %ws\n", name );
pSymbol = 0;
}
}
}
Header: Dia2.h
Library: diaguids.lib
DLL: msdia80.dll
Interfaces (Debug Interface Access SDK)
IDiaSession::findChildren
IDiaSourceFile::get_compilands
IDiaSymbol::findChildren