當前位置: 首頁>>代碼示例>>C++>>正文


C++ EINA_SAFETY_ON_NULL_RETURN_VAL函數代碼示例

本文整理匯總了C++中EINA_SAFETY_ON_NULL_RETURN_VAL函數的典型用法代碼示例。如果您正苦於以下問題:C++ EINA_SAFETY_ON_NULL_RETURN_VAL函數的具體用法?C++ EINA_SAFETY_ON_NULL_RETURN_VAL怎麽用?C++ EINA_SAFETY_ON_NULL_RETURN_VAL使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了EINA_SAFETY_ON_NULL_RETURN_VAL函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: ewk_js_object_new

Ewk_JS_Object* ewk_js_object_new(const Ewk_JS_Class_Meta* jsMetaClass)
{
#if ENABLE(NETSCAPE_PLUGIN_API)
    Ewk_JS_Object* object;

    EINA_SAFETY_ON_NULL_RETURN_VAL(jsMetaClass, 0);

    object = static_cast<Ewk_JS_Object*>(malloc(sizeof(Ewk_JS_Object)));
    if (!object) {
        ERR("Could not allocate memory for ewk_js_object");
        return 0;
    }

    EINA_MAGIC_SET(object, EWK_JS_OBJECT_MAGIC);
    object->cls = ewk_js_class_new(jsMetaClass);
    object->view = 0;
    object->name = 0;
    object->type = EWK_JS_OBJECT_OBJECT;

    if (eina_hash_population(object->cls->properties) < 25)
        object->properties = eina_hash_string_small_new(reinterpret_cast<Eina_Free_Cb>(ewk_js_variant_free));
    else
        object->properties = eina_hash_string_superfast_new(reinterpret_cast<Eina_Free_Cb>(ewk_js_variant_free));

    for (int i = 0; object->cls->meta->properties && object->cls->meta->properties[i].name; i++) {
        Ewk_JS_Property prop = object->cls->meta->properties[i];
        const char* key = object->cls->meta->properties[i].name;
        Ewk_JS_Variant* value = static_cast<Ewk_JS_Variant*>(malloc(sizeof(Ewk_JS_Variant)));
        if (!value) {
            ERR("Could not allocate memory for ewk_js_variant");
            goto error;
        }
        if (prop.get)
            prop.get(object, key, value);
        else {
            value->type = prop.value.type;
            switch (value->type) {
            case EWK_JS_VARIANT_VOID:
            case EWK_JS_VARIANT_NULL:
                value->value.o = 0;
                break;
            case EWK_JS_VARIANT_STRING:
                value->value.s = eina_stringshare_add(prop.value.value.s);
                break;
            case EWK_JS_VARIANT_BOOL:
                value->value.b = prop.value.value.b;
                break;
            case EWK_JS_VARIANT_INT32:
                value->value.i = prop.value.value.i;
                break;
            case EWK_JS_VARIANT_DOUBLE:
                value->value.d = prop.value.value.d;
                break;
            case EWK_JS_VARIANT_OBJECT:
                value->value.o = prop.value.value.o;
                break;
            }
        }
        eina_hash_add(object->properties, key, value);
    }

    object->base.object.referenceCount = 1;
    object->base.object._class = &EWK_NPCLASS;
    return object;

error:
    ewk_js_object_free(object);
    return 0;
#else
    UNUSED_PARAM(jsMetaClass);
    return 0;
#endif
}
開發者ID:dog-god,項目名稱:iptv,代碼行數:73,代碼來源:ewk_js.cpp

示例2: eolian_function_type_get

EAPI Eolian_Function_Type
eolian_function_type_get(const Eolian_Function *fid)
{
   EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EOLIAN_UNRESOLVED);
   return fid->type;
}
開發者ID:tasn,項目名稱:efl,代碼行數:6,代碼來源:database_function_api.c

示例3: efreet_desktop_category_count_get

EAPI unsigned int
efreet_desktop_category_count_get(Efreet_Desktop *desktop)
{
    EINA_SAFETY_ON_NULL_RETURN_VAL(desktop, 0);
    return eina_list_count(desktop->categories);
}
開發者ID:jordemort,項目名稱:efreet,代碼行數:6,代碼來源:efreet_desktop.c

示例4: eolian_function_implement_get

EAPI const Eolian_Implement *
eolian_function_implement_get(const Eolian_Function *fid)
{
   EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
   return fid->impl;
}
開發者ID:tasn,項目名稱:efl,代碼行數:6,代碼來源:database_function_api.c

示例5: eolian_function_object_is_const

EAPI Eina_Bool
eolian_function_object_is_const(const Eolian_Function *fid)
{
   EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
   return fid->obj_is_const;
}
開發者ID:tasn,項目名稱:efl,代碼行數:6,代碼來源:database_function_api.c

示例6: ewk_context_menu_item_title_set

const char* ewk_context_menu_item_title_set(Ewk_Context_Menu_Item* o, const char* title)
{
    EINA_SAFETY_ON_NULL_RETURN_VAL(o, 0);
    eina_stringshare_replace(&o->title, title);
    return o->title;
}
開發者ID:achellies,項目名稱:WinCEWebKit,代碼行數:6,代碼來源:ewk_contextmenu.cpp

示例7: ewk_context_menu_item_enabled_set

Eina_Bool ewk_context_menu_item_enabled_set(Ewk_Context_Menu_Item *o, Eina_Bool enabled)
{
    EINA_SAFETY_ON_NULL_RETURN_VAL(o, EINA_FALSE);
    o->enabled = enabled;
    return EINA_TRUE;
}
開發者ID:achellies,項目名稱:WinCEWebKit,代碼行數:6,代碼來源:ewk_contextmenu.cpp

示例8: eolian_typedecl_type_get

EAPI Eolian_Typedecl_Type
eolian_typedecl_type_get(const Eolian_Typedecl *tp)
{
   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, EOLIAN_TYPEDECL_UNKNOWN);
   return tp->type;
}
開發者ID:tasn,項目名稱:efl,代碼行數:6,代碼來源:database_type_api.c

示例9: eolian_typedecl_is_extern

EAPI Eina_Bool
eolian_typedecl_is_extern(const Eolian_Typedecl *tp)
{
   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, EINA_FALSE);
   return tp->is_extern;
}
開發者ID:tasn,項目名稱:efl,代碼行數:6,代碼來源:database_type_api.c

示例10: eolian_typedecl_base_type_get

EAPI const Eolian_Type *
eolian_typedecl_base_type_get(const Eolian_Typedecl *tp)
{
   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
   return tp->base_type;
}
開發者ID:tasn,項目名稱:efl,代碼行數:6,代碼來源:database_type_api.c

示例11: eolian_type_is_ptr

EAPI Eina_Bool
eolian_type_is_ptr(const Eolian_Type *tp)
{
   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, EINA_FALSE);
   return tp->is_ptr;
}
開發者ID:tasn,項目名稱:efl,代碼行數:6,代碼來源:database_type_api.c

示例12: eolian_type_builtin_type_get

EAPI Eolian_Type_Builtin_Type
eolian_type_builtin_type_get(const Eolian_Type *tp)
{
   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, EOLIAN_TYPE_BUILTIN_INVALID);
   return tp->btype;
}
開發者ID:tasn,項目名稱:efl,代碼行數:6,代碼來源:database_type_api.c

示例13: eolian_type_next_type_get

EAPI const Eolian_Type *
eolian_type_next_type_get(const Eolian_Type *tp)
{
   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
   return tp->next_type;
}
開發者ID:tasn,項目名稱:efl,代碼行數:6,代碼來源:database_type_api.c

示例14: eolian_typedecl_documentation_get

EAPI const Eolian_Documentation *
eolian_typedecl_documentation_get(const Eolian_Typedecl *tp)
{
   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
   return tp->doc;
}
開發者ID:tasn,項目名稱:efl,代碼行數:6,代碼來源:database_type_api.c

示例15: ewk_context_menu_item_action_set

Eina_Bool ewk_context_menu_item_action_set(Ewk_Context_Menu_Item* o, Ewk_Context_Menu_Action action)
{
    EINA_SAFETY_ON_NULL_RETURN_VAL(o, EINA_FALSE);
    o->action = action;
    return EINA_TRUE;
}
開發者ID:achellies,項目名稱:WinCEWebKit,代碼行數:6,代碼來源:ewk_contextmenu.cpp


注:本文中的EINA_SAFETY_ON_NULL_RETURN_VAL函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。