mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-22 08:02:08 +02:00
Added EXT support.
Removed obsolete unpack functions.
Updated examples that no longer use obsolete functions.
Added reference checking function to unpacked. ( unpacked::referenced() )
Added std:: namespace.
Added reference or copy choice function and default behavior:
When you use unpacker, default behavior is:
STR, BIN, EXT types are always held by reference.
When you don't use unpacker, default behavior is:
STR, BIN, EXT types are always held by copy.
The memory is allocated from zone.
You can customize the behavior passing your custom judging function to unpack() or unpacker's constructor.
This commit is contained in:
@@ -46,12 +46,12 @@ int main(void)
|
||||
{
|
||||
std::string buffer(stream.str());
|
||||
|
||||
msgpack::zone mempool;
|
||||
msgpack::object o =
|
||||
msgpack::unpack(buffer.data(), buffer.size(), mempool);
|
||||
msgpack::unpacked result;
|
||||
msgpack::unpack(result, buffer.data(), buffer.size());
|
||||
msgpack::object o = result.get();
|
||||
|
||||
myprotocol::Get req;
|
||||
msgpack::convert(req, o);
|
||||
o.convert(req);
|
||||
std::cout << "received: " << o << std::endl;
|
||||
}
|
||||
|
||||
@@ -74,12 +74,13 @@ int main(void)
|
||||
{
|
||||
std::string buffer(stream.str());
|
||||
|
||||
msgpack::zone mempool;
|
||||
msgpack::object o =
|
||||
msgpack::unpack(buffer.data(), buffer.size(), mempool);
|
||||
msgpack::unpacked result;
|
||||
msgpack::unpack(result, buffer.data(), buffer.size());
|
||||
msgpack::object o = result.get();
|
||||
|
||||
|
||||
myprotocol::MultiGet req;
|
||||
msgpack::convert(req, o);
|
||||
o.convert(req);
|
||||
std::cout << "received: " << o << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user