Kanzi Framework  3.9.0
Kanzi Engine API
kanzi::ActivityElementHistory Class Reference

Encapsulates serialized data for activity elements. More...

#include <kanzi/ui/node/concept/activity/activity_element_history.hpp>

Classes

struct  SerializedActivityProperty
 Encapsulates the serialized data for a property. More...
 

Public Types

typedef vector< SerializedActivityPropertySerializedActivityPropertyContainer
 Container of serialized of properties. More...
 

Public Member Functions

 ActivityElementHistory (string activityElementHistoryData)
 Constructor. More...
 
 ActivityElementHistory (Node &node, const vector< string > &childrenHistory)
 Constructor. More...
 
 ActivityElementHistory (string_view name, const SerializedActivityPropertyContainer &properties, const vector< string > &childrenHistory)
 Constructor. More...
 
string serialize () const
 Serializes the history to a byte buffer. More...
 

activityName The name of an Activity node.

Returns whether a property belongs to an Activity node, or not.

A property belongs to an Activity node if:

  • It is defined in any of the Kanzi Activity classes.
  • Or, it belongs to the s_activityPropertyNamespace namespace.
  • Or, the name of the property belongs to the namespace of a given Activity node object.
  • And, it is serializable.
    Parameters
    propertyThe property to check.
    Returns
    true if the property belongs to the given Activity node, otherwise false.
static constexpr const char * s_activityPropertyNamespace
 The namespace to which an Activity Property must belong. More...
 
const SerializedActivityPropertyContainergetProperties () const
 Accesses the serialized properties. More...
 
const vector< string > & getChildrenHistory () const
 Accesses the serialized children. More...
 
const string & getName () const
 Accesses the name of the element. More...
 
static bool isActivityProperty (AbstractPropertyType property, string_view activityName)
 
static vector< SerializedActivityPropertygetSerializedProperties (Node &node)
 Returns the properties and property values that an Activity serialized. More...
 
static string serializeActivityProperty (AbstractPropertyType property, string_view value)
 Serializes a single Activity property to a string. More...
 
static void deserializeActivityProperty (Node &node, const SerializedActivityProperty &property)
 Deserializes an activity property. More...
 
static optional< string > findPropertyValue (string_view propertyName, string_view serializedActivityElement)
 Returns a value for a property in the serialized history of an ActivityElement. More...
 
static bool extractVariantFromSerializedPropertyString (string_view value, PropertyDataType dataType, Variant &variant)
 Extracts property data from a serialized string into a Variant type. More...
 
static bool isPropertySkippedForUpdate (string_view name)
 Checks if property given with name does not trigger the update of Activity Browser Properties. More...
 

Detailed Description

Encapsulates serialized data for activity elements.

This is a helper class for activities and activity hosts.

Member Typedef Documentation

◆ SerializedActivityPropertyContainer

Constructor & Destructor Documentation

◆ ActivityElementHistory() [1/3]

kanzi::ActivityElementHistory::ActivityElementHistory ( string  activityElementHistoryData)
explicit

Constructor.

Constructs the history of a node and its child nodes from serialized data.

Parameters
activityElementHistoryDataSerialized data.

◆ ActivityElementHistory() [2/3]

kanzi::ActivityElementHistory::ActivityElementHistory ( Node node,
const vector< string > &  childrenHistory 
)
explicit

Constructor.

Constructs the history for a node and uses serialized data for its children.

Parameters
nodeThe node to extract history from.
childrenHistoryThe serialized history of the activity element's children.

◆ ActivityElementHistory() [3/3]

kanzi::ActivityElementHistory::ActivityElementHistory ( string_view  name,
const SerializedActivityPropertyContainer properties,
const vector< string > &  childrenHistory 
)
explicit

Constructor.

Constructs the history from a nodes name, its properties and serialized history of its children.

Parameters
nameThe name of the activity element.
propertiesThe properties of the activity element.
childrenHistoryThe serialized history of the activity element's children.

Member Function Documentation

◆ serialize()

string kanzi::ActivityElementHistory::serialize ( ) const

Serializes the history to a byte buffer.

Returns
The byte buffer with serialized data.

◆ isActivityProperty()

static bool kanzi::ActivityElementHistory::isActivityProperty ( AbstractPropertyType  property,
string_view  activityName 
)
static

◆ getSerializedProperties()

static vector<SerializedActivityProperty> kanzi::ActivityElementHistory::getSerializedProperties ( Node node)
static

Returns the properties and property values that an Activity serialized.

Parameters
nodeThe activity node to serialize.
Returns
Serialized activity properties.

◆ serializeActivityProperty()

static string kanzi::ActivityElementHistory::serializeActivityProperty ( AbstractPropertyType  property,
string_view  value 
)
static

Serializes a single Activity property to a string.

This serialized string is included in the serialized history of the ActivityElement.

Parameters
propertyThe property to serialize.
valueThe value of property to serialize.
Returns
A string containing the serialized Activity property.
Since
Kanzi 3.9.0

◆ deserializeActivityProperty()

static void kanzi::ActivityElementHistory::deserializeActivityProperty ( Node node,
const SerializedActivityProperty property 
)
static

Deserializes an activity property.

Parameters
nodeThe activity node.
propertyThe serialized property.

◆ getProperties()

const SerializedActivityPropertyContainer& kanzi::ActivityElementHistory::getProperties ( ) const

Accesses the serialized properties.

Returns
The serialized properties.

◆ getChildrenHistory()

const vector<string>& kanzi::ActivityElementHistory::getChildrenHistory ( ) const

Accesses the serialized children.

Returns
The serialized children.

◆ getName()

const string& kanzi::ActivityElementHistory::getName ( ) const

Accesses the name of the element.

Returns
The name of the element.

◆ findPropertyValue()

static optional<string> kanzi::ActivityElementHistory::findPropertyValue ( string_view  propertyName,
string_view  serializedActivityElement 
)
static

Returns a value for a property in the serialized history of an ActivityElement.

Parameters
propertyNameThe name of the property for which you requested the value.
serializedActivityElementString representation of a serialized ActivityElement.
Returns
If the property is in the serialized ActivityElement, value as a string of the requested property, otherwise nullopt.
Since
Kanzi 3.9.0

◆ extractVariantFromSerializedPropertyString()

static bool kanzi::ActivityElementHistory::extractVariantFromSerializedPropertyString ( string_view  value,
PropertyDataType  dataType,
Variant variant 
)
static

Extracts property data from a serialized string into a Variant type.

Parameters
valueThe serialized property data string.
dataTypeThe data type of the property to extract.
variantA reference to the extracted Variant.
Returns
If the function successfully parses the value, true, otherwise false.
Since
Kanzi 3.9.0

◆ isPropertySkippedForUpdate()

static bool kanzi::ActivityElementHistory::isPropertySkippedForUpdate ( string_view  name)
static

Checks if property given with name does not trigger the update of Activity Browser Properties.

Parameters
nameThe property name to check.
Returns
true if the property is not supposed to trigger the update of Activity Browser Properties, false otherwise.

Member Data Documentation

◆ s_activityPropertyNamespace

constexpr const char* kanzi::ActivityElementHistory::s_activityPropertyNamespace
static

The namespace to which an Activity Property must belong.

Since
Kanzi 3.9.0

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