-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStorage.h
More file actions
40 lines (24 loc) · 895 Bytes
/
Storage.h
File metadata and controls
40 lines (24 loc) · 895 Bytes
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
39
40
/*
Copyright (c) 2018 by Ilya Barykin
Released under the MIT License.
See the provided LICENSE.TXT file for details.
*/
#ifndef REPOSTBOT_STORAGE_H
#define REPOSTBOT_STORAGE_H
#include <utils/Singleton.h>
#include "vendor/json/json.hpp"
using json = nlohmann::json;
class Storage : public Utils::Singleton<Storage> {
json object;
public:
Storage() = default;
void load();
static void save();
json &operator[](const QString &key) { return object[key.toStdString().c_str()]; }
const json &operator[](const QString &key) const { return object[key.toStdString().c_str()]; }
json &operator[](char *key) { return object[key]; }
const json &operator[](char *key) const { return object[key]; }
json &value(const char *key) { return object[key]; }
const json &value(const char *key) const { return object[key]; }
};
#endif //REPOSTBOT_STORAGE_H