summaryrefslogtreecommitdiffhomepage
path: root/options
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2019-01-03 00:09:09 +0100
committerStanislaw Halik <sthalik@misaki.pl>2019-01-16 07:48:20 +0100
commit545071e998806235442edda5f575ee61e836abe9 (patch)
tree45579d717361f24c6f4a06354f5836447e691771 /options
parent4766be01022d6de50f7b42647299860c2d9909b8 (diff)
cruft
Diffstat (limited to 'options')
-rw-r--r--options/base-value.cpp2
-rw-r--r--options/base-value.hpp4
-rw-r--r--options/value.hpp20
3 files changed, 14 insertions, 12 deletions
diff --git a/options/base-value.cpp b/options/base-value.cpp
index be18bbfd..39453a09 100644
--- a/options/base-value.cpp
+++ b/options/base-value.cpp
@@ -2,7 +2,7 @@
using namespace options;
-value_::value_(bundle const& b, const QString& name) :
+value_::value_(bundle const& b, const QString& name) noexcept :
b(b), self_name(name)
{
b->on_value_created(this);
diff --git a/options/base-value.hpp b/options/base-value.hpp
index 7baff0b3..11d17c00 100644
--- a/options/base-value.hpp
+++ b/options/base-value.hpp
@@ -31,7 +31,7 @@ class OTR_OPTIONS_EXPORT value_ : public QObject
public:
QString name() const { return self_name; }
- value_(bundle const& b, const QString& name);
+ value_(bundle const& b, const QString& name) noexcept;
~value_() override;
// no C++17 "constexpr inline" for data declarations in MSVC
@@ -63,7 +63,7 @@ protected:
bundle b;
QString self_name;
- virtual void store_variant(const QVariant& x) = 0;
+ virtual void store_variant(const QVariant& x) noexcept = 0;
template<typename t>
void store_(const t& datum)
diff --git a/options/value.hpp b/options/value.hpp
index 6714d50d..64234ecf 100644
--- a/options/value.hpp
+++ b/options/value.hpp
@@ -44,7 +44,7 @@ class value final : public value_
using traits = detail::value_traits<t>;
cc_noinline
- t get() const
+ t get() const noexcept
{
if (self_name.isEmpty() || !b->contains(self_name))
return traits::pass_value(def);
@@ -57,7 +57,8 @@ class value final : public value_
return traits::pass_value(traits::value_with_default(traits::value_from_qvariant(variant), def));
}
- void store_variant(const QVariant& value) override
+ cc_noinline
+ void store_variant(const QVariant& value) noexcept override
{
if (self_name.isEmpty())
return;
@@ -78,7 +79,7 @@ public:
emit valueChanged(traits::storage_from_value(get()));
}
- value<u>& operator=(const t& datum)
+ value<u>& operator=(const t& datum) noexcept
{
store_variant(traits::qvariant_from_value(traits::pass_value(datum)));
@@ -88,11 +89,12 @@ public:
static constexpr inline Qt::ConnectionType DIRECT_CONNTYPE = Qt::DirectConnection;
static constexpr inline Qt::ConnectionType SAFE_CONNTYPE = Qt::QueuedConnection;
- value(bundle b, const QString& name, t def) :
- value_(b, name), def(std::move(def))
+ value(bundle b, const QString& name, t def) noexcept : value_(b, name), def(std::move(def))
{
}
+ value(const value<u>& other) noexcept : value{other.b, other.self_name, other.def} {}
+
t default_value() const
{
return def;
@@ -108,16 +110,16 @@ public:
template<typename w>
explicit cc_forceinline operator w() const { return to<w>(); }
- auto operator->() const
+ auto operator->() const noexcept
{
return detail::dereference_wrapper<t>{get()};
}
- cc_forceinline t operator()() const { return get(); }
- cc_forceinline t operator*() const { return get(); }
+ cc_forceinline t operator()() const noexcept { return get(); }
+ cc_forceinline t operator*() const noexcept { return get(); }
template<typename w>
- w to() const
+ w to() const noexcept
{
return static_cast<w>(get());
}