mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-08-31 02:13:51 +08:00
UI: Remove legacy nlohmann workaround (Ubuntu 22.04)
This commit is contained in:
@@ -23,47 +23,6 @@
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
/* From whatsnew.hpp */
|
||||
#ifndef NLOHMANN_DEFINE_TYPE_INTRUSIVE
|
||||
#define NLOHMANN_DEFINE_TYPE_INTRUSIVE(Type, ...) \
|
||||
friend void to_json(nlohmann::json &nlohmann_json_j, \
|
||||
const Type &nlohmann_json_t) \
|
||||
{ \
|
||||
NLOHMANN_JSON_EXPAND( \
|
||||
NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) \
|
||||
} \
|
||||
friend void from_json(const nlohmann::json &nlohmann_json_j, \
|
||||
Type &nlohmann_json_t) \
|
||||
{ \
|
||||
NLOHMANN_JSON_EXPAND( \
|
||||
NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) \
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef NLOHMANN_JSON_FROM_WITH_DEFAULT
|
||||
#define NLOHMANN_JSON_FROM_WITH_DEFAULT(v1) \
|
||||
nlohmann_json_t.v1 = \
|
||||
nlohmann_json_j.value(#v1, nlohmann_json_default_obj.v1);
|
||||
#endif
|
||||
|
||||
#ifndef NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT
|
||||
#define NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(Type, ...) \
|
||||
friend void to_json(nlohmann::json &nlohmann_json_j, \
|
||||
const Type &nlohmann_json_t) \
|
||||
{ \
|
||||
NLOHMANN_JSON_EXPAND( \
|
||||
NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) \
|
||||
} \
|
||||
friend void from_json(const nlohmann::json &nlohmann_json_j, \
|
||||
Type &nlohmann_json_t) \
|
||||
{ \
|
||||
Type nlohmann_json_default_obj; \
|
||||
NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE( \
|
||||
NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Support for (de-)serialising std::optional
|
||||
* From https://github.com/nlohmann/json/issues/1749#issuecomment-1731266676
|
||||
|
||||
@@ -21,29 +21,6 @@
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
/* Ubuntu 22.04 be damned. */
|
||||
#ifndef NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT
|
||||
#define NLOHMANN_JSON_FROM_WITH_DEFAULT(v1) \
|
||||
nlohmann_json_t.v1 = \
|
||||
nlohmann_json_j.value(#v1, nlohmann_json_default_obj.v1);
|
||||
|
||||
#define NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(Type, ...) \
|
||||
friend void to_json(nlohmann::json &nlohmann_json_j, \
|
||||
const Type &nlohmann_json_t) \
|
||||
{ \
|
||||
NLOHMANN_JSON_EXPAND( \
|
||||
NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) \
|
||||
} \
|
||||
friend void from_json(const nlohmann::json &nlohmann_json_j, \
|
||||
Type &nlohmann_json_t) \
|
||||
{ \
|
||||
Type nlohmann_json_default_obj; \
|
||||
NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE( \
|
||||
NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Support for (de-)serialising std::optional
|
||||
* Adapted from https://github.com/nlohmann/json/issues/1749#issuecomment-1555093802
|
||||
|
||||
Reference in New Issue
Block a user