General: Remove unnecessary typename specifiers

This commit is contained in:
Lioncash 2019-08-15 09:41:30 -04:00
parent 60c554f67e
commit 4b7917cc05
7 changed files with 156 additions and 173 deletions

View File

@ -56,7 +56,7 @@ constexpr PropId operator"" _propid(const char* s, size_t len) { return {s}; }
enum class PropType { None, CRC32, CRC64 }; enum class PropType { None, CRC32, CRC64 };
template <class T> template <class T>
using __IsPODType = typename std::disjunction< using __IsPODType = std::disjunction<
std::is_arithmetic<std::remove_cv_t<T>>, std::is_convertible<std::remove_cv_t<T>&, atVec2f&>, std::is_arithmetic<std::remove_cv_t<T>>, std::is_convertible<std::remove_cv_t<T>&, atVec2f&>,
std::is_convertible<std::remove_cv_t<T>&, atVec3f&>, std::is_convertible<std::remove_cv_t<T>&, atVec4f&>, std::is_convertible<std::remove_cv_t<T>&, atVec3f&>, std::is_convertible<std::remove_cv_t<T>&, atVec4f&>,
std::is_convertible<std::remove_cv_t<T>&, atVec2d&>, std::is_convertible<std::remove_cv_t<T>&, atVec3d&>, std::is_convertible<std::remove_cv_t<T>&, atVec2d&>, std::is_convertible<std::remove_cv_t<T>&, atVec3d&>,
@ -65,7 +65,7 @@ template <class T>
constexpr bool __IsPODType_v = __IsPODType<T>::value; constexpr bool __IsPODType_v = __IsPODType<T>::value;
template <class T> template <class T>
using __CastPODType = typename std::conditional_t< using __CastPODType = std::conditional_t<
std::is_convertible_v<std::remove_cv_t<T>&, atVec2f&>, atVec2f, std::is_convertible_v<std::remove_cv_t<T>&, atVec2f&>, atVec2f,
std::conditional_t< std::conditional_t<
std::is_convertible_v<std::remove_cv_t<T>&, atVec3f&>, atVec3f, std::is_convertible_v<std::remove_cv_t<T>&, atVec3f&>, atVec3f,
@ -112,7 +112,7 @@ struct BinarySize {
using PropT = std::conditional_t<PropOp == PropType::CRC64, uint64_t, uint32_t>; using PropT = std::conditional_t<PropOp == PropType::CRC64, uint64_t, uint32_t>;
using StreamT = size_t; using StreamT = size_t;
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_enum_v<T>> Do(const PropId& id, T& var, StreamT& s) { static std::enable_if_t<std::is_enum_v<T>> Do(const PropId& id, T& var, StreamT& s) {
if (PropOp != PropType::None) { if (PropOp != PropType::None) {
/* Accessed via Enumerate, header */ /* Accessed via Enumerate, header */
s += 6; s += 6;
@ -121,7 +121,7 @@ struct BinarySize {
BinarySize<PropType::None>::Do<PODType, DNAE>(id, *reinterpret_cast<PODType*>(&var), s); BinarySize<PropType::None>::Do<PODType, DNAE>(id, *reinterpret_cast<PODType*>(&var), s);
} }
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<__IsPODType_v<T>> Do(const PropId& id, T& var, StreamT& s) { static std::enable_if_t<__IsPODType_v<T>> Do(const PropId& id, T& var, StreamT& s) {
if (PropOp != PropType::None) { if (PropOp != PropType::None) {
/* Accessed via Enumerate, header */ /* Accessed via Enumerate, header */
s += 6; s += 6;
@ -130,19 +130,17 @@ struct BinarySize {
BinarySize<PropType::None>::Do<CastT, DNAE>(id, static_cast<CastT&>(const_cast<std::remove_cv_t<T>&>(var)), s); BinarySize<PropType::None>::Do<CastT, DNAE>(id, static_cast<CastT&>(const_cast<std::remove_cv_t<T>&>(var)), s);
} }
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<__IsDNARecord_v<T> && PropOp != PropType::None> Do(const PropId& id, T& var, static std::enable_if_t<__IsDNARecord_v<T> && PropOp != PropType::None> Do(const PropId& id, T& var, StreamT& s) {
StreamT& s) {
/* Accessed via Enumerate, header */ /* Accessed via Enumerate, header */
s += 6; s += 6;
var.template Enumerate<BinarySize<PropOp>>(s); var.template Enumerate<BinarySize<PropOp>>(s);
} }
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<__IsDNARecord_v<T> && PropOp == PropType::None> Do(const PropId& id, T& var, static std::enable_if_t<__IsDNARecord_v<T> && PropOp == PropType::None> Do(const PropId& id, T& var, StreamT& s) {
StreamT& s) {
var.template Enumerate<BinarySize<PropType::None>>(s); var.template Enumerate<BinarySize<PropType::None>>(s);
} }
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& s) { static std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& s) {
for (auto& v : var) for (auto& v : var)
BinarySize<PropOp>::Do<std::remove_reference_t<decltype(v)>, DNAE>(id, v, s); BinarySize<PropOp>::Do<std::remove_reference_t<decltype(v)>, DNAE>(id, v, s);
} }
@ -151,13 +149,13 @@ struct BinarySize {
BinarySize<PropOp>::Do<T, DNAE>(id, var, s); BinarySize<PropOp>::Do<T, DNAE>(id, var, s);
} }
template <class T, class S, Endian DNAE> template <class T, class S, Endian DNAE>
static typename std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, static std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
const S& count, StreamT& s) { StreamT& s) {
for (T& v : vector) for (T& v : vector)
BinarySize<PropOp>::Do<T, DNAE>(id, v, s); BinarySize<PropOp>::Do<T, DNAE>(id, v, s);
} }
template <class T, class S, Endian DNAE> template <class T, class S, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count, static std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
StreamT& s) { StreamT& s) {
/* libc++ specializes vector<bool> as a bitstream */ /* libc++ specializes vector<bool> as a bitstream */
s += vector.size(); s += vector.size();
@ -167,7 +165,7 @@ struct BinarySize {
s += count; s += count;
} }
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, std::string>> Do(const PropId& id, T& str, StreamT& s) { static std::enable_if_t<std::is_same_v<T, std::string>> Do(const PropId& id, T& str, StreamT& s) {
s += str.size() + 1; s += str.size() + 1;
} }
static void Do(const PropId& id, std::string& str, atInt32 count, StreamT& s) { static void Do(const PropId& id, std::string& str, atInt32 count, StreamT& s) {
@ -177,7 +175,7 @@ struct BinarySize {
s += count; s += count;
} }
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, std::wstring>> Do(const PropId& id, T& str, StreamT& s) { static std::enable_if_t<std::is_same_v<T, std::wstring>> Do(const PropId& id, T& str, StreamT& s) {
s += str.size() * 2 + 2; s += str.size() * 2 + 2;
} }
template <Endian DNAE> template <Endian DNAE>
@ -263,7 +261,7 @@ struct PropCount {
s += 1; s += 1;
} }
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, std::string>> Do(const PropId& id, T& str, StreamT& s) { static std::enable_if_t<std::is_same_v<T, std::string>> Do(const PropId& id, T& str, StreamT& s) {
/* Only reports one level of properties */ /* Only reports one level of properties */
s += 1; s += 1;
} }
@ -272,7 +270,7 @@ struct PropCount {
s += 1; s += 1;
} }
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, std::wstring>> Do(const PropId& id, T& str, StreamT& s) { static std::enable_if_t<std::is_same_v<T, std::wstring>> Do(const PropId& id, T& str, StreamT& s) {
/* Only reports one level of properties */ /* Only reports one level of properties */
s += 1; s += 1;
} }
@ -290,23 +288,21 @@ struct Read {
using PropT = std::conditional_t<PropOp == PropType::CRC64, uint64_t, uint32_t>; using PropT = std::conditional_t<PropOp == PropType::CRC64, uint64_t, uint32_t>;
using StreamT = IStreamReader; using StreamT = IStreamReader;
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_enum_v<T>> Do(const PropId& id, T& var, StreamT& r) { static std::enable_if_t<std::is_enum_v<T>> Do(const PropId& id, T& var, StreamT& r) {
using PODType = std::underlying_type_t<T>; using PODType = std::underlying_type_t<T>;
Read<PropType::None>::Do<PODType, DNAE>(id, *reinterpret_cast<PODType*>(&var), r); Read<PropType::None>::Do<PODType, DNAE>(id, *reinterpret_cast<PODType*>(&var), r);
} }
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<__IsPODType_v<T>> Do(const PropId& id, T& var, StreamT& r) { static std::enable_if_t<__IsPODType_v<T>> Do(const PropId& id, T& var, StreamT& r) {
using CastT = __CastPODType<T>; using CastT = __CastPODType<T>;
Read<PropType::None>::Do<CastT, DNAE>(id, static_cast<CastT&>(var), r); Read<PropType::None>::Do<CastT, DNAE>(id, static_cast<CastT&>(var), r);
} }
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<__IsDNARecord<T>() && PropOp == PropType::None> Do(const PropId& id, T& var, static std::enable_if_t<__IsDNARecord<T>() && PropOp == PropType::None> Do(const PropId& id, T& var, StreamT& r) {
StreamT& r) {
var.template Enumerate<Read<PropType::None>>(r); var.template Enumerate<Read<PropType::None>>(r);
} }
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<__IsDNARecord<T>() && PropOp != PropType::None> Do(const PropId& id, T& var, static std::enable_if_t<__IsDNARecord<T>() && PropOp != PropType::None> Do(const PropId& id, T& var, StreamT& r) {
StreamT& r) {
/* Accessed via Lookup, no header */ /* Accessed via Lookup, no header */
atUint16 propCount = __Read16<T::DNAEndian>(r); atUint16 propCount = __Read16<T::DNAEndian>(r);
for (atUint32 i = 0; i < propCount; ++i) { for (atUint32 i = 0; i < propCount; ++i) {
@ -324,7 +320,7 @@ struct Read {
} }
} }
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& s) { static std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& s) {
for (auto& v : var) for (auto& v : var)
Read<PropOp>::Do<std::remove_reference_t<decltype(v)>, DNAE>(id, v, s); Read<PropOp>::Do<std::remove_reference_t<decltype(v)>, DNAE>(id, v, s);
} }
@ -333,8 +329,8 @@ struct Read {
Read<PropOp>::Do<T, DNAE>(id, var, s); Read<PropOp>::Do<T, DNAE>(id, var, s);
} }
template <class T, class S, Endian DNAE> template <class T, class S, Endian DNAE>
static typename std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, static std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
const S& count, StreamT& r) { StreamT& r) {
vector.clear(); vector.clear();
vector.reserve(count); vector.reserve(count);
for (size_t i = 0; i < static_cast<size_t>(count); ++i) { for (size_t i = 0; i < static_cast<size_t>(count); ++i) {
@ -343,7 +339,7 @@ struct Read {
} }
} }
template <class T, class S, Endian DNAE> template <class T, class S, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count, static std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
StreamT& r) { StreamT& r) {
/* libc++ specializes vector<bool> as a bitstream */ /* libc++ specializes vector<bool> as a bitstream */
vector.clear(); vector.clear();
@ -356,12 +352,12 @@ struct Read {
r.readUBytesToBuf(buf.get(), count); r.readUBytesToBuf(buf.get(), count);
} }
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, std::string>> Do(const PropId& id, T& str, StreamT& r) { static std::enable_if_t<std::is_same_v<T, std::string>> Do(const PropId& id, T& str, StreamT& r) {
str = r.readString(); str = r.readString();
} }
static void Do(const PropId& id, std::string& str, atInt32 count, StreamT& r) { str = r.readString(count); } static void Do(const PropId& id, std::string& str, atInt32 count, StreamT& r) { str = r.readString(count); }
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, std::wstring>> Do(const PropId& id, T& str, StreamT& r) { static std::enable_if_t<std::is_same_v<T, std::wstring>> Do(const PropId& id, T& str, StreamT& r) {
Read<PropType::None>::Do<DNAE>(id, str, r); Read<PropType::None>::Do<DNAE>(id, str, r);
} }
template <Endian DNAE> template <Endian DNAE>
@ -429,7 +425,7 @@ struct Write {
using PropT = std::conditional_t<PropOp == PropType::CRC64, uint64_t, uint32_t>; using PropT = std::conditional_t<PropOp == PropType::CRC64, uint64_t, uint32_t>;
using StreamT = IStreamWriter; using StreamT = IStreamWriter;
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_enum_v<T>> Do(const PropId& id, T& var, StreamT& w) { static std::enable_if_t<std::is_enum_v<T>> Do(const PropId& id, T& var, StreamT& w) {
if (PropOp != PropType::None) { if (PropOp != PropType::None) {
/* Accessed via Enumerate, header */ /* Accessed via Enumerate, header */
if (PropOp == PropType::CRC64) if (PropOp == PropType::CRC64)
@ -444,7 +440,7 @@ struct Write {
Write<PropType::None>::Do<PODType, DNAE>(id, *reinterpret_cast<PODType*>(&var), w); Write<PropType::None>::Do<PODType, DNAE>(id, *reinterpret_cast<PODType*>(&var), w);
} }
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<__IsPODType_v<T>> Do(const PropId& id, T& var, StreamT& w) { static std::enable_if_t<__IsPODType_v<T>> Do(const PropId& id, T& var, StreamT& w) {
using CastT = __CastPODType<T>; using CastT = __CastPODType<T>;
if (PropOp != PropType::None) { if (PropOp != PropType::None) {
/* Accessed via Enumerate, header */ /* Accessed via Enumerate, header */
@ -460,8 +456,7 @@ struct Write {
Write<PropType::None>::Do<CastT, DNAE>(id, static_cast<CastT&>(const_cast<std::remove_cv_t<T>&>(var)), w); Write<PropType::None>::Do<CastT, DNAE>(id, static_cast<CastT&>(const_cast<std::remove_cv_t<T>&>(var)), w);
} }
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<__IsDNARecord<T>() && PropOp != PropType::None> Do(const PropId& id, T& var, static std::enable_if_t<__IsDNARecord<T>() && PropOp != PropType::None> Do(const PropId& id, T& var, StreamT& w) {
StreamT& w) {
/* Accessed via Enumerate, header */ /* Accessed via Enumerate, header */
if (PropOp == PropType::CRC64) if (PropOp == PropType::CRC64)
__Write64<T::DNAEndian>(w, id.crc64); __Write64<T::DNAEndian>(w, id.crc64);
@ -477,12 +472,11 @@ struct Write {
var.template Enumerate<Write<PropOp>>(w); var.template Enumerate<Write<PropOp>>(w);
} }
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<__IsDNARecord<T>() && PropOp == PropType::None> Do(const PropId& id, T& var, static std::enable_if_t<__IsDNARecord<T>() && PropOp == PropType::None> Do(const PropId& id, T& var, StreamT& w) {
StreamT& w) {
var.template Enumerate<Write<PropType::None>>(w); var.template Enumerate<Write<PropType::None>>(w);
} }
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& s) { static std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& s) {
for (auto& v : var) for (auto& v : var)
Write<PropOp>::Do<std::remove_reference_t<decltype(v)>, DNAE>(id, v, s); Write<PropOp>::Do<std::remove_reference_t<decltype(v)>, DNAE>(id, v, s);
} }
@ -491,13 +485,13 @@ struct Write {
Write<PropOp>::Do<T, DNAE>(id, var, s); Write<PropOp>::Do<T, DNAE>(id, var, s);
} }
template <class T, class S, Endian DNAE> template <class T, class S, Endian DNAE>
static typename std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, static std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
const S& count, StreamT& w) { StreamT& w) {
for (T& v : vector) for (T& v : vector)
Write<PropOp>::Do<T, DNAE>(id, v, w); Write<PropOp>::Do<T, DNAE>(id, v, w);
} }
template <class T, class S, Endian DNAE> template <class T, class S, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count, static std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
StreamT& w) { StreamT& w) {
/* libc++ specializes vector<bool> as a bitstream */ /* libc++ specializes vector<bool> as a bitstream */
for (const T& v : vector) for (const T& v : vector)
@ -508,13 +502,12 @@ struct Write {
w.writeUBytes(buf.get(), count); w.writeUBytes(buf.get(), count);
} }
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, std::string>> Do(const PropId& id, std::string& str, StreamT& w) { static std::enable_if_t<std::is_same_v<T, std::string>> Do(const PropId& id, std::string& str, StreamT& w) {
w.writeString(str); w.writeString(str);
} }
static void Do(const PropId& id, std::string& str, atInt32 count, StreamT& w) { w.writeString(str, count); } static void Do(const PropId& id, std::string& str, atInt32 count, StreamT& w) { w.writeString(str, count); }
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, std::wstring>> Do(const PropId& id, std::wstring& str, static std::enable_if_t<std::is_same_v<T, std::wstring>> Do(const PropId& id, std::wstring& str, StreamT& w) {
StreamT& w) {
Write<PropType::None>::Do<DNAE>(id, str, w); Write<PropType::None>::Do<DNAE>(id, str, w);
} }
template <Endian DNAE> template <Endian DNAE>
@ -580,22 +573,22 @@ struct ReadYaml {
using PropT = std::conditional_t<PropOp == PropType::CRC64, uint64_t, uint32_t>; using PropT = std::conditional_t<PropOp == PropType::CRC64, uint64_t, uint32_t>;
using StreamT = YAMLDocReader; using StreamT = YAMLDocReader;
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_enum_v<T>> Do(const PropId& id, T& var, StreamT& r) { static std::enable_if_t<std::is_enum_v<T>> Do(const PropId& id, T& var, StreamT& r) {
using PODType = std::underlying_type_t<T>; using PODType = std::underlying_type_t<T>;
ReadYaml<PropType::None>::Do<PODType, DNAE>(id, *reinterpret_cast<PODType*>(&var), r); ReadYaml<PropType::None>::Do<PODType, DNAE>(id, *reinterpret_cast<PODType*>(&var), r);
} }
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<__IsPODType_v<T>> Do(const PropId& id, T& var, StreamT& r) { static std::enable_if_t<__IsPODType_v<T>> Do(const PropId& id, T& var, StreamT& r) {
using CastT = __CastPODType<T>; using CastT = __CastPODType<T>;
ReadYaml<PropType::None>::Do<CastT, DNAE>(id, static_cast<CastT&>(var), r); ReadYaml<PropType::None>::Do<CastT, DNAE>(id, static_cast<CastT&>(var), r);
} }
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<__IsDNARecord_v<T>> Do(const PropId& id, T& var, StreamT& r) { static std::enable_if_t<__IsDNARecord_v<T>> Do(const PropId& id, T& var, StreamT& r) {
if (auto rec = r.enterSubRecord(id.name)) if (auto rec = r.enterSubRecord(id.name))
var.template Enumerate<ReadYaml<PropOp>>(r); var.template Enumerate<ReadYaml<PropOp>>(r);
} }
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& r) { static std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& r) {
size_t _count; size_t _count;
if (auto __v = r.enterSubVector(id.name, _count)) if (auto __v = r.enterSubVector(id.name, _count))
for (size_t i = 0; i < _count && i < std::extent_v<T>; ++i) for (size_t i = 0; i < _count && i < std::extent_v<T>; ++i)
@ -606,8 +599,8 @@ struct ReadYaml {
/* Squelch size field access */ /* Squelch size field access */
} }
template <class T, class S, Endian DNAE> template <class T, class S, Endian DNAE>
static typename std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, static std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
const S& count, StreamT& r) { StreamT& r) {
size_t _count; size_t _count;
vector.clear(); vector.clear();
if (auto __v = r.enterSubVector(id.name, _count)) { if (auto __v = r.enterSubVector(id.name, _count)) {
@ -621,7 +614,7 @@ struct ReadYaml {
const_cast<S&>(count) = vector.size(); const_cast<S&>(count) = vector.size();
} }
template <class T, class S, Endian DNAE> template <class T, class S, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count, static std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
StreamT& r) { StreamT& r) {
/* libc++ specializes vector<bool> as a bitstream */ /* libc++ specializes vector<bool> as a bitstream */
size_t _count; size_t _count;
@ -638,12 +631,12 @@ struct ReadYaml {
buf = r.readUBytes(id.name); buf = r.readUBytes(id.name);
} }
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, std::string>> Do(const PropId& id, T& str, StreamT& r) { static std::enable_if_t<std::is_same_v<T, std::string>> Do(const PropId& id, T& str, StreamT& r) {
str = r.readString(id.name); str = r.readString(id.name);
} }
static void Do(const PropId& id, std::string& str, atInt32 count, StreamT& r) { str = r.readString(id.name); } static void Do(const PropId& id, std::string& str, atInt32 count, StreamT& r) { str = r.readString(id.name); }
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, std::wstring>> Do(const PropId& id, T& str, StreamT& r) { static std::enable_if_t<std::is_same_v<T, std::wstring>> Do(const PropId& id, T& str, StreamT& r) {
str = r.readWString(id.name); str = r.readWString(id.name);
} }
template <Endian DNAE> template <Endian DNAE>
@ -697,22 +690,22 @@ struct WriteYaml {
using PropT = std::conditional_t<PropOp == PropType::CRC64, uint64_t, uint32_t>; using PropT = std::conditional_t<PropOp == PropType::CRC64, uint64_t, uint32_t>;
using StreamT = YAMLDocWriter; using StreamT = YAMLDocWriter;
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_enum_v<T>> Do(const PropId& id, T& var, StreamT& w) { static std::enable_if_t<std::is_enum_v<T>> Do(const PropId& id, T& var, StreamT& w) {
using PODType = std::underlying_type_t<T>; using PODType = std::underlying_type_t<T>;
WriteYaml<PropType::None>::Do<PODType, DNAE>(id, *reinterpret_cast<PODType*>(&var), w); WriteYaml<PropType::None>::Do<PODType, DNAE>(id, *reinterpret_cast<PODType*>(&var), w);
} }
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<__IsPODType_v<T>> Do(const PropId& id, T& var, StreamT& w) { static std::enable_if_t<__IsPODType_v<T>> Do(const PropId& id, T& var, StreamT& w) {
using CastT = __CastPODType<T>; using CastT = __CastPODType<T>;
WriteYaml<PropType::None>::Do<CastT, DNAE>(id, static_cast<CastT&>(const_cast<std::remove_cv_t<T>&>(var)), w); WriteYaml<PropType::None>::Do<CastT, DNAE>(id, static_cast<CastT&>(const_cast<std::remove_cv_t<T>&>(var)), w);
} }
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<__IsDNARecord_v<T>> Do(const PropId& id, T& var, StreamT& w) { static std::enable_if_t<__IsDNARecord_v<T>> Do(const PropId& id, T& var, StreamT& w) {
if (auto rec = w.enterSubRecord(id.name)) if (auto rec = w.enterSubRecord(id.name))
var.template Enumerate<WriteYaml<PropOp>>(w); var.template Enumerate<WriteYaml<PropOp>>(w);
} }
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& w) { static std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& w) {
if (auto __v = w.enterSubVector(id.name)) if (auto __v = w.enterSubVector(id.name))
for (auto& v : var) for (auto& v : var)
WriteYaml<PropOp>::Do<std::remove_reference_t<decltype(v)>, DNAE>({}, v, w); WriteYaml<PropOp>::Do<std::remove_reference_t<decltype(v)>, DNAE>({}, v, w);
@ -722,14 +715,14 @@ struct WriteYaml {
/* Squelch size field access */ /* Squelch size field access */
} }
template <class T, class S, Endian DNAE> template <class T, class S, Endian DNAE>
static typename std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, static std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
const S& count, StreamT& w) { StreamT& w) {
if (auto __v = w.enterSubVector(id.name)) if (auto __v = w.enterSubVector(id.name))
for (T& v : vector) for (T& v : vector)
WriteYaml<PropOp>::Do<T, DNAE>(id, v, w); WriteYaml<PropOp>::Do<T, DNAE>(id, v, w);
} }
template <class T, class S, Endian DNAE> template <class T, class S, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count, static std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
StreamT& w) { StreamT& w) {
/* libc++ specializes vector<bool> as a bitstream */ /* libc++ specializes vector<bool> as a bitstream */
if (auto __v = w.enterSubVector(id.name)) if (auto __v = w.enterSubVector(id.name))
@ -740,12 +733,12 @@ struct WriteYaml {
w.writeUBytes(id.name, buf, count); w.writeUBytes(id.name, buf, count);
} }
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, std::string>> Do(const PropId& id, T& str, StreamT& w) { static std::enable_if_t<std::is_same_v<T, std::string>> Do(const PropId& id, T& str, StreamT& w) {
w.writeString(id.name, str); w.writeString(id.name, str);
} }
static void Do(const PropId& id, std::string& str, atInt32 count, StreamT& w) { w.writeString(id.name, str); } static void Do(const PropId& id, std::string& str, atInt32 count, StreamT& w) { w.writeString(id.name, str); }
template <class T, Endian DNAE> template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, std::wstring>> Do(const PropId& id, T& str, StreamT& w) { static std::enable_if_t<std::is_same_v<T, std::wstring>> Do(const PropId& id, T& str, StreamT& w) {
w.writeWString(id.name, str); w.writeWString(id.name, str);
} }
template <Endian DNAE> template <Endian DNAE>

View File

@ -9,12 +9,12 @@
namespace athena::io { namespace athena::io {
template <class T> template <class T>
const char* __GetDNAName(const T& dna, typename std::enable_if_t<athena::io::__IsDNAVRecord_v<T>>* = 0) { const char* __GetDNAName(const T& dna, std::enable_if_t<athena::io::__IsDNAVRecord_v<T>>* = nullptr) {
return dna.DNATypeV(); return dna.DNATypeV();
} }
template <class T> template <class T>
const char* __GetDNAName(const T& dna, typename std::enable_if_t<!athena::io::__IsDNAVRecord_v<T>>* = 0) { const char* __GetDNAName(const T& dna, std::enable_if_t<!athena::io::__IsDNAVRecord_v<T>>* = nullptr) {
return dna.DNAType(); return dna.DNAType();
} }

View File

@ -134,14 +134,13 @@ template <Endian DNAE>
struct DNAV; struct DNAV;
template <class T> template <class T>
using __IsDNARecord = using __IsDNARecord = std::disjunction<std::is_base_of<DNA<Endian::Big>, T>, std::is_base_of<DNA<Endian::Little>, T>>;
typename std::disjunction<std::is_base_of<DNA<Endian::Big>, T>, std::is_base_of<DNA<Endian::Little>, T>>;
template <class T> template <class T>
constexpr bool __IsDNARecord_v = __IsDNARecord<T>::value; constexpr bool __IsDNARecord_v = __IsDNARecord<T>::value;
template <class T> template <class T>
using __IsDNAVRecord = using __IsDNAVRecord =
typename std::disjunction<std::is_base_of<DNAV<Endian::Big>, T>, std::is_base_of<DNAV<Endian::Little>, T>>; std::disjunction<std::is_base_of<DNAV<Endian::Big>, T>, std::is_base_of<DNAV<Endian::Little>, T>>;
template <class T> template <class T>
constexpr bool __IsDNAVRecord_v = __IsDNAVRecord<T>::value; constexpr bool __IsDNAVRecord_v = __IsDNAVRecord<T>::value;
} // namespace io } // namespace io

View File

@ -68,15 +68,15 @@ public:
return val; return val;
} }
template <class T> template <class T>
atInt8 readVal(typename std::enable_if<std::is_same<T, atInt8>::value>::type* = 0) { atInt8 readVal(std::enable_if_t<std::is_same_v<T, atInt8>>* = nullptr) {
return readByte(); return readByte();
} }
template <class T> template <class T>
atInt8 readValLittle(typename std::enable_if<std::is_same<T, atInt8>::value>::type* = 0) { atInt8 readValLittle(std::enable_if_t<std::is_same_v<T, atInt8>>* = nullptr) {
return readByte(); return readByte();
} }
template <class T> template <class T>
atInt8 readValBig(typename std::enable_if<std::is_same<T, atInt8>::value>::type* = 0) { atInt8 readValBig(std::enable_if_t<std::is_same_v<T, atInt8>>* = nullptr) {
return readByte(); return readByte();
} }
@ -86,15 +86,15 @@ public:
*/ */
atUint8 readUByte() { return readByte(); } atUint8 readUByte() { return readByte(); }
template <class T> template <class T>
atUint8 readVal(typename std::enable_if<std::is_same<T, atUint8>::value>::type* = 0) { atUint8 readVal(std::enable_if_t<std::is_same_v<T, atUint8>>* = nullptr) {
return readUByte(); return readUByte();
} }
template <class T> template <class T>
atUint8 readValLittle(typename std::enable_if<std::is_same<T, atUint8>::value>::type* = 0) { atUint8 readValLittle(std::enable_if_t<std::is_same_v<T, atUint8>>* = nullptr) {
return readUByte(); return readUByte();
} }
template <class T> template <class T>
atUint8 readValBig(typename std::enable_if<std::is_same<T, atUint8>::value>::type* = 0) { atUint8 readValBig(std::enable_if_t<std::is_same_v<T, atUint8>>* = nullptr) {
return readUByte(); return readUByte();
} }
@ -146,7 +146,7 @@ public:
return m_endian == Big ? utility::BigInt16(val) : utility::LittleInt16(val); return m_endian == Big ? utility::BigInt16(val) : utility::LittleInt16(val);
} }
template <class T> template <class T>
atInt16 readVal(typename std::enable_if<std::is_same<T, atInt16>::value>::type* = 0) { atInt16 readVal(std::enable_if_t<std::is_same_v<T, atInt16>>* = nullptr) {
return readInt16(); return readInt16();
} }
@ -161,7 +161,7 @@ public:
return utility::LittleInt16(val); return utility::LittleInt16(val);
} }
template <class T> template <class T>
atInt16 readValLittle(typename std::enable_if<std::is_same<T, atInt16>::value>::type* = 0) { atInt16 readValLittle(std::enable_if_t<std::is_same_v<T, atInt16>>* = nullptr) {
return readInt16Little(); return readInt16Little();
} }
@ -176,7 +176,7 @@ public:
return utility::BigInt16(val); return utility::BigInt16(val);
} }
template <class T> template <class T>
atInt16 readValBig(typename std::enable_if<std::is_same<T, atInt16>::value>::type* = 0) { atInt16 readValBig(std::enable_if_t<std::is_same_v<T, atInt16>>* = nullptr) {
return readInt16Big(); return readInt16Big();
} }
@ -187,7 +187,7 @@ public:
*/ */
atUint16 readUint16() { return readInt16(); } atUint16 readUint16() { return readInt16(); }
template <class T> template <class T>
atUint16 readVal(typename std::enable_if<std::is_same<T, atUint16>::value>::type* = 0) { atUint16 readVal(std::enable_if_t<std::is_same_v<T, atUint16>>* = 0) {
return readUint16(); return readUint16();
} }
@ -202,7 +202,7 @@ public:
return utility::LittleUint16(val); return utility::LittleUint16(val);
} }
template <class T> template <class T>
atUint16 readValLittle(typename std::enable_if<std::is_same<T, atUint16>::value>::type* = 0) { atUint16 readValLittle(std::enable_if_t<std::is_same_v<T, atUint16>>* = nullptr) {
return readUint16Little(); return readUint16Little();
} }
@ -217,7 +217,7 @@ public:
return utility::BigUint16(val); return utility::BigUint16(val);
} }
template <class T> template <class T>
atUint16 readValBig(typename std::enable_if<std::is_same<T, atUint16>::value>::type* = 0) { atUint16 readValBig(std::enable_if_t<std::is_same_v<T, atUint16>>* = nullptr) {
return readUint16Big(); return readUint16Big();
} }
@ -232,7 +232,7 @@ public:
return m_endian == Big ? utility::BigInt32(val) : utility::LittleInt32(val); return m_endian == Big ? utility::BigInt32(val) : utility::LittleInt32(val);
} }
template <class T> template <class T>
atInt32 readVal(typename std::enable_if<std::is_same<T, atInt32>::value>::type* = 0) { atInt32 readVal(std::enable_if_t<std::is_same_v<T, atInt32>>* = nullptr) {
return readInt32(); return readInt32();
} }
@ -247,7 +247,7 @@ public:
return utility::LittleInt32(val); return utility::LittleInt32(val);
} }
template <class T> template <class T>
atInt32 readValLittle(typename std::enable_if<std::is_same<T, atInt32>::value>::type* = 0) { atInt32 readValLittle(std::enable_if_t<std::is_same_v<T, atInt32>>* = nullptr) {
return readInt32Little(); return readInt32Little();
} }
@ -262,7 +262,7 @@ public:
return utility::BigInt32(val); return utility::BigInt32(val);
} }
template <class T> template <class T>
atInt32 readValBig(typename std::enable_if<std::is_same<T, atInt32>::value>::type* = 0) { atInt32 readValBig(std::enable_if_t<std::is_same_v<T, atInt32>>* = nullptr) {
return readInt32Big(); return readInt32Big();
} }
@ -273,7 +273,7 @@ public:
*/ */
atUint32 readUint32() { return readInt32(); } atUint32 readUint32() { return readInt32(); }
template <class T> template <class T>
atUint32 readVal(typename std::enable_if<std::is_same<T, atUint32>::value>::type* = 0) { atUint32 readVal(std::enable_if_t<std::is_same_v<T, atUint32>>* = nullptr) {
return readUint32(); return readUint32();
} }
@ -288,7 +288,7 @@ public:
return utility::LittleUint32(val); return utility::LittleUint32(val);
} }
template <class T> template <class T>
atInt32 readValLittle(typename std::enable_if<std::is_same<T, atUint32>::value>::type* = 0) { atInt32 readValLittle(std::enable_if_t<std::is_same_v<T, atUint32>>* = nullptr) {
return readUint32Little(); return readUint32Little();
} }
@ -303,7 +303,7 @@ public:
return utility::BigUint32(val); return utility::BigUint32(val);
} }
template <class T> template <class T>
atUint32 readValBig(typename std::enable_if<std::is_same<T, atUint32>::value>::type* = 0) { atUint32 readValBig(std::enable_if_t<std::is_same_v<T, atUint32>>* = nullptr) {
return readUint32Big(); return readUint32Big();
} }
@ -318,7 +318,7 @@ public:
return m_endian == Big ? utility::BigInt64(val) : utility::LittleInt64(val); return m_endian == Big ? utility::BigInt64(val) : utility::LittleInt64(val);
} }
template <class T> template <class T>
atInt64 readVal(typename std::enable_if<std::is_same<T, atInt64>::value>::type* = 0) { atInt64 readVal(std::enable_if_t<std::is_same_v<T, atInt64>>* = nullptr) {
return readInt64(); return readInt64();
} }
@ -333,7 +333,7 @@ public:
return utility::LittleInt64(val); return utility::LittleInt64(val);
} }
template <class T> template <class T>
atInt64 readValLittle(typename std::enable_if<std::is_same<T, atInt64>::value>::type* = 0) { atInt64 readValLittle(std::enable_if_t<std::is_same_v<T, atInt64>>* = nullptr) {
return readInt64Little(); return readInt64Little();
} }
@ -348,7 +348,7 @@ public:
return utility::BigInt64(val); return utility::BigInt64(val);
} }
template <class T> template <class T>
atInt64 readValBig(typename std::enable_if<std::is_same<T, atInt64>::value>::type* = 0) { atInt64 readValBig(std::enable_if_t<std::is_same_v<T, atInt64>>* = nullptr) {
return readInt64Big(); return readInt64Big();
} }
@ -359,7 +359,7 @@ public:
*/ */
atUint64 readUint64() { return readInt64(); } atUint64 readUint64() { return readInt64(); }
template <class T> template <class T>
atUint64 readVal(typename std::enable_if<std::is_same<T, atUint64>::value>::type* = 0) { atUint64 readVal(std::enable_if_t<std::is_same_v<T, atUint64>>* = nullptr) {
return readUint64(); return readUint64();
} }
@ -374,7 +374,7 @@ public:
return utility::LittleUint64(val); return utility::LittleUint64(val);
} }
template <class T> template <class T>
atUint64 readValLittle(typename std::enable_if<std::is_same<T, atUint64>::value>::type* = 0) { atUint64 readValLittle(std::enable_if_t<std::is_same_v<T, atUint64>>* = nullptr) {
return readUint64Little(); return readUint64Little();
} }
@ -389,7 +389,7 @@ public:
return utility::BigUint64(val); return utility::BigUint64(val);
} }
template <class T> template <class T>
atUint64 readValBig(typename std::enable_if<std::is_same<T, atUint64>::value>::type* = 0) { atUint64 readValBig(std::enable_if_t<std::is_same_v<T, atUint64>>* = nullptr) {
return readUint64Big(); return readUint64Big();
} }
@ -404,7 +404,7 @@ public:
return m_endian == Big ? utility::BigFloat(val) : utility::LittleFloat(val); return m_endian == Big ? utility::BigFloat(val) : utility::LittleFloat(val);
} }
template <class T> template <class T>
float readVal(typename std::enable_if<std::is_same<T, float>::value>::type* = 0) { float readVal(std::enable_if_t<std::is_same_v<T, float>>* = nullptr) {
return readFloat(); return readFloat();
} }
@ -419,7 +419,7 @@ public:
return utility::LittleFloat(val); return utility::LittleFloat(val);
} }
template <class T> template <class T>
float readValLittle(typename std::enable_if<std::is_same<T, float>::value>::type* = 0) { float readValLittle(std::enable_if_t<std::is_same_v<T, float>>* = nullptr) {
return readFloatLittle(); return readFloatLittle();
} }
@ -434,7 +434,7 @@ public:
return utility::BigFloat(val); return utility::BigFloat(val);
} }
template <class T> template <class T>
float readValBig(typename std::enable_if<std::is_same<T, float>::value>::type* = 0) { float readValBig(std::enable_if_t<std::is_same_v<T, float>>* = nullptr) {
return readFloatBig(); return readFloatBig();
} }
@ -449,7 +449,7 @@ public:
return m_endian == Big ? utility::BigDouble(val) : utility::LittleDouble(val); return m_endian == Big ? utility::BigDouble(val) : utility::LittleDouble(val);
} }
template <class T> template <class T>
double readVal(typename std::enable_if<std::is_same<T, double>::value>::type* = 0) { double readVal(std::enable_if_t<std::is_same_v<T, double>>* = nullptr) {
return readDouble(); return readDouble();
} }
@ -464,7 +464,7 @@ public:
return utility::LittleDouble(val); return utility::LittleDouble(val);
} }
template <class T> template <class T>
double readValLittle(typename std::enable_if<std::is_same<T, double>::value>::type* = 0) { double readValLittle(std::enable_if_t<std::is_same_v<T, double>>* = nullptr) {
return readDoubleLittle(); return readDoubleLittle();
} }
@ -479,7 +479,7 @@ public:
return utility::BigDouble(val); return utility::BigDouble(val);
} }
template <class T> template <class T>
double readValBig(typename std::enable_if<std::is_same<T, double>::value>::type* = 0) { double readValBig(std::enable_if_t<std::is_same_v<T, double>>* = nullptr) {
return readDoubleBig(); return readDoubleBig();
} }
@ -493,15 +493,15 @@ public:
return val != 0; return val != 0;
} }
template <class T> template <class T>
bool readVal(typename std::enable_if<std::is_same<T, bool>::value>::type* = 0) { bool readVal(std::enable_if_t<std::is_same_v<T, bool>>* = nullptr) {
return readBool(); return readBool();
} }
template <class T> template <class T>
bool readValLittle(typename std::enable_if<std::is_same<T, bool>::value>::type* = 0) { bool readValLittle(std::enable_if_t<std::is_same_v<T, bool>>* = nullptr) {
return readBool(); return readBool();
} }
template <class T> template <class T>
bool readValBig(typename std::enable_if<std::is_same<T, bool>::value>::type* = 0) { bool readValBig(std::enable_if_t<std::is_same_v<T, bool>>* = nullptr) {
return readBool(); return readBool();
} }
@ -527,7 +527,7 @@ public:
return s; return s;
} }
template <class T> template <class T>
atVec2f readVal(typename std::enable_if<std::is_same<T, atVec2f>::value>::type* = 0) { atVec2f readVal(std::enable_if_t<std::is_same_v<T, atVec2f>>* = nullptr) {
return readVec2f(); return readVec2f();
} }
@ -548,7 +548,7 @@ public:
return s; return s;
} }
template <class T> template <class T>
atVec2f readValLittle(typename std::enable_if<std::is_same<T, atVec2f>::value>::type* = 0) { atVec2f readValLittle(std::enable_if_t<std::is_same_v<T, atVec2f>>* = nullptr) {
return readVec2fLittle(); return readVec2fLittle();
} }
@ -569,7 +569,7 @@ public:
return s; return s;
} }
template <class T> template <class T>
atVec2f readValBig(typename std::enable_if<std::is_same<T, atVec2f>::value>::type* = 0) { atVec2f readValBig(std::enable_if_t<std::is_same_v<T, atVec2f>>* = nullptr) {
return readVec2fBig(); return readVec2fBig();
} }
@ -596,7 +596,7 @@ public:
return s; return s;
} }
template <class T> template <class T>
atVec3f readVal(typename std::enable_if<std::is_same<T, atVec3f>::value>::type* = 0) { atVec3f readVal(std::enable_if_t<std::is_same_v<T, atVec3f>>* = nullptr) {
return readVec3f(); return readVec3f();
} }
@ -617,7 +617,7 @@ public:
return s; return s;
} }
template <class T> template <class T>
atVec3f readValLittle(typename std::enable_if<std::is_same<T, atVec3f>::value>::type* = 0) { atVec3f readValLittle(std::enable_if_t<std::is_same_v<T, atVec3f>>* = nullptr) {
return readVec3fLittle(); return readVec3fLittle();
} }
@ -638,7 +638,7 @@ public:
return s; return s;
} }
template <class T> template <class T>
atVec3f readValBig(typename std::enable_if<std::is_same<T, atVec3f>::value>::type* = 0) { atVec3f readValBig(std::enable_if_t<std::is_same_v<T, atVec3f>>* = nullptr) {
return readVec3fBig(); return readVec3fBig();
} }
@ -666,7 +666,7 @@ public:
return s; return s;
} }
template <class T> template <class T>
atVec4f readVal(typename std::enable_if<std::is_same<T, atVec4f>::value>::type* = 0) { atVec4f readVal(std::enable_if_t<std::is_same_v<T, atVec4f>>* = nullptr) {
return readVec4f(); return readVec4f();
} }
@ -687,7 +687,7 @@ public:
return s; return s;
} }
template <class T> template <class T>
atVec4f readValLittle(typename std::enable_if<std::is_same<T, atVec4f>::value>::type* = 0) { atVec4f readValLittle(std::enable_if_t<std::is_same_v<T, atVec4f>>* = nullptr) {
return readVec4fLittle(); return readVec4fLittle();
} }
@ -708,7 +708,7 @@ public:
return s; return s;
} }
template <class T> template <class T>
atVec4f readValBig(typename std::enable_if<std::is_same<T, atVec4f>::value>::type* = 0) { atVec4f readValBig(std::enable_if_t<std::is_same_v<T, atVec4f>>* = nullptr) {
return readVec4fBig(); return readVec4fBig();
} }
@ -734,7 +734,7 @@ public:
return s; return s;
} }
template <class T> template <class T>
atVec2d readVal(typename std::enable_if<std::is_same<T, atVec2d>::value>::type* = 0) { atVec2d readVal(std::enable_if_t<std::is_same_v<T, atVec2d>>* = nullptr) {
return readVec2d(); return readVec2d();
} }
@ -755,7 +755,7 @@ public:
return s; return s;
} }
template <class T> template <class T>
atVec2d readValLittle(typename std::enable_if<std::is_same<T, atVec2d>::value>::type* = 0) { atVec2d readValLittle(std::enable_if_t<std::is_same_v<T, atVec2d>>* = nullptr) {
return readVec2dLittle(); return readVec2dLittle();
} }
@ -776,7 +776,7 @@ public:
return s; return s;
} }
template <class T> template <class T>
atVec2d readValBig(typename std::enable_if<std::is_same<T, atVec2d>::value>::type* = 0) { atVec2d readValBig(std::enable_if_t<std::is_same_v<T, atVec2d>>* = nullptr) {
return readVec2dBig(); return readVec2dBig();
} }
@ -803,7 +803,7 @@ public:
return s; return s;
} }
template <class T> template <class T>
atVec3d readVal(typename std::enable_if<std::is_same<T, atVec3d>::value>::type* = 0) { atVec3d readVal(std::enable_if_t<std::is_same_v<T, atVec3d>>* = nullptr) {
return readVec3d(); return readVec3d();
} }
@ -824,7 +824,7 @@ public:
return s; return s;
} }
template <class T> template <class T>
atVec3d readValLittle(typename std::enable_if<std::is_same<T, atVec3d>::value>::type* = 0) { atVec3d readValLittle(std::enable_if_t<std::is_same_v<T, atVec3d>>* = nullptr) {
return readVec3dLittle(); return readVec3dLittle();
} }
@ -845,7 +845,7 @@ public:
return s; return s;
} }
template <class T> template <class T>
atVec3d readValBig(typename std::enable_if<std::is_same<T, atVec3d>::value>::type* = 0) { atVec3d readValBig(std::enable_if_t<std::is_same_v<T, atVec3d>>* = nullptr) {
return readVec3dBig(); return readVec3dBig();
} }
@ -873,7 +873,7 @@ public:
return s; return s;
} }
template <class T> template <class T>
atVec4d readVal(typename std::enable_if<std::is_same<T, atVec4d>::value>::type* = 0) { atVec4d readVal(std::enable_if_t<std::is_same_v<T, atVec4d>>* = nullptr) {
return readVec4d(); return readVec4d();
} }
@ -894,7 +894,7 @@ public:
return s; return s;
} }
template <class T> template <class T>
atVec4d readValLittle(typename std::enable_if<std::is_same<T, atVec4d>::value>::type* = 0) { atVec4d readValLittle(std::enable_if_t<std::is_same_v<T, atVec4d>>* = nullptr) {
return readVec4dLittle(); return readVec4dLittle();
} }
@ -915,7 +915,7 @@ public:
return s; return s;
} }
template <class T> template <class T>
atVec4d readValBig(typename std::enable_if<std::is_same<T, atVec4d>::value>::type* = 0) { atVec4d readValBig(std::enable_if_t<std::is_same_v<T, atVec4d>>* = nullptr) {
return readVec4dBig(); return readVec4dBig();
} }
@ -946,7 +946,7 @@ public:
return ret; return ret;
} }
template <class T> template <class T>
std::string readVal(typename std::enable_if<std::is_same<T, std::string>::value>::type* = 0) { std::string readVal(std::enable_if_t<std::is_same_v<T, std::string>>* = nullptr) {
return readString(); return readString();
} }
@ -978,7 +978,7 @@ public:
return ret; return ret;
} }
template <class T> template <class T>
std::wstring readVal(typename std::enable_if<std::is_same<T, std::wstring>::value>::type* = 0) { std::wstring readVal(std::enable_if_t<std::is_same_v<T, std::wstring>>* = nullptr) {
return readWString(); return readWString();
} }
@ -1011,7 +1011,7 @@ public:
return ret; return ret;
} }
template <class T> template <class T>
std::wstring readValLittle(typename std::enable_if<std::is_same<T, std::wstring>::value>::type* = 0) { std::wstring readValLittle(std::enable_if_t<std::is_same_v<T, std::wstring>>* = nullptr) {
return readWStringLittle(); return readWStringLittle();
} }
@ -1043,7 +1043,7 @@ public:
return ret; return ret;
} }
template <class T> template <class T>
std::wstring readValBig(typename std::enable_if<std::is_same<T, std::wstring>::value>::type* = 0) { std::wstring readValBig(std::enable_if_t<std::is_same_v<T, std::wstring>>* = nullptr) {
return readWStringBig(); return readWStringBig();
} }
@ -1075,7 +1075,7 @@ public:
return ret; return ret;
} }
template <class T> template <class T>
std::u16string readValBig(typename std::enable_if<std::is_same<T, std::u16string>::value>::type* = 0) { std::u16string readValBig(std::enable_if_t<std::is_same_v<T, std::u16string>>* = nullptr) {
return readU16StringBig(); return readU16StringBig();
} }
@ -1107,7 +1107,7 @@ public:
return ret; return ret;
} }
template <class T> template <class T>
std::u32string readValBig(typename std::enable_if<std::is_same<T, std::u32string>::value>::type* = 0) { std::u32string readValBig(std::enable_if_t<std::is_same_v<T, std::u32string>>* = nullptr) {
return readU32StringBig(); return readU32StringBig();
} }
@ -1121,8 +1121,8 @@ public:
template <class T> template <class T>
void void
enumerate(std::vector<T>& vector, size_t count, enumerate(std::vector<T>& vector, size_t count,
typename std::enable_if<std::is_arithmetic<T>::value || std::is_same<T, atVec2f>::value || std::enable_if<std::is_arithmetic_v<T> || std::is_same_v<T, atVec2f> ||
std::is_same<T, atVec3f>::value || std::is_same<T, atVec4f>::value>::type* = 0) { std::is_same_v<T, atVec3f> || std::is_same_v<T, atVec4f>>* = nullptr) {
vector.clear(); vector.clear();
vector.reserve(count); vector.reserve(count);
for (size_t i = 0; i < count; ++i) for (size_t i = 0; i < count; ++i)
@ -1137,10 +1137,9 @@ public:
* Endianness is little * Endianness is little
*/ */
template <class T> template <class T>
void enumerateLittle( void enumerateLittle(std::vector<T>& vector, size_t count,
std::vector<T>& vector, size_t count, std::enable_if_t<std::is_arithmetic_v<T> || std::is_same_v<T, atVec2f> ||
typename std::enable_if<std::is_arithmetic<T>::value || std::is_same<T, atVec2f>::value || std::is_same_v<T, atVec3f> || std::is_same_v<T, atVec4f>>* = nullptr) {
std::is_same<T, atVec3f>::value || std::is_same<T, atVec4f>::value>::type* = 0) {
vector.clear(); vector.clear();
vector.reserve(count); vector.reserve(count);
for (size_t i = 0; i < count; ++i) for (size_t i = 0; i < count; ++i)
@ -1155,10 +1154,9 @@ public:
* Endianness is big * Endianness is big
*/ */
template <class T> template <class T>
void void enumerateBig(std::vector<T>& vector, size_t count,
enumerateBig(std::vector<T>& vector, size_t count, std::enable_if_t<std::is_arithmetic_v<T> || std::is_same_v<T, atVec2f> ||
typename std::enable_if<std::is_arithmetic<T>::value || std::is_same<T, atVec2f>::value || std::is_same_v<T, atVec3f> || std::is_same_v<T, atVec4f>>* = nullptr) {
std::is_same<T, atVec3f>::value || std::is_same<T, atVec4f>::value>::type* = 0) {
vector.clear(); vector.clear();
vector.reserve(count); vector.reserve(count);
for (size_t i = 0; i < count; ++i) for (size_t i = 0; i < count; ++i)
@ -1171,10 +1169,9 @@ public:
* @param count The number of elements to read into vector * @param count The number of elements to read into vector
*/ */
template <class T> template <class T>
void void enumerate(std::vector<T>& vector, size_t count,
enumerate(std::vector<T>& vector, size_t count, std::enable_if_t<!std::is_arithmetic_v<T> && !std::is_same_v<T, atVec2f> &&
typename std::enable_if<!std::is_arithmetic<T>::value && !std::is_same<T, atVec2f>::value && !std::is_same_v<T, atVec3f> && !std::is_same_v<T, atVec4f>>* = nullptr) {
!std::is_same<T, atVec3f>::value && !std::is_same<T, atVec4f>::value>::type* = 0) {
vector.clear(); vector.clear();
vector.reserve(count); vector.reserve(count);
for (size_t i = 0; i < count; ++i) { for (size_t i = 0; i < count; ++i) {

View File

@ -990,10 +990,9 @@ public:
* Endianness is set with setEndian * Endianness is set with setEndian
*/ */
template <class T> template <class T>
void void enumerate(const std::vector<T>& vector,
enumerate(const std::vector<T>& vector, std::enable_if_t<std::is_arithmetic_v<T> || std::is_same_v<T, atVec2f> || std::is_same_v<T, atVec3f> ||
typename std::enable_if<std::is_arithmetic<T>::value || std::is_same<T, atVec2f>::value || std::is_same_v<T, atVec4f>>* = nullptr) {
std::is_same<T, atVec3f>::value || std::is_same<T, atVec4f>::value>::type* = 0) {
for (const T& item : vector) for (const T& item : vector)
writeVal(item); writeVal(item);
} }
@ -1004,10 +1003,9 @@ public:
* Endianness is little * Endianness is little
*/ */
template <class T> template <class T>
void enumerateLittle( void enumerateLittle(const std::vector<T>& vector,
const std::vector<T>& vector, std::enable_if_t<std::is_arithmetic_v<T> || std::is_same_v<T, atVec2f> ||
typename std::enable_if<std::is_arithmetic<T>::value || std::is_same<T, atVec2f>::value || std::is_same_v<T, atVec3f> || std::is_same_v<T, atVec4f>>* = nullptr) {
std::is_same<T, atVec3f>::value || std::is_same<T, atVec4f>::value>::type* = 0) {
for (const T& item : vector) for (const T& item : vector)
writeValLittle(item); writeValLittle(item);
} }
@ -1018,10 +1016,9 @@ public:
* Endianness is big * Endianness is big
*/ */
template <class T> template <class T>
void void enumerateBig(const std::vector<T>& vector,
enumerateBig(const std::vector<T>& vector, std::enable_if_t<std::is_arithmetic_v<T> || std::is_same_v<T, atVec2f> ||
typename std::enable_if<std::is_arithmetic<T>::value || std::is_same<T, atVec2f>::value || std::is_same_v<T, atVec3f> || std::is_same_v<T, atVec4f>>* = nullptr) {
std::is_same<T, atVec3f>::value || std::is_same<T, atVec4f>::value>::type* = 0) {
for (const T& item : vector) for (const T& item : vector)
writeValBig(item); writeValBig(item);
} }
@ -1030,10 +1027,9 @@ public:
* @param vector The std::vector read from when writing data * @param vector The std::vector read from when writing data
*/ */
template <class T> template <class T>
void void enumerate(const std::vector<T>& vector,
enumerate(const std::vector<T>& vector, std::enable_if_t<!std::is_arithmetic_v<T> && !std::is_same_v<T, atVec2f> &&
typename std::enable_if<!std::is_arithmetic<T>::value && !std::is_same<T, atVec2f>::value && !std::is_same_v<T, atVec3f> && !std::is_same_v<T, atVec4f>>* = nullptr) {
!std::is_same<T, atVec3f>::value && !std::is_same<T, atVec4f>::value>::type* = 0) {
for (const T& item : vector) for (const T& item : vector)
item.write(*this); item.write(*this);
} }

View File

@ -54,7 +54,7 @@ public:
RecordRAII enterSubRecord(const char* name); RecordRAII enterSubRecord(const char* name);
template <class T> template <class T>
void enumerate(const char* name, T& record, typename std::enable_if_t<__IsDNARecord_v<T>>* = 0) { void enumerate(const char* name, T& record, std::enable_if_t<__IsDNARecord_v<T>>* = nullptr) {
if (auto rec = enterSubRecord(name)) if (auto rec = enterSubRecord(name))
record.read(*this); record.read(*this);
} }
@ -77,10 +77,9 @@ public:
VectorRAII enterSubVector(const char* name, size_t& countOut); VectorRAII enterSubVector(const char* name, size_t& countOut);
template <class T> template <class T>
size_t size_t enumerate(const char* name, std::vector<T>& vector,
enumerate(const char* name, std::vector<T>& vector, std::enable_if_t<!std::is_arithmetic_v<T> && !std::is_same_v<T, atVec2f> &&
typename std::enable_if_t<!std::is_arithmetic<T>::value && !std::is_same<T, atVec2f>::value && !std::is_same_v<T, atVec3f> && !std::is_same_v<T, atVec4f>>* = nullptr) {
!std::is_same<T, atVec3f>::value && !std::is_same<T, atVec4f>::value>* = 0) {
size_t countOut; size_t countOut;
if (auto v = enterSubVector(name, countOut)) { if (auto v = enterSubVector(name, countOut)) {
vector.clear(); vector.clear();
@ -96,8 +95,8 @@ public:
template <class T> template <class T>
size_t enumerate(const char* name, std::vector<T>& vector, size_t enumerate(const char* name, std::vector<T>& vector,
typename std::enable_if_t<std::is_arithmetic<T>::value || std::is_same<T, atVec2f>::value || std::enable_if_t<std::is_arithmetic_v<T> || std::is_same_v<T, atVec2f> ||
std::is_same<T, atVec3f>::value || std::is_same<T, atVec4f>::value>* = 0) { std::is_same_v<T, atVec3f> || std::is_same_v<T, atVec4f>>* = nullptr) {
size_t countOut; size_t countOut;
if (auto v = enterSubVector(name, countOut)) { if (auto v = enterSubVector(name, countOut)) {
vector.clear(); vector.clear();

View File

@ -40,7 +40,7 @@ public:
RecordRAII enterSubRecord(const char* name); RecordRAII enterSubRecord(const char* name);
template <class T> template <class T>
void enumerate(const char* name, T& record, typename std::enable_if_t<__IsDNARecord_v<T>>* = 0) { void enumerate(const char* name, T& record, std::enable_if_t<__IsDNARecord_v<T>>* = nullptr) {
if (auto rec = enterSubRecord(name)) if (auto rec = enterSubRecord(name))
record.write(*this); record.write(*this);
} }
@ -63,11 +63,11 @@ public:
VectorRAII enterSubVector(const char* name); VectorRAII enterSubVector(const char* name);
template <class T> template <class T>
void enumerate(const char* name, const std::vector<T>& vector, void
typename std::enable_if_t<!std::is_arithmetic<T>::value && !std::is_same<T, atVec2f>::value && enumerate(const char* name, const std::vector<T>& vector,
!std::is_same<T, atVec3f>::value && !std::is_same<T, atVec4f>::value && std::enable_if_t<!std::is_arithmetic_v<T> && !std::is_same_v<T, atVec2f> && !std::is_same_v<T, atVec3f> &&
!std::is_same<T, atVec2d>::value && !std::is_same<T, atVec3d>::value && !std::is_same_v<T, atVec4f> && !std::is_same_v<T, atVec2d> &&
!std::is_same<T, atVec4d>::value>* = 0) { !std::is_same_v<T, atVec3d> && !std::is_same_v<T, atVec4d>>* = nullptr) {
if (auto v = enterSubVector(name)) if (auto v = enterSubVector(name))
for (const T& item : vector) for (const T& item : vector)
if (auto rec = enterSubRecord(nullptr)) if (auto rec = enterSubRecord(nullptr))
@ -76,10 +76,9 @@ public:
template <class T> template <class T>
void enumerate(const char* name, const std::vector<T>& vector, void enumerate(const char* name, const std::vector<T>& vector,
typename std::enable_if_t<std::is_arithmetic<T>::value || std::is_same<T, atVec2f>::value || std::enable_if_t<std::is_arithmetic_v<T> || std::is_same_v<T, atVec2f> || std::is_same_v<T, atVec3f> ||
std::is_same<T, atVec3f>::value || std::is_same<T, atVec4f>::value || std::is_same_v<T, atVec4f> || std::is_same_v<T, atVec2d> ||
std::is_same<T, atVec2d>::value || std::is_same<T, atVec3d>::value || std::is_same_v<T, atVec3d> || std::is_same_v<T, atVec4d>>* = nullptr) {
std::is_same<T, atVec4d>::value>* = 0) {
if (auto v = enterSubVector(name)) if (auto v = enterSubVector(name))
for (T item : vector) for (T item : vector)
writeVal<T>(nullptr, item); writeVal<T>(nullptr, item);