summaryrefslogtreecommitdiffhomepage
path: root/options/value.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-03-25 09:23:51 +0100
committerStanislaw Halik <sthalik@misaki.pl>2017-03-25 09:33:21 +0100
commitd1415b21a482668e415126408764ca84593a25b3 (patch)
tree67580088d475ce7cb0234980d7676b2954fb05d2 /options/value.hpp
parentb6c700d98bf52cf4326e39a03937b16cddb3b1fe (diff)
options: add some never_inline attribs
Diffstat (limited to 'options/value.hpp')
-rw-r--r--options/value.hpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/options/value.hpp b/options/value.hpp
index 84416a94..204fa15a 100644
--- a/options/value.hpp
+++ b/options/value.hpp
@@ -146,6 +146,7 @@ class value final : public base_value
public:
using element_type = detail::value_element_type_t<t>;
+ OTR_NEVER_INLINE
t operator=(const t& datum)
{
const element_type tmp = static_cast<element_type>(datum);
@@ -157,7 +158,9 @@ public:
static constexpr const Qt::ConnectionType DIRECT_CONNTYPE = Qt::DirectConnection;
static constexpr const Qt::ConnectionType SAFE_CONNTYPE = Qt::QueuedConnection;
- value(bundle b, const QString& name, t def) : base_value(b, name, &is_equal, std::type_index(typeid(element_type))), def(def)
+ OTR_NEVER_INLINE
+ value(bundle b, const QString& name, t def) :
+ base_value(b, name, &is_equal, std::type_index(typeid(element_type))), def(def)
{
QObject::connect(b.get(), SIGNAL(reloading()),
this, SLOT(reload()),
@@ -166,6 +169,7 @@ public:
*this = def;
}
+ OTR_NEVER_INLINE
value(bundle b, const char* name, t def) : value(b, QString(name), def)
{
}
@@ -175,13 +179,16 @@ public:
return def;
}
+ OTR_NEVER_INLINE
void set_to_default() override
{
*this = def;
}
+ OTR_NEVER_INLINE
operator t() const { return get(); }
+ OTR_NEVER_INLINE
void reload() override
{
*this = static_cast<t>(*this);
@@ -192,12 +199,21 @@ public:
emit valueChanged(static_cast<detail::value_type_t<t>>(get()));
}
- element_type operator()() const
+ OTR_NEVER_INLINE
+ t operator()() const
{
- return get();
+ return static_cast<t>(get());
+ }
+
+ template<typename u>
+ OTR_NEVER_INLINE
+ u to()
+ {
+ return static_cast<u>(get());
}
private:
+ OTR_NEVER_INLINE
t get() const
{
t val = b->contains(self_name)