Kanzi 3.9.10
kanzi::AbstractPropertyType Class Reference

AbstractPropertyType is a homogeneous property type handle to an existing property type. More...

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

Public Member Functions

 AbstractPropertyType ()
 Constructor.
 
 AbstractPropertyType (AbstractPropertyTypeDescriptor *descriptor)
 Constructor.
 
 AbstractPropertyType (string_view name)
 Constructor.
 
AbstractPropertyTypeDescriptorget () const
 
uint32_t getChangeFlags () const
 Gets the change flags for a property type.
 
PropertyDataType getDataType () const
 Gets the data type of a property type.
 
PropertyTypeEditorInfoSharedPtr getEditorInfo () const
 Gets the editor information of a property type.
 
const chargetName () const
 Gets the fully qualified name of a property type in the form "Class.PropertyType".
 
const chargetUnqualifiedName () const
 Gets the unqualified name of a property type in the form "PropertyType".
 
bool isInherited () const
 Returns whether a property type is inheritable.
 
 operator bool_type () const
 

Friends

bool operator!= (const AbstractPropertyType &left, const AbstractPropertyType &right)
 
bool operator< (const AbstractPropertyType &left, const AbstractPropertyType &right)
 
bool operator== (const AbstractPropertyType &left, const AbstractPropertyType &right)
 
bool operator> (const AbstractPropertyType &left, const AbstractPropertyType &right)
 

Detailed Description

AbstractPropertyType is a homogeneous property type handle to an existing property type.

You can use AbstractPropertyType to operate on property types when a property type and its data type are unknown or irrelevant. It is usually more convenient to pass AbstractPropertyType as a function argument instead of specifying the exact property type with certain data type. Both PropertyType and DynamicPropertyType have a converting operators to AbstractPropertyType. This enables you to pass these types directly to functions taking AbstractPropertyType argument.

You can query generic non-data type specific property type information from an instance of an AbstractPropertyType. To set or get property values with corresponding data type, you must construct a DynamicPropertyType.

To learn how to create a Kanzi property type, see PropertyType.

Examples

To construct an AbstractPropertyType with a fully qualified property type name:

// Use the fully qualified name to create an AbstractPropertyType object, which you can
// use to refer to an existing property type in the Kanzi property system.
// To see the fully qualified name for a property type in Kanzi Studio, in the Properties
// window hover over the name of that property type.
AbstractPropertyType propertyType("FontStyleConcept.Size");

To compare an AbstractPropertyType to an existing property type:

// You can compare an AbstractPropertyType object to PropertyType objects to find out
// about the property type that the AbstractPropertyType refers to.
//
// In this example, the propertyType argument tells which property changed and the
// PropertyType object is used to query the new value for the property.
void onPropertyChangedExample(const AbstractPropertyType& propertyType)
{
if (propertyType == Node::NameProperty)
{
string newName = getProperty(Node::NameProperty);
// ...
}
else if(propertyType == Node::VisibleProperty)
{
bool visible = getProperty(Node::VisibleProperty);
if(visible)
{
// ...
}
}
}

To construct a DynamicPropertyType from an AbstractPropertyType after resolving data type:

// It is typical to pass an AbstractPropertyType as a function argument without needing to know the exact
// data type that the passed property type represents. Inside the function you can find out about the data type and
// decide what to do with the property type.
//
// In this example we construct DynamicPropertyType object and use it to write the property value.
void resolveDataTypeAndConstructDynamicExample(const AbstractPropertyType& propertyType)
{
// Get data type for the property type.
PropertyDataType dataType = propertyType.getDataType();
if (dataType == PropertyDataTypeFloat)
{
DynamicPropertyType<float> floatProperty(propertyType);
setProperty(floatProperty, newValue);
}
}

Constructor & Destructor Documentation

◆ AbstractPropertyType() [1/3]

kanzi::AbstractPropertyType::AbstractPropertyType ( )
inlineexplicit

Constructor.

Creates an empty AbstractPropertyType instance.

◆ AbstractPropertyType() [2/3]

kanzi::AbstractPropertyType::AbstractPropertyType ( string_view name)
inlineexplicit

Constructor.

Creates an AbstractPropertyType instance referring to the existing property type with the given name. If a property type with the given name does not already exist in the Kanzi property system, the created AbstractPropertyType instance is empty.

Parameters
nameFully qualified name of a property type.

◆ AbstractPropertyType() [3/3]

kanzi::AbstractPropertyType::AbstractPropertyType ( AbstractPropertyTypeDescriptor * descriptor)
inlineexplicit

Constructor.

Used internally by the Kanzi property system.

Parameters
descriptorAbstract property type descriptor.

Member Function Documentation

◆ operator bool_type()

kanzi::AbstractPropertyType::operator bool_type ( ) const
inline

◆ get()

AbstractPropertyTypeDescriptor * kanzi::AbstractPropertyType::get ( ) const
inline

◆ getName()

const char * kanzi::AbstractPropertyType::getName ( ) const
inline

Gets the fully qualified name of a property type in the form "Class.PropertyType".

Returns
The fully qualified name of a property type.
See also
getUnqualifiedName()

◆ getUnqualifiedName()

const char * kanzi::AbstractPropertyType::getUnqualifiedName ( ) const
inline

Gets the unqualified name of a property type in the form "PropertyType".

Returns
The unqualified name of a property type.
See also
getName()

◆ getDataType()

PropertyDataType kanzi::AbstractPropertyType::getDataType ( ) const
inline

Gets the data type of a property type.

The data type of a property type defines the data representation type of each property value. For example, float.

Returns
The data type of a property type.

◆ isInherited()

bool kanzi::AbstractPropertyType::isInherited ( ) const
inline

Returns whether a property type is inheritable.

Inheritable property types provide values to all descendant nodes.

Returns
If the property type is inheritable, true, otherwise false.

◆ getChangeFlags()

uint32_t kanzi::AbstractPropertyType::getChangeFlags ( ) const
inline

Gets the change flags for a property type.

Change flags indicate whether a modification of property value invalidates a particular aspect of a node. For example, when you change the Node::HeightProperty or Node::WidthProperty in a node Kanzi recalculates the layout.

Returns
The change flags for a property type.

◆ getEditorInfo()

PropertyTypeEditorInfoSharedPtr kanzi::AbstractPropertyType::getEditorInfo ( ) const
inline

Gets the editor information of a property type.

Returns
The editor information of a property type.

Friends And Related Symbol Documentation

◆ operator==

◆ operator!=

◆ operator<

◆ operator>


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