Honeycomb
0.1
Component-Model Framework
|
Object that contains properties. More...
#include <PropertyObject.h>
Public Types | |
typedef stdutil::unordered_map< Id, PropertyBase::Ptr, SmallAllocator > | PropertyMap |
typedef stdutil::unordered_map< Id, PropertyBase::ConstPtr, SmallAllocator > | PropertyMapConst |
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 |
PropertyBase & | prop (const Id &id) |
Get property with id. Throws PropertyError if property doesn't exist. More... | |
const PropertyBase & | prop (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 PropertyMap & | props () |
Get all properties. More... | |
const PropertyMapConst & | props () 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 Id & | getInstId () 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 |
Object that contains properties.
typedef stdutil::unordered_map<Id, PropertyBase::Ptr, SmallAllocator> honey::PropertyObject::PropertyMap |
typedef stdutil::unordered_map<Id, PropertyBase::ConstPtr, SmallAllocator> honey::PropertyObject::PropertyMapConst |
|
inline |
|
inlinevirtual |
Releases all contained properties.
|
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.
|
inline |
Wrapper for pointer arg.
|
inline |
Check if object contains property with id.
|
inline |
Check if object contains property with id and type T.
Get property with name of type T. Adds property if it doesn't exist.
Get property with id of type T. Throws PropertyError if property doesn't exist.
|
inline |
Get property with id. Throws PropertyError if property doesn't exist.
|
inline |
|
inline |
Assign property with name to value. Adds property if it doesn't exist. Returns assigned property.
|
inline |
Assign property with id to value. Throws PropertyError if property doesn't exist. Returns assigned property.
|
inline |
Get all properties.
|
inline |
|
inline |
Remove a single property. Returns property if found and removed.
|
inline |
Remove a single property with id. Returns property if found and removed.
|
inline |
Remove all properties. Calls functor for each removed property.