From 42e6b27e1afda7fcd8beddd9676ba7edb6363a34 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 14 Jan 2019 16:21:56 +0100 Subject: modernize only - replace `static constexpr inline' with `static constexpr'. `inline' is implied. - use braced initializer lists where applicable - still missing `override' usages --- options/base-value.hpp | 2 +- options/connector.cpp | 7 +++++++ options/connector.hpp | 14 +------------- options/value-traits.hpp | 3 +-- 4 files changed, 10 insertions(+), 16 deletions(-) (limited to 'options') diff --git a/options/base-value.hpp b/options/base-value.hpp index 11d17c00..7a3ac420 100644 --- a/options/base-value.hpp +++ b/options/base-value.hpp @@ -17,7 +17,7 @@ #include -#define OTR_OPTIONS_SLOT(t) void setValue(t datum) { store_(datum); } +#define OTR_OPTIONS_SLOT(t) void setValue(t datum) noexcept { store_(datum); } #define OTR_OPTIONS_SIGNAL(t) void valueChanged(t) const namespace options { diff --git a/options/connector.cpp b/options/connector.cpp index 90770167..35d408d5 100644 --- a/options/connector.cpp +++ b/options/connector.cpp @@ -78,4 +78,11 @@ void connector::notify_all_values() const val->notify(); } +void connector::set_all_to_default_() +{ + for (auto& pair : connected_values) + for (auto& val : pair.second) + val->set_to_default(); +} + } // ns options::detail diff --git a/options/connector.hpp b/options/connector.hpp index 11aa94da..e22cb20f 100644 --- a/options/connector.hpp +++ b/options/connector.hpp @@ -39,23 +39,11 @@ protected: void notify_values(const QString& name) const; void notify_all_values() const; virtual QMutex* get_mtx() const = 0; - - template - void forall(F&& fun) - { - QMutexLocker l(get_mtx()); - - for (auto& pair : connected_values) - for (auto& val : pair.second) - fun(val); - } + void set_all_to_default_(); public: connector(); virtual ~connector(); - - connector(const connector&) = default; - connector& operator=(const connector&) = default; }; } // ns options::detail diff --git a/options/value-traits.hpp b/options/value-traits.hpp index 21e00d80..aeb34cfa 100644 --- a/options/value-traits.hpp +++ b/options/value-traits.hpp @@ -45,8 +45,7 @@ struct default_value_traits return self::qvariant_from_storage(self::storage_from_value(val)); } - static constexpr inline - value_type pass_value(const value_type& x) + static constexpr value_type pass_value(const value_type& x) { if constexpr(std::is_same_v) return x; -- cgit v1.2.3