IDebugHostType2::EnumerateChildren メソッド (dbgmodel.h)

EnumerateChildren メソッドは、特定のシンボルのすべての子を列挙する列挙子を返します。 たとえば、C++ 型の場合、基底クラス、フィールド、メンバー関数などはすべて、型シンボルの子と見なされます。

構文

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

パラメーター

kind

呼び出し元が列挙する子シンボルの種類を示します。 フラット値 Symbol を渡すと、すべての種類の子シンボルが列挙されます。

name

指定した場合、この引数で指定された名前を持つ子シンボルのみが列挙されます。

ppEnum

指定した種類と名前の子シンボルを列挙する列挙子がここで返されます。

戻り値

このメソッドは、成功または失敗を示す HRESULT を返します。

注釈

サンプル コード

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
}

要件

要件
Header dbgmodel.h

こちらもご覧ください

IDebugHostType2 インターフェイス