Metodo IDebugHostBaseClass::EnumerateChildren (dbgmodel.h)

Il metodo EnumerateChildren restituisce un enumeratore che enumera tutti gli elementi figlio di un determinato simbolo. Per un tipo C++, ad esempio, le classi di base, i campi, le funzioni membro e il tipo sono tutti considerati elementi figlio del simbolo di tipo.

Sintassi

HRESULT EnumerateChildren(
  SymbolKind                 kind,
  PCWSTR                     name,
  IDebugHostSymbolEnumerator **ppEnum
);

Parametri

kind

Indica quali tipi di simboli figlio il chiamante desidera enumerare. Se il valore flat Symbol viene passato, verranno enumerati tutti i tipi di simboli figlio.

name

Se specificato, verranno enumerati solo i simboli figlio con un nome specificato in questo argomento.

ppEnum

Un enumeratore che enumera i simboli figlio del tipo e del nome specificati verrà restituito qui.

Valore restituito

Questo metodo restituisce HRESULT che indica l'esito positivo o l'errore.

Commenti

Codice di esempio

ComPtr<IDebugHostType> spType; /* get the type of an object */

// Enumerate every field of this type.  Note that this *WILL NOT* enumerate 
// fields of base classes!
ComPtr<IDebugHostSymbolEnumerator> spEnum;
if (SUCCEEDED(spType->EnumerateChildren(SymbolField, nullptr, &spEnum)))
{
    ComPtr<IDebugHostSymbol> spFieldSymbol;
    HRESULT hr = S_OK;
    while (SUCCEEDED(hr))
    {
        hr = spEnum->GetNext(&spFieldSymbol);
        if (SUCCEEDED(hr))
        {
            ComPtr<IDebugHostField> spField;
            if (SUCCEEDED(spFieldSymbol.As(&spField))) /* should always succeed */
            {
                // spField is each field of the type in turn
            }
        }
    }

    // hr == E_BOUNDS : we hit the end of the enumerator
    // hr == E_ABORT  : user requested interruption, propagate upwards immediately
}

Requisiti

Requisito Valore
Intestazione dbgmodel.h

Vedi anche

Interfaccia IDebugHostBaseClass