Changeset 377 for tests

Show
Ignore:
Timestamp:
06/15/09 18:27:16 (16 years ago)
Author:
mido
Message:

1) globalni prejmenovani Setting &root na Setting &set
2) smazani par zastaralych adresaru
3) oprava warningu v doc\local
4) prejmenovani SettingsResolver? na SettingResolver? a drobne vylepseni funkcnosti
5) odstranena duplikace kodu v user_info.cpp

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • tests/testUI.cpp

    r357 r377  
    2424  } 
    2525 
    26   virtual void from_setting(const Setting &root) { 
    27     root.lookupValue("name", name); 
    28   } 
    29  
    30   virtual void to_setting(Setting &root) const { 
    31     Setting &name_setting = root.add("name", Setting::TypeString); 
     26  virtual void from_setting(const Setting &set) { 
     27    set.lookupValue("name", name); 
     28  } 
     29 
     30  virtual void to_setting(Setting &set) const { 
     31    Setting &name_setting = set.add("name", Setting::TypeString); 
    3232    name_setting = name; 
    3333  } 
     
    5050  } 
    5151 
    52   virtual void from_setting(const Setting &root) { 
    53     root.lookupValue("number", number); 
    54         if( root.exists( "software" ) ) 
    55                 UI::get(software, root, "software"); 
    56   } 
    57  
    58   virtual void to_setting(Setting &root) const { 
    59     Setting &number_setting = root.add("number", Setting::TypeInt); 
     52  virtual void from_setting(const Setting &set) { 
     53    set.lookupValue("number", number); 
     54        if( set.exists( "software" ) ) 
     55                UI::get(software, set, "software"); 
     56  } 
     57 
     58  virtual void to_setting(Setting &set) const { 
     59    Setting &number_setting = set.add("number", Setting::TypeInt); 
    6060    number_setting = number; 
    6161 
    62     UI::save(software, root, "software"); 
     62    UI::save(software, set, "software"); 
    6363  } 
    6464 
     
    8989  } 
    9090 
    91   virtual void from_setting(const Setting &root) { 
    92     root.lookupValue("year", year); 
    93     root.lookupValue("manufacturer", manufacturer); 
    94   } 
    95  
    96   virtual void to_setting(Setting &root) const { 
    97     Setting &year_setting = root.add("year", Setting::TypeInt); 
     91  virtual void from_setting(const Setting &set) { 
     92    set.lookupValue("year", year); 
     93    set.lookupValue("manufacturer", manufacturer); 
     94  } 
     95 
     96  virtual void to_setting(Setting &set) const { 
     97    Setting &year_setting = set.add("year", Setting::TypeInt); 
    9898    year_setting = year; 
    9999 
    100     Setting &manufacturer_setting = root.add("manufacturer", Setting::TypeString); 
     100    Setting &manufacturer_setting = set.add("manufacturer", Setting::TypeString); 
    101101    manufacturer_setting = manufacturer; 
    102102  } 
     
    118118  } 
    119119 
    120   virtual void from_setting(const Setting &root) { 
    121     Transport::from_setting(root); 
    122  
    123     root.lookupValue("kilometers", kilometers); 
    124  
    125         if( root.exists( "passengers" ) ) 
    126             UI::get(passengers, root, "passengers"); 
    127   } 
    128  
    129   virtual void to_setting(Setting &root) const { 
    130     Transport::to_setting(root); 
    131  
    132     Setting &kilometers_setting = root.add("kilometers", Setting::TypeInt); 
     120  virtual void from_setting(const Setting &set) { 
     121    Transport::from_setting(set); 
     122 
     123    set.lookupValue("kilometers", kilometers); 
     124 
     125        if( set.exists( "passengers" ) ) 
     126            UI::get(passengers, set, "passengers"); 
     127  } 
     128 
     129  virtual void to_setting(Setting &set) const { 
     130    Transport::to_setting(set); 
     131 
     132    Setting &kilometers_setting = set.add("kilometers", Setting::TypeInt); 
    133133    kilometers_setting = kilometers; 
    134134 
    135     UI::save(passengers, root, "passengers"); 
     135    UI::save(passengers, set, "passengers"); 
    136136  } 
    137137 
     
    167167  } 
    168168 
    169   void from_setting(const Setting &root) { 
    170     Transport::from_setting(root); 
    171  
    172     root.lookupValue("electricLights", electricLights); 
    173  
    174         UI::get(matr, root, "matr"); 
    175   } 
    176  
    177   void to_setting(Setting &root) const { 
    178     Transport::to_setting(root); 
    179  
    180     Setting &electricLights_setting = root.add("electricLights", Setting::TypeBoolean); 
     169  void from_setting(const Setting &set) { 
     170    Transport::from_setting(set); 
     171 
     172    set.lookupValue("electricLights", electricLights); 
     173 
     174        UI::get(matr, set, "matr"); 
     175  } 
     176 
     177  void to_setting(Setting &set) const { 
     178    Transport::to_setting(set); 
     179 
     180    Setting &electricLights_setting = set.add("electricLights", Setting::TypeBoolean); 
    181181    electricLights_setting = electricLights; 
    182182 
    183     UI::save(matr, root, "matr"); 
     183    UI::save(matr, set, "matr"); 
    184184  } 
    185185