diff --git a/doc/install.rst b/doc/install.rst index 46e704e..9dba323 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -77,34 +77,10 @@ Also you can just open ``qmsgpack.pro`` in Qt Creator and build it from there. Use it ====== -Separate build -^^^^^^^^^^^^^^ - -In case of CMake and qmake build, just add following lines to your .pro file: +Just add following lines to your .pro file: .. code-block:: makefile LIBS += -lqmsgpack 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 \ No newline at end of file diff --git a/doc/sphinx_deployment.mk b/doc/sphinx_deployment.mk index 2b838d5..334d10b 100644 --- a/doc/sphinx_deployment.mk +++ b/doc/sphinx_deployment.mk @@ -59,7 +59,7 @@ 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@marsworks.ru +SSH_USER = roman@vds.marsworks.ru endif ifndef SSH_PORT diff --git a/qmsgpack.pro b/qmsgpack.pro new file mode 100644 index 0000000..bb80731 --- /dev/null +++ b/qmsgpack.pro @@ -0,0 +1,4 @@ +TEMPLATE = subdirs + +SUBDIRS += \ + src \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp deleted file mode 100644 index f18a437..0000000 --- a/src/main.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include -#include -#include -#include -#include - -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(); -} diff --git a/src/msgpack.h b/src/msgpack.h index e90cc44..b52ebb5 100644 --- a/src/msgpack.h +++ b/src/msgpack.h @@ -18,19 +18,6 @@ namespace MsgPack MSGPACK_EXPORT bool registerType(QMetaType::Type qType, quint8 msgpackType); 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 #endif // MSGPACK_H diff --git a/src/msgpackstream.h b/src/msgpackstream.h index 50ccb68..a90381e 100644 --- a/src/msgpackstream.h +++ b/src/msgpackstream.h @@ -1,11 +1,15 @@ #ifndef STREAM_H #define STREAM_H -#include -#include + +#include "msgpack_export.h" #include "msgpack_common.h" #include "endianhelper.h" -class MsgPackStream +#include + +#include + +class MSGPACK_EXPORT MsgPackStream { public: MsgPackStream(); diff --git a/src/private/qt_types_p.cpp b/src/private/qt_types_p.cpp index 41ebfc2..83949e1 100644 --- a/src/private/qt_types_p.cpp +++ b/src/private/qt_types_p.cpp @@ -134,7 +134,6 @@ QDate MsgPackPrivate::unpack_qdate_raw(quint8 *p) QByteArray MsgPackPrivate::pack_qdate(const QVariant &variant) { - QDate date = variant.toDate(); QByteArray data; data.resize(3); pack_qdate_raw(variant.toDate(), (quint8 *)data.data()); diff --git a/src/src.pro b/src/src.pro new file mode 100644 index 0000000..c011a49 --- /dev/null +++ b/src/src.pro @@ -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