本文整理汇总了C++中StreamString::Empty方法的典型用法代码示例。如果您正苦于以下问题:C++ StreamString::Empty方法的具体用法?C++ StreamString::Empty怎么用?C++ StreamString::Empty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StreamString
的用法示例。
在下文中一共展示了StreamString::Empty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
static
const char *arch_helper()
{
static StreamString g_archs_help;
if (g_archs_help.Empty())
{
StringList archs;
ArchSpec::AutoComplete(NULL, archs);
g_archs_help.Printf("These are the supported architecture names:\n");
archs.Join("\n", g_archs_help);
}
return g_archs_help.GetData();
}
示例2: PrintDecl
void ValueObjectPrinter::PrintDecl() {
bool show_type = true;
// if we are at the root-level and been asked to hide the root's type, then
// hide it
if (m_curr_depth == 0 && m_options.m_hide_root_type)
show_type = false;
else
// otherwise decide according to the usual rules (asked to show types -
// always at the root level)
show_type = m_options.m_show_types ||
(m_curr_depth == 0 && !m_options.m_flat_output);
StreamString typeName;
// always show the type at the root level if it is invalid
if (show_type) {
// Some ValueObjects don't have types (like registers sets). Only print
// the type if there is one to print
ConstString type_name;
if (m_compiler_type.IsValid()) {
if (m_options.m_use_type_display_name)
type_name = m_valobj->GetDisplayTypeName();
else
type_name = m_valobj->GetQualifiedTypeName();
} else {
// only show an invalid type name if the user explicitly triggered
// show_type
if (m_options.m_show_types)
type_name = ConstString("<invalid type>");
else
type_name.Clear();
}
if (type_name) {
std::string type_name_str(type_name.GetCString());
if (m_options.m_hide_pointer_value) {
for (auto iter = type_name_str.find(" *"); iter != std::string::npos;
iter = type_name_str.find(" *")) {
type_name_str.erase(iter, 2);
}
}
typeName.Printf("%s", type_name_str.c_str());
}
}
StreamString varName;
if (m_options.m_flat_output) {
// If we are showing types, also qualify the C++ base classes
const bool qualify_cxx_base_classes = show_type;
if (!m_options.m_hide_name) {
m_valobj->GetExpressionPath(varName, qualify_cxx_base_classes);
}
} else if (!m_options.m_hide_name) {
const char *name_cstr = GetRootNameForDisplay("");
varName.Printf("%s", name_cstr);
}
bool decl_printed = false;
if (!m_options.m_decl_printing_helper) {
// if the user didn't give us a custom helper, pick one based upon the
// language, either the one that this printer is bound to, or the preferred
// one for the ValueObject
lldb::LanguageType lang_type =
(m_options.m_varformat_language == lldb::eLanguageTypeUnknown)
? m_valobj->GetPreferredDisplayLanguage()
: m_options.m_varformat_language;
if (Language *lang_plugin = Language::FindPlugin(lang_type)) {
m_options.m_decl_printing_helper = lang_plugin->GetDeclPrintingHelper();
}
}
if (m_options.m_decl_printing_helper) {
ConstString type_name_cstr(typeName.GetString());
ConstString var_name_cstr(varName.GetString());
StreamString dest_stream;
if (m_options.m_decl_printing_helper(type_name_cstr, var_name_cstr,
m_options, dest_stream)) {
decl_printed = true;
m_stream->PutCString(dest_stream.GetString());
}
}
// if the helper failed, or there is none, do a default thing
if (!decl_printed) {
if (!typeName.Empty())
m_stream->Printf("(%s) ", typeName.GetData());
if (!varName.Empty())
m_stream->Printf("%s =", varName.GetData());
else if (!m_options.m_hide_name)
m_stream->Printf(" =");
}
}