.pro files added

This commit is contained in:
Roman Isaikin
2015-08-07 22:40:18 +03:00
parent d868f78621
commit 169c2bb59d
8 changed files with 40 additions and 100 deletions
-57
View File
@@ -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();
}
-13
View File
@@ -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
+7 -3
View File
@@ -1,11 +1,15 @@
#ifndef STREAM_H
#define STREAM_H
#include <QIODevice>
#include <limits>
#include "msgpack_export.h"
#include "msgpack_common.h"
#include "endianhelper.h"
class MsgPackStream
#include <QIODevice>
#include <limits>
class MSGPACK_EXPORT MsgPackStream
{
public:
MsgPackStream();
-1
View File
@@ -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());
+27
View 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