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


C++ context::current_frame方法代码示例

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


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

示例1: import

HAMIGAKI_BJAM_DECL string_list import(context& ctx)
{
    frame& f = ctx.current_frame();
    const list_of_list& args = f.arguments();

    module& src_module = ctx.get_module(args[0].try_front());
    const string_list& src_rules = args[1];
    const boost::optional<std::string>& tgt_module_name = args[2].try_front();
    module& tgt_module = ctx.get_module(tgt_module_name);
    const string_list& tgt_rules = args[3];
    const bool localize = !args[4].empty();

    if (src_rules.size() != tgt_rules.size())
        throw std::runtime_error("the count of rule names mismatch"); // FIXME

    for (std::size_t i = 0, size = src_rules.size(); i < size; ++i)
    {
        rule_definition def =
            src_module.rules.get_rule_definition(src_rules[i]);

        if (localize)
            def.module_name = tgt_module_name;
        def.exported = false;

        tgt_module.rules.set_rule_definition(tgt_rules[i], def);
    }

    return string_list();
}
开发者ID:fpelliccioni,项目名称:hamigaki,代码行数:29,代码来源:builtin_rules.cpp

示例2: normalize_path

HAMIGAKI_BJAM_DECL string_list normalize_path(context& ctx)
{
    frame& f = ctx.current_frame();
    const list_of_list& args = f.arguments();

    return string_list(bjam::normalize_path(args[0]));
}
开发者ID:fpelliccioni,项目名称:hamigaki,代码行数:7,代码来源:builtin_rules.cpp

示例3: native_rule

HAMIGAKI_BJAM_DECL string_list native_rule(context& ctx)
{
    frame& f = ctx.current_frame();
    const list_of_list& args = f.arguments();

    const std::string& module_name = args[0][0];
    const std::string& rule_name = args[1][0];

    typedef std::map<std::string,bjam::native_rule> table_type;
    typedef table_type::const_iterator iter_type;

    module& m = ctx.get_module(module_name);
    const table_type& table = m.native_rules;
    iter_type it = table.find(rule_name);
    if (it == table.end())
        throw rule_not_found(rule_name);

    const bjam::native_rule& rule = it->second;

    rule_definition def;
    def.parameters = rule.parameters;
    def.native = rule.native;
    def.module_name = module_name;
    def.exported = true;
    m.rules.set_native_rule(rule_name, def);

    return string_list();
}
开发者ID:fpelliccioni,项目名称:hamigaki,代码行数:28,代码来源:builtin_rules.cpp

示例4: match

HAMIGAKI_BJAM_DECL string_list match(context& ctx)
{
    frame& f = ctx.current_frame();
    const list_of_list& args = f.arguments();

    const string_list& regexps = args[0];
    const string_list& list = args[1];

    string_list result;

    for (std::size_t j = 0; j < regexps.size(); ++j)
    {
        const std::string& pattern = bjam::convert_regex(regexps[j]);

        // Note: bjam's regex is not the same as "egrep" and "ECMAScript"
        boost::regex rex(pattern);
        for (std::size_t i = 0; i < list.size(); ++i)
        {
            boost::smatch what;
            if (regex_search(list[i], what, rex))
            {
                result.insert(
                    result.end(), boost::next(what.begin()), what.end());
            }
        }
    }

    return result;
}
开发者ID:fpelliccioni,项目名称:hamigaki,代码行数:29,代码来源:builtin_rules.cpp

示例5: calc

HAMIGAKI_BJAM_DECL string_list calc(context& ctx)
{
    frame& f = ctx.current_frame();
    const list_of_list& args = f.arguments();

    const string_list& arg1 = args[0];

    if (arg1.size() < 3u)
        return string_list();

    long lhs = arg1[0].empty() ? 0 : std::atoi(arg1[0].c_str()); // FIXME
    char op = arg1[1][0];
    long rhs = arg1[2].empty() ? 0 : std::atoi(arg1[2].c_str()); // FIXME

    long value;
    if (op == '+')
        value = lhs + rhs;
    else if (op == '-')
        value = lhs - rhs;
    else
        return string_list();

    std::ostringstream os;
    os.imbue(std::locale::classic());
    os << value;
    return string_list(os.str());
}
开发者ID:fpelliccioni,项目名称:hamigaki,代码行数:27,代码来源:builtin_rules.cpp

示例6: update

HAMIGAKI_BJAM_DECL string_list update(context& ctx)
{
    frame& f = ctx.current_frame();
    const list_of_list& args = f.arguments();

    string_list old = ctx.targets_to_update();
    ctx.targets_to_update(args[0]);
    return old;
}
开发者ID:fpelliccioni,项目名称:hamigaki,代码行数:9,代码来源:builtin_rules.cpp

示例7: sort

HAMIGAKI_BJAM_DECL string_list sort(context& ctx)
{
    frame& f = ctx.current_frame();
    const list_of_list& args = f.arguments();

    string_list sequence = args[0];
    sequence.sort();

    return sequence;
}
开发者ID:fpelliccioni,项目名称:hamigaki,代码行数:10,代码来源:builtin_rules.cpp

示例8: instance

HAMIGAKI_BJAM_DECL string_list instance(context& ctx)
{
    frame& f = ctx.current_frame();
    const list_of_list& args = f.arguments();

    module& instance_module = ctx.get_module(args[0][0]);
    instance_module.class_module = args[1][0];

    return string_list();
}
开发者ID:fpelliccioni,项目名称:hamigaki,代码行数:10,代码来源:builtin_rules.cpp

示例9: delete_module

HAMIGAKI_BJAM_DECL string_list delete_module(context& ctx)
{
    frame& f = ctx.current_frame();
    const list_of_list& args = f.arguments();

    module& m = ctx.get_module(args[0].try_front());
    m.rules.clear();
    m.variables.clear();

    return string_list();
}
开发者ID:fpelliccioni,项目名称:hamigaki,代码行数:11,代码来源:builtin_rules.cpp

示例10: imported_modules

HAMIGAKI_BJAM_DECL string_list imported_modules(context& ctx)
{
    frame& f = ctx.current_frame();
    const list_of_list& args = f.arguments();

    module& m = ctx.get_module(args[0].try_front());

    return string_list(
        m.imported_modules.begin(),
        m.imported_modules.end()
    );
}
开发者ID:fpelliccioni,项目名称:hamigaki,代码行数:12,代码来源:builtin_rules.cpp

示例11: import_module

HAMIGAKI_BJAM_DECL string_list import_module(context& ctx)
{
    frame& f = ctx.current_frame();
    const list_of_list& args = f.arguments();

    const string_list& imported = args[0];
    module& tgt_module = ctx.get_module(args[1].try_front());

    tgt_module.imported_modules.insert(imported.begin(), imported.end());

    return string_list();
}
开发者ID:fpelliccioni,项目名称:hamigaki,代码行数:12,代码来源:builtin_rules.cpp

示例12:

HAMIGAKI_BJAM_DECL string_list w32_getreg(context& ctx)
{
    frame& f = ctx.current_frame();
    const list_of_list& args = f.arguments();

    const string_list& arg1 = args[0];
    const string_list& arg2 = args[1];

    const std::string& path = arg1[0];
    boost::optional<std::string> name = arg2.try_front();

    return win32::registry_values(path, name);
}
开发者ID:fpelliccioni,项目名称:hamigaki,代码行数:13,代码来源:builtin_rules.cpp

示例13: pad

HAMIGAKI_BJAM_DECL string_list pad(context& ctx)
{
    frame& f = ctx.current_frame();
    const list_of_list& args = f.arguments();

    std::string str = args[0][0];
    std::size_t width = static_cast<std::size_t>(std::atoi(args[1][0].c_str()));

    if (str.size() < width)
        str.resize(width, ' ');

    return string_list(str);
}
开发者ID:fpelliccioni,项目名称:hamigaki,代码行数:13,代码来源:builtin_rules.cpp

示例14: check_if_file

HAMIGAKI_BJAM_DECL string_list check_if_file(context& ctx)
{
    frame& f = ctx.current_frame();
    const list_of_list& args = f.arguments();

    const std::string& file = args[0][0];

    fs::path ph(file);
    fs::path work(ctx.working_directory());
    ph = fs::complete(ph, work);
    if (fs::is_regular(ph))
        return string_list(std::string("true"));
    else
        return string_list();
}
开发者ID:fpelliccioni,项目名称:hamigaki,代码行数:15,代码来源:builtin_rules.cpp

示例15: back_trace

HAMIGAKI_BJAM_DECL string_list back_trace(context& ctx)
{
    frame& f = ctx.current_frame();
    const list_of_list& args = f.arguments();
    const string_list& arg1 = args[0];

    int level = boost::integer_traits<int>::const_max;
    if (!arg1.empty())
        level = std::atoi(arg1[0].c_str());

    if (level <= 0)
        return string_list();

    return ctx.back_trace(static_cast<std::size_t>(level), 1u);
}
开发者ID:fpelliccioni,项目名称:hamigaki,代码行数:15,代码来源:builtin_rules.cpp


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