IDiaEnumLineNumbers

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. 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 line numbers contained in the data source.

Syntax

IDiaEnumLineNumbers : IUnknown

Methods in Vtable Order

The following table shows the methods of IDiaEnumLineNumbers.

Method Description
IDiaEnumLineNumbers::get__NewEnum Retrieves the IEnumVARIANT Interface version of this enumerator.
IDiaEnumLineNumbers::get_Count Retrieves the number of line numbers.
IDiaEnumLineNumbers::Item Retrieves a line number by means of an index.
IDiaEnumLineNumbers::Next Retrieves a specified number of line numbers in the enumeration sequence.
IDiaEnumLineNumbers::Skip Skips a specified number of line numbers in an enumeration sequence.
IDiaEnumLineNumbers::Reset Resets an enumeration sequence to the beginning.
IDiaEnumLineNumbers::Clone Creates an enumerator that contains the same enumeration state as the current enumerator.

Remarks

Notes for Callers

This interface is obtained by calling one of the following methods in the IDiaSession interface:

Example

This example shows how to obtain the IDiaEnumLineNumbers interface from a session. In this case, the example shows how to get the line number enumeration for a function (represented by pSymbol). For a more complete example of using line numbers, see the IDiaLineNumber interface.

void dumpFunctionLines( IDiaSymbol* pSymbol, IDiaSession* pSession )
{
    ULONGLONG length = 0;
    DWORD isect = 0;
    DWORD offset = 0;
    pSymbol->get_addressSection( &isect );
    pSymbol->get_addressOffset( &offset );
    pSymbol->get_length( &length );
    if ( isect != 0 && length > 0 )
    {
        CComPtr< IDiaEnumLineNumbers > pLines;
        if ( SUCCEEDED( pSession->findLinesByAddr(
                                      isect,
                                      offset,
                                      static_cast<DWORD>( length ),
                                      &pLines )
                      )
           )
        {
            // Do something with the enumeration
        }
    }
}

Requirements

Header: Dia2.h

Library: diaguids.lib

DLL: msdia80.dll

See also