Changeset 271 for bdm/uibuilder.h

Show
Ignore:
Timestamp:
02/16/09 10:03:13 (15 years ago)
Author:
smidl
Message:

Next major revision

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • bdm/uibuilder.h

    r270 r271  
    1414#define UIREGISTER(UI) UI* UI##_global_instance = new UI(); 
    1515 
     16#define UICATCH         catch ( SettingTypeException e ) {it_error ( "Setting " +string ( e.getPath() ) +" is of incorrect Type" );}    catch ( SettingNotFoundException e ) {it_error ( "Setting " + string ( e.getPath() ) +" was not found" );} 
     17 
    1618////////// GLOBAL VAriables 
    1719 
     
    2527                UIFile ( const char * fname ) :Config() { 
    2628                        try{Config::readFile ( fname );} 
     29                        catch ( FileIOException f ) {it_error ( "File " + string ( fname ) + " not found" );} 
    2730                        catch ( ParseException& P ) { 
    2831                                char msg[200]; 
     
    3033                                it_error ( msg ); 
    3134                        } 
    32                         catch ( FileIOException f ) {it_error ( "File " + string ( fname ) + " not found" );} 
    3335                } 
    3436        }; 
     
    9597                        return tmp; 
    9698                }; 
    97         public: 
     99                const Array<string> get_as ( Setting& S ) const { 
     100                        CHECK_UITYPE ( S,TypeArray ); 
     101                        Array<string> tmp; 
     102                        tmp.set_size ( S.getLength() ); 
     103                        for ( int i=0;i<S.getLength();i++ ) {tmp(i)=(const char*)S[i];} 
     104                        return tmp; 
     105                }; 
     106                public: 
    98107                //!Constructor needs to be run only once macro UIREGISTER 
    99108                UIbuilder ( const string &typ ) {__uimap__.insert ( make_pair ( typ,this ) );} 
     
    135144                        ret = dynamic_cast<T*> ( iter->second->build ( S ) ); 
    136145                } 
    137                 catch ( SettingTypeException e ) { 
    138                         UI_DBG(S,"");  
    139                         it_error ( "Setting " +string ( e.getPath() ) +" is of incorrect Type" );} 
    140                 catch ( SettingNotFoundException e ) { 
    141                         UI_DBG(S,""); 
    142                         it_error ( "Setting " + string ( e.getPath() ) +" was not found" );} 
     146                UICATCH; 
    143147        }; 
    144148