forked from romixlab/qmsgpack
Make it possible to disable Qt type pack handlers at build time
usable with either qmake DEFINES+=MSGPACK_NO_PACKTYPES or DEFINES += MSGPACK_STATIC MSGPACK_NO_PACKTYPES include(path/to/qmsgpack/qmsgpack.pri)
This commit is contained in:
+8
-1
@@ -3,13 +3,16 @@
|
||||
#include "msgpack.h"
|
||||
#include "private/unpack_p.h"
|
||||
#include "private/pack_p.h"
|
||||
#include "private/qt_types_p.h"
|
||||
|
||||
#include <QVector>
|
||||
|
||||
#ifndef MSGPACK_NO_PACKTYPES
|
||||
#include "private/qt_types_p.h"
|
||||
|
||||
#ifdef QT_LOCATION_LIB
|
||||
#include <QGeoCoordinate>
|
||||
#endif
|
||||
#endif // MSGPACK_NO_PACKTYPES
|
||||
|
||||
QVariant MsgPack::unpack(const QByteArray &data)
|
||||
{
|
||||
@@ -51,6 +54,7 @@ qint8 MsgPack::msgpackType(int qType)
|
||||
|
||||
bool MsgPack::registerType(QMetaType::Type qType, quint8 msgpackType)
|
||||
{
|
||||
#ifndef MSGPACK_NO_PACKTYPES
|
||||
switch (qType) {
|
||||
#ifdef QT_GUI_LIB
|
||||
case QMetaType::QColor:
|
||||
@@ -92,6 +96,9 @@ bool MsgPack::registerType(QMetaType::Type qType, quint8 msgpackType)
|
||||
#endif // QT_LOCATION_LIB
|
||||
break;
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(msgpackType)
|
||||
#endif // MSGPACK_NO_PACKTYPES
|
||||
|
||||
qWarning("qmsgpack was built without metatype %d support.", int(qType));
|
||||
qWarning("Use MsgPack::registerPacker() and MsgPack::registerUnpacker() to register metatype %d manually.", int(qType));
|
||||
|
||||
+7
-5
@@ -18,12 +18,14 @@ HEADERS_INSTALL = \
|
||||
msgpack_export.h \
|
||||
msgpackstream.h \
|
||||
|
||||
STREAM_HEADERS_INSTALL = \
|
||||
stream/geometry.h \
|
||||
stream/time.h
|
||||
!contains(DEFINES, MSGPACK_NO_PACKTYPES) {
|
||||
STREAM_HEADERS_INSTALL = \
|
||||
stream/geometry.h \
|
||||
stream/time.h
|
||||
|
||||
qtHaveModule(location) {
|
||||
STREAM_HEADERS_INSTALL += stream/location.h
|
||||
qtHaveModule(location) {
|
||||
STREAM_HEADERS_INSTALL += stream/location.h
|
||||
}
|
||||
}
|
||||
|
||||
unix {
|
||||
|
||||
Reference in New Issue
Block a user