header_utils
Loading...
Searching...
No Matches
JSON

Typedefs

using ghassanpl::formats::json::jtype
 Smaller name for nlohmann::json::value_t.

Functions

expected< nlohmann::json, std::error_code > ghassanpl::formats::json::load_file (std::filesystem::path const &from)
nlohmann::json ghassanpl::formats::json::try_load_file (std::filesystem::path const &from, nlohmann::json or_json)
nlohmann::json ghassanpl::formats::json::try_load_file (std::filesystem::path const &from)
void ghassanpl::formats::json::save_file (std::filesystem::path const &to, nlohmann::json const &j, bool pretty=true)
constexpr const char * ghassanpl::formats::json::type_name (nlohmann::json::value_t type) noexcept
template<typename VISIT_FUNC>
auto ghassanpl::formats::json::visit (nlohmann::json const &j, VISIT_FUNC &&func)
 Calls func with the actual value inside j; similar to std::visit.

Variables

const nlohmann::json ghassanpl::formats::json::empty_json
const nlohmann::json ghassanpl::formats::json::empty_json_array
const nlohmann::json ghassanpl::formats::json::empty_json_object

Detailed Description

Typedef Documentation

◆ jtype

Smaller name for nlohmann::json::value_t.

Definition at line 163 of file json_helpers.h.

Function Documentation

◆ load_file()

expected< nlohmann::json, std::error_code > ghassanpl::formats::json::load_file ( std::filesystem::path const & from)
inline

Definition at line 165 of file json_helpers.h.

◆ save_file()

void ghassanpl::formats::json::save_file ( std::filesystem::path const & to,
nlohmann::json const & j,
bool pretty = true )
inline

Definition at line 188 of file json_helpers.h.

◆ try_load_file() [1/2]

nlohmann::json ghassanpl::formats::json::try_load_file ( std::filesystem::path const & from)
inline

Definition at line 181 of file json_helpers.h.

◆ try_load_file() [2/2]

nlohmann::json ghassanpl::formats::json::try_load_file ( std::filesystem::path const & from,
nlohmann::json or_json )
inline

Definition at line 174 of file json_helpers.h.

◆ type_name()

const char * ghassanpl::formats::json::type_name ( nlohmann::json::value_t type)
constexprnoexcept

Definition at line 195 of file json_helpers.h.

◆ visit()

template<typename VISIT_FUNC>
auto ghassanpl::formats::json::visit ( nlohmann::json const & j,
VISIT_FUNC && func )

Calls func with the actual value inside j; similar to std::visit.

Definition at line 221 of file json_helpers.h.

Variable Documentation

◆ empty_json

const nlohmann::json ghassanpl::formats::json::empty_json
inline

Definition at line 158 of file json_helpers.h.

◆ empty_json_array

const nlohmann::json ghassanpl::formats::json::empty_json_array
inline

Definition at line 159 of file json_helpers.h.

◆ empty_json_object

const nlohmann::json ghassanpl::formats::json::empty_json_object
inline

Definition at line 160 of file json_helpers.h.