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

MessageArguments is the base class for arguments passed in messages. More...

#include <kanzi/core.ui/message/message_arguments.hpp>

Inherited by kanzi::ActivityBrowserController::ForceTriggerMessageArguments, kanzi::ActivityBrowserController::NodeInfoTreeAvailableArguments, kanzi::ActivityConcept::ActivityBaseArguments, kanzi::ActivityConcept::ActivityConceptInternalArguments, kanzi::ActivityConcept::DeactivateInternalMessageArguments, kanzi::ActivityConcept::StartActivationInternalMessageArguments, kanzi::ActivityHostConcept::ActivationMessageArguments, kanzi::ActivityHostConcept::ActivityHostConceptInternalArguments, kanzi::ActivityHostConcept::RegisterActivityElementInternalMessageArguments, kanzi::ActivityHostConcept::UnregisterActivityElementInternalMessageArguments, kanzi::ButtonConcept::CanceledMessageArguments, kanzi::ButtonConcept::ClickedMessageArguments, kanzi::ButtonConcept::LongPressMessageArguments, kanzi::ButtonConcept::PointerEnteredMessageArguments, kanzi::ButtonConcept::PointerLeftMessageArguments, kanzi::ButtonConcept::PressedMessageArguments, kanzi::ButtonConcept::ToggledOffMessageArguments, kanzi::ButtonConcept::ToggledOnMessageArguments, kanzi::ButtonConcept::ToggleStateChangedMessageArguments, kanzi::Command::CommandMessageArguments, kanzi::ExclusiveActivityHostConcept::ImplicitActivityChangeRequestMessageArguments, kanzi::FocusManager::BringScopeToFrontMessageArguments, kanzi::FocusManager::MoveFocusMessageArguments, kanzi::FocusManager::PostFocusMessageArguments, kanzi::FocusManager::ScopeStateChangeMessageArguments, kanzi::FocusManager::SendScopeToBackMessageArguments, kanzi::InputManipulator::InputMessageArguments, kanzi::InputManipulator::KeyInputMessageArguments, kanzi::Keyboard::KeyStateChangedMessageArguments, kanzi::ListBoxConcept::ItemMessageArguments, kanzi::ListBoxConcept::ItemSelectedMessageArguments, kanzi::ListBoxScrollingConcept::ScrollMessageArguments, kanzi::NodeComponent::NodeComponentSourceMessageArguments, kanzi::NodeComponent::NodeComponentTargetMessageArguments, kanzi::Page::ActivatedMessageArguments, kanzi::Page::DeactivatedMessageArguments, kanzi::Page::NavigateMessageArguments, kanzi::Page::NavigationActivatedMessageArguments, kanzi::Page::NavigationDeactivatedMessageArguments, kanzi::Page::RegisterToNavigationMessageArguments, kanzi::Page::UnregisterFromNavigationMessageArguments, kanzi::PageHost::NavigationFinishedMessageArguments, kanzi::PageHost::NavigationStartedMessageArguments, kanzi::PrefabViewConcept::AsynchronousLoadCompletedMessageArguments, kanzi::PrefabViewConcept::LoadAsynchronouslyMessageArguments, kanzi::RangeConcept::CommonMessageArguments, kanzi::Screen::ActivateThemeMessageArguments, kanzi::ScrollViewConcept::ScrollDirectionMessageArguments, kanzi::ScrollViewConcept::ScrollDownMessageArguments, kanzi::ScrollViewConcept::ScrollEdgeMessageArguments, kanzi::ScrollViewConcept::ScrollEndMessageArguments, kanzi::ScrollViewConcept::ScrollHomeMessageArguments, kanzi::ScrollViewConcept::ScrollLeftMessageArguments, kanzi::ScrollViewConcept::ScrollMessageArguments, kanzi::ScrollViewConcept::ScrollPageDownMessageArguments, kanzi::ScrollViewConcept::ScrollPageMessageArguments, kanzi::ScrollViewConcept::ScrollPageUpMessageArguments, kanzi::ScrollViewConcept::ScrollRightMessageArguments, kanzi::ScrollViewConcept::ScrollUpMessageArguments, kanzi::ScrollViewConcept::SetScrollMessageArguments, kanzi::ScrollViewConcept::SetScrollTargetMessageArguments, kanzi::ScrollViewConcept::SnapRequestMessageArguments, kanzi::ScrollViewConcept::ZoomedMessageArguments, kanzi::StateManager::StateManagerMessageArguments, kanzi::TextBoxConcept::CursorPositionMessageArguments, kanzi::TextBoxConcept::DeleteSelectionMessageArguments, kanzi::TextBoxConcept::EditingStateChangedMessageArguments, kanzi::TextBoxConcept::EraseCharactersMessageArguments, kanzi::TextBoxConcept::InputMethodActionMessageArguments, kanzi::TextBoxConcept::InputMethodAvailableMessageArguments, kanzi::TextBoxConcept::ModifyEditingStateMessageArguments, kanzi::TextBoxConcept::ModifySelectionMessageArguments, kanzi::TextBoxConcept::MoveCursorMessageArguments, kanzi::TextBoxConcept::TextChangedMessageArguments, kanzi::TextBoxConcept::TextCompositionStateMessageArguments, kanzi::TextBoxConcept::TextContentMessageArguments, kanzi::TextBoxConcept::TextInsertionMessageArguments, kanzi::TextBoxConcept::TextRangeMessageArguments, kanzi::TextInputManipulator::CursorMovedMessageArguments, kanzi::TextInputManipulator::InputMethodActionMessageArguments, kanzi::TextInputManipulator::InputMethodAvailableChangedMessageArguments, kanzi::TextInputManipulator::InputMethodsDisconnectedMessageArguments, kanzi::TextInputManipulator::InputTypeChangedMessageArguments, kanzi::TextInputManipulator::ReadOnlyStateChangedMessageArguments, kanzi::TextInputManipulator::SelectionChangedMessageArguments, kanzi::TextInputManipulator::TextChangedMessageArguments, kanzi::TextInputManipulator::TextCompositionStateMessageArguments, and kanzi::ToggleButtonGroupConcept::ToggleButtonGroupConceptMessageArguments.

Classes

struct  ArgumentEntry
 Linked list entry containing arguments type and value. More...
 

Public Member Functions

bool getAbstractArgument (AbstractPropertyType argumentType, Variant &variant) const
 Returns the value of an argument using AbstractPropertyType. More...
 
template<typename TDataType >
TDataType getArgument (const PropertyType< TDataType > &argumentType) const
 Returns the value of an argument. More...
 
detail::MessageDispatcher * getDispatcher () const
 Returns the message dispatcher that dispatches a message. More...
 
template<typename TDataType >
optional< TDataType > getOptionalArgument (const PropertyType< TDataType > &argumentType) const
 Returns the value of an argument. More...
 
shared_ptr< NodegetSource () const
 Returns the source node for a message. More...
 
TimePoint getTimestamp () const
 Returns the timestamp of a message. More...
 
AbstractMessageType getType () const
 Returns the message type of these message arguments as an AbstractMessageType instance. More...
 
bool isFrom (const Node &source) const
 Returns whether a node is the source node of a message. More...
 
bool isHandled () const
 Returns whether the message is handled. More...
 
bool isValid () const
 Returns whether a message is valid. More...
 
 MessageArguments ()=default
 Constructor. More...
 
 MessageArguments (const MessageArguments &)=delete
 Deleted copy. More...
 
MessageArgumentsoperator= (const MessageArguments &)=delete
 Deleted assignment. More...
 
void setAbstractArgument (AbstractPropertyType argumentType, const Variant &variant)
 Sets the value of an argument using AbstractPropertyType. More...
 
template<typename TDataType >
void setArgument (const PropertyType< TDataType > &argumentType, typename PropertyType< TDataType >::DataType value)
 Sets the value of an argument. More...
 
void setDispatcher (detail::MessageDispatcher *dispatcher)
 Sets a dispatcher for a message. More...
 
void setHandled (bool handled)
 Sets the handling status for a message. More...
 
void setSource (Node *source)
 Sets the source node that dispatches a message. More...
 
void setTimestamp (TimePoint timestamp)
 Sets the timestamp of a message. More...
 
void setType (AbstractMessageType type)
 Sets the type of a message. More...
 
void setValid (bool valid)
 Sets the validity of a message. More...
 
 ~MessageArguments ()
 Destructor. More...
 

Static Public Member Functions

static size_t getArgumentAllocatorPoolSize ()
 Gets the current size of memory pool of argument entries. More...
 
static const MetaclassgetStaticMetaclass ()
 Initializes and returns static metadata of base MessageArguments class. More...
 
static PropertyTypeEditorInfoSharedPtr makeEditorInfo ()
 Initializes and returns the Kanzi Studio editor information. More...
 

Detailed Description

MessageArguments is the base class for arguments passed in messages.

An instance of MessageArguments together with an instance of MessageType forms a Kanzi message. In Kanzi when you dispatch a message, you dispatch a message of certain type and arguments.

While MessageArguments is a base class where you can inherit your own specialized arguments, MessageType is a templated class which takes message argument type as its template parameter. In practice this means that each MessageType is linked with a certain MessageArguments type. You can derive your own arguments class or use the MessageArguments base class. Note that MessageArguments as a base class carries only the basic message information, such as the timestamp and source of the message. To dispatch any other data with your messages, inherit your own message arguments class.

You can link a message type with only one type of message arguments, but you can use a certain type of message arguments with multiple message types. See MessageType.

See also
For examples on using Kanzi message arguments, message types and messages in general, see Node and MessageType.

Constructor & Destructor Documentation

◆ MessageArguments() [1/2]

kanzi::MessageArguments::MessageArguments ( )
explicitdefault

Constructor.

◆ ~MessageArguments()

kanzi::MessageArguments::~MessageArguments ( )

Destructor.

◆ MessageArguments() [2/2]

kanzi::MessageArguments::MessageArguments ( const MessageArguments )
delete

Deleted copy.

Member Function Documentation

◆ operator=()

MessageArguments& kanzi::MessageArguments::operator= ( const MessageArguments )
delete

Deleted assignment.

◆ getArgument()

template<typename TDataType >
TDataType kanzi::MessageArguments::getArgument ( const PropertyType< TDataType > &  argumentType) const
inline

Returns the value of an argument.

Parameters
argumentTypeThe PropertyType argument whose value to fetch.
Returns
The value of the argument. If the argument is not present in this message arguments instance, returns the default value of the PropertyType.

◆ getOptionalArgument()

template<typename TDataType >
optional<TDataType> kanzi::MessageArguments::getOptionalArgument ( const PropertyType< TDataType > &  argumentType) const
inline

Returns the value of an argument.

Parameters
argumentTypeThe PropertyType argument whose value to fetch.
Returns
The value of the argument. If the argument is not present in this message arguments instance, returns nullopt.

◆ getAbstractArgument()

bool kanzi::MessageArguments::getAbstractArgument ( AbstractPropertyType  argumentType,
Variant variant 
) const

Returns the value of an argument using AbstractPropertyType.

Parameters
argumentTypeThe AbstractPropertyType argument whose value to get.
variantThe variant where to store the message argument value.
Returns
If the argumentType is present in this message arguments instance, true, otherwise false.

◆ setArgument()

template<typename TDataType >
void kanzi::MessageArguments::setArgument ( const PropertyType< TDataType > &  argumentType,
typename PropertyType< TDataType >::DataType  value 
)
inline

Sets the value of an argument.

Parameters
argumentTypeThe PropertyType argument whose value to set.
valueThe value to set for the argument.

◆ setAbstractArgument()

void kanzi::MessageArguments::setAbstractArgument ( AbstractPropertyType  argumentType,
const Variant variant 
)

Sets the value of an argument using AbstractPropertyType.

Parameters
argumentTypeThe AbstractPropertyType argument whose value to set.
variantThe variant whose value to store to the message argument value.

◆ isFrom()

bool kanzi::MessageArguments::isFrom ( const Node source) const
inline

Returns whether a node is the source node of a message.

Parameters
sourceThe node to check.
Returns
If the passed node is the source of the message, true, otherwise false.

◆ getSource()

shared_ptr<Node> kanzi::MessageArguments::getSource ( ) const

Returns the source node for a message.

Returns
The source node where the message was dispatched.

◆ setHandled()

void kanzi::MessageArguments::setHandled ( bool  handled)
inline

Sets the handling status for a message.

Parameters
handledThe new handling status.

◆ isHandled()

bool kanzi::MessageArguments::isHandled ( ) const
inline

Returns whether the message is handled.

Returns
If the message is handled, true, otherwise false.

◆ getTimestamp()

TimePoint kanzi::MessageArguments::getTimestamp ( ) const
inline

Returns the timestamp of a message.

Returns
The timestamp of the message.

◆ getDispatcher()

detail::MessageDispatcher* kanzi::MessageArguments::getDispatcher ( ) const
inline

Returns the message dispatcher that dispatches a message.

Returns
The MessageDispatcher that dispatches the message.

◆ getType()

AbstractMessageType kanzi::MessageArguments::getType ( ) const
inline

Returns the message type of these message arguments as an AbstractMessageType instance.

Returns
The AbstractMessageType of these message arguments.

◆ setSource()

void kanzi::MessageArguments::setSource ( Node source)
inline

Sets the source node that dispatches a message.

Parameters
sourceThe source of the message.

◆ setTimestamp()

void kanzi::MessageArguments::setTimestamp ( TimePoint  timestamp)
inline

Sets the timestamp of a message.

Parameters
timestampThe timestamp of the message.

◆ setValid()

void kanzi::MessageArguments::setValid ( bool  valid)
inline

Sets the validity of a message.

Parameters
validThe validity of the message.

◆ isValid()

bool kanzi::MessageArguments::isValid ( ) const
inline

Returns whether a message is valid.

Returns
If the message is valid, returns true, otherwise false.

◆ setDispatcher()

void kanzi::MessageArguments::setDispatcher ( detail::MessageDispatcher *  dispatcher)
inline

Sets a dispatcher for a message.

Parameters
dispatcherMessage dispatcher that dispatches the message.

◆ setType()

void kanzi::MessageArguments::setType ( AbstractMessageType  type)
inline

Sets the type of a message.

Parameters
typeThe type of the message.

◆ getArgumentAllocatorPoolSize()

static size_t kanzi::MessageArguments::getArgumentAllocatorPoolSize ( )
static

Gets the current size of memory pool of argument entries.

◆ getStaticMetaclass()

static const Metaclass* kanzi::MessageArguments::getStaticMetaclass ( )
static

Initializes and returns static metadata of base MessageArguments class.

Returns
Metaclass object holding metadata of base MessageArguments class.

◆ makeEditorInfo()

static PropertyTypeEditorInfoSharedPtr kanzi::MessageArguments::makeEditorInfo ( )
inlinestatic

Initializes and returns the Kanzi Studio editor information.

Returns
Editor information for Kanzi Studio.

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