Mercurial > minori
comparison src/core/json.cc @ 369:47c9f8502269
*: clang-format all the things
I've edited the formatting a bit. Now pointer asterisks (and reference
ampersands) are on the variable instead of the type, as well as having
newlines for function braces (but nothing else)
author | Paper <paper@tflc.us> |
---|---|
date | Fri, 25 Jul 2025 10:16:02 -0400 |
parents | 9b10175be389 |
children |
comparison
equal
deleted
inserted
replaced
368:6d37a998cf91 | 369:47c9f8502269 |
---|---|
1 #include "core/json.h" | 1 #include "core/json.h" |
2 #include "json/json.hpp" | 2 #include "json/json.hpp" |
3 | 3 |
4 namespace JSON { | 4 namespace JSON { |
5 | 5 |
6 nlohmann::json GetValue(const nlohmann::json& json, const nlohmann::json::json_pointer& ptr) { | 6 nlohmann::json GetValue(const nlohmann::json &json, const nlohmann::json::json_pointer &ptr) |
7 { | |
7 if (json.contains(ptr)) | 8 if (json.contains(ptr)) |
8 return json.at(ptr); | 9 return json.at(ptr); |
9 else | 10 else |
10 return nlohmann::json(); | 11 return nlohmann::json(); |
11 } | 12 } |
12 | 13 |
13 bool GetBoolean(const nlohmann::json& json, const nlohmann::json::json_pointer& ptr, bool def) { | 14 bool GetBoolean(const nlohmann::json &json, const nlohmann::json::json_pointer &ptr, bool def) |
15 { | |
14 if (json.contains(ptr) && json[ptr].is_boolean()) | 16 if (json.contains(ptr) && json[ptr].is_boolean()) |
15 return json[ptr].get<bool>(); | 17 return json[ptr].get<bool>(); |
16 else | 18 else |
17 return def; | 19 return def; |
18 } | 20 } |