diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-07-02 08:20:47 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-07-02 09:34:17 +0200 |
commit | f2faf7acf4445fef2a149ebbdecb569a2d119d94 (patch) | |
tree | 6629ba211a70a54a0ab82f6c4f4de08504072951 /options/bundle.hpp | |
parent | 66e75860d0c54baa39ed789442b09b96eeebe2e6 (diff) |
nothing important
Diffstat (limited to 'options/bundle.hpp')
-rw-r--r-- | options/bundle.hpp | 51 |
1 files changed, 30 insertions, 21 deletions
diff --git a/options/bundle.hpp b/options/bundle.hpp index 98e194db..a12a335c 100644 --- a/options/bundle.hpp +++ b/options/bundle.hpp @@ -27,11 +27,17 @@ #include "export.hpp" -namespace options { +namespace options::detail { + class bundle; +} // ns options::detail -namespace detail { +namespace options { + using bundle_ = detail::bundle; + using bundle = std::shared_ptr<bundle_>; + OTR_OPTIONS_EXPORT std::shared_ptr<detail::bundle> make_bundle(const QString& name); +} // ns options -void set_base_value_to_default(value_* val); +namespace options::detail { struct bundler; @@ -52,17 +58,18 @@ private: group saved; group transient; +signals: + void reloading(); + void saving() const; + void changed() const; + +public: bundle(const bundle&) = delete; bundle(bundle&&) = delete; bundle& operator=(bundle&&) = delete; bundle& operator=(const bundle&) = delete; QMutex* get_mtx() const override; -signals: - void reloading(); - void saving() const; - void changed() const; -public: cc_noinline bundle(const QString& group_name); cc_noinline ~bundle() override; QString name() const { return group_name; } @@ -82,32 +89,34 @@ public slots: void set_all_to_default(); }; -OTR_OPTIONS_EXPORT bundler& singleton(); - -struct OTR_OPTIONS_EXPORT bundler +struct OTR_OPTIONS_EXPORT bundler final { -public: using k = QString; using v = bundle; using weak = std::weak_ptr<v>; using shared = std::shared_ptr<v>; + private: QMutex implsgl_mtx; std::map<k, weak> implsgl_data; void after_profile_changed_(); + public: + static void refresh_all_bundles(); + +private: + friend OTR_OPTIONS_EXPORT + std::shared_ptr<v> options::make_bundle(const QString& name); + + std::shared_ptr<v> make_bundle_(const k& key); + + static bundler& bundler_singleton(); + bundler(); ~bundler(); - std::shared_ptr<v> make_bundle(const k& key); - static void refresh_all_bundles(); }; -OTR_OPTIONS_EXPORT bundler& singleton(); -} // ns options::detail - -using bundle_ = detail::bundle; -using bundle = std::shared_ptr<bundle_>; +void set_base_value_to_default(value_* val); -OTR_OPTIONS_EXPORT std::shared_ptr<bundle_> make_bundle(const QString& name); +} // ns options::detail -} // ns options |