libdisplaydevice latest
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 {
26 extern const std::optional<unsigned int> JSON_COMPACT;
27
29 DD_JSON_DECLARE_CONVERTER(EnumeratedDevice)
30 DD_JSON_DECLARE_CONVERTER(EnumeratedDeviceList)
31 DD_JSON_DECLARE_CONVERTER(SingleDisplayConfiguration)
32 DD_JSON_DECLARE_CONVERTER(std::set<std::string>)
33 DD_JSON_DECLARE_CONVERTER(std::string)
35} // namespace display_device
#define DD_JSON_DECLARE_CONVERTER(Type)
Helper MACRO to declare the toJson and fromJson converters for a type.
Definition json.h:20
Declarations for common display device types.