Qore msgpack Module  1.0.0
msgpack::MsgPack Class Reference

MessagePack packing and unpacking class. More...

Public Member Methods

 constructor (int mode=MSGPACK_SIMPLE_MODE)
 Creates the MsgPack object. More...
 
int getOperationMode ()
 Get module operation mode. More...
 
*binary pack (auto value)
 Pack the passed data. More...
 
nothing setOperationMode (int mode)
 Set operation mode. More...
 
auto unpack (binary value)
 Unpack the passed data. More...
 

Detailed Description

MessagePack packing and unpacking class.

MessagePack module packing and unpacking class.

Member Function Documentation

◆ constructor()

msgpack::MsgPack::constructor ( int  mode = MSGPACK_SIMPLE_MODE)

Creates the MsgPack object.

Parameters
modeMsgPack module operation mode
Exceptions
INVALID-MODEpassed operation mode is invalid

◆ getOperationMode()

int msgpack::MsgPack::getOperationMode ( )

Get module operation mode.

Returns
MsgPack module operation mode

◆ pack()

*binary msgpack::MsgPack::pack ( auto  value)

Pack the passed data.

Parameters
valuevalue to pack
Returns
packed value in MessagePack format
Exceptions
ENCODING-ERRORencoding error occured during packing
PACK-ERRORpacking failed
Example:
MsgPack mp();
hash example = {"compact": True, "schema": 0};
*binary packed = mp.pack(example);

◆ setOperationMode()

nothing msgpack::MsgPack::setOperationMode ( int  mode)

Set operation mode.

Parameters
modeMsgPack module operation mode
Exceptions
INVALID-MODEpassed operation mode is invalid
Example:
MsgPack mp();
mp.setOperationMode(MSGPACK_QORE_MODE);

◆ unpack()

auto msgpack::MsgPack::unpack ( binary  value)

Unpack the passed data.

Parameters
valuedata to unpack
Returns
unpacked Qore value
Exceptions
ENCODING-ERRORencoding error occured during unpacking
INVALID-MODEpassed operation mode is invalid
UNPACK-ERRORunpacking failed
Example:
MsgPack mp();
hash example = {"compact": True, "schema": 0};
*binary packed = mp.pack(example);
# ---
auto unpacked = mp.unpack(packed);

The documentation for this class was generated from the following file: