本文整理汇总了C++中TypeList::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ TypeList::GetSize方法的具体用法?C++ TypeList::GetSize怎么用?C++ TypeList::GetSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeList
的用法示例。
在下文中一共展示了TypeList::GetSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: type_basename_const_str
uint32_t
Module::FindTypes (const SymbolContext& sc,
const ConstString &name,
bool exact_match,
uint32_t max_matches,
TypeList& types)
{
uint32_t num_matches = 0;
const char *type_name_cstr = name.GetCString();
std::string type_scope;
std::string type_basename;
const bool append = true;
TypeClass type_class = eTypeClassAny;
if (Type::GetTypeScopeAndBasename (type_name_cstr, type_scope, type_basename, type_class))
{
// Check if "name" starts with "::" which means the qualified type starts
// from the root namespace and implies and exact match. The typenames we
// get back from clang do not start with "::" so we need to strip this off
// in order to get the qualfied names to match
if (type_scope.size() >= 2 && type_scope[0] == ':' && type_scope[1] == ':')
{
type_scope.erase(0,2);
exact_match = true;
}
ConstString type_basename_const_str (type_basename.c_str());
if (FindTypes_Impl(sc, type_basename_const_str, NULL, append, max_matches, types))
{
types.RemoveMismatchedTypes (type_scope, type_basename, type_class, exact_match);
num_matches = types.GetSize();
}
}
else
{
// The type is not in a namespace/class scope, just search for it by basename
if (type_class != eTypeClassAny)
{
// The "type_name_cstr" will have been modified if we have a valid type class
// prefix (like "struct", "class", "union", "typedef" etc).
num_matches = FindTypes_Impl(sc, ConstString(type_name_cstr), NULL, append, max_matches, types);
types.RemoveMismatchedTypes (type_class);
num_matches = types.GetSize();
}
else
{
num_matches = FindTypes_Impl(sc, name, NULL, append, max_matches, types);
}
}
return num_matches;
}
示例2: exe_ctx
bool
TypeFormatImpl_EnumType::FormatObject (ValueObject *valobj,
std::string& dest) const
{
dest.clear();
if (!valobj)
return false;
if (!valobj->CanProvideValue())
return false;
ProcessSP process_sp;
TargetSP target_sp;
void* valobj_key = (process_sp = valobj->GetProcessSP()).get();
if (!valobj_key)
valobj_key = (target_sp = valobj->GetTargetSP()).get();
else
target_sp = process_sp->GetTarget().shared_from_this();
if (!valobj_key)
return false;
auto iter = m_types.find(valobj_key),
end = m_types.end();
CompilerType valobj_enum_type;
if (iter == end)
{
// probably a redundant check
if (!target_sp)
return false;
const ModuleList& images(target_sp->GetImages());
SymbolContext sc;
TypeList types;
images.FindTypes(sc, m_enum_type, false, UINT32_MAX, types);
if (types.GetSize() == 0)
return false;
for (lldb::TypeSP type_sp : types.Types())
{
if (!type_sp)
continue;
if ( (type_sp->GetForwardCompilerType().GetTypeInfo() & eTypeIsEnumeration) == eTypeIsEnumeration)
{
valobj_enum_type = type_sp->GetFullCompilerType ();
m_types.emplace(valobj_key,valobj_enum_type);
break;
}
}
}
else
valobj_enum_type = iter->second;
if (valobj_enum_type.IsValid() == false)
return false;
DataExtractor data;
Error error;
valobj->GetData(data, error);
if (error.Fail())
return false;
ExecutionContext exe_ctx (valobj->GetExecutionContextRef());
StreamString sstr;
valobj_enum_type.DumpTypeValue(&sstr,
lldb::eFormatEnum,
data,
0,
data.GetByteSize(),
0,
0,
exe_ctx.GetBestExecutionContextScope());
if (!sstr.GetString().empty())
dest.swap(sstr.GetString());
return !dest.empty();
}