Files
qmsgpack/main.cpp
T

42 lines
995 B
C++
Raw Normal View History

2014-09-07 22:24:14 +04:00
#include <QCoreApplication>
#include <msgpack.h>
#include <QDebug>
2014-09-14 23:40:30 +04:00
#include <vector>
2014-09-16 22:54:36 +04:00
//int is_big_endian(void)
//{
// union {
// quint32 i;
// char c[4];
// } bint = {0x01020304};
// return bint.c[0] == 1;
//}
2014-09-07 22:24:14 +04:00
int main(int argc, char *argv[])
{
2014-09-18 22:10:51 +04:00
Q_UNUSED(argc)
Q_UNUSED(argv)
2014-09-16 22:54:36 +04:00
//QCoreApplication a(argc, argv);
2014-09-07 22:24:14 +04:00
2014-09-14 23:40:30 +04:00
// qDebug() << "MsgPack";
// qDebug() << MsgPack::deserialize(QByteArray::fromHex("dc 00 33 c2 c3 c0 00 00 00 00 00 00 00 00 00 ff ff ff ff ff 7f 7f cc ff cd ff ff ce ff ff ff ff e0 e0 d1 ff 80 d2 ff ff 80 00 d3 ff ff ff ff 80 00 00 00 00 00 01 ff a1 61 a1 61 a1 61 a0 a0 a0 91 00 91 00 91 00 90 90 90 80 80 80 81 a1 61 61 81 a1 61 61 81 a1 61 61 91 90 91 91 a1 61"));
2014-09-07 22:24:14 +04:00
2014-09-16 22:54:36 +04:00
QVariantList l;
2014-09-18 22:10:51 +04:00
QVariantMap map;
map["key"] = "val";
map["key2"] = 123;
map["key3"] = 1.2;
l << map;
qDebug() << l[0].type();
QByteArray arr = MsgPack::pack(map);
2014-09-16 22:54:36 +04:00
qDebug() << arr.toBase64();
2014-09-18 22:10:51 +04:00
2014-09-16 22:54:36 +04:00
return 0;
//return a.exec();
2014-09-07 22:24:14 +04:00
}