nrEngine::Property Class Reference

Properties are name value pair with a value of any type. More...


Public Member Functions

 Property ()
 Property (const std::string &name)
 Property (const std::string &name, const boost::any &value)
 Property (const Property &)
NR_FORCEINLINE const std::string & getName () const
NR_FORCEINLINE const std::string & getFullName () const
NR_FORCEINLINE const boost::any & getValue () const
NR_FORCEINLINE boost::any & getValue ()
Propertyoperator= (const boost::any &)
bool operator== (const Property &)
bool operator!= (const Property &p)
template<class T>
bool compare (const Property &p)
template<class T>
get ()
NR_FORCEINLINE void setUserData (void *data)
NR_FORCEINLINE void * getUserData ()
NR_FORCEINLINE bool hasUserData ()

Friends

class PropertyManager
 Manager is allowed to change internal structure.


Detailed Description

Properties are name value pair with a value of any type.

Properties represents name-value pairs with a name as a string and a value of any type. For the type of value we use boost::any which is capable to represent any type of data.

Definition at line 36 of file Property.h.


Constructor & Destructor Documentation

nrEngine::Property::Property (  ) 

Create an empty property object. No name is specified and no value

Definition at line 23 of file Property.cpp.

nrEngine::Property::Property ( const std::string &  name  ) 

Create a new property object.

Parameters:
name Name of the property. Name should be unique within one property map

Definition at line 29 of file Property.cpp.

nrEngine::Property::Property ( const std::string &  name,
const boost::any &  value 
)

Construct a property object with a certain name, but also define a value directly

Definition at line 35 of file Property.cpp.

nrEngine::Property::Property ( const Property  ) 

Construct the property from another one

Definition at line 41 of file Property.cpp.


Member Function Documentation

NR_FORCEINLINE const std::string& nrEngine::Property::getName (  )  const

Get the name of the property

Definition at line 67 of file Property.h.

NR_FORCEINLINE const std::string& nrEngine::Property::getFullName (  )  const

Get the fullname of the property. Fullname contains whole group path and the name (i.e. "group.name" ). Only PropertyManager can change full name, because he does only know to which group this property belongs. If property is not handled by manager, so fullname is equal name

Definition at line 76 of file Property.h.

Referenced by operator==().

NR_FORCEINLINE const boost::any& nrEngine::Property::getValue (  )  const

Get value of the property

Definition at line 81 of file Property.h.

Referenced by compare(), nrEngine::PropertyManager::get(), nrEngine::PropertyManager::getByFullName(), operator==(), and nrEngine::ScriptFunctionDec().

Property & nrEngine::Property::operator= ( const boost::any &   ) 

Assign new value to the property

Definition at line 47 of file Property.cpp.

bool nrEngine::Property::operator== ( const Property  ) 

Compare two properties. Two properties are the same if their names and type of the values are the same.

NOTE: We can not compare the values itself because boost::any library can not be casted here to any type. If you wish to have more usefull comparing function, that refer to compare<T>()

Definition at line 54 of file Property.cpp.

References getFullName(), and getValue().

template<class T>
bool nrEngine::Property::compare ( const Property p  ) 

Specific compare of the values with a certain type. This will compare the properties like operator==() do and also compare the values by converting them to the certain type and looking if they are the same.

Definition at line 114 of file Property.h.

References getValue().

template<class T>
T nrEngine::Property::get (  ) 

Get the value by casting to a certain type

Definition at line 123 of file Property.h.

NR_FORCEINLINE void nrEngine::Property::setUserData ( void *  data  ) 

Set user data. We use extra user data information if casting will fail for the value types.

Definition at line 131 of file Property.h.

NR_FORCEINLINE void* nrEngine::Property::getUserData (  ) 

Get user data from the property

Definition at line 136 of file Property.h.

NR_FORCEINLINE bool nrEngine::Property::hasUserData (  ) 

Does our property contains any user data. Just check if the user data pointer equals to NULL. If yes, so we do not get any user data.

Definition at line 142 of file Property.h.


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