IsMatch 方法返回特定类型实例是否与类型签名中指定的条件匹配的指示。 如果确实如此,则返回此指示以及一个枚举器,该枚举器将指示类型实例(作为符号)的所有特定部分,这些部分与类型签名中的通配符匹配。
语法
HRESULT IsMatch(
IDebugHostType *type,
bool *isMatch,
IDebugHostSymbolEnumerator **wildcardMatches
);
参数
type
要与类型签名进行比较的类型实例。
isMatch
此处返回类型实例是否与类型签名匹配的指示。
wildcardMatches
如果类型实例与类型签名匹配,则会在此处返回枚举器,这将枚举类型实例(作为符号)的所有特定部分,这些部分与类型签名中的通配符匹配。
返回值
此方法返回指示成功或失败的 HRESULT。
言论
示例代码
ComPtr<IDebugHostSymbols> spSym; /* get the host's symbols interface */
ComPtr<IDebugHostType> spType; /* get a type */
ComPtr<IDebugHostTypeSignature> spSig;
if (SUCCEEDED(spSym->CreateTypeSignature(L"MyTemplateType<*>",
nullptr,
&spSig)))
{
bool isMatch;
ComPtr<IDebugHostSymbolEnumerator> spWildcardEnum;
if (SUCCEEDED(spSig->IsMatch(spType.get(), &isMatch, &spWildcardEnum)))
{
// isMatch will contain whether the type matches the signature (whether
// it is a MyTemplateType template with *ANY* template arguments
if (isMatch)
{
// spWildcardEnum will contain what the '*' in 'MyTemplateType<*>'
// matched against. This may be one or more template arguments in
// linear order. An IDebugHostType would be present for type arguments.
}
}
}
要求
要求 | 价值 |
---|---|
标头 | dbgmodel.h |