blob: 3f7839146051a567d90be7944329f815288782e0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#pragma once
#include <nlohmann/json.hpp>
#define JS_D(k, t) \
do { \
j.at(k).get_to(t); \
} while (0)
#define JS_O(k, t) \
do { \
if (j.contains(k)) j.at(k).get_to(t); \
} while (0)
#define JS_N(k, t) \
do { \
if (!j.at(k).is_null()) j.at(k).get_to(t); \
} while (0)
#define JS_ON(k, t) \
do { \
if (j.contains(k) && !j.at(k).is_null()) \
j.at(k).get_to(t); \
} while (0)
#define JS_RD(k, t) \
do { \
if (j.contains(k)) { \
if (j.at(k).is_null()) { \
t = decltype(t)(); \
} else { \
j.at(k).get_to(t); \
} \
} \
} while (0)
#define JS_RV(k, t, d) \
do { \
if (j.contains(k)) { \
if (j.at(k).is_null()) { \
t = d; \
} else { \
j.at(k).get_to(t); \
} \
} \
} while (0)
|