kanzi::PropertyObject Class Reference

PropertyObject is the base class that supports setting and retrieving properties. More...

#include <kanzi/core/property/property_object.hpp>

Inheritance diagram for kanzi::PropertyObject:
kanzi::Object kanzi::AbstractAnimation kanzi::Action kanzi::Binding kanzi::BindingProcessor kanzi::Condition kanzi::Domain kanzi::InputManipulator kanzi::ListBoxItemContainerGenerator2D kanzi::ListBoxItemContainerGenerator3D kanzi::ListBoxItemGenerator2D kanzi::ListBoxItemGenerator3D kanzi::Node kanzi::NodeComponent kanzi::NodeComponentTemplate kanzi::Resource kanzi::Timeline kanzi::TimelineClock kanzi::TimelinePlayback

Public Types

typedef intrusive_ptr< AbstractPropertyTypeDescriptor::PropertyStoragePropertyStoragePtr
 
typedef vector< PropertyStoragePtrPropertyStorageContainer
 
typedef PropertyStorageContainer::iterator PropertyStorageIterator
 
typedef PropertyStorageContainer::const_iterator PropertyStorageConstIterator
 
typedef PropertyStorageContainer::reverse_iterator PropertyStorageReverseIterator
 

Public Member Functions

 PropertyObject ()
 
virtual ~PropertyObject ()
 
template<typename DataType >
void setProperty (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Traits::ParameterType value)
 Sets the local value of a property. More...
 
void removeKzbProperties ()
 
template<typename DataType >
PropertyType< DataType >::Traits::ReturnType getProperty (const PropertyType< DataType > &propertyType) const
 Returns the current value of a property. More...
 
template<typename DataType >
optional< typename PropertyType< DataType >::Traits::ReturnType > getOptionalProperty (const PropertyType< DataType > &propertyType) const
 Evaluates the property value in the same way as the overload above but does not default to the value in property metadata if there are no inputs to the property value. More...
 
template<typename DataType >
PropertyType< DataType >::Traits::ReturnType getPropertyBase (const PropertyType< DataType > &propertyType) const
 Returns the current value of a property disregarding modifiers. More...
 
template<typename DataType >
void setAbstractProperty (AbstractPropertyType abstractPropertyType, typename PropertyType< DataType >::Traits::ParameterType value)
 
template<typename DataType >
PropertyType< DataType >::Traits::ReturnType getAbstractProperty (AbstractPropertyType abstractPropertyType) const
 
template<typename DataType >
PropertyType< DataType >::Traits::ReturnType getAbstractPropertyBase (AbstractPropertyType abstractPropertyType) const
 
template<typename DataType >
optional< typename PropertyType< DataType >::Traits::ReturnType > getOptionalAbstractProperty (AbstractPropertyType abstractPropertyType) const
 
void setPropertyFlag (AbstractPropertyType propertyType, uint32_t flag)
 
bool isPropertyFlagSet (AbstractPropertyType propertyType, uint32_t flag) const
 
void clearPropertyFlag (AbstractPropertyType propertyType, uint32_t flag)
 
bool hasValue (AbstractPropertyType propertyType) const
 Evaluates whether there are any inputs into the property value. More...
 
bool hasBaseValue (AbstractPropertyType propertyType) const
 Evaluates whether there are any inputs into the property value, disregarding modifiers. More...
 
bool hasLocalValue (AbstractPropertyType propertyType) const
 Evaluates whether there is a local value set for the property. More...
 
bool hasNonClassValue (AbstractPropertyType propertyType) const
 Evaluates whether there is a value of any precedence higher than class default value set for the property. More...
 
void removeLocalValue (AbstractPropertyType propertyType)
 Removes the local value associated with the property. More...
 
void copyLocalValue (const PropertyObject &other, AbstractPropertyType propertyType)
 Copies local value of single property from another object. More...
 
void copyLocalValues (const PropertyObject &other)
 Copies all local values from another object. More...
 
virtual void onPropertyChanged (AbstractPropertyType propertyType, PropertyNotificationReason reason)
 Virtual function to handle property change notifications. More...
 
template<typename DataType >
void addPropertyValueSource (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::TypedValueSource *valueSource, PropertyValuePrecedence precedence, void *owner)
 
template<typename DataType >
void removePropertyValueSource (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::TypedValueSource *valueSource, void *owner)
 
template<typename DataType >
void addPropertyModifier (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::ModifierCallback callback, void *owner)
 
template<typename DataType >
void removePropertyModifier (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::ModifierCallback callback, void *owner)
 
void validatePropertyModifiers (AbstractPropertyType propertyType)
 
template<typename DataType >
void addPropertyNotificationHandler (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::NotificationCallback callback, void *owner)
 
template<typename DataType >
void removePropertyNotificationHandler (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::NotificationCallback callback, void *owner)
 
template<typename DataType >
size_t getPropertyNotificationHandlerCount (const PropertyType< DataType > &propertyType)
 Gets number of current notification handlers for given property type. More...
 

Protected Member Functions

void addPropertyValueSource (AbstractPropertyTypeDescriptor &descriptor, AbstractPropertyTypeDescriptor::ValueSource *valueSource, PropertyValuePrecedence precedence, void *owner)
 
void removePropertyValueSource (AbstractPropertyTypeDescriptor &descriptor, AbstractPropertyTypeDescriptor::ValueSource *valueSource, void *owner)
 
AbstractPropertyTypeDescriptor::ValueSourceEntrygetTopValueSourceEntry (AbstractPropertyTypeDescriptor::PropertyStorage &propertyStorage) const
 
AbstractPropertyTypeDescriptor::ValueSourceEntrygetTopValueSourceEntry (AbstractPropertyTypeDescriptor &descriptor) const
 
AbstractPropertyTypeDescriptor::ValueSourcegetTopValueSource (AbstractPropertyTypeDescriptor &descriptor) const
 
AbstractPropertyTypeDescriptor::ValueSourcegetFinalValueSource (AbstractPropertyTypeDescriptor &descriptor) const
 
AbstractPropertyTypeDescriptor::ValueSourcegetNonClassValueSource (AbstractPropertyTypeDescriptor &descriptor) const
 
AbstractPropertyTypeDescriptor::ValueSourcegetClassValueSource (AbstractPropertyTypeDescriptor &descriptor) const
 
AbstractPropertyTypeDescriptor::ValueSourceEntryfindLocalValueSourceEntry (AbstractPropertyTypeDescriptor::PropertyStorage &propertyStorage)
 
AbstractPropertyTypeDescriptor::ValueSourceEntryconstructLocalValueSourceEntry (AbstractPropertyTypeDescriptor &descriptor, AbstractPropertyTypeDescriptor::PropertyStorage &propertyStorage)
 
AbstractPropertyTypeDescriptor::ValueSourceEntryacquireLocalValueSourceEntry (AbstractPropertyTypeDescriptor &descriptor, PropertyStoragePtr &propertyStorage)
 
AbstractPropertyTypeDescriptor::PropertyStoragefindPropertyStorage (AbstractPropertyTypeDescriptor &descriptor) const
 
PropertyStoragePtr findPropertyStoragePtr (AbstractPropertyTypeDescriptor &descriptor) const
 Gets property storage intrusive pointer that can be used to hold a reference until end of operation. More...
 
PropertyStoragePtr constructPropertyStorage (AbstractPropertyTypeDescriptor &descriptor)
 
PropertyStoragePtr acquirePropertyStorage (AbstractPropertyTypeDescriptor &descriptor)
 
AbstractPropertyTypeDescriptor::ModifierStorageacquireModifierStorage (AbstractPropertyTypeDescriptor &descriptor, AbstractPropertyTypeDescriptor::PropertyStorage &propertyStorage)
 
AbstractPropertyTypeDescriptor::ModifierStoragefindModifierStorage (AbstractPropertyTypeDescriptor &descriptor)
 
AbstractPropertyTypeDescriptor::NotificationStorageacquireNotificationStorage (AbstractPropertyTypeDescriptor &descriptor)
 
AbstractPropertyTypeDescriptor::NotificationStoragefindNotificationStorage (AbstractPropertyTypeDescriptor &descriptor)
 
AbstractPropertyTypeDescriptorfindPropertyTypeDescriptorByUnqualifiedNameAndDataType (string_view unqualifiedName, PropertyDataType dataType)
 
void validatePropertyModifiersAndNotifyHandlers (PropertyStoragePtr &propertyStorage)
 
void copyLocalValue (const AbstractPropertyTypeDescriptor::PropertyStorage &otherPropertyStorage)
 Copy local value from property storage. More...
 
PropertyStorageContainer::iterator beginPropertyStorage ()
 
PropertyStorageContainer::iterator endPropertyStorage ()
 
virtual void notifyPropertyHandlers (PropertyStoragePtr &propertyStorage, PropertyNotificationReason reason)
 
void onCopy (const PropertyObject &other)
 

Detailed Description

PropertyObject is the base class that supports setting and retrieving properties.

See PropertyType, AbstractPropertyType, DynamicPropertyType.

Member Typedef Documentation

typedef PropertyStorageContainer::iterator kanzi::PropertyObject::PropertyStorageIterator
typedef PropertyStorageContainer::const_iterator kanzi::PropertyObject::PropertyStorageConstIterator
typedef PropertyStorageContainer::reverse_iterator kanzi::PropertyObject::PropertyStorageReverseIterator

Constructor & Destructor Documentation

kanzi::PropertyObject::PropertyObject ( )
explicit
virtual kanzi::PropertyObject::~PropertyObject ( )
virtual

Member Function Documentation

template<typename DataType >
void kanzi::PropertyObject::setProperty ( const PropertyType< DataType > &  propertyType,
typename PropertyType< DataType >::Traits::ParameterType  value 
)
inline

Sets the local value of a property.

Parameters
propertyTypeThe property type identifying the property to set.
valueThe value to set.
void kanzi::PropertyObject::removeKzbProperties ( )
template<typename DataType >
PropertyType<DataType>::Traits::ReturnType kanzi::PropertyObject::getProperty ( const PropertyType< DataType > &  propertyType) const
inline

Returns the current value of a property.

The value returned by this function is the result of the property system evaluating the inputs that can affect the values of properties. The final value is calculated by determining the base value of the property and applying existing modifiers to it.

Base value is affected by the following inputs where the highest entry in the list determines the base value:

  1. Local value set with setProperty or loaded from kzb
  2. Value set by a style affecting the property.
  3. Value defined by class metadata.

When the base value is determined the system applies modifiers to the value that can change the value or replace it completely. The following is the list of possible modifiers, where the order of evaluation is determined by the order the modifiers were added or applied.

  1. Values defined is states of state manager.
  2. Animations.

If no inputs to the property value can be established the system returns the value registered in the property type metadata.

Parameters
propertyTypeThe property type identifying the property to retrieve.
Returns
Returns the evaluated property value.
template<typename DataType >
optional<typename PropertyType<DataType>::Traits::ReturnType> kanzi::PropertyObject::getOptionalProperty ( const PropertyType< DataType > &  propertyType) const
inline

Evaluates the property value in the same way as the overload above but does not default to the value in property metadata if there are no inputs to the property value.

Parameters
propertyTypeThe property type identifying the property to retrieve.
valueThe reference that receives the value the function evaluates. The reference is not modified if there are no inputs to the property value.
Returns
Returns an optional value that is left empty if the property was not found.
template<typename DataType >
PropertyType<DataType>::Traits::ReturnType kanzi::PropertyObject::getPropertyBase ( const PropertyType< DataType > &  propertyType) const
inline

Returns the current value of a property disregarding modifiers.

Base value is affected by the following inputs where the highest entry in the list determines the base value:

  1. Local value set with setProperty or loaded from kzb
  2. Value set by a style affecting the property.
  3. Value defined by class metadata.

Modifiers are not applied, the highest-priority base value is returned.

If no inputs to the property value can be established the system returns the value default value from property type metadata.

Parameters
propertyTypeThe property type identifying the property to retrieve.
Returns
Returns the evaluated property value.
template<typename DataType >
void kanzi::PropertyObject::setAbstractProperty ( AbstractPropertyType  abstractPropertyType,
typename PropertyType< DataType >::Traits::ParameterType  value 
)
inline
template<typename DataType >
PropertyType<DataType>::Traits::ReturnType kanzi::PropertyObject::getAbstractProperty ( AbstractPropertyType  abstractPropertyType) const
inline
template<typename DataType >
PropertyType<DataType>::Traits::ReturnType kanzi::PropertyObject::getAbstractPropertyBase ( AbstractPropertyType  abstractPropertyType) const
inline
template<typename DataType >
optional<typename PropertyType<DataType>::Traits::ReturnType> kanzi::PropertyObject::getOptionalAbstractProperty ( AbstractPropertyType  abstractPropertyType) const
inline
void kanzi::PropertyObject::setPropertyFlag ( AbstractPropertyType  propertyType,
uint32_t  flag 
)
bool kanzi::PropertyObject::isPropertyFlagSet ( AbstractPropertyType  propertyType,
uint32_t  flag 
) const
void kanzi::PropertyObject::clearPropertyFlag ( AbstractPropertyType  propertyType,
uint32_t  flag 
)
bool kanzi::PropertyObject::hasValue ( AbstractPropertyType  propertyType) const

Evaluates whether there are any inputs into the property value.

Both value sources and modifiers are taken into account.

Parameters
propertyTypeThe property type identifying the property to evaluate.
Returns
Returns true if there are inputs into the property value, false otherwise.
bool kanzi::PropertyObject::hasBaseValue ( AbstractPropertyType  propertyType) const

Evaluates whether there are any inputs into the property value, disregarding modifiers.

Does not take modifiers into account.

Parameters
propertyTypeThe property type identifying the property to evaluate.
Returns
Returns true if there are inputs into the property value, false otherwise.
bool kanzi::PropertyObject::hasLocalValue ( AbstractPropertyType  propertyType) const

Evaluates whether there is a local value set for the property.

Local values are set with setProperty or loaded from kzb.

Parameters
propertyTypeThe property type identifying the property to evaluate.
Returns
Returns true if there is a local value for the property.
bool kanzi::PropertyObject::hasNonClassValue ( AbstractPropertyType  propertyType) const

Evaluates whether there is a value of any precedence higher than class default value set for the property.

Parameters
propertyTypeThe property type identifying the property to evaluate.
Returns
Returns true if there is a non-class value for the property.
void kanzi::PropertyObject::removeLocalValue ( AbstractPropertyType  propertyType)

Removes the local value associated with the property.

Parameters
propertyTypeThe property type identifying the property to evaluate.
void kanzi::PropertyObject::copyLocalValue ( const PropertyObject other,
AbstractPropertyType  propertyType 
)

Copies local value of single property from another object.

Parameters
otherThe object from which to copy the value.
propertyTypeProperty type to copy.
void kanzi::PropertyObject::copyLocalValues ( const PropertyObject other)

Copies all local values from another object.

Parameters
otherThe object from which to copy the values.
virtual void kanzi::PropertyObject::onPropertyChanged ( AbstractPropertyType  propertyType,
PropertyNotificationReason  reason 
)
virtual

Virtual function to handle property change notifications.

Classes deriving from Object can override this function to monitor changes of properties.

Parameters
propertyTypeThe property type identifying the property that has changed.
reasonThe reason that caused the property notification to be invoked.

Reimplemented in kanzi::Brush, kanzi::PropertyDrivenAnimationPlayer, kanzi::BlitRenderPass, kanzi::TextureBrush, kanzi::Material, kanzi::ColorBrush, kanzi::MaterialBrush, kanzi::DrawObjectsWithMaterialRenderPass, kanzi::ResourceDictionarySelector, and kanzi::MaterialSetupRenderPass.

template<typename DataType >
void kanzi::PropertyObject::addPropertyValueSource ( const PropertyType< DataType > &  propertyType,
typename PropertyType< DataType >::Descriptor::TypedValueSource *  valueSource,
PropertyValuePrecedence  precedence,
void *  owner 
)
inline
template<typename DataType >
void kanzi::PropertyObject::removePropertyValueSource ( const PropertyType< DataType > &  propertyType,
typename PropertyType< DataType >::Descriptor::TypedValueSource *  valueSource,
void *  owner 
)
inline
template<typename DataType >
void kanzi::PropertyObject::addPropertyModifier ( const PropertyType< DataType > &  propertyType,
typename PropertyType< DataType >::Descriptor::ModifierCallback  callback,
void *  owner 
)
inline
template<typename DataType >
void kanzi::PropertyObject::removePropertyModifier ( const PropertyType< DataType > &  propertyType,
typename PropertyType< DataType >::Descriptor::ModifierCallback  callback,
void *  owner 
)
inline
void kanzi::PropertyObject::validatePropertyModifiers ( AbstractPropertyType  propertyType)
template<typename DataType >
void kanzi::PropertyObject::addPropertyNotificationHandler ( const PropertyType< DataType > &  propertyType,
typename PropertyType< DataType >::Descriptor::NotificationCallback  callback,
void *  owner 
)
inline
template<typename DataType >
void kanzi::PropertyObject::removePropertyNotificationHandler ( const PropertyType< DataType > &  propertyType,
typename PropertyType< DataType >::Descriptor::NotificationCallback  callback,
void *  owner 
)
inline
template<typename DataType >
size_t kanzi::PropertyObject::getPropertyNotificationHandlerCount ( const PropertyType< DataType > &  propertyType)
inline

Gets number of current notification handlers for given property type.

void kanzi::PropertyObject::addPropertyValueSource ( AbstractPropertyTypeDescriptor descriptor,
AbstractPropertyTypeDescriptor::ValueSource valueSource,
PropertyValuePrecedence  precedence,
void *  owner 
)
protected
void kanzi::PropertyObject::removePropertyValueSource ( AbstractPropertyTypeDescriptor descriptor,
AbstractPropertyTypeDescriptor::ValueSource valueSource,
void *  owner 
)
protected
AbstractPropertyTypeDescriptor::ValueSourceEntry* kanzi::PropertyObject::getTopValueSourceEntry ( AbstractPropertyTypeDescriptor::PropertyStorage propertyStorage) const
protected
AbstractPropertyTypeDescriptor::ValueSourceEntry* kanzi::PropertyObject::getTopValueSourceEntry ( AbstractPropertyTypeDescriptor descriptor) const
protected
AbstractPropertyTypeDescriptor::ValueSource* kanzi::PropertyObject::getTopValueSource ( AbstractPropertyTypeDescriptor descriptor) const
protected
AbstractPropertyTypeDescriptor::ValueSource* kanzi::PropertyObject::getFinalValueSource ( AbstractPropertyTypeDescriptor descriptor) const
protected
AbstractPropertyTypeDescriptor::ValueSource* kanzi::PropertyObject::getNonClassValueSource ( AbstractPropertyTypeDescriptor descriptor) const
protected
AbstractPropertyTypeDescriptor::ValueSource* kanzi::PropertyObject::getClassValueSource ( AbstractPropertyTypeDescriptor descriptor) const
protected
AbstractPropertyTypeDescriptor::ValueSourceEntry* kanzi::PropertyObject::findLocalValueSourceEntry ( AbstractPropertyTypeDescriptor::PropertyStorage propertyStorage)
protected
AbstractPropertyTypeDescriptor::ValueSourceEntry* kanzi::PropertyObject::constructLocalValueSourceEntry ( AbstractPropertyTypeDescriptor descriptor,
AbstractPropertyTypeDescriptor::PropertyStorage propertyStorage 
)
protected
AbstractPropertyTypeDescriptor::ValueSourceEntry* kanzi::PropertyObject::acquireLocalValueSourceEntry ( AbstractPropertyTypeDescriptor descriptor,
PropertyStoragePtr propertyStorage 
)
protected
AbstractPropertyTypeDescriptor::PropertyStorage* kanzi::PropertyObject::findPropertyStorage ( AbstractPropertyTypeDescriptor descriptor) const
protected
PropertyStoragePtr kanzi::PropertyObject::findPropertyStoragePtr ( AbstractPropertyTypeDescriptor descriptor) const
protected

Gets property storage intrusive pointer that can be used to hold a reference until end of operation.

Parameters
descriptorDescriptor to look with.
Returns
Intrusive pointer to property storage.
PropertyStoragePtr kanzi::PropertyObject::constructPropertyStorage ( AbstractPropertyTypeDescriptor descriptor)
protected
PropertyStoragePtr kanzi::PropertyObject::acquirePropertyStorage ( AbstractPropertyTypeDescriptor descriptor)
protected
AbstractPropertyTypeDescriptor::ModifierStorage* kanzi::PropertyObject::acquireModifierStorage ( AbstractPropertyTypeDescriptor descriptor,
AbstractPropertyTypeDescriptor::PropertyStorage propertyStorage 
)
protected
AbstractPropertyTypeDescriptor::ModifierStorage* kanzi::PropertyObject::findModifierStorage ( AbstractPropertyTypeDescriptor descriptor)
protected
AbstractPropertyTypeDescriptor::NotificationStorage* kanzi::PropertyObject::acquireNotificationStorage ( AbstractPropertyTypeDescriptor descriptor)
protected
AbstractPropertyTypeDescriptor::NotificationStorage* kanzi::PropertyObject::findNotificationStorage ( AbstractPropertyTypeDescriptor descriptor)
protected
AbstractPropertyTypeDescriptor* kanzi::PropertyObject::findPropertyTypeDescriptorByUnqualifiedNameAndDataType ( string_view  unqualifiedName,
PropertyDataType  dataType 
)
protected
void kanzi::PropertyObject::validatePropertyModifiersAndNotifyHandlers ( PropertyStoragePtr propertyStorage)
protected
void kanzi::PropertyObject::copyLocalValue ( const AbstractPropertyTypeDescriptor::PropertyStorage otherPropertyStorage)
protected

Copy local value from property storage.

Parameters
propertyStorageProperty storage to copy from.
PropertyStorageContainer::iterator kanzi::PropertyObject::beginPropertyStorage ( )
inlineprotected
PropertyStorageContainer::iterator kanzi::PropertyObject::endPropertyStorage ( )
inlineprotected
virtual void kanzi::PropertyObject::notifyPropertyHandlers ( PropertyStoragePtr propertyStorage,
PropertyNotificationReason  reason 
)
protectedvirtual

Reimplemented in kanzi::Node.

void kanzi::PropertyObject::onCopy ( const PropertyObject other)
protected

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