libdisplaydevice master
C++ library to modify display devices.
json.cpp File Reference

Definitions for JSON conversion functions. More...

Include dependency graph for json.cpp:

Functions

bool display_device::fromJson (const std::string &string, bool &obj, std::string *error_message=nullptr)
 Deserialize a boolean from JSON.
 
bool display_device::fromJson (const std::string &string, EdidData &obj, std::string *error_message=nullptr)
 Deserialize EDID data from JSON.
 
bool display_device::fromJson (const std::string &string, EnumeratedDevice &obj, std::string *error_message=nullptr)
 Deserialize an enumerated device from JSON.
 
bool display_device::fromJson (const std::string &string, EnumeratedDeviceList &obj, std::string *error_message=nullptr)
 Deserialize an enumerated device list from JSON.
 
bool display_device::fromJson (const std::string &string, SingleDisplayConfiguration &obj, std::string *error_message=nullptr)
 Deserialize a single display configuration from JSON.
 
bool display_device::fromJson (const std::string &string, std::string &obj, std::string *error_message=nullptr)
 Deserialize a string from JSON.
 
bool display_device::fromJson (const std::string &string, StringSet &obj, std::string *error_message=nullptr)
 Deserialize a string set from JSON.
 
std::string display_device::toJson (const bool &obj, const std::optional< unsigned int > &indent=2u, bool *success=nullptr)
 Serialize a boolean to JSON.
 
std::string display_device::toJson (const EdidData &obj, const std::optional< unsigned int > &indent=2u, bool *success=nullptr)
 Serialize EDID data to JSON.
 
std::string display_device::toJson (const EnumeratedDevice &obj, const std::optional< unsigned int > &indent=2u, bool *success=nullptr)
 Serialize an enumerated device to JSON.
 
std::string display_device::toJson (const EnumeratedDeviceList &obj, const std::optional< unsigned int > &indent=2u, bool *success=nullptr)
 Serialize an enumerated device list to JSON.
 
std::string display_device::toJson (const SingleDisplayConfiguration &obj, const std::optional< unsigned int > &indent=2u, bool *success=nullptr)
 Serialize a single display configuration to JSON.
 
std::string display_device::toJson (const std::string &obj, const std::optional< unsigned int > &indent=2u, bool *success=nullptr)
 Serialize a string to JSON.
 
std::string display_device::toJson (const StringSet &obj, const std::optional< unsigned int > &indent=2u, bool *success=nullptr)
 Serialize a string set to JSON.
 

Detailed Description

Definitions for JSON conversion functions.

Function Documentation

◆ fromJson() [1/7]

bool display_device::fromJson ( const std::string & string,
bool & obj,
std::string * error_message = nullptr )
nodiscard

Deserialize a boolean from JSON.

Parameters
stringJSON string to parse.
objOutput object updated on success.
error_messageOptional output error message.
Returns
True on success, false otherwise.

◆ fromJson() [2/7]

bool display_device::fromJson ( const std::string & string,
EdidData & obj,
std::string * error_message = nullptr )
nodiscard

Deserialize EDID data from JSON.

Parameters
stringJSON string to parse.
objOutput object updated on success.
error_messageOptional output error message.
Returns
True on success, false otherwise.

◆ fromJson() [3/7]

bool display_device::fromJson ( const std::string & string,
EnumeratedDevice & obj,
std::string * error_message = nullptr )
nodiscard

Deserialize an enumerated device from JSON.

Parameters
stringJSON string to parse.
objOutput object updated on success.
error_messageOptional output error message.
Returns
True on success, false otherwise.

◆ fromJson() [4/7]

bool display_device::fromJson ( const std::string & string,
EnumeratedDeviceList & obj,
std::string * error_message = nullptr )
nodiscard

Deserialize an enumerated device list from JSON.

Parameters
stringJSON string to parse.
objOutput object updated on success.
error_messageOptional output error message.
Returns
True on success, false otherwise.

◆ fromJson() [5/7]

bool display_device::fromJson ( const std::string & string,
SingleDisplayConfiguration & obj,
std::string * error_message = nullptr )
nodiscard

Deserialize a single display configuration from JSON.

Parameters
stringJSON string to parse.
objOutput object updated on success.
error_messageOptional output error message.
Returns
True on success, false otherwise.

◆ fromJson() [6/7]

bool display_device::fromJson ( const std::string & string,
std::string & obj,
std::string * error_message = nullptr )
nodiscard

Deserialize a string from JSON.

Parameters
stringJSON string to parse.
objOutput object updated on success.
error_messageOptional output error message.
Returns
True on success, false otherwise.

◆ fromJson() [7/7]

bool display_device::fromJson ( const std::string & string,
StringSet & obj,
std::string * error_message = nullptr )
nodiscard

Deserialize a string set from JSON.

Parameters
stringJSON string to parse.
objOutput object updated on success.
error_messageOptional output error message.
Returns
True on success, false otherwise.

◆ toJson() [1/7]

std::string display_device::toJson ( const bool & obj,
const std::optional< unsigned int > & indent = 2u,
bool * success = nullptr )
nodiscard

Serialize a boolean to JSON.

Parameters
objObject to serialize.
indentOptional indentation width. Use JSON_COMPACT for compact output.
successOptional output flag set to true on success, false otherwise.
Returns
JSON string on success, error message otherwise.

◆ toJson() [2/7]

std::string display_device::toJson ( const EdidData & obj,
const std::optional< unsigned int > & indent = 2u,
bool * success = nullptr )
nodiscard

Serialize EDID data to JSON.

Parameters
objObject to serialize.
indentOptional indentation width. Use JSON_COMPACT for compact output.
successOptional output flag set to true on success, false otherwise.
Returns
JSON string on success, error message otherwise.

◆ toJson() [3/7]

std::string display_device::toJson ( const EnumeratedDevice & obj,
const std::optional< unsigned int > & indent = 2u,
bool * success = nullptr )
nodiscard

Serialize an enumerated device to JSON.

Parameters
objObject to serialize.
indentOptional indentation width. Use JSON_COMPACT for compact output.
successOptional output flag set to true on success, false otherwise.
Returns
JSON string on success, error message otherwise.

◆ toJson() [4/7]

std::string display_device::toJson ( const EnumeratedDeviceList & obj,
const std::optional< unsigned int > & indent = 2u,
bool * success = nullptr )
nodiscard

Serialize an enumerated device list to JSON.

Parameters
objObject to serialize.
indentOptional indentation width. Use JSON_COMPACT for compact output.
successOptional output flag set to true on success, false otherwise.
Returns
JSON string on success, error message otherwise.

◆ toJson() [5/7]

std::string display_device::toJson ( const SingleDisplayConfiguration & obj,
const std::optional< unsigned int > & indent = 2u,
bool * success = nullptr )
nodiscard

Serialize a single display configuration to JSON.

Parameters
objObject to serialize.
indentOptional indentation width. Use JSON_COMPACT for compact output.
successOptional output flag set to true on success, false otherwise.
Returns
JSON string on success, error message otherwise.

◆ toJson() [6/7]

std::string display_device::toJson ( const std::string & obj,
const std::optional< unsigned int > & indent = 2u,
bool * success = nullptr )
nodiscard

Serialize a string to JSON.

Parameters
objObject to serialize.
indentOptional indentation width. Use JSON_COMPACT for compact output.
successOptional output flag set to true on success, false otherwise.
Returns
JSON string on success, error message otherwise.

◆ toJson() [7/7]

std::string display_device::toJson ( const StringSet & obj,
const std::optional< unsigned int > & indent = 2u,
bool * success = nullptr )
nodiscard

Serialize a string set to JSON.

Parameters
objObject to serialize.
indentOptional indentation width. Use JSON_COMPACT for compact output.
successOptional output flag set to true on success, false otherwise.
Returns
JSON string on success, error message otherwise.