Nota
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare ad accedere o modificare le directory.
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare a modificare le directory.
Il metodo GetIterator sul concetto iterabile restituisce un'interfaccia iteratore che può essere usata per scorrere l'oggetto. L'iteratore restituito deve ricordare l'oggetto contesto passato al metodo GetIterator. Non verrà passato ai metodi sull'iteratore stesso.
Sintassi
HRESULT GetIterator(
IModelObject *contextObject,
IModelIterator **iterator
);
Parametri
contextObject
Istanza (questo puntatore) per cui acquisire un iteratore.
iterator
Implementazione di IModelIterator che esegue l'iterazione dell'oggetto istanza viene restituita qui.
Valore restituito
Questo metodo restituisce HRESULT che indica l'esito positivo o negativo.
Osservazioni
Implementazione di esempio di :
IFACEMETHOD(GetIterator)(_In_ IModelObject *pContextObject,
_COM_Outptr_ IModelIterator **ppIterator)
{
HRESULT hr = S_OK:
*ppIterator = nullptr;
// The iterator is not going to be passed the context object any more.
// If it needs this (to access fields for iteration, etc...), it must
// capture that in its own state.
ComPtr<MyObjectIterator> spIter;
hr = Microsoft::WRL::MakeAndInitialize<MyObjectIterator>(&spIter, pContextObject);
if (SUCCEEDED(hr))
{
*ppIterator = spIter.Detach();
}
return hr;
}
Fabbisogno
Requisito | Valore |
---|---|
intestazione | dbgmodel.h |