7 #ifndef GDCORE_SERIALIZERELEMENT_H
8 #define GDCORE_SERIALIZERELEMENT_H
14 #include "GDCore/Serialization/SerializerValue.h"
15 #include "GDCore/String.h"
59 if ((
this) != &
object) Init(
object);
73 valueUndefined =
false;
81 valueUndefined =
false;
82 elementValue.SetBool(val);
94 valueUndefined =
false;
95 elementValue.SetString(val);
107 valueUndefined =
false;
108 elementValue.SetInt(val);
120 valueUndefined =
false;
121 elementValue.SetInt((
int)val);
129 valueUndefined =
false;
130 elementValue.SetDouble(val);
186 void SetMultilineStringValue(
const gd::String &value);
218 return SetAttribute(name, value);
236 return SetAttribute(name, value);
245 if (value) SetAttribute(name,
gd::String(value));
262 return SetAttribute(name, value);
278 return SetAttribute(name, value);
289 bool defaultValue =
false,
311 int defaultValue = 0,
321 double GetDoubleAttribute(
const gd::String &name,
322 double defaultValue = 0.0,
330 bool HasAttribute(
const gd::String &name)
const;
373 const gd::String &deprecatedName =
"")
const {
376 deprecatedArrayOf = deprecatedName;
402 std::size_t index = 0,
424 std::size_t GetChildrenCount(
gd::String name =
"",
444 const std::vector<std::pair<gd::String, std::shared_ptr<SerializerElement> > >
459 bool valueUndefined =
true;
462 std::map<gd::String, SerializerValue> attributes;
463 std::vector<std::pair<gd::String, std::shared_ptr<SerializerElement> > >
465 mutable bool isArray =
false;
A generic container that can represent a value ( containing a string, double, bool or int),...
Definition: SerializerElement.h:37
bool GetBoolValue() const
Get the value, its type being a boolean.
Definition: SerializerElement.h:160
void SetIntValue(int val)
Set the value of the element, as an integer.
Definition: SerializerElement.h:114
const gd::String & ConsideredAsArrayOf() const
Return the name of the children the element is considered an array of.
Definition: SerializerElement.h:385
void ConsiderAsArray() const
Consider that the element is an array of elements, without specific name for the children element.
Definition: SerializerElement.h:351
void SetValue(unsigned int val)
Set the value of the element, as an unsigned integer.
Definition: SerializerElement.h:119
SerializerElement & operator=(const gd::SerializerElement &object)
Definition: SerializerElement.h:58
gd::String GetStringValue() const
Get the value, its type being a gd::String.
Definition: SerializerElement.h:165
void SetValue(const gd::String &val)
Set the value of the element, as a string.
Definition: SerializerElement.h:93
void SetFloatValue(float val)
Set the value of the element, as a floating point number.
Definition: SerializerElement.h:147
const std::map< gd::String, SerializerValue > & GetAllAttributes() const
Return all the attributes of the element.
Definition: SerializerElement.h:335
SerializerElement & SetAttribute(const gd::String &name, const char *value)
Set the string value of an attribute of the element.
Definition: SerializerElement.h:244
SerializerElement & SetDoubleAttribute(const gd::String &name, double value)
Set the double precision floating point number value of an attribute of the element.
Definition: SerializerElement.h:277
SerializerElement & SetBoolAttribute(const gd::String &name, bool value)
Set the boolean value of an attribute of the element.
Definition: SerializerElement.h:217
void SetValue(bool val)
Set the value of the element, as a boolean.
Definition: SerializerElement.h:80
void SetValue(int val)
Set the value of the element, as an integer.
Definition: SerializerElement.h:106
SerializerElement & SetIntAttribute(const gd::String &name, int value)
Set the integer value of an attribute of the element.
Definition: SerializerElement.h:261
bool IsValueUndefined() const
Return true if no value was set for the element.
Definition: SerializerElement.h:180
SerializerElement & SetStringAttribute(const gd::String &name, const gd::String &value)
Set the string value of an attribute of the element.
Definition: SerializerElement.h:234
void SetDoubleValue(double val)
Set the value of the element, as a double precision floating point number.
Definition: SerializerElement.h:137
void SetValue(float val)
Set the value of the element, as a floating point number.
Definition: SerializerElement.h:142
const std::vector< std::pair< gd::String, std::shared_ptr< SerializerElement > > > & GetAllChildren() const
Return all the children of the element.
Definition: SerializerElement.h:445
SerializerElement(const gd::SerializerElement &object)
Definition: SerializerElement.h:53
int GetIntValue() const
Get the value, its type being an int.
Definition: SerializerElement.h:170
void SetBoolValue(bool val)
Set the value of the element, as a boolean.
Definition: SerializerElement.h:88
void ConsiderAsArrayOf(const gd::String &name, const gd::String &deprecatedName="") const
Consider that the element is an array for elements with the given name.
Definition: SerializerElement.h:372
void SetStringValue(const gd::String &val)
Set the value of the element, as a string.
Definition: SerializerElement.h:101
void SetValue(const SerializerValue &value)
Set the value of the element.
Definition: SerializerElement.h:72
bool ConsideredAsArray() const
Check if the element is considered as an array containing its children.
Definition: SerializerElement.h:360
void SetValue(double val)
Set the value of the element, as a double precision floating point number.
Definition: SerializerElement.h:128
double GetDoubleValue() const
Get the value, its type being a double.
Definition: SerializerElement.h:175
A value stored inside a gd::SerializerElement.
Definition: SerializerValue.h:20
String represents an UTF8 encoded string.
Definition: String.h:33
Definition: CommonTools.h:24