Public Member Functions | |
PropertyManager () | |
~PropertyManager () | |
void | createGroup (const std::string &name) |
const PropertyList & | getPropertyList (const std::string &group=std::string()) |
Property & | getProperty (const std::string &name, const std::string &group=std::string()) |
Property & | getPropertyByFullName (const std::string &fullname) |
NR_FORCEINLINE Property & | operator() (const std::string &name, const std::string &group=std::string()) |
void | set (const Property &property, const std::string &name, const std::string &group=std::string()) |
void | set (const boost::any &value, const std::string &name, const std::string &group=std::string()) |
void | setByFullName (const boost::any &value, const std::string &fullname) |
void | setByFullName (const Property &property, const std::string &name) |
template<typename T> | |
NR_FORCEINLINE T | get (const std::string &name, const std::string &group=std::string()) |
template<typename T> | |
NR_FORCEINLINE T | getByFullName (const std::string &name) |
Property manager class is used to access global properties. In this way your application can store some values of any type in the manager by a certain name. The value can then be accessed from another place. Propertties are grouped in groups, so group names must be unique. If no group name is specified, so default group is used. Property must have unique names in one group.
Definition at line 38 of file PropertyManager.h.
nrEngine::PropertyManager::PropertyManager | ( | ) |
Create Property manager object and initialiye default data
Definition at line 22 of file PropertyManager.cpp.
nrEngine::PropertyManager::~PropertyManager | ( | ) |
Release used memory and remove all properties from the memory.
Definition at line 28 of file PropertyManager.cpp.
void nrEngine::PropertyManager::createGroup | ( | const std::string & | name | ) |
Create new property group. If such group already exists, so nothing happens.
name | Unique name of a property group |
Definition at line 35 of file PropertyManager.cpp.
const PropertyList & nrEngine::PropertyManager::getPropertyList | ( | const std::string & | group = std::string() |
) |
Get property list of properties of certain group. The list is const, so no changes are allowed. If no such group exists, so empty list will be returned
[group] | Name of the group |
Definition at line 41 of file PropertyManager.cpp.
Referenced by nrEngine::ScriptFunctionDec().
Property & nrEngine::PropertyManager::getProperty | ( | const std::string & | name, | |
const std::string & | group = std::string() | |||
) |
Get property.
name | Name of the property | |
[group] | Unique name of the group |
Definition at line 47 of file PropertyManager.cpp.
Referenced by get(), getPropertyByFullName(), nrEngine::ScriptFunctionDec(), and set().
NR_FORCEINLINE Property& nrEngine::PropertyManager::operator() | ( | const std::string & | name, | |
const std::string & | group = std::string() | |||
) |
Get the property directly.
Definition at line 85 of file PropertyManager.h.
void nrEngine::PropertyManager::set | ( | const Property & | property, | |
const std::string & | name, | |||
const std::string & | group = std::string() | |||
) |
Add/add new property to a group. If no such group exists, so group will be created. If such property already exists, so it will be overwritten
property | Property which to add | |
name | Name of the property | |
group | Unique group name. |
Definition at line 74 of file PropertyManager.cpp.
References nrEngine::Property::copyDataOnly(), getProperty(), nrEngine::Property::mFullName, and nrEngine::Property::mName.
Referenced by nrEngine::ScriptFunctionDec().
void nrEngine::PropertyManager::set | ( | const boost::any & | value, | |
const std::string & | name, | |||
const std::string & | group = std::string() | |||
) |
Directly setup new property with new value
value | Any value to set to the property (value must be convertible) | |
name | Name of the property | |
group | Unique goup name |
Definition at line 94 of file PropertyManager.cpp.
References getProperty(), and nrEngine::Property::mValue.
void nrEngine::PropertyManager::setByFullName | ( | const boost::any & | value, | |
const std::string & | fullname | |||
) |
Set new value based on fullname
value | Valeu to be set for the property | |
fullname | Fullname of the property (i.e. "group.name") |
Definition at line 104 of file PropertyManager.cpp.
References getPropertyByFullName(), and nrEngine::Property::mValue.
NR_FORCEINLINE T nrEngine::PropertyManager::get | ( | const std::string & | name, | |
const std::string & | group = std::string() | |||
) |
Get the value directly from the database. The method is templated, so you get the value converted to given type. If conversion is not possible, so error occurs. To prevent errors, check the type before access.
name | Name of the property | |
[group] | Unique group name of the property |
Definition at line 146 of file PropertyManager.h.
References getProperty(), nrEngine::Property::getValue(), nrEngine::Log::LL_WARNING, nrEngine::Log::LOG_CONSOLE, nrEngine::Log::LOG_ENGINE, NR_EXCEPT, and nrEngine::PROPERTY_WRONG_TYPE.
NR_FORCEINLINE T nrEngine::PropertyManager::getByFullName | ( | const std::string & | name | ) |
Definition at line 170 of file PropertyManager.h.
References getPropertyByFullName(), nrEngine::Property::getValue(), nrEngine::Log::LL_WARNING, nrEngine::Log::LOG_CONSOLE, nrEngine::Log::LOG_ENGINE, NR_EXCEPT, and nrEngine::PROPERTY_WRONG_TYPE.