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:
parent
3db69c34ee
commit
5177057be1
|
@ -28,7 +28,9 @@
|
||||||
|
|
||||||
#include "vgeometrydef.h"
|
#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 "../ifc/exception/vexception.h"
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
|
|
@ -34,7 +34,9 @@
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
|
||||||
#include "../vmisc/diagnostic.h"
|
#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 "../vmisc/defglobal.h"
|
||||||
#include "../ifc/exception/vexception.h"
|
#include "../ifc/exception/vexception.h"
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,9 @@
|
||||||
#include "../vpatterndb/floatItemData/vpatternlabeldata.h"
|
#include "../vpatterndb/floatItemData/vpatternlabeldata.h"
|
||||||
#include "../vpatterndb/floatItemData/vgrainlinedata.h"
|
#include "../vpatterndb/floatItemData/vgrainlinedata.h"
|
||||||
#include "../vmisc/diagnostic.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 "vlayoutpiecepath.h"
|
||||||
#include "../vgeometry/vgeometrydef.h"
|
#include "../vgeometry/vgeometrydef.h"
|
||||||
#include "vtextmanager.h"
|
#include "vtextmanager.h"
|
||||||
|
|
|
@ -34,7 +34,9 @@
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
#include "../vmisc/diagnostic.h"
|
#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"
|
#include "../ifc/exception/vexception.h"
|
||||||
|
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
|
|
|
@ -39,7 +39,9 @@
|
||||||
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
||||||
#include "../vmisc/vabstractapplication.h"
|
#include "../vmisc/vabstractapplication.h"
|
||||||
#include "../vmisc/vmath.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 "../vpatterndb/vcontainer.h"
|
||||||
#include "vtextmanager.h"
|
#include "vtextmanager.h"
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,9 @@
|
||||||
#include <QGlobalStatic>
|
#include <QGlobalStatic>
|
||||||
|
|
||||||
#include "vabstractapplication.h"
|
#include "vabstractapplication.h"
|
||||||
#include "vdatastreamenum.h"
|
#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
|
||||||
|
# include "vdatastreamenum.h"
|
||||||
|
#endif
|
||||||
#include "../ifc/exception/vexception.h"
|
#include "../ifc/exception/vexception.h"
|
||||||
|
|
||||||
const qreal defCurveApproximationScale = 0.5;
|
const qreal defCurveApproximationScale = 0.5;
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
|
|
||||||
// (de)serialize enums into QDataStream
|
// (de)serialize enums into QDataStream
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
|
||||||
//a function that can serialize any enum into QDataStream
|
//a function that can serialize any enum into QDataStream
|
||||||
//it stores the enum in a qint64
|
//it stores the enum in a qint64
|
||||||
template<typename Enum,
|
template<typename Enum,
|
||||||
|
@ -54,6 +55,7 @@ inline QDataStream& operator>>(QDataStream& stream, Enum& e)
|
||||||
e = static_cast<Enum>(v);
|
e = static_cast<Enum>(v);
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 9, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 9, 0)
|
||||||
template <typename Enum>
|
template <typename Enum>
|
||||||
|
|
|
@ -36,7 +36,9 @@
|
||||||
#include "../ifc/ifcdef.h"
|
#include "../ifc/ifcdef.h"
|
||||||
#include "../ifc/exception/vexception.h"
|
#include "../ifc/exception/vexception.h"
|
||||||
#include "../vmisc/diagnostic.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_PUSH
|
||||||
QT_WARNING_DISABLE_GCC("-Weffc++")
|
QT_WARNING_DISABLE_GCC("-Weffc++")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user