Files
qmsgpack/README.md
T

52 lines
1.0 KiB
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();
~~~
2015-04-11 16:14:13 +03:00
By default these Qt types are supported: `Int, UInt, LongLong, ULongLong, Double, QByteArray, Bool, QString, QStringList, QVariantList, QVariantMap`.
2014-12-19 22:54:05 +03:00
2015-04-11 16:14:13 +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.
Thread-safety
-------------
At this time it is not thread safe to call `MsgPack::registerPacker`, `MsgPack::registerUnpacker` and `MsgPack::setCompatibilityModeEnabled` from different threads.
pack and unpack methods do not use any global data, so