当前位置: 首页>>代码示例>>C++>>正文


C++ SBStringList类代码示例

本文整理汇总了C++中SBStringList的典型用法代码示例。如果您正苦于以下问题:C++ SBStringList类的具体用法?C++ SBStringList怎么用?C++ SBStringList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SBStringList类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: switch

void
Driver::WriteCommandsForSourcing (CommandPlacement placement, SBStream &strm)
{
    std::vector<OptionData::InitialCmdEntry> *command_set;
    switch (placement)
    {
    case eCommandPlacementBeforeFile:
        command_set = &m_option_data.m_initial_commands;
        break;
    case eCommandPlacementAfterFile:
        command_set = &m_option_data.m_after_file_commands;
        break;
    case eCommandPlacementAfterCrash:
        command_set = &m_option_data.m_after_crash_commands;
        break;
    }
    
    for (const auto &command_entry : *command_set)
    {
        const char *command = command_entry.contents.c_str();
        if (command_entry.is_file)
        {
            // If this command_entry is a file to be sourced, and it's the ./.lldbinit file (the .lldbinit
            // file in the current working directory), only read it if target.load-cwd-lldbinit is 'true'.
            if (command_entry.is_cwd_lldbinit_file_read)
            {
                SBStringList strlist = m_debugger.GetInternalVariableValue ("target.load-cwd-lldbinit", 
                                                                            m_debugger.GetInstanceName());
                if (strlist.GetSize() == 1 && strcmp (strlist.GetStringAtIndex(0), "warn") == 0)
                {
                    FILE *output = m_debugger.GetOutputFileHandle ();
                    ::fprintf (output, 
                            "There is a .lldbinit file in the current directory which is not being read.\n"
                            "To silence this warning without sourcing in the local .lldbinit,\n"
                            "add the following to the lldbinit file in your home directory:\n"
                            "    settings set target.load-cwd-lldbinit false\n"
                            "To allow lldb to source .lldbinit files in the current working directory,\n"
                            "set the value of this variable to true.  Only do so if you understand and\n"
                            "accept the security risk.\n");
                    return;
                }
                if (strlist.GetSize() == 1 && strcmp (strlist.GetStringAtIndex(0), "false") == 0)
                {
                    return;
                }
            }
            bool source_quietly = m_option_data.m_source_quietly || command_entry.source_quietly;
            strm.Printf("command source -s %i '%s'\n", source_quietly, command);
        }
        else
            strm.Printf("%s\n", command);
    }
}
开发者ID:32bitmicro,项目名称:riscv-lldb,代码行数:53,代码来源:Driver.cpp

示例2: AppendList

void SBStringList::AppendList(const SBStringList &strings) {
  if (strings.IsValid()) {
    if (!IsValid())
      m_opaque_ap.reset(new lldb_private::StringList());
    m_opaque_ap->AppendList(*(strings.m_opaque_ap));
  }
}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:7,代码来源:SBStringList.cpp

示例3: LLDB_RECORD_METHOD

void SBStringList::AppendList(const SBStringList &strings) {
  LLDB_RECORD_METHOD(void, SBStringList, AppendList,
                     (const lldb::SBStringList &), strings);

  if (strings.IsValid()) {
    if (!IsValid())
      m_opaque_up.reset(new lldb_private::StringList());
    m_opaque_up->AppendList(*(strings.m_opaque_up));
  }
}
开发者ID:llvm-project,项目名称:lldb,代码行数:10,代码来源:SBStringList.cpp

示例4: GetCommandLineCommands

bool SBBreakpointName::GetCommandLineCommands(SBStringList &commands) {
  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
  
  BreakpointName *bp_name = GetBreakpointName();
  if (!bp_name)
    return false;
 
  LLDB_LOG(log, "Name: {0}\n", bp_name->GetName());
  StringList command_list;
  bool has_commands =
      bp_name->GetOptions().GetCommandLineCallbacks(command_list);
  if (has_commands)
    commands.AppendList(command_list);
  return has_commands;
}
开发者ID:derekmarcotte,项目名称:freebsd,代码行数:15,代码来源:SBBreakpointName.cpp

示例5: strlen

int
SBCommandInterpreter::HandleCompletion (const char *current_line,
                                        const char *cursor,
                                        const char *last_char,
                                        int match_start_point,
                                        int max_return_elements,
                                        SBStringList &matches)
{
    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
    int num_completions = 0;

    // Sanity check the arguments that are passed in:
    // cursor & last_char have to be within the current_line.
    if (current_line == nullptr || cursor == nullptr || last_char == nullptr)
        return 0;

    if (cursor < current_line || last_char < current_line)
        return 0;

    size_t current_line_size = strlen (current_line);
    if (cursor - current_line > static_cast<ptrdiff_t>(current_line_size) ||
        last_char - current_line > static_cast<ptrdiff_t>(current_line_size))
        return 0;

    if (log)
        log->Printf ("SBCommandInterpreter(%p)::HandleCompletion (current_line=\"%s\", cursor at: %" PRId64 ", last char at: %" PRId64 ", match_start_point: %d, max_return_elements: %d)",
                     static_cast<void*>(m_opaque_ptr), current_line,
                     static_cast<uint64_t>(cursor - current_line),
                     static_cast<uint64_t>(last_char - current_line),
                     match_start_point, max_return_elements);

    if (IsValid())
    {
        lldb_private::StringList lldb_matches;
        num_completions = m_opaque_ptr->HandleCompletion(current_line, cursor, last_char, match_start_point,
                                                         max_return_elements, lldb_matches);

        SBStringList temp_list (&lldb_matches);
        matches.AppendList (temp_list);
    }
    if (log)
        log->Printf ("SBCommandInterpreter(%p)::HandleCompletion - Found %d completions.",
                     static_cast<void*>(m_opaque_ptr), num_completions);

    return num_completions;
}
开发者ID:cadets,项目名称:lldb,代码行数:46,代码来源:SBCommandInterpreter.cpp

示例6: SetCommandLineCommands

void SBBreakpointName::SetCommandLineCommands(SBStringList &commands) {
  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
  BreakpointName *bp_name = GetBreakpointName();
  if (!bp_name)
    return;
  if (commands.GetSize() == 0)
    return;

  LLDB_LOG(log, "Name: {0} commands\n", bp_name->GetName());

  std::lock_guard<std::recursive_mutex> guard(
        m_impl_up->GetTarget()->GetAPIMutex());
  std::unique_ptr<BreakpointOptions::CommandData> cmd_data_up(
      new BreakpointOptions::CommandData(*commands, eScriptLanguageNone));

  bp_name->GetOptions().SetCommandDataCallback(cmd_data_up);
  UpdateName(*bp_name);
}
开发者ID:derekmarcotte,项目名称:freebsd,代码行数:18,代码来源:SBBreakpointName.cpp

示例7: guard

void
SBBreakpoint::GetNames (SBStringList &names)
{
    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));

    if (log)
        log->Printf ("SBBreakpoint(%p)::GetNames ()",
                     static_cast<void*>(m_opaque_sp.get()));

    if (m_opaque_sp)
    {
        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
        std::vector<std::string> names_vec;
        m_opaque_sp->GetNames(names_vec);
        for (std::string name : names_vec)
        {
            names.AppendString (name.c_str());
        }
    }
}
开发者ID:Aj0Ay,项目名称:lldb,代码行数:20,代码来源:SBBreakpoint.cpp

示例8: temp_list

int
SBCommandInterpreter::HandleCompletion (const char *current_line,
                                        const char *cursor,
                                        const char *last_char,
                                        int match_start_point,
                                        int max_return_elements,
                                        SBStringList &matches)
{
    int num_completions = 0;
    if (m_opaque_ptr)
    {
        lldb_private::StringList lldb_matches;
        num_completions =  m_opaque_ptr->HandleCompletion (current_line, cursor, last_char, match_start_point,
                                                           max_return_elements, lldb_matches);

        SBStringList temp_list (&lldb_matches);
        matches.AppendList (temp_list);
    }
    return num_completions;
}
开发者ID:ice799,项目名称:lldb,代码行数:20,代码来源:SBCommandInterpreter.cpp

示例9: m_opaque_ap

SBStringList::SBStringList(const SBStringList &rhs) : m_opaque_ap() {
  if (rhs.IsValid())
    m_opaque_ap.reset(new lldb_private::StringList(*rhs));
}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:4,代码来源:SBStringList.cpp

示例10: assert

unsigned char
IOChannel::HandleCompletion (EditLine *e, int ch)
{
    assert (e == m_edit_line);

    const LineInfo *line_info  = el_line(m_edit_line);
    SBStringList completions;
    int page_size = 40;

    int num_completions = m_driver->GetDebugger().GetCommandInterpreter().HandleCompletion (line_info->buffer,
                                                                                            line_info->cursor,
                                                                                            line_info->lastchar,
                                                                                            0,
                                                                                            -1,
                                                                                            completions);
    
    if (num_completions == -1)
    {
        el_insertstr (m_edit_line, m_completion_key);
        return CC_REDISPLAY;
    }

    // If we get a longer match display that first.
    const char *completion_str = completions.GetStringAtIndex(0);
    if (completion_str != NULL && *completion_str != '\0')
    {
        el_insertstr (m_edit_line, completion_str);
        return CC_REDISPLAY;
    }

    if (num_completions > 1)
    {
        const char *comment = "\nAvailable completions:";

        int num_elements = num_completions + 1;
        OutWrite(comment,  strlen (comment));
        if (num_completions < page_size)
        {
            for (int i = 1; i < num_elements; i++)
            {
                completion_str = completions.GetStringAtIndex(i);
                OutWrite("\n\t", 2);
                OutWrite(completion_str, strlen (completion_str));
            }
            OutWrite ("\n", 1);
        }
        else
        {
            int cur_pos = 1;
            char reply;
            int got_char;
            while (cur_pos < num_elements)
            {
                int endpoint = cur_pos + page_size;
                if (endpoint > num_elements)
                    endpoint = num_elements;
                for (; cur_pos < endpoint; cur_pos++)
                {
                    completion_str = completions.GetStringAtIndex(cur_pos);
                    OutWrite("\n\t", 2);
                    OutWrite(completion_str, strlen (completion_str));
                }

                if (cur_pos >= num_elements)
                {
                    OutWrite("\n", 1);
                    break;
                }

                OutWrite("\nMore (Y/n/a): ", strlen ("\nMore (Y/n/a): "));
                reply = 'n';
                got_char = el_getc(m_edit_line, &reply);
                if (got_char == -1 || reply == 'n')
                    break;
                if (reply == 'a')
                    page_size = num_elements - cur_pos;
            }
        }

    }

    if (num_completions == 0)
        return CC_REFRESH_BEEP;
    else
        return CC_REDISPLAY;
}
开发者ID:eightcien,项目名称:lldb,代码行数:86,代码来源:IOChannel.cpp


注:本文中的SBStringList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。