Changes in src/Actions/Action.cpp [e4afb4:bcf653]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/Action.cpp
re4afb4 rbcf653 20 20 #include "Helpers/MemDebug.hpp" 21 21 22 #include <iostream>23 22 #include <string> 24 23 … … 26 25 #include "Actions/ActionRegistry.hpp" 27 26 #include "Actions/ActionHistory.hpp" 28 #include "Actions/OptionRegistry.hpp"29 #include "Actions/OptionTrait.hpp"30 27 #include "Exceptions/MissingValueException.hpp" 31 28 #include "UIElements/Dialog.hpp" 32 #include "Helpers/Assert.hpp"33 29 #include "Helpers/MemDebug.hpp" 34 30 #include "UIElements/UIFactory.hpp" … … 47 43 Action::state_ptr Action::failure = getEmptyState(); 48 44 49 Action::Action( const ActionTraits &_Traits,bool _doRegister) :50 Traits(_Traits)45 Action::Action(std::string _name,bool _doRegister) : 46 name(_name) 51 47 { 52 // register with ActionRegistry53 48 if(_doRegister){ 54 49 ActionRegistry::getInstance().registerInstance(this); 55 }56 57 // register with OptionRegistry58 for (ActionTraits::options_const_iterator optioniter = Traits.getBeginIter();59 optioniter != Traits.getEndIter();60 ++optioniter) {61 // options may have been re-used by other Actions, so check beforehand whether adding is needed62 if (!OptionRegistry::getInstance().isOptionPresentByName((optioniter->first))) {63 OptionRegistry::getInstance().registerInstance(optioniter->second);64 } else { // if present, ASSERT that types coincide65 OptionTrait const * const PresentOption = OptionRegistry::getInstance().getOptionByName(optioniter->first);66 ASSERT(PresentOption->getType() == optioniter->second->getType(),67 ("Action::Action() - option to add "+68 std::string(optioniter->first)+69 " of Action "+70 std::string(getName())+71 " is already present with different type!"72 )73 );74 }75 50 } 76 51 } … … 80 55 81 56 const string Action::getName(){ 82 return Traits.getName();57 return name; 83 58 } 84 59 … … 129 104 return true; 130 105 } 131
Note:
See TracChangeset
for help on using the changeset viewer.