- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/CmdAction/VerboseAction.cpp
r92c52f rbf3817 5 5 * Author: heber 6 6 */ 7 8 // include config.h 9 #ifdef HAVE_CONFIG_H 10 #include <config.h> 11 #endif 7 12 8 13 #include "Helpers/MemDebug.hpp" … … 26 31 class CommandLineVerboseState : public ActionState { 27 32 public: 28 CommandLineVerboseState(const int _oldverbosity, const int _newverbosity) : 29 oldverbosity(_oldverbosity), 30 newverbosity(_newverbosity) 33 CommandLineVerboseState(int _verbosity) : 34 verbosity(_verbosity) 31 35 {} 32 int oldverbosity; 33 int newverbosity; 36 int verbosity; 34 37 }; 35 38 … … 58 61 59 62 Action::state_ptr CommandLineVerboseAction::performCall() { 60 int oldverbosity = getVerbosity(); 61 int newverbosity = 2; 63 int verbosity = 2; 62 64 63 ValueStorage::getInstance().queryCurrentValue(NAME, newverbosity);65 ValueStorage::getInstance().queryCurrentValue(NAME, verbosity); 64 66 65 if (oldverbosity != newverbosity) { 66 CommandLineVerboseState *UndoState = new CommandLineVerboseState(oldverbosity, newverbosity); 67 setVerbosity(newverbosity); 68 DoLog(0) && (Log() << Verbose(0) << "Setting verbosity from " << oldverbosity << " to " << newverbosity << "." << endl); 69 return Action::state_ptr(UndoState); 70 } else { 71 DoLog(0) && (Log() << Verbose(0) << "Verbosity remains unchanged at " << oldverbosity << "." << endl); 72 return Action::failure; 73 } 67 setVerbosity(verbosity); 68 DoLog(0) && (Log() << Verbose(0) << "Setting verbosity to " << verbosity << "." << endl); 69 return Action::success; 74 70 } 75 71 … … 77 73 CommandLineVerboseState *state = assert_cast<CommandLineVerboseState*>(_state.get()); 78 74 79 DoLog(0) && (Log() << Verbose(0) << "Setting verbosity from " << state->newverbosity << " to " << state->oldverbosity << "." << endl);80 setVerbosity(state->oldverbosity);75 int verbosity = 2; 76 ValueStorage::getInstance().queryCurrentValue(NAME, verbosity); 81 77 82 return Action::state_ptr(_state); 78 setVerbosity(state->verbosity); 79 return Action::state_ptr(new CommandLineVerboseState(verbosity)); 83 80 } 84 81 85 82 Action::state_ptr CommandLineVerboseAction::performRedo(Action::state_ptr _state){ 86 CommandLineVerboseState *state = assert_cast<CommandLineVerboseState*>(_state.get()); 87 88 DoLog(0) && (Log() << Verbose(0) << "Setting verbosity from " << state->oldverbosity << " to " << state->newverbosity << "." << endl); 89 setVerbosity(state->newverbosity); 90 91 return Action::state_ptr(_state); 83 return performUndo(_state); 92 84 } 93 85
Note:
See TracChangeset
for help on using the changeset viewer.