Mercurial > minori
comparison include/core/json.h @ 317:b1f4d1867ab1
services: VERY initial Kitsu support
it only supports user authentication for now, but it's definitely
a start.
| author | Paper <paper@paper.us.eu.org> |
|---|---|
| date | Wed, 12 Jun 2024 04:07:10 -0400 |
| parents | 3ec7804abf17 |
| children | 1686fac290c5 |
comparison
equal
deleted
inserted
replaced
| 316:180714442770 | 317:b1f4d1867ab1 |
|---|---|
| 22 | 22 |
| 23 } // namespace nlohmann | 23 } // namespace nlohmann |
| 24 | 24 |
| 25 namespace JSON { | 25 namespace JSON { |
| 26 | 26 |
| 27 /* TODO: refactor these to return a std::optional... */ | |
| 27 template<typename T = std::string> | 28 template<typename T = std::string> |
| 28 T GetString(const nlohmann::json& json, const nlohmann::json::json_pointer& ptr, T def) { | 29 T GetString(const nlohmann::json& json, const nlohmann::json::json_pointer& ptr, T def) { |
| 29 if (json.contains(ptr) && json[ptr].is_string()) | 30 if (json.contains(ptr) && json[ptr].is_string()) |
| 30 return json[ptr].get<T>(); | 31 return json[ptr].get<T>(); |
| 31 else | 32 else |
