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 IsTypedef è l'unico metodo in grado di vedere se un tipo è un typedef. Il metodo GetTypeKind si comporterà come se chiamato sul tipo sottostante.
Sintassi
HRESULT IsTypedef(
bool *isTypedef
);
Parametri
isTypedef
Restituisce true se il simbolo di tipo è un typedef e false se non lo è.
Valore restituito
Questo metodo restituisce HRESULT.
Osservazioni
codice di esempio
ComPtr<IDebugHostType> spType; /* get a type for a typedef (only FindTypeByName
since the compiler usually only emits base types
in the symbols for data) */
ComPtr<IDebugHostType3> spType3;
if (SUCCEEDED(spType.As(&spType3)))
{
bool isTypeDef;
if (SUCCEEDED(spType3->IsTypedef(&isTypeDef)))
{
// isTypeDef indicates whether the type is a typedef.
}
}
Qualsiasi tipo che è un typedef si comporta come se il tipo sia il tipo finale sottostante il typedef. Ciò significa che i metodi come GetTypeKind non indicherà che il tipo è un typedef. Analogamente, il metodo GetBaseType non restituirà il tipo a cui fa riferimento la definizione. Indicano invece il comportamento come se fossero stati chiamati nella definizione finale sottostante il typedef. Ad esempio:
typedef MYSTRUCT *PMYSTRUCT;
typedef PMYSTRUCT PTRMYSTRUCT;
Un IDebugHostType per 'PMYSTRUCT o PTRMYSTRUCT invierà le informazioni seguenti:
Il metodo GetTypeKind restituirà TypePointer. Il tipo sottostante finale MYSTRUCT * è in effetti un puntatore.
Il metodo GetBaseType restituirà un tipo per MYSTRUCT. Il tipo sottostante di MYSTRUCT * è MYSTRUCT.
L'unica differenza è il comportamento dei metodi specifici typedef in IDebugHostType3. Questi metodi sono:
STDMETHOD(IsTypedef)(_Out_ bool* isTypedef) PURE;
STDMETHOD(GetTypedefBaseType)(_Out_ IDebugHostType3** baseType) PURE;
STDMETHOD(GetTypedefFinalBaseType)(_Out_ IDebugHostType3** finalBaseType) PURE;
In questo esempio:
- Il metodo IsTypedef restituirà true sia per PMYSTRUCT che per PTRMYSTRUCT
- Il metodo GetTypedefBaseType restituirà MYSTRUCT * per PMYSTRUCT e PMYSTRUCT per PTRMYSTRUCT
- Il metodo GetTypedefFinalBaseType restituirà MYSTRUCT * per entrambi i tipi
Fabbisogno
Requisito | Valore |
---|---|
intestazione | dbgmodel.h |