libdisplaydevice master
C++ library to modify display devices.
json.h
Go to the documentation of this file.
1
5#pragma once
6
7// system includes
8#include <set>
9
10// local includes
11#include "types.h"
12
20#define DD_JSON_DECLARE_CONVERTER(Type) \
21 [[nodiscard]] std::string toJson(const Type &obj, const std::optional<unsigned int> &indent = 2u, bool *success = nullptr); \
22 [[nodiscard]] bool fromJson(const std::string &string, Type &obj, std::string *error_message = nullptr); // NOLINT(*-macro-parentheses)
23
24// Shared converters (add as needed)
25namespace display_device {
29 extern const std::optional<unsigned int> JSON_COMPACT;
30
38 [[nodiscard]] std::string toJson(const EdidData &obj, const std::optional<unsigned int> &indent = 2u, bool *success = nullptr);
39
47 [[nodiscard]] bool fromJson(const std::string &string, EdidData &obj, std::string *error_message = nullptr);
48
56 [[nodiscard]] std::string toJson(const EnumeratedDevice &obj, const std::optional<unsigned int> &indent = 2u, bool *success = nullptr);
57
65 [[nodiscard]] bool fromJson(const std::string &string, EnumeratedDevice &obj, std::string *error_message = nullptr);
66
74 [[nodiscard]] std::string toJson(const EnumeratedDeviceList &obj, const std::optional<unsigned int> &indent = 2u, bool *success = nullptr);
75
83 [[nodiscard]] bool fromJson(const std::string &string, EnumeratedDeviceList &obj, std::string *error_message = nullptr);
84
92 [[nodiscard]] std::string toJson(const SingleDisplayConfiguration &obj, const std::optional<unsigned int> &indent = 2u, bool *success = nullptr);
93
101 [[nodiscard]] bool fromJson(const std::string &string, SingleDisplayConfiguration &obj, std::string *error_message = nullptr);
102
110 [[nodiscard]] std::string toJson(const StringSet &obj, const std::optional<unsigned int> &indent = 2u, bool *success = nullptr);
111
119 [[nodiscard]] bool fromJson(const std::string &string, StringSet &obj, std::string *error_message = nullptr);
120
128 [[nodiscard]] std::string toJson(const std::string &obj, const std::optional<unsigned int> &indent = 2u, bool *success = nullptr);
129
137 [[nodiscard]] bool fromJson(const std::string &string, std::string &obj, std::string *error_message = nullptr);
138
146 [[nodiscard]] std::string toJson(const bool &obj, const std::optional<unsigned int> &indent = 2u, bool *success = nullptr);
147
155 [[nodiscard]] bool fromJson(const std::string &string, bool &obj, std::string *error_message = nullptr);
156} // namespace display_device
Declarations for common display device types.