Changes between Version 8 and Version 9 of EFLWebKitCodingStyle


Ignore:
Timestamp:
Aug 13, 2012 6:38:18 PM (9 years ago)
Author:
gyuyoung.kim@samsung.com
Comment:

Add new coding style related to double not operator(!!)

Legend:

Unmodified
Added
Removed
Modified
  • EFLWebKitCodingStyle

    v8 v9  
    1010 * Use '''const''' keyword instead of '''#define''' when you define constant variable.
    1111 * Use NULL in public C headers instead of 0
     12 * Use '''double not operator(!!)''' when you modify a Eina Bool member variable which stores a value in a bit field.
    1213
    1314= Example =
    1415
    1516== Do not use abbreviation except for public APIs ==
    16 
    1717=== Public APIs ===
    18 
    1918{{{
    2019 EAPI void ewk_view_bg_color_set(Evas_Object *o, int r, int g, int b, int a);
     
    4140
    4241== Do not use Eina_Bool type except for public APIs ==
    43 
    4442=== Public APIs ===
    45 
    4643{{{
    4744EAPI Eina_Bool ewk_view_scale_set(Evas_Object *o, float scale_factor, Evas_Coord cx, Evas_Coord cy);
     
    4946
    5047=== Implementation ===
    51 
    5248{{{
    5349Eina_Bool ewk_view_scale_set(Evas_Object* ewkView, float scaleFactor, Evas_Coord centerX, Evas_Coord centerY)
     
    7066
    7167== Use "void" for empty parameter of public APIs ==
    72 
    73 === Right ===
    74 
     68=== Right ===
    7569{{{
    7670EAPI Ewk_Context *ewk_context_new(void);
     
    7872
    7973=== Wrong ===
    80 
    8174{{{
    8275EAPI Ewk_Context *ewk_context_new();
     
    8477
    8578== Place '*' operator to data type ==
    86 
    87 === Right ===
    88 
     79=== Right ===
    8980{{{
    9081static void _ewk_view_smart_show(Evas_Object* ewkView)
     
    9283
    9384=== Wrong ===
    94 
    9585{{{
    9686static void _ewk_view_smart_show(Evas_Object *ewkView)
     
    9888
    9989== Use C++ casting for type casting ==
    100 
    101 === Right ===
    102 
     90=== Right ===
    10391{{{
    10492 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
     
    10694
    10795=== Wrong ===
    108 
    10996{{{
    11097 Ewk_View_Smart_Data* smartData = (Ewk_View_Smart_Data*)data;
     
    174161=== Wrong ===
    175162{{{
    176 {{{
    177163/**
    178164 * Query action for this intent.
     
    184170EAPI const char *ewk_intent_action_get(const Ewk_Intent *intent);
    185171}}}
    186 }}}
     172
     173== Use double not operator(!!) when you modify a Eina Bool member variable which stores a value in a bit field. ==
     174=== Right ===
     175{{{
     176struct {
     177    ...
     178    bool pageCache : 1;
     179    ...
     180}
     181
     182Eina_Bool ewk_view_setting_page_cache_set(Evas_Object* ewkView, Eina_Bool enable)
     183{
     184    EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
     185    EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
     186    enable = !!enable;
     187    if (priv->settings.pageCache != enable) {
     188        priv->pageSettings->setUsesPageCache(enable);
     189        priv->settings.pageCache = enable;
     190    }
     191    return true;
     192}
     193}}}
     194=== Wrong ===
     195{{{
     196Eina_Bool ewk_settings_auto_load_images_set(Ewk_Settings* settings, Eina_Bool automatic)
     197{
     198    EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
     199
     200    automatic = !!automatic;
     201    WKPreferencesSetLoadsImagesAutomatically(settings->preferences.get(), automatic);
     202
     203    return true;
     204}
     205}}}