24 #ifndef __DOTS_INTERNAL_SERIALIZATION_H__
25 #define __DOTS_INTERNAL_SERIALIZATION_H__
31 #include <Safir/Dob/Typesystem/ToolSupport/Internal/BasicTypeOperations.h>
32 #include <Safir/Dob/Typesystem/ToolSupport/Internal/BlobToXmlSerializer.h>
33 #include <Safir/Dob/Typesystem/ToolSupport/Internal/BlobToJsonSerializer.h>
34 #include <Safir/Dob/Typesystem/ToolSupport/Internal/XmlToBlobSerializer.h>
35 #include <Safir/Dob/Typesystem/ToolSupport/Internal/JsonToBlobSerializer.h>
36 #include <Safir/Dob/Typesystem/ToolSupport/Internal/RepositoryToStringHelper.h>
56 inline void BinaryToBase64(
const char* binary,
size_t size, std::ostringstream& base64)
58 std::string bin(binary, size);
59 base64<<Internal::SerializationUtils::ToBase64(bin);
69 inline void Base64ToBinary(
const std::string& base64Str, std::vector<char>& binary)
72 Internal::SerializationUtils::FromBase64(base64Str, bin);
73 binary.insert(binary.begin(), bin.begin(), bin.end());
84 template <
class RepositoryT>
85 void BinaryToXml(
const RepositoryT* repository,
const char* blob, std::ostringstream& xml)
87 (Internal::BlobToXmlSerializer<RepositoryT>(repository))(blob, xml);
98 template <
class RepositoryT>
99 void XmlToBinary(
const RepositoryT* repository,
const char* xml, std::vector<char>& binary)
101 (Internal::XmlToBlobSerializer<RepositoryT>(repository))(xml, binary);
112 template <
class RepositoryT>
113 void BinaryToJson(
const RepositoryT* repository,
const char* blob, std::ostringstream& json)
115 (Internal::BlobToJsonSerializer<RepositoryT>(repository))(blob, json);
126 template <
class RepositoryT>
127 void JsonToBinary(
const RepositoryT* repository,
const char* json, std::vector<char>& binary)
129 (Internal::JsonToBlobSerializer<RepositoryT>(repository))(json, binary);
145 template <
class RepositoryT>
148 (Internal::ToStringHelper<RepositoryT>(repository, includeCreateRoutines)).RepositoryToString(os);
158 template <
class RepositoryT>
159 void TypeToString(
const RepositoryT* repository, DotsC_TypeId typeId, std::ostream &os)
161 (Internal::ToStringHelper<RepositoryT>(repository,
false)).TypeToString(typeId, os);