本文整理汇总了C++中IDiaSymbol::get_value方法的典型用法代码示例。如果您正苦于以下问题:C++ IDiaSymbol::get_value方法的具体用法?C++ IDiaSymbol::get_value怎么用?C++ IDiaSymbol::get_value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDiaSymbol
的用法示例。
在下文中一共展示了IDiaSymbol::get_value方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getName
DDR_RC
PdbScanner::addEnumMembers(IDiaSymbol *symbol, EnumUDT *enumUDT)
{
DDR_RC rc = DDR_RC_OK;
/* All children symbols of a symbol for an Enum type should be
* enum members.
*/
IDiaEnumSymbols *enumSymbols = NULL;
HRESULT hr = symbol->findChildren(SymTagNull, NULL, nsNone, &enumSymbols);
if (FAILED(hr)) {
ERRMSG("findChildren() failed with HRESULT = %08lX", hr);
rc = DDR_RC_ERROR;
}
if (DDR_RC_OK == rc) {
vector<EnumMember *> *members = NULL;
NamespaceUDT *outerUDT = enumUDT->_outerNamespace;
/* literals of a nested anonymous enum are collected in the enclosing namespace */
if ((NULL != outerUDT) && enumUDT->isAnonymousType()) {
members = &outerUDT->_enumMembers;
} else {
members = &enumUDT->_enumMembers;
}
set<string> memberNames;
for (vector<EnumMember *>::iterator m = members->begin(); m != members->end(); ++m) {
memberNames.insert((*m)->_name);
}
IDiaSymbol *childSymbol = NULL;
ULONG celt = 0;
LONG count = 0;
enumSymbols->get_Count(&count);
members->reserve(count);
while (SUCCEEDED(enumSymbols->Next(1, &childSymbol, &celt))
&& (1 == celt)
&& (DDR_RC_OK == rc)
) {
string name = "";
int value = 0;
rc = getName(childSymbol, &name);
if (DDR_RC_OK == rc) {
VARIANT variantValue;
variantValue.vt = VT_EMPTY;
hr = childSymbol->get_value(&variantValue);
if (FAILED(hr)) {
ERRMSG("get_value() failed with HRESULT = %08lX", hr);
rc = DDR_RC_ERROR;
} else {
switch (variantValue.vt) {
case VT_I1:
value = variantValue.cVal;
break;
case VT_I2:
value = variantValue.iVal;
break;
case VT_I4:
value = (int)variantValue.lVal;
break;
case VT_UI1:
value = variantValue.bVal;
break;
case VT_UI2:
value = variantValue.uiVal;
break;
case VT_UI4:
value = (int)variantValue.ulVal;
break;
case VT_INT:
value = variantValue.intVal;
break;
case VT_UINT:
value = (int)variantValue.uintVal;
break;
default:
ERRMSG("get_value() unexpected variant: 0x%02X", variantValue.vt);
rc = DDR_RC_ERROR;
break;
}
}
}
if (DDR_RC_OK == rc) {
if (memberNames.end() == memberNames.find(name)) {
EnumMember *enumMember = new EnumMember;
enumMember->_name = name;
enumMember->_value = value;
members->push_back(enumMember);
memberNames.insert(name);
}
}
childSymbol->Release();
}
enumSymbols->Release();
}
return rc;
}