mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 16:30:05 +00:00
65 lines
1.5 KiB
C++
65 lines
1.5 KiB
C++
#include <scwx/qt/settings/settings_variable_base.hpp>
|
|
|
|
namespace scwx::qt::settings
|
|
{
|
|
|
|
static const std::string logPrefix_ =
|
|
"scwx::qt::settings::settings_variable_base";
|
|
|
|
class SettingsVariableBase::Impl
|
|
{
|
|
public:
|
|
explicit Impl(const std::string& name) : name_ {name} {}
|
|
|
|
~Impl() = default;
|
|
Impl(const Impl&) = delete;
|
|
Impl& operator=(const Impl&) = delete;
|
|
Impl(const Impl&&) = delete;
|
|
Impl& operator=(const Impl&&) = delete;
|
|
|
|
const std::string name_;
|
|
|
|
boost::signals2::signal<void()> changedSignal_ {};
|
|
boost::signals2::signal<void()> stagedSignal_ {};
|
|
};
|
|
|
|
SettingsVariableBase::SettingsVariableBase(const std::string& name) :
|
|
p(std::make_unique<Impl>(name))
|
|
{
|
|
}
|
|
|
|
SettingsVariableBase::~SettingsVariableBase() = default;
|
|
|
|
SettingsVariableBase::SettingsVariableBase(SettingsVariableBase&&) noexcept =
|
|
default;
|
|
|
|
SettingsVariableBase&
|
|
SettingsVariableBase::operator=(SettingsVariableBase&&) noexcept = default;
|
|
|
|
std::string SettingsVariableBase::name() const
|
|
{
|
|
return p->name_;
|
|
}
|
|
|
|
boost::signals2::signal<void()>& SettingsVariableBase::changed_signal()
|
|
{
|
|
return p->changedSignal_;
|
|
}
|
|
|
|
boost::signals2::signal<void()>& SettingsVariableBase::staged_signal()
|
|
{
|
|
return p->stagedSignal_;
|
|
}
|
|
|
|
bool SettingsVariableBase::Equals(const SettingsVariableBase& o) const
|
|
{
|
|
return p->name_ == o.p->name_;
|
|
}
|
|
|
|
bool operator==(const SettingsVariableBase& lhs,
|
|
const SettingsVariableBase& rhs)
|
|
{
|
|
return typeid(lhs) == typeid(rhs) && lhs.Equals(rhs);
|
|
}
|
|
|
|
} // namespace scwx::qt::settings
|