Since Qt 5.14 enumerations can be serialized through QDataStream without the

need of manually defining streaming operators. Enum classes are
serialized using the declared size.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2020-01-07 09:45:26 +02:00
parent 3db69c34ee
commit 5177057be1
8 changed files with 23 additions and 7 deletions

View File

@ -28,7 +28,9 @@
#include "vgeometrydef.h"
#include "../vmisc/vdatastreamenum.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
# include "../vmisc/vdatastreamenum.h"
#endif
#include "../ifc/exception/vexception.h"
#include <QCoreApplication>

View File

@ -34,7 +34,9 @@
#include <QCoreApplication>
#include "../vmisc/diagnostic.h"
#include "../vmisc/vdatastreamenum.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
# include "../vmisc/vdatastreamenum.h"
#endif
#include "../vmisc/defglobal.h"
#include "../ifc/exception/vexception.h"

View File

@ -38,7 +38,9 @@
#include "../vpatterndb/floatItemData/vpatternlabeldata.h"
#include "../vpatterndb/floatItemData/vgrainlinedata.h"
#include "../vmisc/diagnostic.h"
#include "../vmisc/vdatastreamenum.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
# include "../vmisc/vdatastreamenum.h"
#endif
#include "vlayoutpiecepath.h"
#include "../vgeometry/vgeometrydef.h"
#include "vtextmanager.h"

View File

@ -34,7 +34,9 @@
#include <QVector>
#include "../vmisc/diagnostic.h"
#include "../vmisc/vdatastreamenum.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
# include "../vmisc/vdatastreamenum.h"
#endif
#include "../ifc/exception/vexception.h"
QT_WARNING_PUSH

View File

@ -39,7 +39,9 @@
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vmath.h"
#include "../vmisc/vdatastreamenum.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
# include "../vmisc/vdatastreamenum.h"
#endif
#include "../vpatterndb/vcontainer.h"
#include "vtextmanager.h"

View File

@ -56,7 +56,9 @@
#include <QGlobalStatic>
#include "vabstractapplication.h"
#include "vdatastreamenum.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
# include "vdatastreamenum.h"
#endif
#include "../ifc/exception/vexception.h"
const qreal defCurveApproximationScale = 0.5;

View File

@ -34,6 +34,7 @@
// (de)serialize enums into QDataStream
#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
//a function that can serialize any enum into QDataStream
//it stores the enum in a qint64
template<typename Enum,
@ -54,6 +55,7 @@ inline QDataStream& operator>>(QDataStream& stream, Enum& e)
e = static_cast<Enum>(v);
return stream;
}
#endif
#if QT_VERSION < QT_VERSION_CHECK(5, 9, 0)
template <typename Enum>

View File

@ -36,7 +36,9 @@
#include "../ifc/ifcdef.h"
#include "../ifc/exception/vexception.h"
#include "../vmisc/diagnostic.h"
#include "../vmisc/vdatastreamenum.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
# include "../vmisc/vdatastreamenum.h"
#endif
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++")