GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
Serializer.h
1 /*
2  * GDevelop Core
3  * Copyright 2008-2016 Florian Rival ([email protected]). All rights
4  * reserved. This project is released under the MIT License.
5  */
6 
7 #ifndef GDCORE_SERIALIZER_H
8 #define GDCORE_SERIALIZER_H
9 #include <string>
10 #include "GDCore/Serialization/SerializerElement.h"
11 class TiXmlElement;
12 
13 namespace gd {
14 
19 class GD_CORE_API Serializer {
20  public:
25 #if !defined(EMSCRIPTEN)
26  static void ToXML(SerializerElement& element, TiXmlElement* xmlElement);
27  static void FromXML(SerializerElement& element,
28  const TiXmlElement* xmlElement);
29 #endif
33  static gd::String ToEscapedXMLString(const gd::String& str);
35 
42 
45  static gd::String ToJSON(const SerializerElement& element);
46 
50  static SerializerElement FromJSON(const char* json);
51 
55  static SerializerElement FromJSON(const gd::String& json) {
56  return FromJSON(json.c_str());
57  }
59 
60  virtual ~Serializer(){};
61 
62  private:
63  Serializer(){};
64 };
65 
66 } // namespace gd
67 
68 #endif
A generic container that can represent a value ( containing a string, double, bool or int),...
Definition: SerializerElement.h:37
The class used to save/load projects and GDCore classes from/to XML or JSON.
Definition: Serializer.h:19
static SerializerElement FromJSON(const gd::String &json)
Construct a gd::SerializerElement from a JSON string.
Definition: Serializer.h:55
String represents an UTF8 encoded string.
Definition: String.h:31
const char * c_str() const
Get the C-string.
Definition: String.h:357
Definition: CommonTools.h:24