Safir SDK Core
Loading...
Searching...
No Matches
Serialization.h
Go to the documentation of this file.
1/******************************************************************************
2*
3* Copyright Saab AB, 2006-2013 (http://safirsdkcore.com)
4*
5* Created by: Lars Hagström / stlrha
6*
7*******************************************************************************
8*
9* This file is part of Safir SDK Core.
10*
11* Safir SDK Core is free software: you can redistribute it and/or modify
12* it under the terms of version 3 of the GNU General Public License as
13* published by the Free Software Foundation.
14*
15* Safir SDK Core is distributed in the hope that it will be useful,
16* but WITHOUT ANY WARRANTY; without even the implied warranty of
17* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18* GNU General Public License for more details.
19*
20* You should have received a copy of the GNU General Public License
21* along with Safir SDK Core. If not, see <http://www.gnu.org/licenses/>.
22*
23******************************************************************************/
24
25#ifndef __DOTS_SERIALIZATION_H__
26#define __DOTS_SERIALIZATION_H__
27
28#include <memory>
31
32namespace Safir
33{
34namespace Dob
35{
36namespace Typesystem
37{
38 //forward declarations
39 class Object;
40
42 typedef std::shared_ptr<Object> ObjectPtr;
43 typedef std::shared_ptr<const Object> ObjectConstPtr;
44
49 {
50 public:
58 static const std::wstring ToXml(const Dob::Typesystem::ObjectConstPtr& object);
59
67 static const std::wstring ToJson(const Dob::Typesystem::ObjectConstPtr& object);
68
81 static Dob::Typesystem::ObjectPtr ToObject(const std::wstring& xml);
82
95 static Dob::Typesystem::ObjectPtr ToObjectFromJson(const std::wstring& json);
96
103 static const std::wstring ToXml(const BinarySerialization& bin);
104
111 static const std::wstring ToJson(const BinarySerialization& bin);
112
119 static const std::wstring ToXml(const char * const blob);
120
127 static const std::wstring ToJson(const char * const blob);
128
141
142
156
157 };
158}
159}
160}
161
162
163#endif
164
This namespace contains all the functionality and definitions of the SAFIR SDK.
Definition Backdoor.h:31
std::vector< char > BinarySerialization
A type to contain binary serializations of DOB objects.
Definition Defs.h:301
std::shared_ptr< const Object > ObjectConstPtr
A smart pointer to a const Object.
Definition Object.h:47
std::shared_ptr< Object > ObjectPtr
A smart pointer to an Object.
Definition Object.h:44
Functions for serializing objects to binary, XML and JSON forms.
Definition Serialization.h:49
static Dob::Typesystem::ObjectPtr ToObject(const std::wstring &xml)
Deserialize an XML serialization.
static const std::wstring ToJson(const Dob::Typesystem::ObjectConstPtr &object)
Serialize an object to JSON.
static const std::wstring ToJson(const BinarySerialization &bin)
Convert a binary serialization to JSON.
static void ToBinary(const Dob::Typesystem::ObjectConstPtr &object, Dob::Typesystem::BinarySerialization &binary)
Serialize an object to binary form.
static const std::wstring ToXml(const char *const blob)
Convert a blob to XML.
static Dob::Typesystem::ObjectPtr ToObjectFromJson(const std::wstring &json)
Deserialize an JSON serialization.
static Dob::Typesystem::ObjectPtr ToObject(const Dob::Typesystem::BinarySerialization &binary)
Deserialize a binary serialization and create an object.
static const std::wstring ToJson(const char *const blob)
Convert a blob to JSON.
static const std::wstring ToXml(const BinarySerialization &bin)
Convert a binary serialization to XML.
static const std::wstring ToXml(const Dob::Typesystem::ObjectConstPtr &object)
Serialize an object to XML.
#define DOTS_CPP_API
Definition Defs.h:33