|
Safir SDK Core
|
Functions for serializing objects to binary, XML and JSON forms. More...
#include <Safir/Dob/Typesystem/Serialization.h>
Static Public Member Functions | |
| static const std::wstring | ToXml (const Dob::Typesystem::ObjectConstPtr &object) |
| Serialize an object to XML. | |
| static const std::wstring | ToJson (const Dob::Typesystem::ObjectConstPtr &object) |
| Serialize an object to JSON. | |
| static Dob::Typesystem::ObjectPtr | ToObject (const std::wstring &xml) |
| Deserialize an XML serialization. | |
| static Dob::Typesystem::ObjectPtr | ToObjectFromJson (const std::wstring &json) |
| Deserialize an JSON serialization. | |
| static const std::wstring | ToXml (const BinarySerialization &bin) |
| Convert a binary serialization to XML. | |
| static const std::wstring | ToJson (const BinarySerialization &bin) |
| Convert a binary serialization to JSON. | |
| static const std::wstring | ToXml (const char *const blob) |
| Convert a blob to XML. | |
| static const std::wstring | ToJson (const char *const blob) |
| Convert a blob to JSON. | |
| static void | ToBinary (const Dob::Typesystem::ObjectConstPtr &object, Dob::Typesystem::BinarySerialization &binary) |
| Serialize an object to binary form. | |
| static Dob::Typesystem::ObjectPtr | ToObject (const Dob::Typesystem::BinarySerialization &binary) |
| Deserialize a binary serialization and create an object. | |
Functions for serializing objects to binary, XML and JSON forms.
|
static |
Serialize an object to binary form.
The serialization is put into a variable of type BinarySerialization, which is of type std::vector<char>. If you need to get hold of a "raw" C-pointer to the data use&binary[0]. See Effective STL Item 16 for more info.
| [in] | object | - The object to serialize |
| [out] | binary | - The destination of the serialization |
| IllegalValueException | - There is something wrong with the object. |
|
static |
Convert a binary serialization to JSON.
| [in] | bin | - the binary serialization to convert to json. |
|
static |
Convert a blob to JSON.
| [in] | blob | - the blob to convert to json. |
|
static |
Serialize an object to JSON.
| [in] | object | - The object to serialize |
| IllegalValueException | - There is something wrong with the object. |
|
static |
Deserialize a binary serialization and create an object.
It uses the ObjectFactory to accomplish this. If you have a char * that you want to deserialize the easiest way is to pass it to the ObjectFactory instead.
| [in] | binary | - The binary serialization to deserialize. |
| IllegalValueException | If the type represented by the serialization isn't found in the ObjectFactory. |
|
static |
Deserialize an XML serialization.
This method creates a new object from a given xml serialization. It uses the ObjectFactory to accomplish this.
| [in] | xml | - The xml to convert. |
| IllegalValueException | If there is something wrong with the XML or if the type represented by the serialization isn't found in the ObjectFactory. |
|
static |
Deserialize an JSON serialization.
This method creates a new object from a given json serialization. It uses the ObjectFactory to accomplish this.
| [in] | json | - The json to convert. |
| IllegalValueException | If there is something wrong with the JSON or if the type represented by the serialization isn't found in the ObjectFactory. |
|
static |
Convert a binary serialization to XML.
| [in] | bin | - the binary serialization to convert to xml. |
|
static |
Convert a blob to XML.
| [in] | blob | - the blob to convert to xml. |
|
static |
Serialize an object to XML.
| [in] | object | - The object to serialize |
| IllegalValueException | - There is something wrong with the object. |