summaryrefslogtreecommitdiffhomepage
path: root/options/group.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-08-25 11:58:24 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-08-25 13:37:23 +0200
commit39169acf3bc2bc43cc32a6455d43e9588765c84a (patch)
tree3e0cbee0c68e15c87fe34746d1e9eb148ddd7bd1 /options/group.hpp
parentc7532ed82f57e4281d3f5ecded59a95a4f756b04 (diff)
options: use non-generic comparison for bundle modification check
The generic QVariant comparison works badly for QList<QPointF>. Create a comparator between two QVariants for base_value in value<tp> ctor, using QVariant::value<tp> which returns right results once it's converted to tp. If a value was registered for a name in a bundle, use that comparator as the comparator for that name. In case conflicting value types were registered always use generic comparison for that name. std::type_index needs to be used here since value<t> can be instantiated in different modules (libraries), resulting in different value for the comparator function pointer. Move group::operator== to bundle type to avoid circular include for connector.h. Also use element_type more consistently in value<tp>.
Diffstat (limited to 'options/group.hpp')
-rw-r--r--options/group.hpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/options/group.hpp b/options/group.hpp
index 05ef3b4b..f76978ad 100644
--- a/options/group.hpp
+++ b/options/group.hpp
@@ -14,10 +14,9 @@ namespace options {
// snapshot of qsettings group at given time
class OPENTRACK_OPTIONS_EXPORT group final
{
-private:
- std::map<QString, QVariant> kvs;
QString name;
public:
+ std::map<QString, QVariant> kvs;
group(const QString& name);
void save() const;
void save_deferred(QSettings& s) const;
@@ -28,8 +27,6 @@ public:
static QString ini_pathname();
static const QStringList ini_list();
static const std::shared_ptr<QSettings> ini_file();
- bool operator==(const group& other) const;
- bool operator!=(const group& other) const { return !(*this == other); }
template<typename t>
t get(const QString& k) const