Mana
Loading...
Searching...
No Matches
Public Member Functions | Private Types | Private Attributes | List of all members
Properties Class Reference

A class holding a set of properties. More...

#include <properties.h>

Inheritance diagram for Properties:
Map

Public Member Functions

virtual ~Properties ()=default
 
std::string getProperty (const std::string &name, const std::string &def=std::string()) const
 Get a map property.
 
float getFloatProperty (const std::string &name, float def=0.0f) const
 Gets a map property as a float.
 
float getIntProperty (const std::string &name, int def=0) const
 Gets a map property as an int.
 
bool getBoolProperty (const std::string &name, bool def=false) const
 Gets a map property as a boolean.
 
bool hasProperty (const std::string &name) const
 Returns whether a certain property is available.
 
void setProperty (const std::string &name, const std::string &value)
 Set a map property.
 

Private Types

using PropertyMap = std::map< std::string, std::string >
 

Private Attributes

PropertyMap mProperties
 

Detailed Description

A class holding a set of properties.

Definition at line 31 of file properties.h.

Member Typedef Documentation

◆ PropertyMap

using Properties::PropertyMap = std::map<std::string, std::string>
private

Definition at line 139 of file properties.h.

Constructor & Destructor Documentation

◆ ~Properties()

virtual Properties::~Properties ( )
virtualdefault

Member Function Documentation

◆ getBoolProperty()

bool Properties::getBoolProperty ( const std::string &  name,
bool  def = false 
) const
inline

Gets a map property as a boolean.

Parameters
nameThe name of the property.
defDefault value, false by default.
Returns
the value of the given property or the given default when it doesn't exist.

Definition at line 101 of file properties.h.

◆ getFloatProperty()

float Properties::getFloatProperty ( const std::string &  name,
float  def = 0.0f 
) const
inline

Gets a map property as a float.

Parameters
nameThe name of the property.
defDefault value, 0.0f by default.
Returns
the value of the given property or the given default when it doesn't exist.

Definition at line 59 of file properties.h.

◆ getIntProperty()

float Properties::getIntProperty ( const std::string &  name,
int  def = 0 
) const
inline

Gets a map property as an int.

Parameters
nameThe name of the property.
defDefault value, 0 by default.
Returns
the value of the given property or the given default when it doesn't exist.

Definition at line 80 of file properties.h.

◆ getProperty()

std::string Properties::getProperty ( const std::string &  name,
const std::string &  def = std::string() 
) const
inline

Get a map property.

Parameters
nameThe name of the property.
defDefault value, empty string by default.
Returns
the value of the given property or the given default when it doesn't exist.

Definition at line 44 of file properties.h.

◆ hasProperty()

bool Properties::hasProperty ( const std::string &  name) const
inline

Returns whether a certain property is available.

Parameters
nameThe name of the property.
Returns
true when a property is defined, false otherwise.

Definition at line 122 of file properties.h.

◆ setProperty()

void Properties::setProperty ( const std::string &  name,
const std::string &  value 
)
inline

Set a map property.

Parameters
nameThe name of the property.
valueThe value of the property.

Definition at line 133 of file properties.h.

Member Data Documentation

◆ mProperties

PropertyMap Properties::mProperties
private

Definition at line 140 of file properties.h.


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