|
xentara-workbench-plugin v1.0.1
The Xentara Workbench Plugin Framework
|
A generic element within a Xentara model. More...
#include <xentara/workbench/model/Element.hpp>
Public Member Functions | |
| virtual | ~Element ()=0 |
| Virtual destructor. | |
Access to the Properties | |
| auto | name () const noexcept -> utils::string::StringView |
| Gets the name of the element. | |
| auto | primaryKey () const -> std::string |
| Gets the primary key of the element. | |
| auto | uuid () const noexcept -> utils::core::Uuid |
| Gets the UUID of the element. | |
| auto | type () const -> ui::String |
| Gets the the user facing type name of the element. | |
| auto | category () const noexcept -> ElementCategory |
| Gets the element category of the element. | |
Access to Elements Members | |
| auto | attribute (std::string_view name) const -> utils::eh::expected< Attribute, ui::String > |
| Gets the attribute with a specific name. | |
| auto | attributes () const -> std::vector< Attribute > |
| Returns a list of all the element’s attributes. | |
| auto | event (std::string_view name, process::EventSearchOptions options={}) const -> utils::eh::expected< process::Event, ui::String > |
| Gets the event with a specific name. | |
| auto | events (process::EventSearchOptions options={}) const -> std::vector< process::Event > |
| Returns a list of all the element’s events. | |
| auto | task (std::string_view name) const -> utils::eh::expected< process::Task, ui::String > |
| Gets the task with a specific name. | |
| auto | tasks () const -> std::vector< process::Task > |
| Returns a list of all the element’s tasks. | |
Access to the Element Hierarchy | |
| auto | childElement (std::string_view name) const noexcept -> const Element * |
| Gets the child element with a specific name. | |
| auto | childElements () const noexcept -> ChildElementAccessor |
| Returns a list of all the element’s children. | |
| auto | parentElement () const noexcept -> const Element * |
| Returns the element’s parent. | |
Creating References | |
| auto | makeReference () const -> ElementReference |
| Creates a reference to this element. | |
| auto | makeAttributeReference (const Attribute &attribute) const -> AttributeReference |
| Creates a reference to one of this element’s attributes. | |
| auto | makeAttributeReference (std::string_view attributeName) const -> AttributeReference |
| Creates a reference to one of this element’s attributes. | |
| auto | makeEventReference (const process::Event &event, process::EventSearchOptions options={}) const -> process::EventReference |
| Creates a reference to one of this element’s events. | |
| auto | makeEventReference (std::string_view eventName, process::EventSearchOptions options={}) const -> process::EventReference |
| Creates a reference to one of this element’s events. | |
| auto | makeTaskReference (const process::Task &task) const -> process::TaskReference |
| Creates a reference to one of this element’s tasks. | |
| auto | makeTaskReference (std::string_view taskName) const -> process::TaskReference |
| Creates a reference to one of this element’s tasks. | |
Iterator Functions | |
| template<std::invocable< const Attribute & > Callback> | |
| auto | forEachAttribute (Callback &&callback) const -> bool |
| Iterates over all the element’s attributes. | |
| template<std::invocable< const process::Event & > Callback> | |
| auto | forEachEvent (Callback &&callback, process::EventSearchOptions options={}) const -> bool |
| Iterates over all the element’s events. | |
| template<std::invocable< const process::Task & > Callback> | |
| auto | forEachTask (Callback &&callback) const -> bool |
| Iterates over all the element’s tasks. | |
Validation functions for validating cross references | |
| auto | checkCategory (ElementCategories allowedCategories) const noexcept -> bool |
| Checks whether the element has one of a selection of categories. | |
| auto | isDataPoint () const noexcept -> bool |
| Checks whether the element is a data point. | |
| auto | isSkillDataPoint () const noexcept -> bool |
| Checks whether the element is a skill data point. | |
| auto | isA (const skill::Element::Class &elementClass) const noexcept -> bool |
| Checks whether the element has a certain class. | |
| auto | isInvisibleRoot () const noexcept -> bool |
| Checks whether the element is the invisible root element of the model. | |
| auto | findAncestor (const skill::Element::Class &elementClass) const noexcept -> const Element * |
| Finds the closest ancestor that has a certain class. | |
| auto | isDescendentOf (const Element &ancestor) const noexcept -> bool |
| Check whether the element is a descendent of another element. | |
A generic element within a Xentara model.
|
pure virtualdefault |
Virtual destructor.
| auto xentara::workbench::model::Element::attribute | ( | std::string_view | name | ) | const -> utils::eh::expected< Attribute, ui::String > |
Gets the attribute with a specific name.
| name | The name of the desired attribute, in UTF-8 encoding |
| auto xentara::workbench::model::Element::attributes | ( | ) | const -> std::vector< Attribute > |
Returns a list of all the element’s attributes.
|
noexcept |
Gets the element category of the element.
|
noexcept |
Checks whether the element has one of a selection of categories.
| allowedCategories | The categories that the element may have. |
|
noexcept |
Gets the child element with a specific name.
| name | The name of the desired child element, in UTF-8 encoding |
|
noexcept |
Returns a list of all the element’s children.
| auto xentara::workbench::model::Element::event | ( | std::string_view | name, |
| process::EventSearchOptions | options = {} |
||
| ) | const -> utils::eh::expected< process::Event, ui::String > |
Gets the event with a specific name.
Normally, this function only finds free-standing events. It does not find change events for attributes. To include change events for attributes in the search, set the [.includeChangeEvents](EventSearchOptions::includeChangeEvents) option in the options parameter.
| name | The name of the desired event, in UTF-8 encoding |
| options | The search options. |
| auto xentara::workbench::model::Element::events | ( | process::EventSearchOptions | options = {} | ) | const -> std::vector< process::Event > |
Returns a list of all the element’s events.
Normally, this function only returns free-standing events. It does not include change events for attributes. To include change events for attributes in the list, set the [.includeChangeEvents](EventSearchOptions::includeChangeEvents) option in the options parameter. as it eliminates the construction of the vector.
| options | The search options. |
|
noexcept |
Finds the closest ancestor that has a certain class.
| elementClass | The desired element class for the ancestor |
| auto xentara::workbench::model::Element::forEachAttribute | ( | Callback && | callback | ) | const -> bool |
Iterates over all the element’s attributes.
This function takes a callback that will be called once for each event the element supports, in no particular order. The callback will be passed the UUID and the name of the event, as well as a pointer to the event itself.
If the callback returns a value that can be converted to bool, then the return value is used to determine whether the iteration should be terminated early. If the callback returns a value that evaluates to true, then the iteration is stopped and the callback is not called again. If the return value evaluates to false, then iteration continues as normal.
| callback | The callback that should be called for each event. |
| auto xentara::workbench::model::Element::forEachEvent | ( | Callback && | callback, |
| process::EventSearchOptions | options = {} |
||
| ) | const -> bool |
Iterates over all the element’s events.
This function takes a callback that will be called once for each event the element supports, in no particular order. The callback will be passed the UUID and the name of the event, as well as a pointer to the event itself.
If the callback returns a value that can be converted to bool, then the return value is used to determine whether the iteration should be terminated early. If the callback returns a value that evaluates to true, then the iteration is stopped and the callback is not called again. If the return value evaluates to false, then iteration continues as normal.
Normally, this function only returns free-standing events. It does not include change events for attributes. To include change events for attributes in the list, set the [.includeChangeEvents](EventSearchOptions::includeChangeEvents) option in the options parameter.
Normally, this function only iterates over free-standing events. It does not include change events for attributes. To iterate over the change events for attributes as well, set the [.includeChangeEvents](EventSearchOptions::includeChangeEvents) option in the options parameter.
| callback | The callback that should be called for each event. |
| options | The search options. |
| auto xentara::workbench::model::Element::forEachTask | ( | Callback && | callback | ) | const -> bool |
Iterates over all the element’s tasks.
This function takes a callback that will be called once for each event the element supports, in no particular order. The callback will be passed the UUID and the name of the event, as well as a pointer to the event itself.
If the callback returns a value that can be converted to bool, then the return value is used to determine whether the iteration should be terminated early. If the callback returns a value that evaluates to true, then the iteration is stopped and the callback is not called again. If the return value evaluates to false, then iteration continues as normal.
| callback | The callback that should be called for each event. |
|
noexcept |
Checks whether the element has a certain class.
| elementClass | The desired element class |
|
noexcept |
Checks whether the element is a data point.
This function is shorthand for checkCategory(xentara::workbench::model::ElementCategory::DataPoint)
|
noexcept |
Check whether the element is a descendent of another element.
| ancestor | The ancestor to check |
|
noexcept |
Checks whether the element is the invisible root element of the model.
This function is shorthand for checkCategory(xentara::workbench::model::ElementCategory::DataPoint)
|
noexcept |
Checks whether the element is a skill data point.
| auto xentara::workbench::model::Element::makeAttributeReference | ( | const Attribute & | attribute | ) | const -> AttributeReference |
Creates a reference to one of this element’s attributes.
| attribute | The attribute. Existence of the attribute is not checked. |
| auto xentara::workbench::model::Element::makeAttributeReference | ( | std::string_view | attributeName | ) | const -> AttributeReference |
Creates a reference to one of this element’s attributes.
| attributeName | The name of the desired attribute, in UTF-8 encoding. The name is not checked for existence or validity. |
| auto xentara::workbench::model::Element::makeEventReference | ( | const process::Event & | event, |
| process::EventSearchOptions | options = {} |
||
| ) | const -> process::EventReference |
Creates a reference to one of this element’s events.
| event | The event. Existence of the event is not checked. |
| options | The search options to set in the reference. |
| auto xentara::workbench::model::Element::makeEventReference | ( | std::string_view | eventName, |
| process::EventSearchOptions | options = {} |
||
| ) | const -> process::EventReference |
Creates a reference to one of this element’s events.
| eventName | The name of the desired event, in UTF-8 encoding. The name is not checked for existence or validity. |
| options | The search options to set in the reference. |
| auto xentara::workbench::model::Element::makeReference | ( | ) | const -> ElementReference |
Creates a reference to this element.
| auto xentara::workbench::model::Element::makeTaskReference | ( | const process::Task & | task | ) | const -> process::TaskReference |
Creates a reference to one of this element’s tasks.
| task | The task. Existence of the task is not checked. |
| auto xentara::workbench::model::Element::makeTaskReference | ( | std::string_view | taskName | ) | const -> process::TaskReference |
Creates a reference to one of this element’s tasks.
| taskName | The name of the desired task, in UTF-8 encoding. The name is not checked for existence or validity. |
|
noexcept |
Gets the name of the element.
|
noexcept |
Returns the element’s parent.
| auto xentara::workbench::model::Element::primaryKey | ( | ) | const -> std::string |
Gets the primary key of the element.
| auto xentara::workbench::model::Element::task | ( | std::string_view | name | ) | const -> utils::eh::expected< process::Task, ui::String > |
Gets the task with a specific name.
| name | The name of the desired task, in UTF-8 encoding |
| auto xentara::workbench::model::Element::tasks | ( | ) | const -> std::vector< process::Task > |
Returns a list of all the element’s tasks.
| auto xentara::workbench::model::Element::type | ( | ) | const -> ui::String |
Gets the the user facing type name of the element.
|
noexcept |
Gets the UUID of the element.