Tileson 1.4.0
A helpful json parser for Tiled maps
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
tson::PropertyCollection Class Reference

#include <PropertyCollection.hpp>

Public Member Functions

 PropertyCollection ()=default
 
 PropertyCollection (std::string id)
 
tson::Propertyadd (const tson::Property &property)
 
tson::Propertyadd (IJson &json, tson::Project *project=nullptr)
 
tson::Propertyadd (const std::string &name, const std::any &value, tson::Type type)
 
void remove (const std::string &name)
 
void setValue (const std::string &name, const std::any &value)
 
void setProperty (const std::string &name, const tson::Property &value)
 
void setId (const std::string &id)
 
bool hasProperty (const std::string &name)
 
tson::PropertygetProperty (const std::string &name)
 
std::map< std::string, Property > & getProperties ()
 
std::vector< Property * > get ()
 
template<typename T >
getValue (const std::string &name)
 
const std::string & getId () const
 
size_t getSize () const
 

Protected Attributes

std::string m_id
 
std::map< std::string, tson::Propertym_properties
 

Constructor & Destructor Documentation

◆ PropertyCollection() [1/2]

tson::PropertyCollection::PropertyCollection ( )
inlinedefault

◆ PropertyCollection() [2/2]

tson::PropertyCollection::PropertyCollection ( std::string  id)
inlineexplicit

Member Function Documentation

◆ add() [1/3]

tson::Property * tson::PropertyCollection::add ( const std::string &  name,
const std::any &  value,
tson::Type  type 
)
inline

◆ add() [2/3]

tson::Property * tson::PropertyCollection::add ( const tson::Property property)
inline

◆ add() [3/3]

tson::Property * tson::PropertyCollection::add ( IJson json,
tson::Project project = nullptr 
)
inline

◆ get()

std::vector< tson::Property * > tson::PropertyCollection::get ( )
inline

Gets vector of pointers to all the existing properties

Returns

◆ getId()

const std::string & tson::PropertyCollection::getId ( ) const
inline

◆ getProperties()

std::map< std::string, tson::Property > & tson::PropertyCollection::getProperties ( )
inline

◆ getProperty()

tson::Property * tson::PropertyCollection::getProperty ( const std::string &  name)
inline

◆ getSize()

size_t tson::PropertyCollection::getSize ( ) const
inline

◆ getValue()

template<typename T >
T tson::PropertyCollection::getValue ( const std::string &  name)
inline

◆ hasProperty()

bool tson::PropertyCollection::hasProperty ( const std::string &  name)
inline

◆ remove()

void tson::PropertyCollection::remove ( const std::string &  name)
inline

◆ setId()

void tson::PropertyCollection::setId ( const std::string &  id)
inline

◆ setProperty()

void tson::PropertyCollection::setProperty ( const std::string &  name,
const tson::Property value 
)
inline

Overwrites the current property if it exists, or adds it if it doesn't.

Parameters
name
value

◆ setValue()

void tson::PropertyCollection::setValue ( const std::string &  name,
const std::any &  value 
)
inline

Sets a value IF the property already exists. Does nothing otherwise. See add() for adding new properties

Parameters
name
value

Member Data Documentation

◆ m_id

std::string tson::PropertyCollection::m_id
protected

◆ m_properties

std::map<std::string, tson::Property> tson::PropertyCollection::m_properties
protected

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