mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 22:40:05 +00:00
Settings container
This commit is contained in:
parent
08b1d6e152
commit
1ad67de71b
7 changed files with 251 additions and 14 deletions
50
scwx-qt/source/scwx/qt/settings/settings_container.hpp
Normal file
50
scwx-qt/source/scwx/qt/settings/settings_container.hpp
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
#pragma once
|
||||
|
||||
#include <scwx/qt/settings/settings_variable.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
{
|
||||
|
||||
template<class Container>
|
||||
class SettingsContainer : public SettingsVariable<Container>
|
||||
{
|
||||
public:
|
||||
using T = Container::value_type;
|
||||
|
||||
explicit SettingsContainer(const std::string& name);
|
||||
~SettingsContainer();
|
||||
|
||||
SettingsContainer(const SettingsContainer&) = delete;
|
||||
SettingsContainer& operator=(const SettingsContainer&) = delete;
|
||||
|
||||
SettingsContainer(SettingsContainer&&) noexcept;
|
||||
SettingsContainer& operator=(SettingsContainer&&) noexcept;
|
||||
|
||||
bool SetValueOrDefault(const Container& c) override;
|
||||
|
||||
bool Validate(const Container& c) const override;
|
||||
bool ValidateElement(const T& value) const;
|
||||
|
||||
T GetElementDefault() const;
|
||||
|
||||
void SetElementDefault(const T& value);
|
||||
void SetElementMinimum(const T& value);
|
||||
void SetElementMaximum(const T& value);
|
||||
void SetElementValidator(std::function<bool(const T&)> validator);
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
std::unique_ptr<Impl> p;
|
||||
};
|
||||
|
||||
#ifdef SETTINGS_CONTAINER_IMPLEMENTATION
|
||||
template class SettingsContainer<std::vector<int64_t>>;
|
||||
#endif
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
Loading…
Add table
Add a link
Reference in a new issue