xentara-workbench-plugin v1.0.1
The Xentara Workbench Plugin Framework
Loading...
Searching...
No Matches
xentara::workbench::skill::Element::Class Class Referenceabstract

Meta-Information about an element class. More...

#include <xentara/workbench/skill/Element.hpp>

+ Inheritance diagram for xentara::workbench::skill::Element::Class:

Public Types

using I18n = i18n::Context<"workbench::skill::Element::Class">
 The translation context that should be used for displayName()
 

Public Member Functions

virtual ~Class ()=0
 Virtual destructor.
 
virtual auto name () const -> std::string_view=0
 Gets the name of the element class.
 
virtual auto uuid () const -> utils::core::Uuid=0
 Gets the UUID of the element class.
 
virtual auto displayName () const -> ui::String=0
 Gets the user facing name of the class.
 
virtual auto menuText () const -> ui::String=0
 Gets the menu text used for the class.
 
virtual auto newElementName () const -> std::string_view=0
 Gets the name of newly created elements of this class.
 
virtual auto category () const -> model::ElementCategory=0
 Gets the element category.
 
virtual auto allowChildElement (const Class &elementClass) const -> bool
 Called by the framework to determine if it is allowed to create a child element.
 
virtual auto elementFactory () const -> const AbstractElementFactory &=0
 Returns a factory for creating new elements.
 

Detailed Description

Meta-Information about an element class.

Member Typedef Documentation

◆ I18n

using xentara::workbench::skill::Element::Class::I18n = i18n::Context<"workbench::skill::Element::Class">

The translation context that should be used for displayName()

Constructor & Destructor Documentation

◆ ~Class()

xentara::workbench::skill::Element::Class::~Class ( )
pure virtualdefault

Virtual destructor.

Member Function Documentation

◆ allowChildElement()

virtual auto xentara::workbench::skill::Element::Class::allowChildElement ( const Class elementClass) const -> bool
virtual

Called by the framework to determine if it is allowed to create a child element.

Default Implementation
The default implementation returns false, denoting that the element class does not support any child elements.
Parameters
elementClassThe class for the new element
Returns
Must return true if the element can be created, or false if the element class does not support child elements of the given class

Reimplemented in xentara::workbench::skill::Element::ConcreteClass< DerivedElement, kName, kUuid, DisplayName, MenuText, kNewElementName, kCategory >, and xentara::workbench::skill::PlaceholderElement< DerivedElement, kClassName, kUuid, DisplayName, MenuText, kNewElementName, kCategory, kIsIncomplete >::Class.

◆ category()

virtual auto xentara::workbench::skill::Element::Class::category ( ) const -> model::ElementCategory
pure virtual

◆ displayName()

virtual auto xentara::workbench::skill::Element::Class::displayName ( ) const -> ui::String
pure virtual

Gets the user facing name of the class.

The display name is a short description of the class used to identify it to end users. The display name should be a short, internationalized text like “Modbus TCP device” or “reflective memory segment”. You should use the helper type I18n to internationalize the display name.

Returns
The localized display name of the class.

Implemented in xentara::workbench::skill::Element::ConcreteClass< DerivedElement, kName, kUuid, DisplayName, MenuText, kNewElementName, kCategory >, and xentara::workbench::skill::PlaceholderElement< DerivedElement, kClassName, kUuid, DisplayName, MenuText, kNewElementName, kCategory, kIsIncomplete >::Class.

◆ elementFactory()

◆ menuText()

virtual auto xentara::workbench::skill::Element::Class::menuText ( ) const -> ui::String
pure virtual

Gets the menu text used for the class.

The menu text is the text under which the class appears in the “New Element” menu. The menu text should use title case, like “Modbus TCP Device” or “Reflective Memory Segment”.

If the element type can only be the child of one or more specific parents, then the menu text can be context sensitive. For example, since an S7 data block can only be a child of an S7 PLC, the menu text can simply be “Data Block”, rather that “S7 Data Block”.

Returns
The localized menu text for the class.

Implemented in xentara::workbench::skill::Element::ConcreteClass< DerivedElement, kName, kUuid, DisplayName, MenuText, kNewElementName, kCategory >, and xentara::workbench::skill::PlaceholderElement< DerivedElement, kClassName, kUuid, DisplayName, MenuText, kNewElementName, kCategory, kIsIncomplete >::Class.

◆ name()

◆ newElementName()

virtual auto xentara::workbench::skill::Element::Class::newElementName ( ) const -> std::string_view
pure virtual

Gets the name of newly created elements of this class.

The new element name should be in English, should title case, and should not be internationalized. The new element name should reflect what a user is likely to want to name the element, rather than the full element type. For example, an S/ PLC’s new element name should be “PLC” rather than “S7 PLC”, as it is unlikely that the user will want to include the PLC type in the name.

Returns
The default name for new elements, in UTF-8 encoding.

Implemented in xentara::workbench::skill::Element::ConcreteClass< DerivedElement, kName, kUuid, DisplayName, MenuText, kNewElementName, kCategory >, and xentara::workbench::skill::PlaceholderElement< DerivedElement, kClassName, kUuid, DisplayName, MenuText, kNewElementName, kCategory, kIsIncomplete >::Class.

◆ uuid()