summaryrefslogtreecommitdiffhomepage
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
parentb6c700d98bf52cf4326e39a03937b16cddb3b1fe (diff)
options: add some never_inline attribs
-rw-r--r--options/bundle.hpp10
-rw-r--r--options/connector.hpp4
-rw-r--r--options/value.hpp22
3 files changed, 24 insertions, 12 deletions
diff --git a/options/bundle.hpp b/options/bundle.hpp
index 51881a63..64210d33 100644
--- a/options/bundle.hpp
+++ b/options/bundle.hpp
@@ -66,12 +66,12 @@ signals:
void saving() const;
void changed() const;
public:
- bundle(const QString& group_name);
- ~bundle() override;
+ OTR_NEVER_INLINE bundle(const QString& group_name);
+ OTR_NEVER_INLINE ~bundle() override;
QString name() const { return group_name; }
- void store_kv(const QString& name, const QVariant& datum);
- bool contains(const QString& name) const;
- bool is_modified() const;
+ OTR_NEVER_INLINE void store_kv(const QString& name, const QVariant& datum);
+ OTR_NEVER_INLINE bool contains(const QString& name) const;
+ OTR_NEVER_INLINE bool is_modified() const;
template<typename t>
t get(const QString& name) const
diff --git a/options/connector.hpp b/options/connector.hpp
index abe72154..06f5d68e 100644
--- a/options/connector.hpp
+++ b/options/connector.hpp
@@ -51,12 +51,8 @@ protected:
QMutexLocker l(get_mtx());
for (auto& pair : connected_values)
- {
for (auto& val : std::get<0>(pair.second))
- {
fun(pair.first, val);
- }
- }
}
public:
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)