Fix build with Qt 5.6.

This commit is contained in:
Roman Telezhynskyi 2022-11-14 16:53:44 +02:00
parent 7a3e37c19a
commit 56cdd08e71
3 changed files with 8 additions and 8 deletions

View File

@ -39,7 +39,6 @@
#endif
#include "../vmisc/def.h"
#include "../vmisc/vdatastreamenum.h"
#include "../ifc/exception/vexception.h"
const QByteArray VRawLayout::fileHeaderByteArray = QByteArray("RLD!...");

View File

@ -39,6 +39,9 @@
#include "../ifc/xml/vabstractpattern.h"
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
#include "../vmisc/vabstractvalapplication.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 9, 0)
# include "../vmisc/vdatastreamenum.h"
#endif
#include "../vpatterndb/vcontainer.h"
#include "../vpatterndb/calculator.h"
#include "../vpatterndb/variables/vmeasurement.h"

View File

@ -39,19 +39,16 @@
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
template <typename T>
typename std::enable_if<std::is_enum<T>::value, QDataStream &>::type&
operator<<(QDataStream &s, const T &t)
auto operator<<(QDataStream &s, const T &t) -> typename std::enable_if<std::is_enum<T>::value, QDataStream &>::type&
{
return s << static_cast<typename std::underlying_type<T>::type>(t);
}
template <typename T>
typename std::enable_if<std::is_enum<T>::value, QDataStream &>::type&
operator>>(QDataStream &s, T &t)
auto operator>>(QDataStream &s, T &t) -> typename std::enable_if<std::is_enum<T>::value, QDataStream &>::type&
{
return s >> reinterpret_cast<typename std::underlying_type<T>::type &>(t);
return s >> reinterpret_cast<typename std::underlying_type<T>::type &>(t); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
}
#endif
#if QT_VERSION < QT_VERSION_CHECK(5, 9, 0)
template <typename Enum>
@ -68,6 +65,7 @@ inline QDataStream &operator>>(QDataStream &s, QFlags<Enum> &e)
e = static_cast<QFlags<Enum>>(v);
return s;
}
#endif
#endif // QT_VERSION < QT_VERSION_CHECK(5, 9, 0)
#endif // QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
#endif // DATASTREAM_ENUM_H