|
xentara-workbench-plugin v1.0.1
The Xentara Workbench Plugin Framework
|
Base class for objects that contain properties, directly or indirectly. More...
#include <xentara/workbench/bindings/PropertyContainer.hpp>
Inheritance diagram for xentara::workbench::bindings::PropertyContainer:Classes | |
| class | ErrorCountSubscription |
| struct | ForEachCrossReferenceOptions |
| Options for forEachCrossReference() More... | |
| struct | SetEnclosingPropertyContainerOptions |
| Options for setEnclosingPropertyContainer() and resetEnclosingPropertyContainer() More... | |
| struct | SubPropertyContainerListChangedOptions |
| Options for subPropertyContainerListChanged() and related functions. More... | |
Public Member Functions | |
| PropertyContainer () noexcept=default | |
| Default constructor. | |
| PropertyContainer (const PropertyContainer &other) | |
| Copy constructor. | |
| PropertyContainer (PropertyContainer &&other) noexcept | |
| Move constructor. | |
| auto | operator= (const PropertyContainer &rhs) -> PropertyContainer & |
| Copy assignment operator. | |
| auto | operator= (PropertyContainer &&rhs) noexcept -> PropertyContainer & |
| Move assignment operator that does not actually assign anything. | |
| virtual | ~PropertyContainer ()=0 |
| Virtual destructor. | |
| auto | setEnclosingPropertyContainer (PropertyContainer &enclosingContainer, SetEnclosingPropertyContainerOptions options={}) -> void |
| Sets the enclosing container. | |
| auto | resetEnclosingPropertyContainer (SetEnclosingPropertyContainerOptions options={}) -> void |
| Resets the enclosing container. | |
| auto | enclosingPropertyContainer () const -> PropertyContainer * |
| Gets the enclosing container. | |
| auto | propertyErrorCount () const -> std::size_t |
| Gets the number of error properties, including those of sub containers. | |
| template<std::invocable Callback> | |
| auto | subscribeToPropertyErrorCount (Callback &&callback) -> ErrorCountSubscription |
| Subscribes to a property. | |
| auto | forEachCrossReference (const ForEachCrossReferenceFunction &function, ForEachCrossReferenceOptions options={}) noexcept -> void |
| Calls a function for each cross reference contained within the container. | |
Protected Member Functions | |
| auto | subPropertyContainerAdded (const PropertyContainer &container) -> void |
| Must be called by derived classes if a sub container was added. | |
| auto | subPropertyContainerRemoved (const PropertyContainer &container) -> void |
| Must be called by derived classes if a sub container was removed. | |
| auto | subPropertyContainerListChanged (SubPropertyContainerListChangedOptions options={}) -> void |
| Must be called by derived classes if the list of sub containers changed completely. | |
| auto | subPropertyContainerListCopied (const PropertyContainer &other, SubPropertyContainerListChangedOptions options={}) -> void |
| Must be called by derived classes if the list of sub containers was copied from another container. | |
| auto | subPropertyContainerListMoved (PropertyContainer &other, SubPropertyContainerListChangedOptions options={}) -> void |
| Must be called by derived classes if the list of sub containers was moved from another container. | |
| auto | subPropertyContainerListSwapped (PropertyContainer &other, SubPropertyContainerListChangedOptions options={}) -> void |
| Must be called by derived classes if the list of sub containers was swapped with another container. | |
| auto | localPropertyErrorCountChanged () -> void |
| Must be called by derived classes if the value returned by localPropertyErrorCount() has changed. | |
| auto | raisePropertyNotification (const PropertyId &propertyId) const -> void |
| Passes a property notification to the enclosing container. | |
Private Member Functions | |
| virtual auto | propertyErrorCountChanged () -> void |
| Called by the framework if the property error count changed. | |
| virtual auto | forEachSubPropertyContainer (const ForEachSubPropertyContainerFunction &function, bool includeInvisible) noexcept -> void=0 |
| Called by the framework to iterate over all the sub containers. | |
| virtual auto | forEachLocalCrossReference (const ForEachCrossReferenceFunction &function, bool includeInvisible) noexcept -> void=0 |
| Called by the framework to iterate over all the sub containers. | |
| virtual auto | localPropertyErrorCount () const -> std::size_t=0 |
| Called by the framework to get the number of error properties of this container, excluding those of sub containers. | |
| virtual auto | propertyNotificationRaised (const PropertyId &propertyId) -> void=0 |
| Called by the framework if a sub container raised a property notification. | |
Base class for objects that contain properties, directly or indirectly.
Property containers form a hierarchy, where an enclosing containers can contain one or more sub containers. This is used to enclose [sub elements](skill::SubElement] in their parent elements, for example.
|
defaultnoexcept |
Default constructor.
| xentara::workbench::bindings::PropertyContainer::PropertyContainer | ( | const PropertyContainer & | other | ) |
Copy constructor.
This constructor does not copy the reference to the enclosing container. The new container will not have an enclosing container.
Since this constructor does not know how to copy the list of sub containers, the new container will not have any sub containers. If a derived implementation copies the sub containers, it must correctly set their enclosing containers to this container, and then call subPropertyContainerListCopied().
| other | The container that is to be copied |
|
noexcept |
Move constructor.
This constructor does not move the reference to the enclosing container. The new container will not have an enclosing container.
Since this constructor does not know how to move the list of sub containers, the new container will not have any sub containers. If a derived implementation moves the sub containers, it must correctly set their enclosing containers to this container, and then call subPropertyContainerListMoved().
Please note that subPropertyContainerListMoved() is not noexcept, and thus a derived implementation that calls that function cannot be noexcept either. subPropertyContainerListMoved() cannot be noexcept because it may have to call callbacks that may raise exceptions.
| other | The container that is to be moved |
|
pure virtualdefault |
Virtual destructor.
| auto xentara::workbench::bindings::PropertyContainer::enclosingPropertyContainer | ( | ) | const -> PropertyContainer * |
Gets the enclosing container.
|
noexcept |
Calls a function for each cross reference contained within the container.
|
privatepure virtualnoexcept |
Called by the framework to iterate over all the sub containers.
| function | A function that must be called for each sub container. |
| includeInvisible | Whether to include invisible cross references. |
Implemented in xentara::workbench::skill::SubElementVector< Element, Allocator >, and xentara::workbench::bindings::PropertyController.
|
privatepure virtualnoexcept |
Called by the framework to iterate over all the sub containers.
| function | A function that must be called for each sub container. |
| includeInvisible | Whether to include invisible containers. |
Implemented in xentara::workbench::skill::SubElementVector< Element, Allocator >, and xentara::workbench::bindings::PropertyController.
|
privatepure virtual |
Called by the framework to get the number of error properties of this container, excluding those of sub containers.
Implemented in xentara::workbench::bindings::PropertyController, and xentara::workbench::skill::SubElementVector< Element, Allocator >.
|
protected |
Must be called by derived classes if the value returned by localPropertyErrorCount() has changed.
This function will automatically notify any enclosing containers, and also cause the propertyErrorCountChanged() callback to be called.
| auto xentara::workbench::bindings::PropertyContainer::operator= | ( | const PropertyContainer & | rhs | ) | -> PropertyContainer & |
Copy assignment operator.
This assignment operator does not change the reference to the enclosing container.
Since this assignment operator does not know how to copy the list of sub containers, the sub containers will not be modified. If a derived implementation copies the sub containers, it must correctly set their enclosing containers to this container, and then call subPropertyContainerListCopied().
| rhs | The container that is to be copied |
|
noexcept |
Move assignment operator that does not actually assign anything.
This assignment operator does not change the reference to the enclosing container.
Since this assignment operator does not know how to move the list of sub containers, the sub containers will not be modified. If a derived implementation moves the sub containers, it must correctly set their enclosing containers to this container, and then call subPropertyContainerListMoved().
Please note that subPropertyContainerListMoved() is not noexcept, and thus a derived implementation that calls that function cannot be noexcept either. subPropertyContainerListMoved() cannot be noexcept because it may have to call callbacks that may raise exceptions.
| rhs | The container that is to be moved |
| auto xentara::workbench::bindings::PropertyContainer::propertyErrorCount | ( | ) | const -> std::size_t |
Gets the number of error properties, including those of sub containers.
|
privatevirtual |
Called by the framework if the property error count changed.
This function is a lightweight way for a property container to react to react to changes in the property error count. It is equivalent to subscribing to the property error count using subscribeToPropertyErrorCount().
|
privatepure virtual |
Called by the framework if a sub container raised a property notification.
propertyId The ID of the property that was raised.
Implemented in xentara::workbench::skill::SubElementVector< Element, Allocator >, and xentara::workbench::bindings::PropertyController.
|
protected |
Passes a property notification to the enclosing container.
| propertyId | The ID of the property to raise. This ID should normally be name-based property ID created using the literal operator operator""_propertyId(), rather than an address-based property ID, so that it is independent of any property controller. |
| auto xentara::workbench::bindings::PropertyContainer::resetEnclosingPropertyContainer | ( | SetEnclosingPropertyContainerOptions | options = {} | ) | -> void |
Resets the enclosing container.
| options | Options for suppressing notifications. |
| auto xentara::workbench::bindings::PropertyContainer::setEnclosingPropertyContainer | ( | PropertyContainer & | enclosingContainer, |
| SetEnclosingPropertyContainerOptions | options = {} |
||
| ) | -> void |
Sets the enclosing container.
| enclosingContainer | The new enclosing container. |
| options | Options for suppressing notifications. |
|
protected |
Must be called by derived classes if a sub container was added.
|
protected |
Must be called by derived classes if the list of sub containers changed completely.
|
protected |
Must be called by derived classes if the list of sub containers was copied from another container.
This function is mainly intended to be called from copy constructors and copy assignment operators after the sub containers have been copied and properly initialized.
This function guards against self-assignment, so passing *this as this parameter is safe, and will result in a no-op.
The container from which the sub containers have been copied. It is safe to pass *this as this parameter.
|
protected |
Must be called by derived classes if the list of sub containers was moved from another container.
This function is mainly intended to be called from move constructors and move assignment operators after the sub containers have been moved and properly updated.
This function guards against self-assignment, so passing *this as this parameter is safe, and will result in a no-op.
The container from which the sub containers have been moved. It is safe to pass *this as this parameter.
|
protected |
Must be called by derived classes if the list of sub containers was swapped with another container.
This function is mainly intended to be called from swap functions after the sub containers have been swapped and properly updated.
This function guards against self-assignment, so passing *this as this parameter is safe, and will result in a no-op.
The container from which the sub containers have been moved. It is safe to pass *this as this parameter.
|
protected |
Must be called by derived classes if a sub container was removed.
| auto xentara::workbench::bindings::PropertyContainer::subscribeToPropertyErrorCount | ( | Callback && | callback | ) | -> ErrorCountSubscription |
Subscribes to a property.
| callback | A callback that will be called whenever the peroperty error count changed. |