nrEngine::PropertyManager Class Reference

Property manager does hold properties for global access. More...


Public Member Functions

 PropertyManager ()
 ~PropertyManager ()
void createGroup (const std::string &name)
const PropertyListgetPropertyList (const std::string &group=std::string())
PropertygetProperty (const std::string &name, const std::string &group=std::string())
PropertygetPropertyByFullName (const std::string &fullname)
NR_FORCEINLINE Propertyoperator() (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)


Detailed Description

Property manager does hold properties for global access.

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.


Constructor & Destructor Documentation

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.


Member Function Documentation

void nrEngine::PropertyManager::createGroup ( const std::string &  name  ) 

Create new property group. If such group already exists, so nothing happens.

Parameters:
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

Parameters:
[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.

Parameters:
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.

See also:
PropertyManager::getProperty()

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

Parameters:
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

See also:
PropertyManager::set()
Parameters:
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

See also:
IPropertyManager::set()
Parameters:
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.

template<typename T>
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.

Parameters:
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.

template<typename T>
NR_FORCEINLINE T nrEngine::PropertyManager::getByFullName ( const std::string &  name  ) 

See also:
get()

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.


The documentation for this class was generated from the following files:
Generated on Wed Sep 12 23:19:43 2007 for nrEngine by  doxygen 1.5.1