/* * Copyright (c) 2020-2021. Uniontech Software Ltd. All rights reserved. * * Author: Iceyer * * Maintainer: Iceyer * * SPDX-License-Identifier: GPL-3.0-or-later */ #ifndef LINGLONG_BOX_SRC_UTIL_JSON_H_ #define LINGLONG_BOX_SRC_UTIL_JSON_H_ #define JSON_USE_IMPLICIT_CONVERSIONS 0 #include #define tl std // namespace nlohmann { // template // inline void from_json(const J &j, tl::optional &v) // { // if (j.is_null()) { // v = tl::nullopt; // } else { // v = j.template get(); // } // } // template // inline void to_json(J &j, const tl::optional &o) // { // if (o.has_value()) { // j = o.value(); // } // } // } // namespace nlohmann // namespace linglong { // template // tl::optional optional(const QJsonObject &j, const char *key) // { // tl::optional o; // auto iter = j.template find(key); // if (iter != j.end()) { // o = iter->template get>(); // } // return o; // } // template // tl::optional optional(const nlohmann::json &j, const char *key) // { // tl::optional o; // auto iter = j.template find(key); // if (iter != j.end()) { // o = iter->template get>(); // } // return o; // } // } // namespace linglong #endif /* LINGLONG_BOX_SRC_UTIL_JSON_H_ */