-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjsonadapter.h
More file actions
39 lines (30 loc) · 1003 Bytes
/
jsonadapter.h
File metadata and controls
39 lines (30 loc) · 1003 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
#ifndef JSONADAPTER_H_
#define JSONADAPTER_H_
#include <json/json.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include "monitor_setup.h"
#include "mode.h"
#include "config.h"
namespace schrandr {
class ModeList;
class JSONAdapter {
public:
MonitorSetup setup_from_json(Json::Value root);
Json::Value setup_to_json(MonitorSetup ms);
Mode mode_from_json(Json::Value root);
Json::Value mode_to_json(Mode m);
ModeList modesFromJson(const Json::Value &root);
Json::Value modesToJson(const ModeList &modes);
Json::Value read_stream(std::ifstream *str);
void write_to_stream(std::stringstream *ofs, Json::Value content);
void write_to_stream(std::ostream *ofs, Json::Value content);
private:
Json::StyledStreamWriter styled_stream_writer_;
Json::Reader reader_;
Json::Value setup_to_json_(MonitorSetup ms);
};
}
#endif