Changeset 493 for library/bdm/base
- Timestamp:
- 08/11/09 08:32:02 (15 years ago)
- Location:
- library/bdm/base
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
library/bdm/base/user_info.cpp
r490 r493 63 63 64 64 void UI::MappedUI::add_class ( const string &class_name, const type_info * const class_type_info, const UI* const ui ) { 65 pair< const string, const UI* const > new_pair = make_pair ( class_name, ui ); 66 mapped_strings().insert ( new_pair ); 67 mapped_type_infos().insert ( make_pair ( class_type_info, new_pair.first ) ); 65 pair< StringToUIMap::iterator, bool> inres = 66 mapped_strings().insert ( 67 StringToUIMap::value_type( class_name, ui ) ); 68 if ( inres.second ) { 69 mapped_type_infos().insert ( 70 TypeInfoToStringMap::value_type ( 71 class_type_info, class_name ) ); 72 } 68 73 } 69 74 -
library/bdm/base/user_info.h
r483 r493 514 514 515 515 516 //! The only UI descendant class which is not intended for direct use. It should be accessed within the ::UIREGISTER macro only.516 //! The only UI descendant class which is not intended for direct use. It should be accessed within the UIREGISTER macro only. 517 517 //! \ref ui_page 518 518 template<typename T> class ParticularUI : private UI { 519 p rivate:520 //! Default constructor, which is intentionally declared as private519 public: 520 //! Constructor used by the UIREGISTER macro. 521 521 ParticularUI<T> ( const string &class_name ) : UI ( class_name, &typeid ( T ) ) {}; 522 523 public:524 //! The only instance of this class (each type T has its own instance) which is used as a factory for processing related UI525 static const ParticularUI<T>& factory;526 522 527 523 //! A method returning a brand new instance of class T, this method is the reason why there have to be a parameterless construcotor in class T … … 533 529 } 534 530 531 #define CONCATENATE0( name, line ) name##line 532 #define CONCATENATE( name, line ) CONCATENATE0( name, line ) 533 535 534 /*! 536 535 \def UIREGISTER(class_name) … … 543 542 */ 544 543 #ifndef BDMLIB 545 #define UIREGISTER(class_name) template<> const ParticularUI<class_name>& ParticularUI<class_name>::factory = ParticularUI<class_name>(#class_name)544 #define UIREGISTER(class_name) static ParticularUI<class_name> CONCATENATE(registrator, __LINE__)(#class_name) 546 545 #else 547 546 #define UIREGISTER(class_name)