OpenEnroth 73e68f7
|
#include <string>
#include <nlohmann/json.hpp>
#include "Library/Serialization/Serialization.h"
#include "Utility/Preprocessor.h"
#include "JsonFwd.h"
#include "JsonExceptions.h"
Macros | |
#define | JSON_DISABLE_ENUM_SERIALIZATION 1 |
#define | MM_DEFINE_JSON_LEXICAL_SERIALIZATION_FUNCTIONS(TYPE) |
#define | MM_DEFINE_JSON_STRUCT_SERIALIZATION_FUNCTIONS(TYPE, MEMBER_NAMES) |
#define | MM_DEFINE_JSON_STRUCT_MEMBER_SERIALIZATION_I(ARG) MM_DEFINE_JSON_STRUCT_MEMBER_SERIALIZATION_II ARG |
#define | MM_DEFINE_JSON_STRUCT_MEMBER_SERIALIZATION_II(MEMBER, NAME) nlohmann::to_json(json[NAME], value.MEMBER); |
#define | MM_DEFINE_JSON_STRUCT_MEMBER_DESERIALIZATION_I(ARG) MM_DEFINE_JSON_STRUCT_MEMBER_DESERIALIZATION_II ARG |
#define | MM_DEFINE_JSON_STRUCT_MEMBER_DESERIALIZATION_II(MEMBER, NAME) |
#define JSON_DISABLE_ENUM_SERIALIZATION 1 |
#define MM_DEFINE_JSON_LEXICAL_SERIALIZATION_FUNCTIONS | ( | TYPE | ) |
Defines enum json serialization functions that just forward into lexical serialization declared via Library/Serialization
.
Note that NLOHMANN_JSON_SERIALIZE_ENUM
offers no customization of how errors are reported, and this is why we're not using it.
TYPE | Type to define json serialization functions for. |
#define MM_DEFINE_JSON_STRUCT_MEMBER_DESERIALIZATION_I | ( | ARG | ) | MM_DEFINE_JSON_STRUCT_MEMBER_DESERIALIZATION_II ARG |
#define MM_DEFINE_JSON_STRUCT_MEMBER_DESERIALIZATION_II | ( | MEMBER, | |
NAME | |||
) |
#define MM_DEFINE_JSON_STRUCT_MEMBER_SERIALIZATION_I | ( | ARG | ) | MM_DEFINE_JSON_STRUCT_MEMBER_SERIALIZATION_II ARG |
#define MM_DEFINE_JSON_STRUCT_MEMBER_SERIALIZATION_II | ( | MEMBER, | |
NAME | |||
) | nlohmann::to_json(json[NAME], value.MEMBER); |
#define MM_DEFINE_JSON_STRUCT_SERIALIZATION_FUNCTIONS | ( | TYPE, | |
MEMBER_NAMES | |||
) |
Unfortunately NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT
is also very weak when it comes to customization, so we have to roll out our own version.
TYPE | Struct to define functions for. |
MEMBER_NAMES | Member-name pairs. Repeats are not supported for now. |