You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
738 B

  1. #include "src/settings/SettingMemento.h"
  2. #include "src/settings/modules/ModuleSettings.h"
  3. namespace storm {
  4. namespace settings {
  5. SettingMemento::SettingMemento(modules::ModuleSettings& settings, std::string const& longOptionName, bool resetToState) : settings(settings), optionName(longOptionName), resetToState(resetToState) {
  6. // Intentionally left empty.
  7. }
  8. /*!
  9. * Destructs the memento object and resets the value of the option to its original state.
  10. */
  11. SettingMemento::~SettingMemento() {
  12. if (resetToState) {
  13. settings.set(optionName);
  14. } else {
  15. settings.unset(optionName);
  16. }
  17. }
  18. }
  19. }