mirror of
https://github.com/romixlab/qmsgpack.git
synced 2025-07-30 18:37:14 +02:00
.pro files added
This commit is contained in:
@ -77,34 +77,10 @@ Also you can just open ``qmsgpack.pro`` in Qt Creator and build it from there.
|
|||||||
Use it
|
Use it
|
||||||
======
|
======
|
||||||
|
|
||||||
Separate build
|
Just add following lines to your .pro file:
|
||||||
^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
In case of CMake and qmake build, just add following lines to your .pro file:
|
|
||||||
|
|
||||||
.. code-block:: makefile
|
.. code-block:: makefile
|
||||||
|
|
||||||
LIBS += -lqmsgpack
|
LIBS += -lqmsgpack
|
||||||
|
|
||||||
On Windows you may also set the ``INCLUDEPATH`` variable to appropriate location
|
On Windows you may also set the ``INCLUDEPATH`` variable to appropriate location
|
||||||
|
|
||||||
qmake subproject
|
|
||||||
^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
If you are working on a bigger Qt project, building qmsgpack with your project automatically can be very neat feature.
|
|
||||||
Below are the list of variables that allows you to do it:
|
|
||||||
|
|
||||||
.. cmdoption:: QMSGPACK_SUBPROJECT
|
|
||||||
|
|
||||||
Settings this variable to ``true`` changes build and destination folder
|
|
||||||
|
|
||||||
.. cmdoption:: QMSGPACK_BUILD_DIR
|
|
||||||
|
|
||||||
Build directory, default value: ``../../build/3rdparty``
|
|
||||||
|
|
||||||
.. cmdoption:: QMSGPACK_BIN_DIR
|
|
||||||
|
|
||||||
Where to put dynamic library file, default value: ``../../bin``
|
|
||||||
|
|
||||||
.. tip::
|
|
||||||
You can use GitHub submodules to automatically clone qmsgpack repository
|
|
@ -59,7 +59,7 @@ endif
|
|||||||
## -- Rsync Deploy config -- ##
|
## -- Rsync Deploy config -- ##
|
||||||
# Be sure your public key is listed in your server's ~/.ssh/authorized_keys file
|
# Be sure your public key is listed in your server's ~/.ssh/authorized_keys file
|
||||||
ifndef SSH_USER
|
ifndef SSH_USER
|
||||||
SSH_USER = roman@marsworks.ru
|
SSH_USER = roman@vds.marsworks.ru
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef SSH_PORT
|
ifndef SSH_PORT
|
||||||
|
4
qmsgpack.pro
Normal file
4
qmsgpack.pro
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
TEMPLATE = subdirs
|
||||||
|
|
||||||
|
SUBDIRS += \
|
||||||
|
src
|
57
src/main.cpp
57
src/main.cpp
@ -1,57 +0,0 @@
|
|||||||
#include <QCoreApplication>
|
|
||||||
#include <msgpack.h>
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QDataStream>
|
|
||||||
#include <QPoint>
|
|
||||||
|
|
||||||
quint32 packQPoint(const QVariant &variant, QByteArray &data, bool write)
|
|
||||||
{
|
|
||||||
if (write) {
|
|
||||||
data.resize(8);
|
|
||||||
QDataStream out(&data, QIODevice::WriteOnly);
|
|
||||||
out.setVersion(QDataStream::Qt_5_3);
|
|
||||||
out << variant.toPoint();
|
|
||||||
}
|
|
||||||
return 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant unpackQPoint(QByteArray &data)
|
|
||||||
{
|
|
||||||
QDataStream in(&data, QIODevice::ReadOnly);
|
|
||||||
in.setVersion(QDataStream::Qt_5_3);
|
|
||||||
QPoint p;
|
|
||||||
in >> p;
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
Q_UNUSED(argc)
|
|
||||||
Q_UNUSED(argv)
|
|
||||||
//QCoreApplication a(argc, argv);
|
|
||||||
|
|
||||||
qDebug() << "msgpack v" << MsgPack::version();
|
|
||||||
|
|
||||||
QVariantMap map;
|
|
||||||
map["one"] = 1;
|
|
||||||
map["map"] = QVariantMap();
|
|
||||||
// map["booleans"] = QVariantList() << false << true;
|
|
||||||
// map["list2"] = QVariantList() << (QVariantList() << "abc" << "def")
|
|
||||||
// << (QVariantList() << "qwe" << "rty");
|
|
||||||
map["integers"] = QVariantList() << 0 << 127 << -31 << 128 << 777;
|
|
||||||
// map["bytearray"] = QByteArray("bytes");
|
|
||||||
|
|
||||||
// QVariantMap map2;
|
|
||||||
// map2["one"] = 1;
|
|
||||||
// map2["two"] = QVariantMap();
|
|
||||||
// map["map2"] = map2;
|
|
||||||
|
|
||||||
QByteArray arr = MsgPack::pack(map);
|
|
||||||
|
|
||||||
QVariantMap um = MsgPack::unpack(arr).toMap();
|
|
||||||
|
|
||||||
qDebug() << arr.toBase64();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
//return a.exec();
|
|
||||||
}
|
|
@ -18,19 +18,6 @@ namespace MsgPack
|
|||||||
MSGPACK_EXPORT bool registerType(QMetaType::Type qType, quint8 msgpackType);
|
MSGPACK_EXPORT bool registerType(QMetaType::Type qType, quint8 msgpackType);
|
||||||
|
|
||||||
MSGPACK_EXPORT void setCompatibilityModeEnabled(bool enabled);
|
MSGPACK_EXPORT void setCompatibilityModeEnabled(bool enabled);
|
||||||
|
|
||||||
namespace ExtHelpers {
|
|
||||||
quint8 * unpack_upto_quint8(quint8 *to, quint8 *from, bool *success);
|
|
||||||
quint8 * unpack_upto_quint16(quint16 *to, quint8 *from, bool *success);
|
|
||||||
quint8 * unpack_upto_quint32(quint32 *to, quint8 *from, bool *success);
|
|
||||||
quint8 * unpack_upto_quint64(quint64 *to, quint8 *from, bool *success);
|
|
||||||
quint8 * unpack_upto_qint8(qint8 *to, quint8 *from, bool *success);
|
|
||||||
quint8 * unpack_upto_qint16(qint16 *to, quint8 *from, bool *success);
|
|
||||||
quint8 * unpack_upto_qint32(qint32 *to, quint8 *from, bool *success);
|
|
||||||
quint8 * unpack_upto_qint64(qint64 *to, quint8 *from, bool *success);
|
|
||||||
quint8 * unpack_float(float *to, quint8 *from, bool *success);
|
|
||||||
quint8 * unpack_double(double *to, quint8 *from, bool *success);
|
|
||||||
} // ExtHelpers
|
|
||||||
} // MsgPack
|
} // MsgPack
|
||||||
|
|
||||||
#endif // MSGPACK_H
|
#endif // MSGPACK_H
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
#ifndef STREAM_H
|
#ifndef STREAM_H
|
||||||
#define STREAM_H
|
#define STREAM_H
|
||||||
#include <QIODevice>
|
|
||||||
#include <limits>
|
#include "msgpack_export.h"
|
||||||
#include "msgpack_common.h"
|
#include "msgpack_common.h"
|
||||||
#include "endianhelper.h"
|
#include "endianhelper.h"
|
||||||
|
|
||||||
class MsgPackStream
|
#include <QIODevice>
|
||||||
|
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
|
class MSGPACK_EXPORT MsgPackStream
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MsgPackStream();
|
MsgPackStream();
|
||||||
|
@ -134,7 +134,6 @@ QDate MsgPackPrivate::unpack_qdate_raw(quint8 *p)
|
|||||||
|
|
||||||
QByteArray MsgPackPrivate::pack_qdate(const QVariant &variant)
|
QByteArray MsgPackPrivate::pack_qdate(const QVariant &variant)
|
||||||
{
|
{
|
||||||
QDate date = variant.toDate();
|
|
||||||
QByteArray data;
|
QByteArray data;
|
||||||
data.resize(3);
|
data.resize(3);
|
||||||
pack_qdate_raw(variant.toDate(), (quint8 *)data.data());
|
pack_qdate_raw(variant.toDate(), (quint8 *)data.data());
|
||||||
|
27
src/src.pro
Normal file
27
src/src.pro
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
TEMPLATE = lib
|
||||||
|
CONFIG += shared
|
||||||
|
QMAKE_CXXFLAGS += -std=c++11
|
||||||
|
TARGET = qmsgpack
|
||||||
|
DEFINES += MSGPACK_MAKE_LIB
|
||||||
|
HEADERS += msgpack_common.h
|
||||||
|
VERSION = 0.1.0
|
||||||
|
message($${PWD})
|
||||||
|
message($$_PRO_FILE_PWD_)
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
msgpack_common.h \
|
||||||
|
msgpackstream.h \
|
||||||
|
msgpack_export.h \
|
||||||
|
msgpack.h \
|
||||||
|
endianhelper.h \
|
||||||
|
private/unpack_p.h \
|
||||||
|
private/qt_types_p.h \
|
||||||
|
private/pack_p.h
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
msgpackstream.cpp \
|
||||||
|
msgpack_common.cpp \
|
||||||
|
msgpack.cpp \
|
||||||
|
private/qt_types_p.cpp \
|
||||||
|
private/unpack_p.cpp \
|
||||||
|
private/pack_p.cpp
|
Reference in New Issue
Block a user