Changeset 281 for bdm/uibuilder.cpp

Show
Ignore:
Timestamp:
02/24/09 14:13:23 (15 years ago)
Author:
smidl
Message:

new version of mpf_test for TR2245

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • bdm/uibuilder.cpp

    r278 r281  
    11#include "uibuilder.h" 
    22 
    3 namespace bdm{ 
    4          
    5         //! global map of UIbulder names to instances of UIbuilders. Created by UIREGISTER macro 
     3namespace bdm { 
     4 
     5//! global map of UIbulder names to instances of UIbuilders. Created by UIREGISTER macro 
    66UImap __uimap__; 
    77 
    8 bdmroot* UIexternal::build(Setting &S) const{ 
     8bdmroot* UIexternal::build ( Setting &S ) const { 
    99        Config C; 
    1010        bdmroot* tmp; 
    11         try{ 
    12                 C.readFile((const char*)S["filename"]); 
    13         } catch (...){ 
    14                 it_error("File " + string((const char*)S["filename"]) + " not found or broken"); 
     11        try { 
     12                C.readFile ( ( const char* ) S["filename"] ); 
    1513        } 
    16         try {    
    17                 Setting& remS=C.lookup((const char*)S["path"]); 
    18                 UIbuild(remS,tmp); 
     14        catch ( ... ) { 
     15                it_error ( "File " + string ( ( const char* ) S["filename"] ) + " not found or broken" ); 
    1916        } 
    20         catch (...) { it_error("External field " + string(S.getPath()) + " not valid"); 
     17        try { 
     18                Setting& remS=C.lookup ( ( const char* ) S["path"] ); 
     19                UIbuild ( remS,tmp ); 
     20        } 
     21        catch ( ... ) { 
     22                it_error ( "External field " + string ( S.getPath() ) + " not valid" ); 
    2123        } 
    2224        return tmp; 
    2325}; 
    24 UIREGISTER(UIexternal); 
     26UIREGISTER ( UIexternal ); 
    2527 
    26 bdmroot* UIinternal::build(Setting &S) const{ 
     28bdmroot* UIinternal::build ( Setting &S ) const { 
    2729        bdmroot* tmp; 
    28         try {    
     30        try { 
    2931                Setting* Stmp = &S; 
    30                 do {Stmp=&(Stmp->getParent());} while (!Stmp->isRoot()); 
    31                 Setting& intS=Stmp->lookup((const char*)S["path"]); 
    32                 UIbuild(intS,tmp); 
     32                do {Stmp=& ( Stmp->getParent() );} 
     33                while ( !Stmp->isRoot() ); 
     34                Setting& intS=Stmp->lookup ( ( const char* ) S["path"] ); 
     35                UIbuild ( intS,tmp ); 
    3336        } 
    34         catch (...) { it_error("Internal field " + string(S.getPath()) + " not valid"); 
     37        catch ( ... ) { 
     38                it_error ( "Internal field " + string ( S.getPath() ) + " not valid" ); 
    3539        } 
    3640        return tmp; 
    3741}; 
    38 UIREGISTER(UIinternal); 
     42UIREGISTER ( UIinternal ); 
    3943 
    40         void UI_DBG ( Setting &S, const string &spc ) { 
    41                 const char *Name=S.getName(); 
    42                 if ( Name!=NULL ) {cout << spc << std::string ( Name );}; 
    43                 Setting::Type T=S.getType(); 
    44                 switch ( T ) { 
    45                         case Setting::TypeArray: 
    46                                 cout << endl; 
    47                                 for ( int i=0;i<S.getLength();i++ ) {UI_DBG ( S[i], spc+" " );}; 
    48                                 break; 
    49                         case Setting::TypeList: 
    50                                 cout << endl; 
    51                                 for ( int i=0;i<S.getLength();i++ ) {UI_DBG ( S[i], spc+" " );}; 
    52                                 break; 
    53                         case Setting::TypeGroup: 
    54                                 cout << endl; 
    55                                 for ( int i=0;i<S.getLength();i++ ) {UI_DBG ( S[i], spc+" " );} 
    56                                 break; 
    57                         case Setting::TypeInt: 
    58                                 cout << " = "; 
    59                                 cout << int ( S ) <<endl; 
    60                                 break; 
    61                         case Setting::TypeFloat: 
    62                                 cout << " = "; 
    63                                 cout << double ( S ) <<endl; 
    64                                 break; 
    65                         case Setting::TypeString: 
    66                                 cout << " = "; 
    67                                 cout << ( const char* ) ( S ) <<endl; 
    68                                 break; 
    69                         case Setting::TypeBoolean: 
    70                                 cout << " = "; 
    71                                 cout << bool ( S ) <<endl; 
    72                                 break; 
    73                                 default: {cout << "?";}; 
    74                 } 
     44void UI_DBG ( Setting &S, const string &spc ) { 
     45        const char *Name=S.getName(); 
     46        if ( Name!=NULL ) {cout << spc << std::string ( Name );}; 
     47        Setting::Type T=S.getType(); 
     48        switch ( T ) { 
     49                case Setting::TypeArray: 
     50                        cout << endl; 
     51                        for ( int i=0;i<S.getLength();i++ ) {UI_DBG ( S[i], spc+" " );}; 
     52                        break; 
     53                case Setting::TypeList: 
     54                        cout << endl; 
     55                        for ( int i=0;i<S.getLength();i++ ) {UI_DBG ( S[i], spc+" " );}; 
     56                        break; 
     57                case Setting::TypeGroup: 
     58                        cout << endl; 
     59                        for ( int i=0;i<S.getLength();i++ ) {UI_DBG ( S[i], spc+" " );} 
     60                        break; 
     61                case Setting::TypeInt: 
     62                        cout << " = "; 
     63                        cout << int ( S ) <<endl; 
     64                        break; 
     65                case Setting::TypeFloat: 
     66                        cout << " = "; 
     67                        cout << double ( S ) <<endl; 
     68                        break; 
     69                case Setting::TypeString: 
     70                        cout << " = "; 
     71                        cout << ( const char* ) ( S ) <<endl; 
     72                        break; 
     73                case Setting::TypeBoolean: 
     74                        cout << " = "; 
     75                        cout << bool ( S ) <<endl; 
     76                        break; 
     77                default: {cout << "?";}; 
    7578        } 
     79} 
    7680 
    7781}