TypedVariant: Apply formatting to macros

Applies clang-format to the macros to prevent the changes from being
placed into the following change.
This commit is contained in:
Lioncash 2019-09-20 17:52:25 -04:00
parent 35988aff00
commit 8814ecbc4c
1 changed files with 61 additions and 56 deletions

View File

@ -202,62 +202,67 @@ private:
TypedVariantBigDNA(TypedVariant<_Types...> var) : TypedVariant<_Types...>(std::move(var)) {} TypedVariantBigDNA(TypedVariant<_Types...> var) : TypedVariant<_Types...>(std::move(var)) {}
}; };
#define AT_SPECIALIZE_TYPED_VARIANT_BIGDNA(...) \ #define AT_SPECIALIZE_TYPED_VARIANT_BIGDNA(...) \
template <> \ template <> \
template <> \ template <> \
inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate<athena::io::DNA<athena::Big>::Read>(typename Read::StreamT & r) { \ inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate<athena::io::DNA<athena::Big>::Read>( \
EnumType variant_type = {}; \ typename Read::StreamT & r) { \
Do<athena::io::DNA<athena::Big>::Read>(athena::io::PropId("variant_type"), variant_type, r); \ EnumType variant_type = {}; \
static_cast<TypedVariant<__VA_ARGS__>&>(*this) = Build(variant_type); \ Do<athena::io::DNA<athena::Big>::Read>(athena::io::PropId("variant_type"), variant_type, r); \
visit([&](auto& var) { var.read(r); }); \ static_cast<TypedVariant<__VA_ARGS__>&>(*this) = Build(variant_type); \
} \ visit([&](auto& var) { var.read(r); }); \
\ } \
template <> \ \
template <> \ template <> \
inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate<athena::io::DNA<athena::Big>::Write>(typename Write::StreamT & w) { \ template <> \
visit([&](auto& var) { \ inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate<athena::io::DNA<athena::Big>::Write>( \
using T = std::decay_t<decltype(var)>; \ typename Write::StreamT & w) { \
EnumType variant_type = T::variant_type(); \ visit([&](auto& var) { \
Do<athena::io::DNA<athena::Big>::Write>(athena::io::PropId("variant_type"), variant_type, w); \ using T = std::decay_t<decltype(var)>; \
var.write(w); \ EnumType variant_type = T::variant_type(); \
}); \ Do<athena::io::DNA<athena::Big>::Write>(athena::io::PropId("variant_type"), variant_type, w); \
} \ var.write(w); \
\ }); \
template <> \ } \
template <> \ \
inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate<athena::io::DNA<athena::Big>::BinarySize>(typename BinarySize::StreamT & sz) { \ template <> \
visit([&](auto& var) { \ template <> \
using T = std::decay_t<decltype(var)>; \ inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate<athena::io::DNA<athena::Big>::BinarySize>( \
EnumType variant_type = T::variant_type(); \ typename BinarySize::StreamT & sz) { \
Do<athena::io::DNA<athena::Big>::BinarySize>(athena::io::PropId("variant_type"), variant_type, sz); \ visit([&](auto& var) { \
var.binarySize(sz); \ using T = std::decay_t<decltype(var)>; \
}); \ EnumType variant_type = T::variant_type(); \
} \ Do<athena::io::DNA<athena::Big>::BinarySize>(athena::io::PropId("variant_type"), variant_type, sz); \
template <> \ var.binarySize(sz); \
inline const char* hecl::TypedVariantBigDNA<__VA_ARGS__>::DNAType() { \ }); \
return "hecl::TypedVariantBigDNA<" #__VA_ARGS__ ">"; \ } \
} template <> \
inline const char* hecl::TypedVariantBigDNA<__VA_ARGS__>::DNAType() { \
return "hecl::TypedVariantBigDNA<" #__VA_ARGS__ ">"; \
}
#define AT_SPECIALIZE_TYPED_VARIANT_BIGDNA_YAML(...) \ #define AT_SPECIALIZE_TYPED_VARIANT_BIGDNA_YAML(...) \
AT_SPECIALIZE_TYPED_VARIANT_BIGDNA(__VA_ARGS__) \ AT_SPECIALIZE_TYPED_VARIANT_BIGDNA(__VA_ARGS__) \
template <> \ template <> \
template <> \ template <> \
inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate<athena::io::DNA<athena::Big>::ReadYaml>(typename ReadYaml::StreamT & r) { \ inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate<athena::io::DNA<athena::Big>::ReadYaml>( \
EnumType variant_type = {}; \ typename ReadYaml::StreamT & r) { \
Do<athena::io::DNA<athena::Big>::ReadYaml>(athena::io::PropId("variant_type"), variant_type, r); \ EnumType variant_type = {}; \
static_cast<TypedVariant<__VA_ARGS__>&>(*this) = Build(variant_type); \ Do<athena::io::DNA<athena::Big>::ReadYaml>(athena::io::PropId("variant_type"), variant_type, r); \
visit([&](auto& var) { var.read(r); }); \ static_cast<TypedVariant<__VA_ARGS__>&>(*this) = Build(variant_type); \
} \ visit([&](auto& var) { var.read(r); }); \
\ } \
template <> \ \
template <> \ template <> \
inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate<athena::io::DNA<athena::Big>::WriteYaml>(typename WriteYaml::StreamT & w) { \ template <> \
visit([&](auto& var) { \ inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate<athena::io::DNA<athena::Big>::WriteYaml>( \
using T = std::decay_t<decltype(var)>; \ typename WriteYaml::StreamT & w) { \
EnumType variant_type = T::variant_type(); \ visit([&](auto& var) { \
Do<athena::io::DNA<athena::Big>::WriteYaml>(athena::io::PropId("variant_type"), variant_type, w); \ using T = std::decay_t<decltype(var)>; \
var.write(w); \ EnumType variant_type = T::variant_type(); \
}); \ Do<athena::io::DNA<athena::Big>::WriteYaml>(athena::io::PropId("variant_type"), variant_type, w); \
} var.write(w); \
}); \
}
} }