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


C++ SBError::SetErrorStringWithFormat方法代码示例

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


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

示例1: file

void
Driver::OptionData::AddInitialCommand (const char *command, CommandPlacement placement, bool is_file, SBError &error)
{
    std::vector<InitialCmdEntry> *command_set;
    switch (placement)
    {
    case eCommandPlacementBeforeFile:
        command_set = &(m_initial_commands);
        break;
    case eCommandPlacementAfterFile:
        command_set = &(m_after_file_commands);
        break;
    case eCommandPlacementAfterCrash:
        command_set = &(m_after_crash_commands);
        break;
    }

    if (is_file)
    {
        SBFileSpec file(command);
        if (file.Exists())
            command_set->push_back (InitialCmdEntry(command, is_file));
        else if (file.ResolveExecutableLocation())
        {
            char final_path[PATH_MAX];
            file.GetPath (final_path, sizeof(final_path));
            command_set->push_back (InitialCmdEntry(final_path, is_file));
        }
        else
            error.SetErrorStringWithFormat("file specified in --source (-s) option doesn't exist: '%s'", optarg);
    }
    else
        command_set->push_back (InitialCmdEntry(command, is_file));
}
开发者ID:wiltonlazary,项目名称:swift-lldb,代码行数:34,代码来源:Driver.cpp

示例2: file

void
Driver::OptionData::AddInitialCommand (const char *command, bool before_file, bool is_file, SBError &error)
{
    std::vector<std::pair<bool, std::string> > *command_set;
    if (before_file)
        command_set = &(m_initial_commands);
    else
        command_set = &(m_after_file_commands);

    if (is_file)
    {
        SBFileSpec file(command);
        if (file.Exists())
            command_set->push_back (std::pair<bool, std::string> (true, optarg));
        else if (file.ResolveExecutableLocation())
        {
            char final_path[PATH_MAX];
            file.GetPath (final_path, sizeof(final_path));
            std::string path_str (final_path);
            command_set->push_back (std::pair<bool, std::string> (true, path_str));
        }
        else
            error.SetErrorStringWithFormat("file specified in --source (-s) option doesn't exist: '%s'", optarg);
    }
    else
        command_set->push_back (std::pair<bool, std::string> (false, optarg));
}
开发者ID:Jean-Daniel,项目名称:lldb,代码行数:27,代码来源:Driver.cpp

示例3: value_sp

bool
SBValue::SetData (lldb::SBData &data, SBError &error)
{
    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
    ValueLocker locker;
    lldb::ValueObjectSP value_sp(GetSP(locker));
    bool ret = true;
    
    if (value_sp)
    {
        DataExtractor *data_extractor = data.get();
        
        if (!data_extractor)
        {
            if (log)
                log->Printf ("SBValue(%p)::SetData() => error: no data to set", value_sp.get());
            
            error.SetErrorString("No data to set");
            ret = false;
        }
        else
        {
            Error set_error;
            
            value_sp->SetData(*data_extractor, set_error);
            
            if (!set_error.Success())
            {
                error.SetErrorStringWithFormat("Couldn't set data: %s", set_error.AsCString());
                ret = false;
            }
        }
    }
    else
    {
        error.SetErrorStringWithFormat ("Couldn't set data: could not get SBValue: %s", locker.GetError().AsCString());
        ret = false;
    }
    
    if (log)
        log->Printf ("SBValue(%p)::SetData (%p) => %s",
                     value_sp.get(),
                     data.get(),
                     ret ? "true" : "false");
    return ret;
}
开发者ID:ChaosJohn,项目名称:freebsd,代码行数:46,代码来源:SBValue.cpp

示例4: if

SBError
Driver::ParseArgs (int argc, const char *argv[], FILE *out_fh, bool &exiting)
{
    ResetOptionValues ();

    SBCommandReturnObject result;

    SBError error;
    std::string option_string;
    struct option *long_options = NULL;
    std::vector<struct option> long_options_vector;
    uint32_t num_options;

    for (num_options = 0; g_options[num_options].long_option != NULL; ++num_options)
        /* Do Nothing. */;

    if (num_options == 0)
    {
        if (argc > 1)
            error.SetErrorStringWithFormat ("invalid number of options");
        return error;
    }

    BuildGetOptTable (g_options, long_options_vector, num_options);

    if (long_options_vector.empty())
        long_options = NULL;
    else
        long_options = &long_options_vector.front();

    if (long_options == NULL)
    {
        error.SetErrorStringWithFormat ("invalid long options");
        return error;
    }

    // Build the option_string argument for call to getopt_long_only.

    for (int i = 0; long_options[i].name != NULL; ++i)
    {
        if (long_options[i].flag == NULL)
        {
            option_string.push_back ((char) long_options[i].val);
            switch (long_options[i].has_arg)
            {
                default:
                case no_argument:
                    break;
                case required_argument:
                    option_string.push_back (':');
                    break;
                case optional_argument:
                    option_string.append ("::");
                    break;
            }
        }
    }

    // This is kind of a pain, but since we make the debugger in the Driver's constructor, we can't
    // know at that point whether we should read in init files yet.  So we don't read them in in the
    // Driver constructor, then set the flags back to "read them in" here, and then if we see the
    // "-n" flag, we'll turn it off again.  Finally we have to read them in by hand later in the
    // main loop.
    
    m_debugger.SkipLLDBInitFiles (false);
    m_debugger.SkipAppInitFiles (false);

    // Prepare for & make calls to getopt_long_only.
#if __GLIBC__
    optind = 0;
#else
    optreset = 1;
    optind = 1;
#endif
    int val;
    while (1)
    {
        int long_options_index = -1;
        val = ::getopt_long_only (argc, const_cast<char **>(argv), option_string.c_str(), long_options, &long_options_index);

        if (val == -1)
            break;
        else if (val == '?')
        {
            m_option_data.m_print_help = true;
            error.SetErrorStringWithFormat ("unknown or ambiguous option");
            break;
        }
        else if (val == 0)
            continue;
        else
        {
            m_option_data.m_seen_options.insert ((char) val);
            if (long_options_index == -1)
            {
                for (int i = 0;
                     long_options[i].name || long_options[i].has_arg || long_options[i].flag || long_options[i].val;
                     ++i)
                {
                    if (long_options[i].val == val)
//.........这里部分代码省略.........
开发者ID:wiltonlazary,项目名称:swift-lldb,代码行数:101,代码来源:Driver.cpp


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