| 61 | } |
| 62 | |
| 63 | class SettingChanges { |
| 64 | public: |
| 65 | SettingChanges() : m_settingChanges{} {} |
| 66 | SettingChanges(const SettingChanges&) = delete; |
| 67 | SettingChanges(SettingChanges&&) YAML_CPP_NOEXCEPT = default; |
| 68 | SettingChanges& operator=(const SettingChanges&) = delete; |
| 69 | SettingChanges& operator=(SettingChanges&& rhs) YAML_CPP_NOEXCEPT { |
| 70 | if (this == &rhs) |
| 71 | return *this; |
| 72 | |
| 73 | clear(); |
| 74 | std::swap(m_settingChanges, rhs.m_settingChanges); |
| 75 | |
| 76 | return *this; |
| 77 | } |
| 78 | ~SettingChanges() { clear(); } |
| 79 | |
| 80 | void clear() YAML_CPP_NOEXCEPT { |
| 81 | restore(); |
| 82 | m_settingChanges.clear(); |
| 83 | } |
| 84 | |
| 85 | void restore() YAML_CPP_NOEXCEPT { |
| 86 | for (const auto& setting : m_settingChanges) |
| 87 | setting->pop(); |
| 88 | } |
| 89 | |
| 90 | void push(std::unique_ptr<SettingChangeBase> pSettingChange) { |
| 91 | m_settingChanges.push_back(std::move(pSettingChange)); |
| 92 | } |
| 93 | |
| 94 | private: |
| 95 | using setting_changes = std::vector<std::unique_ptr<SettingChangeBase>>; |
| 96 | setting_changes m_settingChanges; |
| 97 | }; |
| 98 | } // namespace YAML |
| 99 | |
| 100 | #endif // SETTING_H_62B23520_7C8E_11DE_8A39_0800200C9A66 |