tmxlite: tmx::Property Class Reference

tmxlite 1.0.0 lightweight parse for Tiled maps

Public Types | Public Member Functions | Static Public Member Functions | List of all members
tmx::Property Class Referencefinal

Represents a custom property. Tiles, objects and layers of a tmx map may have custom properties assigned to them. This class represents a single property and provides access to its value, the type of which can be determined with getType(). More...

`#include <Property.hpp>`

## Public Types
enum class | Type { Boolean , Float , Int , String , Colour , File , Object , Class , Undef }

## Public Member Functions
void | parse (const pugi::xml_node &, bool isObjectTypes=false)
| Attempts to parse the given node as a property.
Type | getType () const
| Returns the type of data stored in the property. This should generally be called first before trying to read the proprty value, as reading the incorrect type will lead to undefined behaviour.
const std::string & | getName () const
| Returns the name of this property.
bool | getBoolValue () const
| Returns the property's value as a boolean.
float | getFloatValue () const
| Returns the property's value as a float.
int | getIntValue () const
| Returns the property's value as an integer.
const std::string & | getStringValue () const
| Returns the property's value as a string.
const Colour & | getColourValue () const
| Returns the property's value as a Colour struct.
const std::string & | getFileValue () const
| Returns the file path property as a string, relative to the map file.
const std::vector< Property > & | getClassValue () const
| Returns an array of properties.
const std::string | getPropertyType () const
| Returns an the propertytype value.
int | getObjectValue () const
| Returns the property's value as an integer object handle.

## Static Public Member Functions
static Property | fromBoolean (bool value)
static Property | fromFloat (float value)
static Property | fromInt (int value)
static Property | fromString (const std::string &value)
static Property | fromColour (const Colour &value)
static Property | fromFile (const std::string &value)
static Property | fromObject (int value)

## Detailed Description

Represents a custom property. Tiles, objects and layers of a tmx map may have custom properties assigned to them. This class represents a single property and provides access to its value, the type of which can be determined with getType().

## Member Function Documentation

## ◆ parse()

void tmx::Property::parse | ( | const pugi::xml_node & | ,
|  | bool | isObjectTypes = false )

Attempts to parse the given node as a property.

Parameters

  isObjectTypes | Set to true if the parsing is done from an object types files.

The documentation for this class was generated from the following file:

- D:/W/B/src/tmxlite-1.4.5/tmxlite/include/tmxlite/Property.hpp