summaryrefslogtreecommitdiffhomepage
path: root/options/group.hpp
blob: 45e9353c971fc44309d2d7a58202601698445bcf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#pragma once

#include "options/defs.hpp"

#include "compat/base-path.hpp"
#include "compat/library-path.hpp"
#include "compat/macros.hpp"
#include "compat/qhash.hpp"
#include "export.hpp"

#include <optional>
#include <unordered_map>

#include <QString>
#include <QVariant>

#include <QDebug>

// XXX TODO remove qsettings usage -sh 20180624

namespace options::detail {
    // snapshot of qsettings group at given time
    class OTR_OPTIONS_EXPORT group final
    {
        QString name;

    public:
        std::unordered_map<QString, QVariant> kvs;
        explicit group(const QString& name);
        void save() const;
        void put(const QString& s, const QVariant& d);
        bool contains(const QString& s) const;

        never_inline QVariant get_variant(const QString& name) const;
    };
} // ns options::detail