GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
SerializerValue.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_SERIALIZERVALUE_H
8 #define GDCORE_SERIALIZERVALUE_H
9 #include <string>
10 #include "GDCore/String.h"
11 
12 namespace gd {
13 
20 class GD_CORE_API SerializerValue {
21  public:
23  SerializerValue(bool val);
24  SerializerValue(const gd::String &val);
25  SerializerValue(int val);
26  SerializerValue(double val);
27  virtual ~SerializerValue(){};
28 
32  void SetBool(bool val);
33 
37  void SetString(const gd::String &val);
38 
42  void SetInt(int val);
43 
47  void SetDouble(double val);
48 
52  void Set(const gd::String &val);
53 
57  bool GetBool() const;
58 
62  gd::String GetString() const;
63 
68  const gd::String& GetRawString() const { return stringValue; };
69 
73  int GetInt() const;
74 
78  double GetDouble() const;
79 
83  bool IsBoolean() const { return isBoolean; }
87  bool IsString() const { return isString; }
91  bool IsInt() const { return isInt; }
95  bool IsDouble() const { return isDouble; }
96 
97  private:
98  bool isUnknown;
100  bool isBoolean;
101  bool isString;
102  bool isInt;
103  bool isDouble;
104 
105  bool booleanValue;
106  gd::String stringValue;
107  int intValue;
108  double doubleValue;
109 };
110 
111 } // namespace gd
112 
113 #endif
A value stored inside a gd::SerializerElement.
Definition: SerializerValue.h:20
bool IsDouble() const
Return true if the value is a double.
Definition: SerializerValue.h:95
bool IsString() const
Return true if the value is a string.
Definition: SerializerValue.h:87
const gd::String & GetRawString() const
Definition: SerializerValue.h:68
bool IsInt() const
Return true if the value is an int.
Definition: SerializerValue.h:91
bool IsBoolean() const
Return true if the value is a boolean.
Definition: SerializerValue.h:83
String represents an UTF8 encoded string.
Definition: String.h:33
Definition: CommonTools.h:24