Merge pull request #42 from lioncash/inline

General: Minor general cleanup
This commit is contained in:
Phillip Stephens 2019-08-15 08:39:13 -07:00 committed by GitHub
commit 5973db475c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 284 additions and 302 deletions

View File

@ -6,6 +6,6 @@ class LZType10 : public LZBase {
public:
explicit LZType10(atInt32 minimumOffset = 1, atInt32 SlidingWindow = 4096, atInt32 MinimumMatch = 3,
atInt32 BlockSize = 8);
atUint32 compress(const atUint8* src, atUint8** dstBuf, atUint32 srcLength);
atUint32 decompress(const atUint8* src, atUint8** dst, atUint32 srcLen);
atUint32 compress(const atUint8* src, atUint8** dstBuf, atUint32 srcLength) override;
atUint32 decompress(const atUint8* src, atUint8** dst, atUint32 srcLen) override;
};

View File

@ -6,6 +6,6 @@ class LZType11 : public LZBase {
public:
explicit LZType11(atInt32 MinimumOffset = 1, atInt32 SlidingWindow = 4096, atInt32 MinimumMatch = 3,
atInt32 BlockSize = 8);
atUint32 compress(const atUint8* src, atUint8** dst, atUint32 srcLength);
atUint32 decompress(const atUint8* src, atUint8** dst, atUint32 srcLength);
atUint32 compress(const atUint8* src, atUint8** dst, atUint32 srcLength) override;
atUint32 decompress(const atUint8* src, atUint8** dst, atUint32 srcLength) override;
};

View File

@ -56,16 +56,16 @@ constexpr PropId operator"" _propid(const char* s, size_t len) { return {s}; }
enum class PropType { None, CRC32, CRC64 };
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_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>&, atVec4d&>>;
template <class T>
inline constexpr bool __IsPODType_v = __IsPODType<T>::value;
constexpr bool __IsPODType_v = __IsPODType<T>::value;
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::conditional_t<
std::is_convertible_v<std::remove_cv_t<T>&, atVec3f&>, atVec3f,
@ -78,32 +78,32 @@ using __CastPODType = typename std::conditional_t<
std::remove_cv_t<T>>>>>>>;
template <Endian DNAE>
inline uint16_t __Read16(IStreamReader& r) {
uint16_t __Read16(IStreamReader& r) {
return DNAE == Endian::Big ? r.readUint16Big() : r.readUint16Little();
}
template <Endian DNAE>
inline void __Write16(IStreamWriter& w, uint16_t v) {
void __Write16(IStreamWriter& w, uint16_t v) {
DNAE == Endian::Big ? w.writeUint16Big(v) : w.writeUint16Little(v);
}
template <Endian DNAE>
inline uint32_t __Read32(IStreamReader& r) {
uint32_t __Read32(IStreamReader& r) {
return DNAE == Endian::Big ? r.readUint32Big() : r.readUint32Little();
}
template <Endian DNAE>
inline void __Write32(IStreamWriter& w, uint32_t v) {
void __Write32(IStreamWriter& w, uint32_t v) {
DNAE == Endian::Big ? w.writeUint32Big(v) : w.writeUint32Little(v);
}
template <Endian DNAE>
inline uint64_t __Read64(IStreamReader& r) {
uint64_t __Read64(IStreamReader& r) {
return DNAE == Endian::Big ? r.readUint64Big() : r.readUint64Little();
}
template <Endian DNAE>
inline void __Write64(IStreamWriter& w, uint64_t v) {
void __Write64(IStreamWriter& w, uint64_t v) {
DNAE == Endian::Big ? w.writeUint64Big(v) : w.writeUint64Little(v);
}
@ -112,7 +112,7 @@ struct BinarySize {
using PropT = std::conditional_t<PropOp == PropType::CRC64, uint64_t, uint32_t>;
using StreamT = size_t;
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) {
/* Accessed via Enumerate, header */
s += 6;
@ -121,7 +121,7 @@ struct BinarySize {
BinarySize<PropType::None>::Do<PODType, DNAE>(id, *reinterpret_cast<PODType*>(&var), s);
}
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) {
/* Accessed via Enumerate, header */
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);
}
template <class T, Endian DNAE>
static typename std::enable_if_t<__IsDNARecord_v<T> && PropOp != PropType::None> Do(const PropId& id, T& var,
StreamT& s) {
static std::enable_if_t<__IsDNARecord_v<T> && PropOp != PropType::None> Do(const PropId& id, T& var, StreamT& s) {
/* Accessed via Enumerate, header */
s += 6;
var.template Enumerate<BinarySize<PropOp>>(s);
}
template <class T, Endian DNAE>
static typename std::enable_if_t<__IsDNARecord_v<T> && PropOp == PropType::None> Do(const PropId& id, T& var,
StreamT& s) {
static std::enable_if_t<__IsDNARecord_v<T> && PropOp == PropType::None> Do(const PropId& id, T& var, StreamT& s) {
var.template Enumerate<BinarySize<PropType::None>>(s);
}
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)
BinarySize<PropOp>::Do<std::remove_reference_t<decltype(v)>, DNAE>(id, v, s);
}
@ -151,14 +149,14 @@ struct BinarySize {
BinarySize<PropOp>::Do<T, DNAE>(id, var, s);
}
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, StreamT& s) {
static std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
StreamT& s) {
for (T& v : vector)
BinarySize<PropOp>::Do<T, DNAE>(id, v, s);
}
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,
StreamT& s) {
static std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
StreamT& s) {
/* libc++ specializes vector<bool> as a bitstream */
s += vector.size();
}
@ -167,7 +165,7 @@ struct BinarySize {
s += count;
}
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;
}
static void Do(const PropId& id, std::string& str, atInt32 count, StreamT& s) {
@ -177,7 +175,7 @@ struct BinarySize {
s += count;
}
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;
}
template <Endian DNAE>
@ -263,7 +261,7 @@ struct PropCount {
s += 1;
}
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 */
s += 1;
}
@ -272,7 +270,7 @@ struct PropCount {
s += 1;
}
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 */
s += 1;
}
@ -290,23 +288,21 @@ struct Read {
using PropT = std::conditional_t<PropOp == PropType::CRC64, uint64_t, uint32_t>;
using StreamT = IStreamReader;
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>;
Read<PropType::None>::Do<PODType, DNAE>(id, *reinterpret_cast<PODType*>(&var), r);
}
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>;
Read<PropType::None>::Do<CastT, DNAE>(id, static_cast<CastT&>(var), r);
}
template <class T, Endian DNAE>
static typename std::enable_if_t<__IsDNARecord<T>() && PropOp == PropType::None> Do(const PropId& id, T& var,
StreamT& r) {
static std::enable_if_t<__IsDNARecord<T>() && PropOp == PropType::None> Do(const PropId& id, T& var, StreamT& r) {
var.template Enumerate<Read<PropType::None>>(r);
}
template <class T, Endian DNAE>
static typename std::enable_if_t<__IsDNARecord<T>() && PropOp != PropType::None> Do(const PropId& id, T& var,
StreamT& r) {
static std::enable_if_t<__IsDNARecord<T>() && PropOp != PropType::None> Do(const PropId& id, T& var, StreamT& r) {
/* Accessed via Lookup, no header */
atUint16 propCount = __Read16<T::DNAEndian>(r);
for (atUint32 i = 0; i < propCount; ++i) {
@ -324,7 +320,7 @@ struct Read {
}
}
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)
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);
}
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, StreamT& r) {
static std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
StreamT& r) {
vector.clear();
vector.reserve(count);
for (size_t i = 0; i < static_cast<size_t>(count); ++i) {
@ -343,8 +339,8 @@ struct Read {
}
}
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,
StreamT& r) {
static std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
StreamT& r) {
/* libc++ specializes vector<bool> as a bitstream */
vector.clear();
vector.reserve(count);
@ -356,12 +352,12 @@ struct Read {
r.readUBytesToBuf(buf.get(), count);
}
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();
}
static void Do(const PropId& id, std::string& str, atInt32 count, StreamT& r) { str = r.readString(count); }
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);
}
template <Endian DNAE>
@ -429,7 +425,7 @@ struct Write {
using PropT = std::conditional_t<PropOp == PropType::CRC64, uint64_t, uint32_t>;
using StreamT = IStreamWriter;
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) {
/* Accessed via Enumerate, header */
if (PropOp == PropType::CRC64)
@ -444,7 +440,7 @@ struct Write {
Write<PropType::None>::Do<PODType, DNAE>(id, *reinterpret_cast<PODType*>(&var), w);
}
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>;
if (PropOp != PropType::None) {
/* 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);
}
template <class T, Endian DNAE>
static typename std::enable_if_t<__IsDNARecord<T>() && PropOp != PropType::None> Do(const PropId& id, T& var,
StreamT& w) {
static std::enable_if_t<__IsDNARecord<T>() && PropOp != PropType::None> Do(const PropId& id, T& var, StreamT& w) {
/* Accessed via Enumerate, header */
if (PropOp == PropType::CRC64)
__Write64<T::DNAEndian>(w, id.crc64);
@ -477,12 +472,11 @@ struct Write {
var.template Enumerate<Write<PropOp>>(w);
}
template <class T, Endian DNAE>
static typename std::enable_if_t<__IsDNARecord<T>() && PropOp == PropType::None> Do(const PropId& id, T& var,
StreamT& w) {
static std::enable_if_t<__IsDNARecord<T>() && PropOp == PropType::None> Do(const PropId& id, T& var, StreamT& w) {
var.template Enumerate<Write<PropType::None>>(w);
}
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)
Write<PropOp>::Do<std::remove_reference_t<decltype(v)>, DNAE>(id, v, s);
}
@ -491,14 +485,14 @@ struct Write {
Write<PropOp>::Do<T, DNAE>(id, var, s);
}
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, StreamT& w) {
static std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
StreamT& w) {
for (T& v : vector)
Write<PropOp>::Do<T, DNAE>(id, v, w);
}
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,
StreamT& w) {
static std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
StreamT& w) {
/* libc++ specializes vector<bool> as a bitstream */
for (const T& v : vector)
w.writeBool(v);
@ -508,13 +502,12 @@ struct Write {
w.writeUBytes(buf.get(), count);
}
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);
}
static void Do(const PropId& id, std::string& str, atInt32 count, StreamT& w) { w.writeString(str, count); }
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,
StreamT& w) {
static std::enable_if_t<std::is_same_v<T, std::wstring>> Do(const PropId& id, std::wstring& str, StreamT& w) {
Write<PropType::None>::Do<DNAE>(id, str, w);
}
template <Endian DNAE>
@ -580,22 +573,22 @@ struct ReadYaml {
using PropT = std::conditional_t<PropOp == PropType::CRC64, uint64_t, uint32_t>;
using StreamT = YAMLDocReader;
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>;
ReadYaml<PropType::None>::Do<PODType, DNAE>(id, *reinterpret_cast<PODType*>(&var), r);
}
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>;
ReadYaml<PropType::None>::Do<CastT, DNAE>(id, static_cast<CastT&>(var), r);
}
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))
var.template Enumerate<ReadYaml<PropOp>>(r);
}
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;
if (auto __v = r.enterSubVector(id.name, _count))
for (size_t i = 0; i < _count && i < std::extent_v<T>; ++i)
@ -606,8 +599,8 @@ struct ReadYaml {
/* Squelch size field access */
}
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, StreamT& r) {
static std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
StreamT& r) {
size_t _count;
vector.clear();
if (auto __v = r.enterSubVector(id.name, _count)) {
@ -621,8 +614,8 @@ struct ReadYaml {
const_cast<S&>(count) = vector.size();
}
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,
StreamT& r) {
static std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
StreamT& r) {
/* libc++ specializes vector<bool> as a bitstream */
size_t _count;
vector.clear();
@ -638,12 +631,12 @@ struct ReadYaml {
buf = r.readUBytes(id.name);
}
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);
}
static void Do(const PropId& id, std::string& str, atInt32 count, StreamT& r) { str = r.readString(id.name); }
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);
}
template <Endian DNAE>
@ -697,22 +690,22 @@ struct WriteYaml {
using PropT = std::conditional_t<PropOp == PropType::CRC64, uint64_t, uint32_t>;
using StreamT = YAMLDocWriter;
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>;
WriteYaml<PropType::None>::Do<PODType, DNAE>(id, *reinterpret_cast<PODType*>(&var), w);
}
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>;
WriteYaml<PropType::None>::Do<CastT, DNAE>(id, static_cast<CastT&>(const_cast<std::remove_cv_t<T>&>(var)), w);
}
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))
var.template Enumerate<WriteYaml<PropOp>>(w);
}
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))
for (auto& v : var)
WriteYaml<PropOp>::Do<std::remove_reference_t<decltype(v)>, DNAE>({}, v, w);
@ -722,15 +715,15 @@ struct WriteYaml {
/* Squelch size field access */
}
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, StreamT& w) {
static std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
StreamT& w) {
if (auto __v = w.enterSubVector(id.name))
for (T& v : vector)
WriteYaml<PropOp>::Do<T, DNAE>(id, v, w);
}
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,
StreamT& w) {
static std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
StreamT& w) {
/* libc++ specializes vector<bool> as a bitstream */
if (auto __v = w.enterSubVector(id.name))
for (const T& v : vector)
@ -740,12 +733,12 @@ struct WriteYaml {
w.writeUBytes(id.name, buf, count);
}
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);
}
static void Do(const PropId& id, std::string& str, atInt32 count, StreamT& w) { w.writeString(id.name, str); }
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);
}
template <Endian DNAE>
@ -795,77 +788,77 @@ __WRITE_YAML_S(atVec4f, Endian::Little) { w.writeVec4f(id.name, var); }
__WRITE_YAML_S(atVec4d, Endian::Little) { w.writeVec4d(id.name, var); }
template <class Op, class T, Endian DNAE>
inline void __Do(const PropId& id, T& var, typename Op::StreamT& s) {
void __Do(const PropId& id, T& var, typename Op::StreamT& s) {
Op::template Do<T, DNAE>(id, var, s);
}
template <class Op, class T, Endian DNAE>
inline void __DoSize(const PropId& id, T& var, typename Op::StreamT& s) {
void __DoSize(const PropId& id, T& var, typename Op::StreamT& s) {
Op::template DoSize<T, DNAE>(id, var, s);
}
template <class Op, class T, class S, Endian DNAE>
inline void __Do(const PropId& id, std::vector<T>& vector, const S& count, typename Op::StreamT& s) {
void __Do(const PropId& id, std::vector<T>& vector, const S& count, typename Op::StreamT& s) {
Op::template Do<T, S, DNAE>(id, vector, count, s);
}
template <class Op>
inline void __Do(const PropId& id, std::unique_ptr<atUint8[]>& buf, size_t count, typename Op::StreamT& s) {
void __Do(const PropId& id, std::unique_ptr<atUint8[]>& buf, size_t count, typename Op::StreamT& s) {
Op::Do(id, buf, count, s);
}
template <class Op>
inline void __Do(const PropId& id, std::string& str, atInt32 count, typename Op::StreamT& s) {
void __Do(const PropId& id, std::string& str, atInt32 count, typename Op::StreamT& s) {
Op::Do(id, str, count, s);
}
template <class Op, Endian DNAE>
inline void __Do(const PropId& id, std::wstring& str, atInt32 count, typename Op::StreamT& s) {
void __Do(const PropId& id, std::wstring& str, atInt32 count, typename Op::StreamT& s) {
Op::template Do<DNAE>(id, str, count, s);
}
template <class Op>
inline void __DoSeek(atInt64 delta, athena::SeekOrigin whence, typename Op::StreamT& s) {
void __DoSeek(atInt64 delta, athena::SeekOrigin whence, typename Op::StreamT& s) {
Op::DoSeek(delta, whence, s);
}
template <class Op>
inline void __DoAlign(atInt64 amount, typename Op::StreamT& s) {
void __DoAlign(atInt64 amount, typename Op::StreamT& s) {
Op::DoAlign(amount, s);
}
template <class T>
inline void __Read(T& obj, athena::io::IStreamReader& r) {
void __Read(T& obj, athena::io::IStreamReader& r) {
__Do<Read<PropType::None>, T, T::DNAEndian>({}, obj, r);
}
template <class T>
inline void __Write(const T& obj, athena::io::IStreamWriter& w) {
void __Write(const T& obj, athena::io::IStreamWriter& w) {
__Do<Write<PropType::None>, T, T::DNAEndian>({}, const_cast<T&>(obj), w);
}
template <class T>
inline void __BinarySize(const T& obj, size_t& s) {
void __BinarySize(const T& obj, size_t& s) {
__Do<BinarySize<PropType::None>, T, T::DNAEndian>({}, const_cast<T&>(obj), s);
}
template <class T>
inline void __PropCount(const T& obj, size_t& s) {
void __PropCount(const T& obj, size_t& s) {
const_cast<T&>(obj).template Enumerate<PropCount<PropType::None>>(s);
}
template <class T>
inline void __ReadYaml(T& obj, athena::io::YAMLDocReader& r) {
void __ReadYaml(T& obj, athena::io::YAMLDocReader& r) {
obj.template Enumerate<ReadYaml<PropType::None>>(r);
}
template <class T>
inline void __WriteYaml(const T& obj, athena::io::YAMLDocWriter& w) {
void __WriteYaml(const T& obj, athena::io::YAMLDocWriter& w) {
const_cast<T&>(obj).template Enumerate<WriteYaml<PropType::None>>(w);
}
template <class T>
inline void __ReadProp(T& obj, athena::io::IStreamReader& r) {
void __ReadProp(T& obj, athena::io::IStreamReader& r) {
/* Read root 0xffffffff hash (hashed empty string) */
T::DNAEndian == Endian::Big ? r.readUint32Big() : r.readUint32Little();
atInt64 size = T::DNAEndian == Endian::Big ? r.readUint16Big() : r.readUint16Little();
@ -877,17 +870,17 @@ inline void __ReadProp(T& obj, athena::io::IStreamReader& r) {
}
template <class T>
inline void __WriteProp(const T& obj, athena::io::IStreamWriter& w) {
void __WriteProp(const T& obj, athena::io::IStreamWriter& w) {
__Do<Write<PropType::CRC32>, T, T::DNAEndian>({}, const_cast<T&>(obj), w);
}
template <class T>
inline void __BinarySizeProp(const T& obj, size_t& s) {
void __BinarySizeProp(const T& obj, size_t& s) {
__Do<BinarySize<PropType::CRC32>, T, T::DNAEndian>({}, const_cast<T&>(obj), s);
}
template <class T>
inline void __ReadProp64(T& obj, athena::io::IStreamReader& r) {
void __ReadProp64(T& obj, athena::io::IStreamReader& r) {
/* Read root 0x0 hash (hashed empty string) */
T::DNAEndian == Endian::Big ? r.readUint64Big() : r.readUint64Little();
atInt64 size = T::DNAEndian == Endian::Big ? r.readUint16Big() : r.readUint16Little();
@ -899,12 +892,12 @@ inline void __ReadProp64(T& obj, athena::io::IStreamReader& r) {
}
template <class T>
inline void __WriteProp64(const T& obj, athena::io::IStreamWriter& w) {
void __WriteProp64(const T& obj, athena::io::IStreamWriter& w) {
__Do<Write<PropType::CRC64>, T, T::DNAEndian>({}, const_cast<T&>(obj), w);
}
template <class T>
inline void __BinarySizeProp64(const T& obj, size_t& s) {
void __BinarySizeProp64(const T& obj, size_t& s) {
__Do<BinarySize<PropType::CRC64>, T, T::DNAEndian>({}, const_cast<T&>(obj), s);
}

View File

@ -9,17 +9,17 @@
namespace athena::io {
template <class T>
inline 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();
}
template <class T>
inline 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();
}
template <class T>
inline std::string ToYAMLString(const T& dna) {
std::string ToYAMLString(const T& dna) {
YAMLDocWriter docWriter(__GetDNAName(dna));
std::string res;
@ -35,7 +35,7 @@ inline std::string ToYAMLString(const T& dna) {
}
template <class T>
inline bool FromYAMLString(T& dna, std::string_view str) {
bool FromYAMLString(T& dna, std::string_view str) {
YAMLStdStringViewReaderState reader(str);
YAMLDocReader docReader;
yaml_parser_set_input(docReader.getParser(), (yaml_read_handler_t*)YAMLStdStringReader, &reader);
@ -46,7 +46,7 @@ inline bool FromYAMLString(T& dna, std::string_view str) {
}
template <class DNASubtype>
inline bool ValidateFromYAMLString(std::string_view str) {
bool ValidateFromYAMLString(std::string_view str) {
YAMLStdStringViewReaderState reader(str);
YAMLDocReader docReader;
yaml_parser_set_input(docReader.getParser(), (yaml_read_handler_t*)YAMLStdStringReader, &reader);
@ -55,7 +55,7 @@ inline bool ValidateFromYAMLString(std::string_view str) {
}
template <class T>
inline bool ToYAMLStream(const T& dna, athena::io::IStreamWriter& fout) {
bool ToYAMLStream(const T& dna, athena::io::IStreamWriter& fout) {
YAMLDocWriter docWriter(__GetDNAName(dna));
yaml_emitter_set_unicode(docWriter.getEmitter(), true);
@ -66,8 +66,7 @@ inline bool ToYAMLStream(const T& dna, athena::io::IStreamWriter& fout) {
}
template <class T>
inline bool ToYAMLStream(const T& dna, athena::io::IStreamWriter& fout,
void (T::*fn)(YAMLDocWriter& out) const) {
bool ToYAMLStream(const T& dna, athena::io::IStreamWriter& fout, void (T::*fn)(YAMLDocWriter& out) const) {
YAMLDocWriter docWriter(__GetDNAName(dna));
yaml_emitter_set_unicode(docWriter.getEmitter(), true);
@ -78,7 +77,7 @@ inline bool ToYAMLStream(const T& dna, athena::io::IStreamWriter& fout,
}
template <class T>
inline bool FromYAMLStream(T& dna, athena::io::IStreamReader& fin) {
bool FromYAMLStream(T& dna, athena::io::IStreamReader& fin) {
YAMLDocReader docReader;
if (!docReader.parse(&fin))
return false;
@ -87,7 +86,7 @@ inline bool FromYAMLStream(T& dna, athena::io::IStreamReader& fin) {
}
template <class T>
inline bool FromYAMLStream(T& dna, athena::io::IStreamReader& fin, void (T::*fn)(YAMLDocReader& in)) {
bool FromYAMLStream(T& dna, athena::io::IStreamReader& fin, void (T::*fn)(YAMLDocReader& in)) {
YAMLDocReader docReader;
if (!docReader.parse(&fin))
return false;
@ -96,7 +95,7 @@ inline bool FromYAMLStream(T& dna, athena::io::IStreamReader& fin, void (T::*fn)
}
template <class T, typename NameT>
inline bool MergeToYAMLFile(const T& dna, const NameT& filename) {
bool MergeToYAMLFile(const T& dna, const NameT& filename) {
athena::io::FileReader r(filename);
YAMLDocWriter docWriter(__GetDNAName(dna), r.isOpen() ? &r : nullptr);
r.close();
@ -109,7 +108,7 @@ inline bool MergeToYAMLFile(const T& dna, const NameT& filename) {
}
template <class DNASubtype>
inline bool ValidateFromYAMLStream(athena::io::IStreamReader& fin) {
bool ValidateFromYAMLStream(athena::io::IStreamReader& fin) {
YAMLDocReader reader;
atUint64 pos = fin.position();
yaml_parser_set_input(reader.getParser(), (yaml_read_handler_t*)YAMLAthenaReader, &fin);

View File

@ -14,7 +14,7 @@ public:
explicit Dir(std::string_view path);
std::string absolutePath() const;
static inline std::string absolutePath(std::string_view path) { return Dir(path).absolutePath(); }
static std::string absolutePath(std::string_view path) { return Dir(path).absolutePath(); }
bool isDir() const;
static bool isDir(std::string_view dir) { return Dir(dir).isDir(); }

View File

@ -10,33 +10,33 @@ public:
explicit FileInfo(std::string_view path = {});
std::string absolutePath() const;
static inline std::string absolutePath(std::string_view lnk) { return FileInfo(lnk).absolutePath(); }
static std::string absolutePath(std::string_view lnk) { return FileInfo(lnk).absolutePath(); }
std::string absoluteFilePath() const;
static inline std::string absoluteFilePath(std::string_view path) { return FileInfo(path).absoluteFilePath(); }
static std::string absoluteFilePath(std::string_view path) { return FileInfo(path).absoluteFilePath(); }
std::string filename() const;
static inline std::string filename(std::string_view path) { return FileInfo(path).filename(); }
static std::string filename(std::string_view path) { return FileInfo(path).filename(); }
std::string path() const { return m_path; }
static inline std::string path(std::string_view path) { return FileInfo(path).path(); }
static std::string path(std::string_view path) { return FileInfo(path).path(); }
std::string extension() const;
static inline std::string extension(std::string_view path) { return FileInfo(path).extension(); }
static std::string extension(std::string_view path) { return FileInfo(path).extension(); }
atUint64 size() const;
static inline atUint64 size(std::string_view path) { return FileInfo(path).size(); }
static atUint64 size(std::string_view path) { return FileInfo(path).size(); }
bool exists() const;
static inline bool exists(std::string_view path) { return FileInfo(path).exists(); }
static bool exists(std::string_view path) { return FileInfo(path).exists(); }
bool isLink() const;
static inline bool isLink(std::string_view lnk) { return FileInfo(lnk).isLink(); }
static bool isLink(std::string_view lnk) { return FileInfo(lnk).isLink(); }
bool isFile() const;
static inline bool isFile(std::string_view path) { return FileInfo(path).isFile(); }
static bool isFile(std::string_view path) { return FileInfo(path).isFile(); }
bool touch() const;
static inline bool touch(std::string_view path) { return FileInfo(path).touch(); }
static bool touch(std::string_view path) { return FileInfo(path).touch(); }
private:
std::string m_path;

View File

@ -18,9 +18,9 @@ class FileReader : public IStreamReader {
public:
FileReader(std::string_view filename, atInt32 cacheSize = (32 * 1024), bool globalErr = true);
FileReader(std::wstring_view filename, atInt32 cacheSize = (32 * 1024), bool globalErr = true);
virtual ~FileReader();
~FileReader() override;
inline std::string filename() const {
std::string filename() const {
#if _WIN32
return utility::wideToUtf8(m_filename);
#else
@ -28,7 +28,7 @@ public:
#endif
}
inline std::wstring wfilename() const {
std::wstring wfilename() const {
#if _WIN32
return m_filename;
#else
@ -38,12 +38,12 @@ public:
void open();
void close();
inline bool isOpen() const { return m_fileHandle != 0; }
bool isOpen() const { return m_fileHandle != 0; }
bool save();
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current);
atUint64 position() const;
atUint64 length() const;
atUint64 readUBytesToBuf(void* buf, atUint64 len);
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current) override;
atUint64 position() const override;
atUint64 length() const override;
atUint64 readUBytesToBuf(void* buf, atUint64 len) override;
void setCacheSize(const atInt32 blockSize);

View File

@ -15,16 +15,16 @@ class FileWriter : public IStreamWriter {
public:
FileWriter(std::string_view filename, bool overwrite = true, bool globalErr = true);
FileWriter(std::wstring_view filename, bool overwrite = true, bool globalErr = true);
virtual ~FileWriter();
~FileWriter() override;
inline std::string filename() const {
std::string filename() const {
#if _WIN32
return utility::wideToUtf8(m_filename);
#else
return m_filename;
#endif
}
inline std::wstring wfilename() const {
std::wstring wfilename() const {
#if _WIN32
return m_filename;
#else
@ -34,11 +34,11 @@ public:
void open(bool overwrite = true);
void close();
inline bool isOpen() const { return m_fileHandle != 0; }
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current);
atUint64 position() const;
atUint64 length() const;
void writeUBytes(const atUint8* data, atUint64 len);
bool isOpen() const { return m_fileHandle != 0; }
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current) override;
atUint64 position() const override;
atUint64 length() const override;
void writeUBytes(const atUint8* data, atUint64 len) override;
#if _WIN32
using HandleType = HANDLE;
@ -99,12 +99,12 @@ public:
m_position = 0;
}
inline atUint64 position() const { return m_position; }
inline atUint64 length() const { return m_deferredBuffer.size(); }
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current);
void writeUBytes(const atUint8* data, atUint64 len);
atUint64 position() const override { return m_position; }
atUint64 length() const override { return m_deferredBuffer.size(); }
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current) override;
void writeUBytes(const atUint8* data, atUint64 len) override;
~TransactionalFileWriter() { flush(); }
~TransactionalFileWriter() override { flush(); }
};
} // namespace athena::io

View File

@ -134,16 +134,15 @@ template <Endian DNAE>
struct DNAV;
template <class T>
using __IsDNARecord =
typename std::disjunction<std::is_base_of<DNA<Endian::Big>, T>, std::is_base_of<DNA<Endian::Little>, T>>;
using __IsDNARecord = std::disjunction<std::is_base_of<DNA<Endian::Big>, T>, std::is_base_of<DNA<Endian::Little>, T>>;
template <class T>
inline constexpr bool __IsDNARecord_v = __IsDNARecord<T>::value;
constexpr bool __IsDNARecord_v = __IsDNARecord<T>::value;
template <class T>
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>
inline constexpr bool __IsDNAVRecord_v = __IsDNAVRecord<T>::value;
constexpr bool __IsDNAVRecord_v = __IsDNAVRecord<T>::value;
} // namespace io
} // namespace athena
@ -163,7 +162,7 @@ std::ostream& operator<<(std::ostream& os, const athena::Endian& endian);
template <typename First, typename... Rest>
constexpr auto __FIRST_ARG__(First first, Rest...) { return first; }
template <typename S, typename... Args>
inline auto __make_args_checked__(const S& format_str, Args&&... args) {
auto __make_args_checked__(const S& format_str, Args&&... args) {
return fmt::internal::make_args_checked<Args...>(format_str, std::forward<Args>(args)...);
}

View File

@ -15,14 +15,14 @@ namespace athena::io {
*/
class IStreamReader : public IStream {
public:
virtual ~IStreamReader() = default;
~IStreamReader() override = default;
/** @brief Sets the buffers position relative to the specified position.<br />
* It seeks relative to the current position by default.
* @param position where in the buffer to seek
* @param origin The Origin to seek relative to
*/
virtual void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current) = 0;
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current) override = 0;
/** @brief Sets the buffer's position relative to the next 64-byte aligned position.<br />
*/
@ -44,19 +44,19 @@ public:
*
* @return True if at end; False otherwise.
*/
bool atEnd() const { return position() >= length(); }
bool atEnd() const override { return position() >= length(); }
/** @brief Returns the current position in the stream.
*
* @return The current position in the stream.
*/
virtual atUint64 position() const = 0;
atUint64 position() const override = 0;
/** @brief Returns the length of the file.
*
* @return True length of the file.
*/
virtual atUint64 length() const = 0;
atUint64 length() const override = 0;
/** @brief Reads a byte at the current position and advances the current position
*
@ -68,15 +68,15 @@ public:
return val;
}
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();
}
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();
}
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();
}
@ -86,15 +86,15 @@ public:
*/
atUint8 readUByte() { return readByte(); }
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();
}
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();
}
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();
}
@ -146,7 +146,7 @@ public:
return m_endian == Big ? utility::BigInt16(val) : utility::LittleInt16(val);
}
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();
}
@ -161,7 +161,7 @@ public:
return utility::LittleInt16(val);
}
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();
}
@ -176,7 +176,7 @@ public:
return utility::BigInt16(val);
}
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();
}
@ -187,7 +187,7 @@ public:
*/
atUint16 readUint16() { return readInt16(); }
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();
}
@ -202,7 +202,7 @@ public:
return utility::LittleUint16(val);
}
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();
}
@ -217,7 +217,7 @@ public:
return utility::BigUint16(val);
}
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();
}
@ -232,7 +232,7 @@ public:
return m_endian == Big ? utility::BigInt32(val) : utility::LittleInt32(val);
}
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();
}
@ -247,7 +247,7 @@ public:
return utility::LittleInt32(val);
}
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();
}
@ -262,7 +262,7 @@ public:
return utility::BigInt32(val);
}
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();
}
@ -273,7 +273,7 @@ public:
*/
atUint32 readUint32() { return readInt32(); }
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();
}
@ -288,7 +288,7 @@ public:
return utility::LittleUint32(val);
}
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();
}
@ -303,7 +303,7 @@ public:
return utility::BigUint32(val);
}
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();
}
@ -318,7 +318,7 @@ public:
return m_endian == Big ? utility::BigInt64(val) : utility::LittleInt64(val);
}
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();
}
@ -333,7 +333,7 @@ public:
return utility::LittleInt64(val);
}
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();
}
@ -348,7 +348,7 @@ public:
return utility::BigInt64(val);
}
template <class T>
atInt64 readValBig(typename std::enable_if<std::is_same<T, atInt64>::value>::type* = 0) {