Changeset 534

Show
Ignore:
Timestamp:
08/14/09 15:55:25 (15 years ago)
Author:
vbarta
Message:

removed unused overload of UI::build, changed another one to return shared_ptr<T>

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/bdm/base/user_info.h

    r529 r534  
    349349 
    350350protected: 
    351         //! Default constructor for internal use only, see \sa ParticularUI<T> 
     351        //! Constructor for internal use only, see \sa ParticularUI<T> 
    352352        UI ( const string& class_name, const type_info * const class_type_info ) { 
    353353                MappedUI::add_class ( class_name, class_type_info, this ); 
     
    356356public: 
    357357 
    358         //! Enumerical type used to determine whether the data for concrete Settingis is compulsory or optional 
     358        //! Enum type used to determine whether the data for concrete Settingis is compulsory or optional 
    359359        enum SettingPresence { optional, compulsory } ; 
    360360 
     
    382382        //! The new instance of type T* is constructed and initialized with values stored in the Setting element[index] 
    383383        //! 
    384         //! If there is not any sub-element indexed by #index, the null pointer is returned. 
    385         template<class T> static T* build ( const Setting &element, const int index, SettingPresence settingPresence = optional ) { 
     384        //! If there is not any sub-element indexed by #index, and settingPresence is #optional, an empty shared_ptr<T> is returned. When settingPresence is #compulsory, the returned shared_ptr<T> is never empty (an exception is thrown when the object isn't found). 
     385        template<class T> 
     386        static shared_ptr<T> build ( const Setting &element, const int index, SettingPresence settingPresence = optional ) { 
    386387                if ( element.getLength() <= index ) { 
    387388                        if ( settingPresence == optional ) 
    388                                 return NULL; 
     389                                return shared_ptr<T>(); 
    389390                        else { 
    390391                                stringstream stream; 
     
    394395                } 
    395396 
    396                 T* instance; 
     397                shared_ptr<T> instance; 
    397398                from_setting<T> ( instance, to_child_setting ( element, index ) ); 
    398399                return instance; 
    399         } 
    400  
    401         //! The new instance of type T* is constructed and initialized with values stored in the Setting element 
    402         template<class T> static T* build ( const Setting &element ) { 
    403                 T* instance; 
    404                 from_setting<T> ( instance,  element ); 
    405                 return instance; 
    406  
    407400        } 
    408401