19 #ifndef IRCCD_JSON_UTIL_HPP
20 #define IRCCD_JSON_UTIL_HPP
76 static auto get(
const nlohmann::json& value) noexcept -> std::optional<bool>;
90 static auto get(
const nlohmann::json& value) noexcept -> std::optional<double>;
104 static auto get(
const nlohmann::json& value) -> std::optional<std::string>;
118 static auto get(
const nlohmann::json& value) -> std::optional<std::int8_t>;
132 static auto get(
const nlohmann::json& value) -> std::optional<std::int16_t>;
146 static auto get(
const nlohmann::json& value) -> std::optional<std::int32_t>;
160 static auto get(
const nlohmann::json& value) noexcept -> std::optional<std::int64_t>;
174 static auto get(
const nlohmann::json& value) -> std::optional<std::uint8_t>;
188 static auto get(
const nlohmann::json& value) -> std::optional<std::uint16_t>;
202 static auto get(
const nlohmann::json& value) -> std::optional<std::uint32_t>;
216 static auto get(
const nlohmann::json& value) noexcept -> std::optional<std::uint64_t>;
240 template <
typename Type>
241 auto get(
const std::string& key)
const noexcept -> std::optional<Type>
243 const auto it = find(key);
261 template <
typename Type,
typename DefaultValue>
262 auto optional(
const std::string& key, DefaultValue&& def)
const noexcept -> std::optional<Type>
264 const auto it = find(key);
267 return std::optional<Type>(std::forward<DefaultValue>(def));
281 auto pretty(
const nlohmann::json& value,
int indent = 4) -> std::string;
290 auto contains(
const nlohmann::json& array,
const nlohmann::json& value) noexcept -> bool;
296 #endif // !IRCCD_JSON_UTIL_HPP