30#include <tmxlite/Config.hpp>
31#include <tmxlite/Types.hpp>
51 class TMXLITE_EXPORT_API Property final
70 static Property fromBoolean(
bool value);
71 static Property fromFloat(
float value);
72 static Property fromInt(
int value);
73 static Property fromString(
const std::string& value);
74 static Property fromColour(
const Colour& value);
75 static Property fromFile(
const std::string& value);
76 static Property fromObject(
int value);
82 void parse(
const pugi::xml_node&,
bool isObjectTypes =
false);
95 const std::string&
getName()
const {
return m_name; }
100 bool getBoolValue()
const { assert(m_type == Type::Boolean);
return m_boolValue; }
105 float getFloatValue()
const { assert(m_type == Type::Float);
return m_floatValue; }
110 int getIntValue()
const { assert(m_type == Type::Int || m_type == Type::Object);
return m_intValue; }
115 const std::string&
getStringValue()
const { assert(m_type == Type::String);
return m_stringValue; }
125 const std::string&
getFileValue()
const { assert(m_type == Type::File);
return m_stringValue; }
130 const std::vector<Property>&
getClassValue()
const {assert(m_type == Type::Class);
return m_classValue; }
135 const std::string
getPropertyType()
const {assert(m_type == Type::Class);
return m_propertyType; }
140 int getObjectValue()
const { assert(m_type == Type::Object);
return m_intValue; }
150 std::string m_stringValue;
152 std::string m_propertyType;
154 Colour m_colourValue;
155 std::vector<Property> m_classValue;
Objects are stored in ObjectGroup layers. Objects may be rectangular, elliptical, polygonal or a poly...
Definition Object.hpp:84
float getFloatValue() const
Returns the property's value as a float.
Definition Property.hpp:105
const std::vector< Property > & getClassValue() const
Returns an array of properties.
Definition Property.hpp:130
void parse(const pugi::xml_node &, bool isObjectTypes=false)
Attempts to parse the given node as a property.
bool getBoolValue() const
Returns the property's value as a boolean.
Definition Property.hpp:100
const std::string & getStringValue() const
Returns the property's value as a string.
Definition Property.hpp:115
const Colour & getColourValue() const
Returns the property's value as a Colour struct.
Definition Property.hpp:120
int getObjectValue() const
Returns the property's value as an integer object handle.
Definition Property.hpp:140
const std::string & getFileValue() const
Returns the file path property as a string, relative to the map file.
Definition Property.hpp:125
Type getType() const
Returns the type of data stored in the property. This should generally be called first before trying ...
Definition Property.hpp:90
int getIntValue() const
Returns the property's value as an integer.
Definition Property.hpp:110
const std::string & getName() const
Returns the name of this property.
Definition Property.hpp:95
const std::string getPropertyType() const
Returns an the propertytype value.
Definition Property.hpp:135
Contains the red, green, blue and alpha values of a colour in the range 0 - 255.
Definition Types.hpp:111