mirror of
https://github.com/romixlab/qmsgpack.git
synced 2025-07-30 18:37:14 +02:00
Merge remote-tracking branch 'upstream/static-build'
This commit is contained in:
@ -4,7 +4,6 @@ compiler:
|
||||
- gcc
|
||||
|
||||
env:
|
||||
- QT4_BUILD=ON
|
||||
- QT4_BUILD=OFF
|
||||
|
||||
before_install:
|
||||
|
@ -1,3 +1,8 @@
|
||||
set(Qt5Core_DIR "/opt/Qt5.6.0/5.6/gcc_64/lib/cmake/Qt5Core")
|
||||
set(Qt5Test_DIR "/opt/Qt5.6.0/5.6/gcc_64/lib/cmake/Qt5Test")
|
||||
set(Qt5_DIR "/opt/Qt5.6.0/5.6/gcc_64/lib/cmake/Qt5Core")
|
||||
set(QT_QMAKE_EXECUTABLE "/opt/Qt5.6.0/5.6/gcc_64/bin/qmake")
|
||||
|
||||
project(qmsgpack)
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.8)
|
||||
|
@ -5,7 +5,7 @@ MessagePack for Qt
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
Complete documentation is available here: [mp.marsw.ru](http://msgpack.marsworks.ru/) (still working on it)
|
||||
Complete documentation is available here: [msgpack.marsworks.ru](http://msgpack.marsworks.ru/) (still working on it)
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
BIN
doc/_themes/sphinx_rtd_theme
vendored
BIN
doc/_themes/sphinx_rtd_theme
vendored
Binary file not shown.
@ -62,6 +62,18 @@ Add options before ``..`` as follow:
|
||||
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_TESTS=True ..
|
||||
|
||||
Custom Qt installation
|
||||
""""""""""""""""""""""
|
||||
|
||||
If you installed Qt with online installer, cmake will most likely not find it, in this case try adding following lines to CMakeLists.txt:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
set(Qt5Core_DIR "/opt/Qt5.6.0/5.6/gcc_64/lib/cmake/Qt5Core")
|
||||
set(Qt5Test_DIR "/opt/Qt5.6.0/5.6/gcc_64/lib/cmake/Qt5Test")
|
||||
set(Qt5_DIR "/opt/Qt5.6.0/5.6/gcc_64/lib/cmake/Qt5Core")
|
||||
set(QT_QMAKE_EXECUTABLE "/opt/Qt5.6.0/5.6/gcc_64/bin/qmake")
|
||||
|
||||
qmake
|
||||
^^^^^
|
||||
|
||||
|
@ -59,15 +59,15 @@ endif
|
||||
## -- Rsync Deploy config -- ##
|
||||
# Be sure your public key is listed in your server's ~/.ssh/authorized_keys file
|
||||
ifndef SSH_USER
|
||||
SSH_USER = roman@vds.marsworks.ru
|
||||
SSH_USER = nginx@mars
|
||||
endif
|
||||
|
||||
ifndef SSH_PORT
|
||||
SSH_PORT = 22
|
||||
SSH_PORT = 7722
|
||||
endif
|
||||
|
||||
ifndef DOCUMENT_ROOT
|
||||
DOCUMENT_ROOT = /var/www/roman/data/www/msgpack.marsworks.ru/
|
||||
DOCUMENT_ROOT = /var/www/msgpack.marsworks.ru/
|
||||
endif
|
||||
|
||||
#If you choose to delete on sync, rsync will create a 1:1 match
|
||||
|
@ -19,6 +19,10 @@
|
||||
#define MSGPACK_SYSDEP_H__
|
||||
#include <qglobal.h>
|
||||
|
||||
#if defined(_WIN32) && defined(_MSC_VER) && _MSC_VER >= 1600
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <arpa/inet.h> /* __BYTE_ORDER */
|
||||
#endif
|
||||
|
@ -4,6 +4,12 @@
|
||||
#include <QVariant>
|
||||
#include <QtGlobal>
|
||||
|
||||
#ifdef Q_OS_WINRT
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#include "msgpack_export.h"
|
||||
|
||||
#define MSGPACK_MAJOR @QMSGPACK_MAJOR@
|
||||
#define MSGPACK_MINOR @QMSGPACK_MINOR@
|
||||
#define MSGPACK_VERSION @QMSGPACK_VERSION@
|
||||
@ -24,7 +30,7 @@ typedef QVariant (*unpack_user_f)(const QByteArray &data);
|
||||
* @brief version
|
||||
* @return current version
|
||||
*/
|
||||
QString version();
|
||||
MSGPACK_EXPORT QString version();
|
||||
/**
|
||||
* @brief The FirstByte enum
|
||||
* From Message Pack spec
|
||||
|
@ -1,6 +1,7 @@
|
||||
#ifndef STREAM_H
|
||||
#define STREAM_H
|
||||
|
||||
#include "msgpack_export.h"
|
||||
#include "msgpackcommon.h"
|
||||
#include "endianhelper.h"
|
||||
|
||||
@ -8,7 +9,7 @@
|
||||
|
||||
#include <QIODevice>
|
||||
|
||||
class MsgPackStream
|
||||
class MSGPACK_EXPORT MsgPackStream
|
||||
{
|
||||
public:
|
||||
MsgPackStream();
|
||||
|
@ -18,7 +18,9 @@ QReadWriteLock MsgPackPrivate::packers_lock;
|
||||
quint8 *MsgPackPrivate::pack(const QVariant &v, quint8 *p, bool wr, QVector<QByteArray> &user_data)
|
||||
{
|
||||
QMetaType::Type t = (QMetaType::Type)v.type();
|
||||
if (t == QMetaType::Int)
|
||||
if (v.isNull() && !v.isValid())
|
||||
p = pack_nil(p, wr);
|
||||
else if (t == QMetaType::Int)
|
||||
p = pack_int(v.toInt(), p, wr);
|
||||
else if (t == QMetaType::UInt)
|
||||
p = pack_uint(v.toUInt(), p, wr);
|
||||
@ -59,6 +61,12 @@ quint8 *MsgPackPrivate::pack(const QVariant &v, quint8 *p, bool wr, QVector<QByt
|
||||
return p;
|
||||
}
|
||||
|
||||
quint8 *MsgPackPrivate::pack_nil(quint8 *p, bool wr)
|
||||
{
|
||||
if (wr) *p = MsgPack::FirstByte::NIL;
|
||||
return p + 1;
|
||||
}
|
||||
|
||||
quint8 *MsgPackPrivate::pack_int(qint32 i, quint8 *p, bool wr)
|
||||
{
|
||||
if (i >= -32 && i <= 127) {
|
||||
|
@ -27,6 +27,8 @@ extern bool compatibilityMode;
|
||||
|
||||
quint8 * pack(const QVariant &v, quint8 *p, bool wr, QVector<QByteArray> &user_data);
|
||||
|
||||
quint8 * pack_nil(quint8 *p, bool wr);
|
||||
|
||||
quint8 * pack_int(qint32 i, quint8 *p, bool wr);
|
||||
quint8 * pack_uint(quint32 i, quint8 *p, bool wr);
|
||||
quint8 * pack_longlong(qint64 i, quint8 *p, bool wr);
|
||||
|
@ -87,6 +87,7 @@ quint8 * MsgPackPrivate::unpack_nil(QVariant &v, quint8 *p)
|
||||
{
|
||||
Q_UNUSED(p)
|
||||
Q_UNUSED(v)
|
||||
v = QVariant();
|
||||
return p + 1;
|
||||
}
|
||||
|
||||
@ -94,6 +95,7 @@ quint8 * MsgPackPrivate::unpack_never_used(QVariant &v, quint8 *p)
|
||||
{
|
||||
Q_UNUSED(p)
|
||||
Q_UNUSED(v)
|
||||
v = QVariant();
|
||||
return p + 1;
|
||||
}
|
||||
|
||||
|
@ -68,6 +68,7 @@ void QtTypesTest::test_qtime()
|
||||
QByteArray packed = MsgPack::pack(t);
|
||||
QTime t2 = MsgPack::unpack(packed).toTime();
|
||||
QVERIFY(t == t2);
|
||||
qDebug() << packed.toHex();
|
||||
QVERIFY(packed.size() == 3);
|
||||
|
||||
t = QTime(12, 01, 01, 0);
|
||||
|
Reference in New Issue
Block a user