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


C++ eina_hash_find函数代码示例

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


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

示例1: loader_module_find

static Evas_Loader_Module_Api *
loader_module_find(const char *type)
{
   Evas_Loader_Module_Api *l;
   Eina_Module *em;
   char buf[PATH_MAX];

   l = eina_hash_find(loaders, type);
   if (l) return l;

   /* FIXME: Look in every possible path, but what will those be? */
   snprintf(buf, sizeof(buf), PACKAGE_LIB_DIR "/evas/cserve2/loaders/%s/%s/%s",
            type, MODULE_ARCH, EVAS_MODULE_NAME_IMAGE_LOADER);

   em = eina_module_new(buf);
   if (!em) return NULL;

   if (!eina_module_load(em))
     {
        eina_module_free(em);
        return NULL;
     }

   l = eina_hash_find(loaders, type);
   if (l)
     {
        modules = eina_list_append(modules, em);
        return l;
     }

   eina_module_free(em);

   return NULL;
}
开发者ID:TetragrammatonHermit,项目名称:enlightenment,代码行数:34,代码来源:evas_cserve2_slave.c

示例2: deserialize_sinks_watcher

static void
deserialize_sinks_watcher(Pulse *conn, Pulse_Tag *tag)
{
   pa_subscription_event_type_t e;
   uint32_t idx;

   EINA_SAFETY_ON_FALSE_RETURN(untag_uint32(tag, &e));
   EINA_SAFETY_ON_FALSE_RETURN(untag_uint32(tag, &idx));

   if (e & PA_SUBSCRIPTION_EVENT_CHANGE)
     {
        Pulse_Sink *sink;

        sink = eina_hash_find(pulse_sinks, &idx);
        if (sink)
          {
             if (pulse_sink_get(conn, idx))
               sink->update = EINA_TRUE;
          }
        else
          {
             sink = eina_hash_find(pulse_sources, &idx);
             if (!sink) return;
             if (pulse_source_get(conn, idx))
               sink->update = EINA_TRUE;
          }
     }
}
开发者ID:amitesh-singh,项目名称:Enlightenment,代码行数:28,代码来源:serial.c

示例3: efreet_desktop_free

/**
 * @internal
 * @param desktop: The Efreet_Desktop to work with
 * @return Returns no value
 * @brief Frees the Efreet_Desktop structure and all of it's data
 */
EAPI void
efreet_desktop_free(Efreet_Desktop *desktop)
{
    if (!desktop) return;

    desktop->ref--;
    if (desktop->ref > 0) return;

    if (desktop->cached)
    {
       if (efreet_desktop_cache &&
           desktop == eina_hash_find(efreet_desktop_cache, desktop->orig_path))
       {
           eina_hash_del_by_key(efreet_desktop_cache, desktop->orig_path);
       }
       else if (old_caches)
       {
           Efreet_Old_Cache *d;
           Efreet_Desktop *curr;
           Eina_List *l;

           EINA_LIST_FOREACH(old_caches, l, d)
           {
               curr = eina_hash_find(d->desktop_cache, desktop->orig_path);
               if (curr && curr == desktop)
               {
                   eina_hash_del_by_key(d->desktop_cache, desktop->orig_path);
                   break;
               }
           }
       }
    }
开发者ID:OpenInkpot-archive,项目名称:efreet,代码行数:38,代码来源:efreet_desktop.c

示例4: START_TEST

END_TEST

START_TEST(eina_hash_int32_fuzze)
{
   Eina_Hash *hash;
   Eina_List *added = NULL;
   unsigned int *r;
   unsigned int i;
   unsigned int j;
   unsigned int seed;

   eina_init();

   seed = time(NULL);
   srand(seed);

   hash = eina_hash_int32_new(free);

   for (i = 0; i < 10000; ++i)
     {
        r = malloc(sizeof (unsigned int));
        *r = rand();
        eina_hash_direct_add(hash, r, r);
     }

   for (j = 0; j < 100; ++j)
     {
        for (i = 0; i < 1000; ++i)
          {
             do
               {
                  unsigned int tr;

                  tr = rand();
                  r = eina_hash_find(hash, &tr);
                  if (r)
                    {
                       r = NULL;
                       continue;
                    }

                  r = malloc(sizeof (unsigned int));
                  *r = tr;
                  eina_hash_direct_add(hash, r, r);
                  added = eina_list_append(added, r);
               }
             while (r == NULL);
          }

        EINA_LIST_FREE(added, r)
          {
             unsigned int *s;

             s = eina_hash_find(hash, r);
	     fail_if(s != r);
             eina_hash_del(hash, r, r);
          }
     }
开发者ID:RomainNaour,项目名称:efl,代码行数:58,代码来源:eina_test_hash.c

示例5: _cb_property_get

static Eldbus_Message *
_cb_property_get(const Eldbus_Service_Interface *piface, const Eldbus_Message *msg)
{
   const char *propname, *iface_name;
   Eldbus_Service_Object *obj = piface->obj;
   Eldbus_Service_Interface *iface;
   Property *prop;
   Eldbus_Message *reply, *error_reply = NULL;
   Eldbus_Message_Iter *main_iter, *variant;
   Eina_Bool ret;
   Eldbus_Property_Get_Cb getter = NULL;

   if (!eldbus_message_arguments_get(msg, "ss", &iface_name, &propname))
     return NULL;

   iface = eina_hash_find(obj->interfaces, iface_name);
   if (!iface)
     return eldbus_message_error_new(msg, DBUS_ERROR_UNKNOWN_INTERFACE,
                                    "Interface not found.");

   prop = eina_hash_find(iface->properties, propname);
   if (!prop || prop->is_invalidate) goto not_found;

   if (prop->property->get_func)
     getter = prop->property->get_func;
   else if (iface->get_func)
     getter = iface->get_func;

   if (!getter) goto not_found;

   reply = eldbus_message_method_return_new(msg);
   EINA_SAFETY_ON_NULL_RETURN_VAL(reply, NULL);

   main_iter = eldbus_message_iter_get(reply);
   variant = eldbus_message_iter_container_new(main_iter, 'v',
                                              prop->property->type);

   ret = getter(iface, propname, variant, msg, &error_reply);

   if (ret)
     {
        eldbus_message_iter_container_close(main_iter, variant);
        return reply;
     }

   eldbus_message_unref(reply);
   return error_reply;

not_found:
   return eldbus_message_error_new(msg, DBUS_ERROR_UNKNOWN_PROPERTY,
                                  "Property not found.");
}
开发者ID:tguillem,项目名称:efl,代码行数:52,代码来源:eldbus_service.c

示例6: _sub_path_process

static void
_sub_path_process(Elm_App_Client *eo, Eldbus_Message_Iter *obj_iter, Elm_App_Client_Data *data, Eina_Bool loading_list)
{
   const char *obj_path;
   Eldbus_Message_Iter *array_iface, *iface;

   eldbus_message_iter_arguments_get(obj_iter, "oa{sa{sv}}", &obj_path, &array_iface);
   while (eldbus_message_iter_get_and_next(array_iface, '{', &iface))
     {
        const char *iface_name;
        Eldbus_Message_Iter *array_props;
        Elm_App_Client_View *view;

        eldbus_message_iter_arguments_get(iface, "sa{sv}", &iface_name,
                                          &array_props);
        if (strcmp(iface_name, "org.enlightenment.ApplicationView1"))
          continue;

        view = eina_hash_find(data->views, obj_path);
        if (view)
          continue;

        view = eo_add(ELM_APP_CLIENT_VIEW_CLASS, eo,
                             elm_app_client_view_path_set(obj_path));
        eina_hash_add(data->views, obj_path, view);
        if (!loading_list)
          eo_do(eo, eo_event_callback_call(ELM_APP_CLIENT_EVENT_VIEW_CREATED, view));
     }
}
开发者ID:FlorentRevest,项目名称:Elementary,代码行数:29,代码来源:elm_app_client.c

示例7: etam_packets_del

void
etam_packets_del(Etam_Collection *coll, const char *name)
{
   Etam_Packets *r;

   if (!coll) return ;

   eina_rwlock_take_write(&coll->lock);

   r = eina_hash_find(coll->rows, name);
   if (!r) goto end;

   eina_hash_del(coll->rows, name, r);

   eina_rwlock_take_write(&r->lock);

   EINA_REFCOUNT_UNREF(r)
   {
      eina_rwlock_release(&r->lock);
      etam_packets_free(r);
      r = NULL;
   }

   if (r) eina_rwlock_release(&r->lock);

 end:
   eina_rwlock_release(&coll->lock);
}
开发者ID:Limsik,项目名称:e17,代码行数:28,代码来源:etam_packets.c

示例8: trigger_run

static Eina_Bool trigger_run(void *data)
{
	struct callback_trigger_data *trigger = data;
	struct connline_context *context;
	connline_callback_f callback;
	enum connline_event event;
	char **changed_property;
	Ecore_Timer *e_timer;
	Eina_Hash *context_ht;

	if (trigger == NULL)
		return EINA_FALSE;

	callback = trigger->callback;
	context = trigger->context;
	event = trigger->event;

	changed_property = trigger->changed_property;
	trigger->changed_property = NULL;

	e_timer = trigger->e_timer;
	trigger->e_timer = NULL;

	callback(context, event, changed_property, context->user_data);

	context_ht = eina_hash_find(triggers_table, context);
	if (context_ht != NULL)
		eina_hash_del(context_ht, e_timer, NULL);

	return FALSE;
}
开发者ID:connectivity,项目名称:connline,代码行数:31,代码来源:efl.c

示例9: e_mod_comp_atoms_name_get

EINTERN const char *
e_mod_comp_atoms_name_get(Ecore_X_Atom a)
{
   E_CHECK_RETURN(a, NULL);
   return eina_hash_find(atoms_hash,
                         e_util_winid_str_get(a));
}
开发者ID:tizenorg,项目名称:framework.uifw.e17-extra-modules,代码行数:7,代码来源:e_mod_comp_atoms.c

示例10: email_config_data_remove

EAPI Eina_Bool
email_config_data_remove(Email_Config *cfg,
                         const char   *key)
{
    EINA_SAFETY_ON_NULL_RETURN_VAL(cfg, EINA_FALSE);
    EINA_SAFETY_ON_NULL_RETURN_VAL(key, EINA_FALSE);

    Hash_Data *hd;
    Eina_Bool chk;

    _config_lock(cfg);

    /*
     * Set the free_cb to NULL, so the data will just be
     * removed from the hash table, not freed behind the
     * hood.
     */
    hd = eina_hash_find(cfg->user_config, key);
    if (EINA_UNLIKELY(!hd))
    {
        _config_unlock(cfg);
        ERR("No data found for key \"%s\"", key);
        return EINA_FALSE;
    }
    hd->free_cb = NULL;
    chk = eina_hash_del(cfg->user_config, key, hd);
    _config_unlock(cfg);
    if (EINA_UNLIKELY(!chk))
    {
        ERR("Failed to delete item for key \"%s\"", key);
        return EINA_FALSE;
    }

    return EINA_TRUE;
}
开发者ID:jeanguyomarch,项目名称:Email,代码行数:35,代码来源:email_config.c

示例11: process_job_results

list_t * process_job_results(Eina_Hash *map_histo, list_t *files, float threshold)
{
    list_t * similar_files = NULL;
    list_t * lst_files = NULL;
    list_t * list_histo = NULL;
    list_t * current = NULL;

    while(files) {
        histogram_t *cached_elem = eina_hash_find(map_histo, files->value);
        list_histo = list_append(list_histo, cached_elem);
        files = files->next;
    }

    printf("Looking for similarities in %i elements with threshold %.2f\n"
           , eina_hash_population(map_histo), threshold);
    current = list_histo;
    while(current) {
        lst_files = search_similar(current->value
                                   , current->next, threshold);
        current = current->next;
        similar_files = list_append(similar_files, lst_files);
    }
    list_release(list_histo);

    return similar_files;
}
开发者ID:bonnefoa,项目名称:imagecmp,代码行数:26,代码来源:job_handler.c

示例12: ewk_js_method_invoke

static bool ewk_js_method_invoke(NPObject* npObject, NPIdentifier name, const NPVariant* npArgs, uint32_t npArgCount, NPVariant* result)
{
    Ewk_JS_Object* object = reinterpret_cast<Ewk_JS_Object*>(npObject);
    Ewk_JS_Method* method;
    Ewk_JS_Variant* args;
    Ewk_JS_Variant* ret_val;

    EINA_SAFETY_ON_NULL_RETURN_VAL(npObject, false);
    EINA_MAGIC_CHECK_OR_RETURN(object, false);

    if (!_NPN_IdentifierIsString(name)) {
        ERR("int NPIdentifier is not supported.");
        return false;
    }

    method = static_cast<Ewk_JS_Method*>(eina_hash_find(object->cls->methods, name));
    if (!method)
        return false;

    args = static_cast<Ewk_JS_Variant*>(malloc(sizeof(Ewk_JS_Variant)  *npArgCount));
    if (!args) {
        ERR("Could not allocate memory for ewk_js_variant");
        return false;
    }

    for (uint32_t i = 0; i < npArgCount; i++)
        ewk_js_npvariant_to_variant(&args[i], &npArgs[i]);
    ret_val = method->invoke(object, args, npArgCount);
    ewk_js_variant_to_npvariant(ret_val, result);

    ewk_js_variant_free(ret_val);

    return true;
}
开发者ID:dog-god,项目名称:iptv,代码行数:34,代码来源:ewk_js.cpp

示例13: evas_module_register

Eina_Bool
evas_module_register(const Evas_Module_Api *module, Evas_Module_Type type)
{
   Evas_Module *em;

   if ((unsigned int)type > 3) return EINA_FALSE;
   if (!module) return EINA_FALSE;
   if (module->version != EVAS_MODULE_API_VERSION) return EINA_FALSE;

   em = eina_hash_find(evas_modules[type], module->name);
   if (em) return EINA_FALSE;

   em = calloc(1, sizeof (Evas_Module));
   if (!em) return EINA_FALSE;

   em->definition = module;

   if (type == EVAS_MODULE_TYPE_ENGINE)
     {
	eina_array_push(evas_engines, em);
	em->id_engine = eina_array_count(evas_engines);
     }

   eina_hash_direct_add(evas_modules[type], module->name, em);

   return EINA_TRUE;
}
开发者ID:antognolli,项目名称:Evas,代码行数:27,代码来源:evas_module.c

示例14: _ecore_evas_engine_load

Eina_Module *
_ecore_evas_engine_load(const char *engine)
{
   const char *path;
   Eina_List *l;
   Eina_Module *em = NULL;

   EINA_SAFETY_ON_NULL_RETURN_VAL(engine, NULL);

   em =  (Eina_Module *)eina_hash_find(_registered_engines, engine);
   if (em) return em;

   EINA_LIST_FOREACH(_engines_paths, l, path)
     {
        char tmp[PATH_MAX];

        snprintf(tmp, sizeof (tmp), "%s/%s/%s/"ECORE_EVAS_ENGINE_NAME, path, engine, MODULE_ARCH);
        em = eina_module_new(tmp);
        if (!em) continue;

        if (!eina_module_load(em))
          {
             eina_module_free(em);
             continue;
          }
        if (eina_hash_add(_registered_engines, engine, em))
          return em;
     }
开发者ID:TetragrammatonHermit,项目名称:enlightenment,代码行数:28,代码来源:ecore_evas_module.c

示例15: ewk_js_property_remove

static bool ewk_js_property_remove(NPObject* npObject, NPIdentifier name)
{
    Ewk_JS_Object* object = reinterpret_cast<Ewk_JS_Object*>(npObject);
    Ewk_JS_Property* prop;
    bool fail = false;

    EINA_SAFETY_ON_NULL_RETURN_VAL(npObject, false);
    EINA_MAGIC_CHECK_OR_RETURN(object, false);

    if (!_NPN_IdentifierIsString(name)) {
        ERR("int NPIdentifier is not supported.");
        return fail;
    }

    char* prop_name = _NPN_UTF8FromIdentifier(name);
    prop = static_cast<Ewk_JS_Property*>(eina_hash_find(object->cls->properties, prop_name));
    if (prop && prop->del)
        fail = prop->del(object, prop->name); // Class has property and property has getter.
    else if (object->cls->default_prop.del)
        fail = object->cls->default_prop.del(object, prop_name);
    else
        fail = eina_hash_del(object->properties, prop_name, 0);

    free(prop_name);
    return fail;
}
开发者ID:dog-god,项目名称:iptv,代码行数:26,代码来源:ewk_js.cpp


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