Changeset 534
- Timestamp:
- 08/14/09 15:55:25 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
library/bdm/base/user_info.h
r529 r534 349 349 350 350 protected: 351 //! Default constructor for internal use only, see \sa ParticularUI<T>351 //! Constructor for internal use only, see \sa ParticularUI<T> 352 352 UI ( const string& class_name, const type_info * const class_type_info ) { 353 353 MappedUI::add_class ( class_name, class_type_info, this ); … … 356 356 public: 357 357 358 //! Enum ericaltype used to determine whether the data for concrete Settingis is compulsory or optional358 //! Enum type used to determine whether the data for concrete Settingis is compulsory or optional 359 359 enum SettingPresence { optional, compulsory } ; 360 360 … … 382 382 //! The new instance of type T* is constructed and initialized with values stored in the Setting element[index] 383 383 //! 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 ) { 386 387 if ( element.getLength() <= index ) { 387 388 if ( settingPresence == optional ) 388 return NULL;389 return shared_ptr<T>(); 389 390 else { 390 391 stringstream stream; … … 394 395 } 395 396 396 T*instance;397 shared_ptr<T> instance; 397 398 from_setting<T> ( instance, to_child_setting ( element, index ) ); 398 399 return instance; 399 }400 401 //! The new instance of type T* is constructed and initialized with values stored in the Setting element402 template<class T> static T* build ( const Setting &element ) {403 T* instance;404 from_setting<T> ( instance, element );405 return instance;406 407 400 } 408 401