本文整理汇总了C++中Stream::EOL方法的典型用法代码示例。如果您正苦于以下问题:C++ Stream::EOL方法的具体用法?C++ Stream::EOL怎么用?C++ Stream::EOL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stream
的用法示例。
在下文中一共展示了Stream::EOL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OutputFormattedUsageText
void Options::OutputFormattedUsageText(Stream &strm,
const OptionDefinition &option_def,
uint32_t output_max_columns) {
std::string actual_text;
if (option_def.validator) {
const char *condition = option_def.validator->ShortConditionString();
if (condition) {
actual_text = "[";
actual_text.append(condition);
actual_text.append("] ");
}
}
actual_text.append(option_def.usage_text);
// Will it all fit on one line?
if (static_cast<uint32_t>(actual_text.length() + strm.GetIndentLevel()) <
output_max_columns) {
// Output it as a single line.
strm.Indent(actual_text.c_str());
strm.EOL();
} else {
// We need to break it up into multiple lines.
int text_width = output_max_columns - strm.GetIndentLevel() - 1;
int start = 0;
int end = start;
int final_end = actual_text.length();
int sub_len;
while (end < final_end) {
// Don't start the 'text' on a space, since we're already outputting the
// indentation.
while ((start < final_end) && (actual_text[start] == ' '))
start++;
end = start + text_width;
if (end > final_end)
end = final_end;
else {
// If we're not at the end of the text, make sure we break the line on
// white space.
while (end > start && actual_text[end] != ' ' &&
actual_text[end] != '\t' && actual_text[end] != '\n')
end--;
}
sub_len = end - start;
if (start != 0)
strm.EOL();
strm.Indent();
assert(start < final_end);
assert(start + sub_len <= final_end);
strm.Write(actual_text.c_str() + start, sub_len);
start = end + 1;
}
strm.EOL();
}
}
示例2: strlen
void
Options::OutputFormattedUsageText
(
Stream &strm,
const char *text,
uint32_t output_max_columns
)
{
int len = strlen (text);
// Will it all fit on one line?
if (static_cast<uint32_t>(len + strm.GetIndentLevel()) < output_max_columns)
{
// Output it as a single line.
strm.Indent (text);
strm.EOL();
}
else
{
// We need to break it up into multiple lines.
int text_width = output_max_columns - strm.GetIndentLevel() - 1;
int start = 0;
int end = start;
int final_end = strlen (text);
int sub_len;
while (end < final_end)
{
// Don't start the 'text' on a space, since we're already outputting the indentation.
while ((start < final_end) && (text[start] == ' '))
start++;
end = start + text_width;
if (end > final_end)
end = final_end;
else
{
// If we're not at the end of the text, make sure we break the line on white space.
while (end > start
&& text[end] != ' ' && text[end] != '\t' && text[end] != '\n')
end--;
}
sub_len = end - start;
if (start != 0)
strm.EOL();
strm.Indent();
assert (start < final_end);
assert (start + sub_len <= final_end);
strm.Write(text + start, sub_len);
start = end + 1;
}
strm.EOL();
}
}
示例3: DumpRegister
bool DumpRegister(const ExecutionContext &exe_ctx, Stream &strm,
RegisterContext *reg_ctx, const RegisterInfo *reg_info) {
if (reg_info) {
RegisterValue reg_value;
if (reg_ctx->ReadRegister(reg_info, reg_value)) {
strm.Indent();
bool prefix_with_altname = (bool)m_command_options.alternate_name;
bool prefix_with_name = !prefix_with_altname;
reg_value.Dump(&strm, reg_info, prefix_with_name, prefix_with_altname,
m_format_options.GetFormat(), 8);
if ((reg_info->encoding == eEncodingUint) ||
(reg_info->encoding == eEncodingSint)) {
Process *process = exe_ctx.GetProcessPtr();
if (process && reg_info->byte_size == process->GetAddressByteSize()) {
addr_t reg_addr = reg_value.GetAsUInt64(LLDB_INVALID_ADDRESS);
if (reg_addr != LLDB_INVALID_ADDRESS) {
Address so_reg_addr;
if (exe_ctx.GetTargetRef()
.GetSectionLoadList()
.ResolveLoadAddress(reg_addr, so_reg_addr)) {
strm.PutCString(" ");
so_reg_addr.Dump(&strm, exe_ctx.GetBestExecutionContextScope(),
Address::DumpStyleResolvedDescription);
}
}
}
}
strm.EOL();
return true;
}
}
return false;
}
示例4: DumpQualifiedName
void
Property::Dump (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) const
{
if (m_value_sp)
{
const bool dump_desc = dump_mask & OptionValue::eDumpOptionDescription;
const bool transparent = m_value_sp->ValueIsTransparent ();
if (dump_desc || !transparent)
{
if ((dump_mask & OptionValue::eDumpOptionName) && m_name)
{
DumpQualifiedName(strm);
if (dump_mask & ~OptionValue::eDumpOptionName)
strm.PutChar(' ');
}
}
if (dump_desc)
{
const char *desc = GetDescription();
if (desc)
strm.Printf ("-- %s", desc);
if (transparent && (dump_mask == (OptionValue::eDumpOptionName | OptionValue::eDumpOptionDescription)))
strm.EOL();
}
m_value_sp->DumpValue(exe_ctx, strm, dump_mask);
}
}
示例5:
void StructuredData::Array::Dump(Stream &s, bool pretty_print) const {
bool first = true;
s << "[";
if (pretty_print) {
s << "\n";
s.IndentMore();
}
for (const auto &item_sp : m_items) {
if (first) {
first = false;
} else {
s << ",";
if (pretty_print)
s << "\n";
}
if (pretty_print)
s.Indent();
item_sp->Dump(s, pretty_print);
}
if (pretty_print) {
s.IndentLess();
s.EOL();
s.Indent();
}
s << "]";
}
示例6: GetCFARegister
void
UnwindPlan::Row::Dump (Stream& s, const UnwindPlan* unwind_plan, Thread* thread, addr_t base_addr) const
{
const RegisterInfo *reg_info = unwind_plan->GetRegisterInfo (thread, GetCFARegister());
if (base_addr != LLDB_INVALID_ADDRESS)
s.Printf ("0x%16.16" PRIx64 ": CFA=", base_addr + GetOffset());
else
s.Printf ("0x%8.8" PRIx64 ": CFA=", GetOffset());
if (reg_info)
s.Printf ("%s", reg_info->name);
else
s.Printf ("reg(%u)", GetCFARegister());
s.Printf ("%+3d => ", GetCFAOffset ());
for (collection::const_iterator idx = m_register_locations.begin (); idx != m_register_locations.end (); ++idx)
{
reg_info = unwind_plan->GetRegisterInfo (thread, idx->first);
if (reg_info)
s.Printf ("%s", reg_info->name);
else
s.Printf ("reg(%u)", idx->first);
const bool verbose = false;
idx->second.Dump(s, unwind_plan, this, thread, verbose);
s.PutChar (' ');
}
s.EOL();
}
示例7:
size_t
Disassembler::Disassemble
(
Debugger &debugger,
const ArchSpec &arch,
const ExecutionContext &exe_ctx,
SymbolContextList &sc_list,
uint32_t num_mixed_context_lines,
bool show_bytes,
Stream &strm
)
{
size_t success_count = 0;
const size_t count = sc_list.GetSize();
SymbolContext sc;
AddressRange range;
for (size_t i=0; i<count; ++i)
{
if (sc_list.GetContextAtIndex(i, sc) == false)
break;
if (sc.GetAddressRange(eSymbolContextFunction | eSymbolContextSymbol, range))
{
if (Disassemble (debugger, arch, exe_ctx, range, num_mixed_context_lines, show_bytes, strm))
{
++success_count;
strm.EOL();
}
}
}
return success_count;
}
示例8: target_sp
void
UnwindPlan::Dump (Stream& s, Thread *thread, lldb::addr_t base_addr) const
{
if (!m_source_name.IsEmpty())
{
s.Printf ("This UnwindPlan originally sourced from %s\n", m_source_name.GetCString());
}
if (m_lsda_address.IsValid() && m_personality_func_addr.IsValid())
{
TargetSP target_sp(thread->CalculateTarget());
addr_t lsda_load_addr = m_lsda_address.GetLoadAddress (target_sp.get());
addr_t personality_func_load_addr = m_personality_func_addr.GetLoadAddress (target_sp.get());
if (lsda_load_addr != LLDB_INVALID_ADDRESS && personality_func_load_addr != LLDB_INVALID_ADDRESS)
{
s.Printf("LSDA address 0x%" PRIx64 ", personality routine is at address 0x%" PRIx64 "\n",
lsda_load_addr, personality_func_load_addr);
}
}
s.Printf ("This UnwindPlan is sourced from the compiler: ");
switch (m_plan_is_sourced_from_compiler)
{
case eLazyBoolYes:
s.Printf ("yes.\n");
break;
case eLazyBoolNo:
s.Printf ("no.\n");
break;
case eLazyBoolCalculate:
s.Printf ("not specified.\n");
break;
}
s.Printf ("This UnwindPlan is valid at all instruction locations: ");
switch (m_plan_is_valid_at_all_instruction_locations)
{
case eLazyBoolYes:
s.Printf ("yes.\n");
break;
case eLazyBoolNo:
s.Printf ("no.\n");
break;
case eLazyBoolCalculate:
s.Printf ("not specified.\n");
break;
}
if (m_plan_valid_address_range.GetBaseAddress().IsValid() && m_plan_valid_address_range.GetByteSize() > 0)
{
s.PutCString ("Address range of this UnwindPlan: ");
TargetSP target_sp(thread->CalculateTarget());
m_plan_valid_address_range.Dump (&s, target_sp.get(), Address::DumpStyleSectionNameOffset);
s.EOL();
}
collection::const_iterator pos, begin = m_row_list.begin(), end = m_row_list.end();
for (pos = begin; pos != end; ++pos)
{
s.Printf ("row[%u]: ", (uint32_t)std::distance (begin, pos));
(*pos)->Dump(s, this, thread, base_addr);
}
}
示例9: DumpToStream
bool DumpToStream(Stream &stream, bool print_help_if_available) override {
if (IsValid()) {
m_compiler_type.DumpTypeDescription(&stream);
stream.EOL();
return true;
}
return false;
}
示例10: ConvertTypeMaskToType
void
OptionValueDictionary::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask)
{
const Type dict_type = ConvertTypeMaskToType (m_type_mask);
if (dump_mask & eDumpOptionType)
{
if (m_type_mask != eTypeInvalid)
strm.Printf ("(%s of %ss)", GetTypeAsCString(), GetBuiltinTypeAsCString(dict_type));
else
strm.Printf ("(%s)", GetTypeAsCString());
}
if (dump_mask & eDumpOptionValue)
{
if (dump_mask & eDumpOptionType)
strm.PutCString (" =");
collection::iterator pos, end = m_values.end();
strm.IndentMore();
for (pos = m_values.begin(); pos != end; ++pos)
{
OptionValue *option_value = pos->second.get();
strm.EOL();
strm.Indent(pos->first.GetCString());
const uint32_t extra_dump_options = m_raw_value_dump ? eDumpOptionRaw : 0;
switch (dict_type)
{
default:
case eTypeArray:
case eTypeDictionary:
case eTypeProperties:
case eTypeFileSpecList:
case eTypePathMap:
strm.PutChar (' ');
option_value->DumpValue(exe_ctx, strm, dump_mask | extra_dump_options);
break;
case eTypeBoolean:
case eTypeChar:
case eTypeEnum:
case eTypeFileSpec:
case eTypeFormat:
case eTypeSInt64:
case eTypeString:
case eTypeUInt64:
case eTypeUUID:
// No need to show the type for dictionaries of simple items
strm.PutCString("=");
option_value->DumpValue(exe_ctx, strm, (dump_mask & (~eDumpOptionType)) | extra_dump_options);
break;
}
}
strm.IndentLess();
}
}
示例11: arch
void
Platform::GetStatus (Stream &strm)
{
uint32_t major = UINT32_MAX;
uint32_t minor = UINT32_MAX;
uint32_t update = UINT32_MAX;
std::string s;
strm.Printf (" Platform: %s\n", GetPluginName().GetCString());
ArchSpec arch (GetSystemArchitecture());
if (arch.IsValid())
{
if (!arch.GetTriple().str().empty())
strm.Printf(" Triple: %s\n", arch.GetTriple().str().c_str());
}
if (GetOSVersion(major, minor, update))
{
strm.Printf("OS Version: %u", major);
if (minor != UINT32_MAX)
strm.Printf(".%u", minor);
if (update != UINT32_MAX)
strm.Printf(".%u", update);
if (GetOSBuildString (s))
strm.Printf(" (%s)", s.c_str());
strm.EOL();
}
if (GetOSKernelDescription (s))
strm.Printf(" Kernel: %s\n", s.c_str());
if (IsHost())
{
strm.Printf(" Hostname: %s\n", GetHostname());
}
else
{
const bool is_connected = IsConnected();
if (is_connected)
strm.Printf(" Hostname: %s\n", GetHostname());
strm.Printf(" Connected: %s\n", is_connected ? "yes" : "no");
}
if (GetWorkingDirectory())
{
strm.Printf("WorkingDir: %s\n", GetWorkingDirectory().GetCString());
}
if (!IsConnected())
return;
std::string specific_info(GetPlatformSpecificConnectionInformation());
if (specific_info.empty() == false)
strm.Printf("Platform-specific connection: %s\n", specific_info.c_str());
}
示例12: Dump
void SectionLoadHistory::Dump(Stream &s, Target *target) {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
StopIDToSectionLoadList::iterator pos,
end = m_stop_id_to_section_load_list.end();
for (pos = m_stop_id_to_section_load_list.begin(); pos != end; ++pos) {
s.Printf("StopID = %u:\n", pos->first);
pos->second->Dump(s, target);
s.EOL();
}
}
示例13:
void
UnwindTable::Dump (Stream &s)
{
s.Printf("UnwindTable for %s/%s:\n", m_object_file.GetFileSpec().GetDirectory().GetCString(), m_object_file.GetFileSpec().GetFilename().GetCString());
const_iterator begin = m_unwinds.begin();
const_iterator end = m_unwinds.end();
for (const_iterator pos = begin; pos != end; ++pos)
{
s.Printf ("[%u] 0x%16.16llx\n", (unsigned)std::distance (begin, pos), pos->first);
}
s.EOL();
}
示例14:
void
UnwindTable::Dump (Stream &s)
{
s.Printf("UnwindTable for '%s':\n", m_object_file.GetFileSpec().GetPath().c_str());
const_iterator begin = m_unwinds.begin();
const_iterator end = m_unwinds.end();
for (const_iterator pos = begin; pos != end; ++pos)
{
s.Printf ("[%u] 0x%16.16" PRIx64 "\n", (unsigned)std::distance (begin, pos), pos->first);
}
s.EOL();
}
示例15: ConvertTypeMaskToType
void
OptionValueArray::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask)
{
const Type array_element_type = ConvertTypeMaskToType (m_type_mask);
if (dump_mask & eDumpOptionType)
{
if ((GetType() == eTypeArray) && (m_type_mask != eTypeInvalid))
strm.Printf ("(%s of %ss)", GetTypeAsCString(), GetBuiltinTypeAsCString(array_element_type));
else
strm.Printf ("(%s)", GetTypeAsCString());
}
if (dump_mask & eDumpOptionValue)
{
if (dump_mask & eDumpOptionType)
strm.Printf (" =%s", (m_values.size() > 0) ? "\n" : "");
strm.IndentMore();
const uint32_t size = m_values.size();
for (uint32_t i = 0; i<size; ++i)
{
strm.Indent();
strm.Printf("[%u]: ", i);
const uint32_t extra_dump_options = m_raw_value_dump ? eDumpOptionRaw : 0;
switch (array_element_type)
{
default:
case eTypeArray:
case eTypeDictionary:
case eTypeProperties:
case eTypeFileSpecList:
case eTypePathMap:
m_values[i]->DumpValue(exe_ctx, strm, dump_mask | extra_dump_options);
break;
case eTypeBoolean:
case eTypeChar:
case eTypeEnum:
case eTypeFileSpec:
case eTypeFormat:
case eTypeSInt64:
case eTypeString:
case eTypeUInt64:
case eTypeUUID:
// No need to show the type for dictionaries of simple items
m_values[i]->DumpValue(exe_ctx, strm, (dump_mask & (~eDumpOptionType)) | extra_dump_options);
break;
}
if (i < (size - 1))
strm.EOL();
}
strm.IndentLess();
}
}