xentara-plugin v2.0.4
The Xentara Plugin Framework
|
A function object used to iterate over all the attributes of an element. More...
#include <xentara/model/ForEachAttributeFunction.hpp>
Public Types | |
using | result_type = bool |
The result type. | |
Public Member Functions | |
template<std::invocable< const std::shared_ptr< const model::Attribute > & > Callable> | |
ForEachAttributeFunction (Callable &&callable) | |
Constructor that sets the callable to be called. | |
auto | operator() (const std::shared_ptr< const model::Attribute > &attribute) const -> bool |
Function call operator. | |
auto | operator() (const model::Attribute &attribute) const -> bool |
Function call operator for an attribute that is not tied to a specific element. | |
A function object used to iterate over all the attributes of an element.
The result type.
xentara::model::ForEachAttributeFunction::ForEachAttributeFunction | ( | Callable && | callable | ) |
Constructor that sets the callable to be called.
callable | The callable to be called for each attribute. The return type must be bool, and must evaluate to true to stop iterating over the attributes, or to false to continue iterating. |
auto xentara::model::ForEachAttributeFunction::operator() | ( | const model::Attribute & | attribute | ) | const -> bool |
Function call operator for an attribute that is not tied to a specific element.
This is a convenience overload that allows you to call the function using an attribute that is not actually a shared object, and is of no risk of disappearing while being used by another element.
The most common use for this overload is for attributes having static storage duration, meaning that it is either:
You can also use this overload if the attribute variable is a member of the skill object, or of any other object that never gets destroyed until Xentara shuts down. Basically, this function can be used for any attribute that is guaranteed to outlive all Xentara elements in the model.
attribute | The attribute. |
auto xentara::model::ForEachAttributeFunction::operator() | ( | const std::shared_ptr< const model::Attribute > & | attribute | ) | const -> bool |
Function call operator.
attribute | The attribute. |