Files
qmsgpack/README.md
T

47 lines
789 B
Markdown
Raw Normal View History

2014-09-07 17:41:02 +04:00
qmsgpack
========
MessagePack for Qt
2014-12-19 22:54:05 +03:00
Installation
------------
Clone repository:
2014-12-19 23:00:24 +03:00
~~~bash
2014-12-19 23:13:13 +03:00
git clone https://github.com/romixlab/qmsgpack.git
2014-12-19 22:54:05 +03:00
~~~
Run cmake:
2014-12-19 23:00:24 +03:00
~~~bash
2014-12-19 23:13:13 +03:00
cd qmsgpack
2014-12-19 22:54:05 +03:00
mkdir build
cd build
cmake ..
~~~
Compile:
2014-12-19 23:00:24 +03:00
~~~bash
2014-12-19 22:54:05 +03:00
make
~~~
Run tests and install
2014-12-19 23:00:24 +03:00
~~~bash
2014-12-19 22:54:05 +03:00
make tests install
~~~
Sample usage
------------
Packing
2014-12-19 23:00:24 +03:00
~~~cpp
2014-12-19 22:54:05 +03:00
QVariantList list;
list << 1 << 2 << 3;
QByteArray array = MsgPack::pack(list);
~~~
Unpacking:
2014-12-19 23:00:24 +03:00
~~~cpp
2014-12-19 22:54:05 +03:00
QVariantList unpacked = MsgPack::unpack(array).toList();
~~~
By default these Qt types are supported: Int, UInt, LongLong, ULongLong, Double, QByteArray, Bool, QString, QStringList, QVariantList, QVariantMap.
2014-12-19 22:55:21 +03:00
Also you can provide packer and unpacker functions for any other type (even for user type defined via Q_DECLARE_METATYPE) or MsgPack type.