Bson¶
Inherited: None
Description¶
This class implements Binary JSON parser with Variant based DOM structure input/output. It allows to serialize and deserialize object structures represented in Variant DOM structure.
Example:
VariantMap dictionary;
dictionary["bool"] = true;
dictionary["str"] = "string";
dictionary["int"] = 1;
dictionary["float"] = 2.0f;
ByteArray data = Bson::save(dictionary); // Serializing dictionary to binary format
....
VariantMap result = Bson::load(data).toMap(); // Resotoring it back
Public Methods¶
None
Static Methods¶
Methods Description¶
Variant Bson::load (ByteArray & data, MetaType::Type type = MetaType::VARIANTLIST)
Returns deserialized binary data as Variant based DOM structure with expected type of container (can be MetaType::VARIANTLIST or MetaType::VARIANTMAP).
ByteArray Bson::save (Variant & data)
Returns serialized data as binary buffer.