Honeycomb  0.1
Component-Model Framework
Public Types | Public Member Functions | List of all members
honey::PropertyObject Class Reference

Object that contains properties. More...

#include <PropertyObject.h>

Inheritance diagram for honey::PropertyObject:
Inheritance graph
[legend]
Collaboration diagram for honey::PropertyObject:
Collaboration graph
[legend]

Public Types

typedef stdutil::unordered_map< Id, PropertyBase::Ptr, SmallAllocatorPropertyMap
 
typedef stdutil::unordered_map< Id, PropertyBase::ConstPtr, SmallAllocatorPropertyMapConst
 

Public Member Functions

 PropertyObject ()
 
virtual ~PropertyObject ()
 Releases all contained properties. More...
 
void addProp (PropertyBase &prop)
 Add a property reference. Any existing property with the same id will be released and replaced. More...
 
void addProp (PropertyBase *prop)
 Wrapper for pointer arg. More...
 
bool hasProp (const Id &id) const
 Check if object contains property with id. More...
 
template<class T >
bool hasProp (const Id &id) const
 Check if object contains property with id and type T. More...
 
template<class T >
Property< T > & prop (const String &name)
 Get property with name of type T. Adds property if it doesn't exist. More...
 
template<class T >
Property< T > & prop (const Id &id)
 Get property with id of type T. Throws PropertyError if property doesn't exist. More...
 
template<class T >
const Property< T > & prop (const Id &id) const
 
PropertyBaseprop (const Id &id)
 Get property with id. Throws PropertyError if property doesn't exist. More...
 
const PropertyBaseprop (const Id &id) const
 
template<class T , class T_ = typename mt::removeRef<T>::type>
Property< T_ > & prop (const String &name, T &&val)
 Assign property with name to value. Adds property if it doesn't exist. Returns assigned property. More...
 
template<class T , class T_ = typename mt::removeRef<T>::type>
Property< T_ > & prop (const Id &id, T &&val)
 Assign property with id to value. Throws PropertyError if property doesn't exist. Returns assigned property. More...
 
const PropertyMapprops ()
 Get all properties. More...
 
const PropertyMapConstprops () const
 
PropertyBase::Ptr removeProp (PropertyBase &prop)
 Remove a single property. Returns property if found and removed. More...
 
PropertyBase::Ptr removeProp (const Id &id)
 Remove a single property with id. Returns property if found and removed. More...
 
void removeProps (const function< void(PropertyBase &)> &f=[](PropertyBase &){})
 Remove all properties. Calls functor for each removed property. More...
 
- Public Member Functions inherited from honey::Object
 Object (const Id &id=idnull)
 
virtual ~Object ()
 
virtual void setInstId (const Id &id)
 Set per instance id. More...
 
const IdgetInstId () const
 
- Public Member Functions inherited from honey::SharedObj< Object >
 SharedObj (Alloc &&a=Alloc()) debug_if(
 Construct with allocator that is called to deallocate this shared object when all references have been released. More...
 

Additional Inherited Members

- Protected Member Functions inherited from honey::SharedObj< Object >
void finalize ()
 Destroys object. Called when strong reference count reaches 0. May be overridden to prevent destruction. More...
 
- Protected Attributes inherited from honey::Object
Id _instId
 

Detailed Description

Object that contains properties.

Member Typedef Documentation

Constructor & Destructor Documentation

honey::PropertyObject::PropertyObject ( )
inline
virtual honey::PropertyObject::~PropertyObject ( )
inlinevirtual

Releases all contained properties.

Member Function Documentation

void honey::PropertyObject::addProp ( PropertyBase prop)
inline

Add a property reference. Any existing property with the same id will be released and replaced.

Properties contained by this object will be released upon object destruction.

void honey::PropertyObject::addProp ( PropertyBase prop)
inline

Wrapper for pointer arg.

bool honey::PropertyObject::hasProp ( const Id id) const
inline

Check if object contains property with id.

template<class T >
bool honey::PropertyObject::hasProp ( const Id id) const
inline

Check if object contains property with id and type T.

template<class T >
Property<T>& honey::PropertyObject::prop ( const String name)
inline

Get property with name of type T. Adds property if it doesn't exist.

template<class T >
Property<T>& honey::PropertyObject::prop ( const Id id)
inline

Get property with id of type T. Throws PropertyError if property doesn't exist.

template<class T >
const Property<T>& honey::PropertyObject::prop ( const Id id) const
inline
PropertyBase& honey::PropertyObject::prop ( const Id id)
inline

Get property with id. Throws PropertyError if property doesn't exist.

const PropertyBase& honey::PropertyObject::prop ( const Id id) const
inline
template<class T , class T_ = typename mt::removeRef<T>::type>
Property<T_>& honey::PropertyObject::prop ( const String name,
T &&  val 
)
inline

Assign property with name to value. Adds property if it doesn't exist. Returns assigned property.

template<class T , class T_ = typename mt::removeRef<T>::type>
Property<T_>& honey::PropertyObject::prop ( const Id id,
T &&  val 
)
inline

Assign property with id to value. Throws PropertyError if property doesn't exist. Returns assigned property.

const PropertyMap& honey::PropertyObject::props ( )
inline

Get all properties.

const PropertyMapConst& honey::PropertyObject::props ( ) const
inline
PropertyBase::Ptr honey::PropertyObject::removeProp ( PropertyBase prop)
inline

Remove a single property. Returns property if found and removed.

PropertyBase::Ptr honey::PropertyObject::removeProp ( const Id id)
inline

Remove a single property with id. Returns property if found and removed.

void honey::PropertyObject::removeProps ( const function< void(PropertyBase &)> &  f = [](PropertyBase&){})
inline

Remove all properties. Calls functor for each removed property.


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