Changeset 710
- Timestamp:
- 11/05/09 17:51:42 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
library/bdm/base/user_info.h
r691 r710 493 493 //! If there is not any sub-element named #name, this method returns false. 494 494 template<class T> static bool get ( Array<T> &array_to_load, const Setting &element, const string &name, SettingPresence settingPresence = optional ) { 495 if ( !element.exists ( name ) ) 496 return false; 495 if ( !element.exists ( name ) ) { 496 if ( settingPresence == optional ) 497 return false; 498 else 499 throw UISettingException ( "UIException: the compulsory Setting named \"" + name + "\" is missing.", element ); 500 } 497 501 498 502 from_setting ( array_to_load, to_child_setting ( element, name ) ); … … 503 507 //! If there is not any sub-element indexed by #index, this method returns false. 504 508 template<class T> static bool get ( Array<T> &array_to_load, const Setting &element, const int index, SettingPresence settingPresence = optional ) { 505 if ( element.getLength() <= index ) 506 return false; 509 if ( element.getLength() <= index ) { 510 if ( settingPresence == optional ) 511 return shared_ptr<T>(); 512 else { 513 stringstream stream; 514 stream << index; 515 throw UISettingException ( "UIException: the compulsory Setting with the index " + stream.str() + " is missing.", element ); 516 } 517 } 507 518 508 519 from_setting ( array_to_load, to_child_setting ( element, index ) );