Create msgpack.org.md

This commit is contained in:
Roman
2015-06-27 14:48:41 +03:00
parent f45abecbb1
commit 23157d8eb1

42
msgpack.org.md Normal file
View File

@ -0,0 +1,42 @@
MessagePack for Qt
==================
Installation
------------
Clone repository:
~~~bash
git clone https://github.com/romixlab/qmsgpack.git
cd qmsgpack
mkdir build
cd build
cmake ..
make install
~~~
Sample usage
------------
Packing
~~~cpp
QVariantList list;
list << 1 << 2 << 3;
QByteArray array = MsgPack::pack(list);
~~~
Unpacking:
~~~cpp
QVariantList unpacked = MsgPack::unpack(array).toList();
~~~
Streaming API:
~~~cpp
// packing
MsgPackStream stream(&ba, QIODevice::WriteOnly);
stream << 1 << 2.3 << "some string";
// unpacking
MsgPackStream stream(ba);
int a;
double b;
QSting s;
stream >> a >> b >> s;
~~~