• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ function_map_t类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: function_set_desc

void function_set_desc(const wcstring &name, const wcstring &desc) {
    load(name);
    scoped_lock locker(functions_lock);
    function_map_t::iterator iter = loaded_functions.find(name);
    if (iter != loaded_functions.end()) {
        iter->second.description = desc;
    }
}
开发者ID:Mabinogiysk,项目名称:fish-shell,代码行数:8,代码来源:function.cpp


示例2:

static const function_info_t *function_get(const wcstring &name) {
    // The caller must lock the functions_lock before calling this; however our mutex is currently
    // recursive, so trylock will never fail. We need a way to correctly check if a lock is locked
    // (or better yet, make our lock non-recursive).
    // ASSERT_IS_LOCKED(functions_lock);
    function_map_t::iterator iter = loaded_functions.find(name);
    if (iter == loaded_functions.end()) {
        return NULL;
    }
    return &iter->second;
}
开发者ID:Mabinogiysk,项目名称:fish-shell,代码行数:11,代码来源:function.cpp


示例3: function_copy

bool function_copy(const wcstring &name, const wcstring &new_name)
{
    bool result = false;
    scoped_lock lock(functions_lock);
    function_map_t::const_iterator iter = loaded_functions.find(name);
    if (iter != loaded_functions.end()) {
		// This new instance of the function shouldn't be tied to the definition file of the original, so pass NULL filename, etc.
        const function_map_t::value_type new_pair(new_name, function_info_t(iter->second, NULL, 0, false));
        loaded_functions.insert(new_pair);
        result = true;
    }
	return result;
}
开发者ID:Soares,项目名称:fish-shell,代码行数:13,代码来源:function.cpp


示例4: function_add

void function_add(const function_data_t &data, const parser_t &parser)
{
    ASSERT_IS_MAIN_THREAD();

    CHECK(! data.name.empty(),);
    CHECK(data.definition,);
    scoped_lock lock(functions_lock);

    /* Remove the old function */
    function_remove(data.name);

    /* Create and store a new function */
    const wchar_t *filename = reader_current_filename();

    int def_offset = -1;
    if (parser.current_block() != NULL)
    {
        def_offset = parser.line_number_of_character_at_offset(parser.current_block()->tok_pos);
    }

    const function_map_t::value_type new_pair(data.name, function_info_t(data, filename, def_offset, is_autoload));
    loaded_functions.insert(new_pair);

    /* Add event handlers */
    for (std::vector<event_t>::const_iterator iter = data.events.begin(); iter != data.events.end(); ++iter)
    {
        event_add_handler(*iter);
    }
}
开发者ID:GarethLewin,项目名称:fish-shell,代码行数:29,代码来源:function.cpp


示例5: load

/**
   Make sure that if the specified function is a dynamically loaded
   function, it has been fully loaded.
*/
static int load( const wcstring &name )
{
    ASSERT_IS_MAIN_THREAD();
    scoped_lock lock(functions_lock);
	bool was_autoload = is_autoload;
	int res;
    function_map_t::iterator iter = loaded_functions.find(name);
	if( iter !=  loaded_functions.end() && !iter->second.is_autoload ) {
        /* We have a non-autoload version already */
		return 0;
    }
	
	is_autoload = true;	
	res = function_autoloader.load( name, true );
	is_autoload = was_autoload;
	return res;
}
开发者ID:Soares,项目名称:fish-shell,代码行数:21,代码来源:function.cpp


示例6: function_get_names

wcstring_list_t function_get_names(int get_hidden) {
    std::set<wcstring> names;
    scoped_lock locker(functions_lock);
    autoload_names(names, get_hidden);

    function_map_t::const_iterator iter;
    for (iter = loaded_functions.begin(); iter != loaded_functions.end(); ++iter) {
        const wcstring &name = iter->first;

        // Maybe skip hidden.
        if (!get_hidden) {
            if (name.empty() || name.at(0) == L'_') continue;
        }
        names.insert(name);
    }
    return wcstring_list_t(names.begin(), names.end());
}
开发者ID:Mabinogiysk,项目名称:fish-shell,代码行数:17,代码来源:function.cpp


示例7: function_remove_ignore_autoload

static bool function_remove_ignore_autoload(const wcstring &name, bool tombstone) {
    // Note: the lock may be held at this point, but is recursive.
    scoped_lock locker(functions_lock);

    function_map_t::iterator iter = loaded_functions.find(name);

    // Not found.  Not erasing.
    if (iter == loaded_functions.end()) return false;

    // Removing an auto-loaded function.  Prevent it from being auto-reloaded.
    if (iter->second.is_autoload && tombstone) function_tombstones.insert(name);

    loaded_functions.erase(iter);
    event_t ev(EVENT_ANY);
    ev.function_name = name;
    event_remove(ev);
    return true;
}
开发者ID:Mabinogiysk,项目名称:fish-shell,代码行数:18,代码来源:function.cpp


示例8: load

/// Make sure that if the specified function is a dynamically loaded function, it has been fully
/// loaded.
static int load(const wcstring &name) {
    ASSERT_IS_MAIN_THREAD();
    scoped_lock locker(functions_lock);
    bool was_autoload = is_autoload;
    int res;

    bool no_more_autoload = function_tombstones.count(name) > 0;
    if (no_more_autoload) return 0;

    function_map_t::iterator iter = loaded_functions.find(name);
    if (iter != loaded_functions.end() && !iter->second.is_autoload) {
        // We have a non-autoload version already.
        return 0;
    }

    is_autoload = true;
    res = function_autoloader.load(name, true);
    is_autoload = was_autoload;
    return res;
}
开发者ID:Mabinogiysk,项目名称:fish-shell,代码行数:22,代码来源:function.cpp


示例9: function_add

void function_add(const function_data_t &data, const parser_t &parser, int definition_line_offset) {
    ASSERT_IS_MAIN_THREAD();

    CHECK(!data.name.empty(), );
    CHECK(data.definition, );
    scoped_lock locker(functions_lock);

    // Remove the old function.
    function_remove(data.name);

    // Create and store a new function.
    const wchar_t *filename = reader_current_filename();

    const function_map_t::value_type new_pair(
        data.name, function_info_t(data, filename, definition_line_offset, is_autoload));
    loaded_functions.insert(new_pair);

    // Add event handlers.
    for (std::vector<event_t>::const_iterator iter = data.events.begin(); iter != data.events.end();
         ++iter) {
        event_add_handler(*iter);
    }
}
开发者ID:Mabinogiysk,项目名称:fish-shell,代码行数:23,代码来源:function.cpp


示例10: function_exists_no_autoload

int function_exists_no_autoload( const wcstring &cmd, const env_vars_snapshot_t &vars )
{
	if( parser_keywords_is_reserved(cmd) )
		return 0;
    scoped_lock lock(functions_lock);
    return loaded_functions.find(cmd) != loaded_functions.end() || function_autoloader.can_load(cmd, vars);            
}
开发者ID:Soares,项目名称:fish-shell,代码行数:7,代码来源:function.cpp


示例11: function_exists

int function_exists( const wcstring &cmd )
{
	if( parser_keywords_is_reserved(cmd) )
		return 0;
    scoped_lock lock(functions_lock);
    load(cmd);
    return loaded_functions.find(cmd) != loaded_functions.end();            
}
开发者ID:Soares,项目名称:fish-shell,代码行数:8,代码来源:function.cpp


示例12: function_remove_ignore_autoload

static bool function_remove_ignore_autoload(const wcstring &name)
{
    scoped_lock lock(functions_lock);
    bool erased = (loaded_functions.erase(name) > 0);
	
	if (erased) {
        event_t ev(EVENT_ANY);
        ev.function_name=name;	
        event_remove( &ev );
    }
    return erased;

}
开发者ID:Soares,项目名称:fish-shell,代码行数:13,代码来源:function.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ future类代码示例发布时间:2022-05-31
下一篇:
C++ function_autoload_t类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap