#include <Magnum/Ui/DataLayer.h>
template<class T>
StorageQuery class new in Git master
DataLayer storage query
Returned from AbstractStorage implementations.
Base classes
- class AbstractStorageQuery new in Git master
- Base for DataLayer storage queries.
Constructors, destructors, conversion operators
-
template<class Storage>StorageQuery(const Storage& storage, StorageOperations operations, T(*)(const Storage&storage, StorageOperation operation) query, StorageUpdateState(*)(const Storage&storage, StorageOperation operation, const T*value) updater = nullptr)
- Create a query to a single-item storage.
-
template<class Storage>StorageQuery(const Storage& storage, std::
size_t index, StorageOperations operations, T(*)(const Storage&storage, std:: size_t index, StorageOperation operation) query, StorageUpdateState(*)(const Storage&storage, std:: size_t index, StorageOperation operation, const T*value) updater = nullptr) - Create a query to a 1D storage.
-
template<class Storage>StorageQuery(const Storage& storage, const Containers::
Size1D& index, StorageOperations operations, T(*)(const Storage&storage, const Containers:: Size1D&index, StorageOperation operation) query, StorageUpdateState(*)(const Storage&storage, const Containers:: Size1D&index, StorageOperation operation, const T*value) updater = nullptr) - Create a query to a 1D storage.
-
template<class Storage>StorageQuery(const Storage& storage, const Containers::
Size2D& index, StorageOperations operations, T(*)(const Storage&storage, const Containers:: Size2D&index, StorageOperation operation) query, StorageUpdateState(*)(const Storage&storage, const Containers:: Size2D&index, StorageOperation operation, const T*value) updater = nullptr) - Create a query to a 2D storage.
-
template<class Storage>StorageQuery(const Storage& storage, const Containers::
Size3D& index, StorageOperations operations, T(*)(const Storage&storage, const Containers:: Size3D&index, StorageOperation operation) query, StorageUpdateState(*)(const Storage&storage, const Containers:: Size3D&index, StorageOperation operation, const T*value) updater = nullptr) - Create a query to a 3D storage.
- operator T() const
- Storage value.
Public functions
-
auto onUpdate(Containers::
Function<void(const T&value)>&& function, NodeHandle node = NodeHandle:: Null) const -> DataHandle - Bind a function to storage data update.
-
auto onUpdate(Containers::
Function<void(T value)>&& function, NodeHandle node = NodeHandle:: Null) const -> DataHandle -
auto onUpdate(Containers::
Function<void(T value, T min, T max)>&& function, NodeHandle node = NodeHandle:: Null) const -> DataHandle - Bind a function to storage data update along with min/max values.
-
auto onUpdate(Containers::
Function<void(DataHandle handle, const T&value)>&& function, NodeHandle node = NodeHandle:: Null) const -> DataHandle - Bind a function to storage data update along with the data handle itself.
-
auto onUpdate(Containers::
Function<void(DataHandle handle, T value)>&& function, NodeHandle node = NodeHandle:: Null) const -> DataHandle - auto set(const T& value) const -> StorageUpdateState
- Update the storage value.
- auto min() const -> T
- Minimum allowed storage value.
- auto max() const -> T
- Maximum allowed storage value.
Function documentation
template<class T>
template<class Storage>
Magnum:: Ui:: StorageQuery<T>:: StorageQuery(const Storage& storage,
StorageOperations operations,
T(*)(const Storage&storage, StorageOperation operation) query,
StorageUpdateState(*)(const Storage&storage, StorageOperation operation, const T*value) updater = nullptr)
Create a query to a single-item storage.
| Parameters | |
|---|---|
| storage | Storage instance |
| operations | Operations supported by query and updater |
| query | Lambda to call on the storage to retrieve the desired value for given operation |
| updater | Lambda to call to update the storage value based on supplied operation and value or nullptr if the storage isn't mutable. |
Expects that storage is valid in the layer it's associated with and is single-item, i.e. with a size of {1, 1, 1}. The query and updater is expected to be a non-capturing lambda with given signature, not a function pointer.
The operations are expected to be set according to constraints specified in particular StorageOperation values. If operations contain StorageOperation::query should return a min / max allowed storage value, otherwise query is expected to return the currently stored value. If updater is not nullptr, operations are expected to be either empty or contain StorageOperation::updater return value should follow StorageUpdateState value documentation.
template<class T>
template<class Storage>
Magnum:: Ui:: StorageQuery<T>:: StorageQuery(const Storage& storage,
std:: size_t index,
StorageOperations operations,
T(*)(const Storage&storage, std:: size_t index, StorageOperation operation) query,
StorageUpdateState(*)(const Storage&storage, std:: size_t index, StorageOperation operation, const T*value) updater = nullptr)
Create a query to a 1D storage.
| Parameters | |
|---|---|
| storage | Storage instance |
| index | Value index to query |
| operations | Operations supported by query and updater |
| query | Lambda to call on the storage to retrieve the desired value for given operation |
| updater | Lambda to call to update the storage value based on supplied operation and value or nullptr if the storage isn't mutable. |
Expects that storage is valid in the layer it's associated with, is 1D, i.e. with a size of {1, 1, size}, and index is not larger than size. The query and updater is expected to be a non-capturing lambda with given signature, not a function pointer.
The operations are expected to be set according to constraints specified in particular StorageOperation values. If operations contain StorageOperation::query should return a min / max allowed storage value, otherwise query is expected to return the currently stored value. If updater is not nullptr, operations are expected to be either empty or contain StorageOperation::updater return value should follow StorageUpdateState value documentation.
template<class T>
template<class Storage>
Magnum:: Ui:: StorageQuery<T>:: StorageQuery(const Storage& storage,
const Containers:: Size1D& index,
StorageOperations operations,
T(*)(const Storage&storage, const Containers:: Size1D&index, StorageOperation operation) query,
StorageUpdateState(*)(const Storage&storage, const Containers:: Size1D&index, StorageOperation operation, const T*value) updater = nullptr)
Create a query to a 1D storage.
Same as StorageQuery(const Storage&, std::
template<class T>
template<class Storage>
Magnum:: Ui:: StorageQuery<T>:: StorageQuery(const Storage& storage,
const Containers:: Size2D& index,
StorageOperations operations,
T(*)(const Storage&storage, const Containers:: Size2D&index, StorageOperation operation) query,
StorageUpdateState(*)(const Storage&storage, const Containers:: Size2D&index, StorageOperation operation, const T*value) updater = nullptr)
Create a query to a 2D storage.
| Parameters | |
|---|---|
| storage | Storage instance |
| index | Value index to query |
| operations | Operations supported by query and updater |
| query | Lambda to call on the storage to retrieve the desired value for given operation |
| updater | Lambda to call to update the storage value based on supplied operation and value or nullptr if the storage isn't mutable. |
Expects that storage is valid in the layer it's associated with, is 2D, i.e. with a size of {1, size[0], size[1]}, and index is not larger than size. The query and updater is expected to be a non-capturing lambda with given signature, not a function pointer.
The operations are expected to be set according to constraints specified in particular StorageOperation values. If operations contain StorageOperation::query should return a min / max allowed storage value, otherwise query is expected to return the currently stored value. If updater is not nullptr, operations are expected to be either empty or contain StorageOperation::updater return value should follow StorageUpdateState value documentation.
template<class T>
template<class Storage>
Magnum:: Ui:: StorageQuery<T>:: StorageQuery(const Storage& storage,
const Containers:: Size3D& index,
StorageOperations operations,
T(*)(const Storage&storage, const Containers:: Size3D&index, StorageOperation operation) query,
StorageUpdateState(*)(const Storage&storage, const Containers:: Size3D&index, StorageOperation operation, const T*value) updater = nullptr)
Create a query to a 3D storage.
| Parameters | |
|---|---|
| storage | Storage instance |
| index | Value index to query |
| operations | Operations supported by query and updater |
| query | Lambda to call on the storage to retrieve the desired value for given operation |
| updater | Lambda to call to update the storage value based on supplied operation and value or nullptr if the storage isn't mutable. |
Expects that storage is valid in the layer it's associated with and index is not larger than storage size. The query and updater is expected to be a non-capturing lambda with given signature, not a function pointer.
The operations are expected to be set according to constraints specified in particular StorageOperation values. If operations contain StorageOperation::query should return a min / max allowed storage value, otherwise query is expected to return the currently stored value. If updater is not nullptr, operations are expected to be either empty or contain StorageOperation::updater return value should follow StorageUpdateState value documentation.
template<class T>
Magnum:: Ui:: StorageQuery<T>:: operator T() const
Storage value.
Returns value of given storage() at index(). Expects that storage() is still valid in the layer().
template<class T>
DataHandle Magnum:: Ui:: StorageQuery<T>:: onUpdate(Containers:: Function<void(const T&value)>&& function,
NodeHandle node = NodeHandle:: Null) const
Bind a function to storage data update.
| Parameters | |
|---|---|
| function | Function to call when data get updated |
| node | Node to attach to |
| Returns | New data handle |
Expects that storage() is still valid in the layer() and function is not nullptr. The function gets called with the result of query with AbstractUserInterface::storage is marked as dirty. The data is marked as dirty initially.
Delegates to AbstractLayer::
template<class T>
DataHandle Magnum:: Ui:: StorageQuery<T>:: onUpdate(Containers:: Function<void(T value)>&& function,
NodeHandle node = NodeHandle:: Null) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
DataHandle Magnum:: Ui:: StorageQuery<T>:: onUpdate(Containers:: Function<void(T value, T min, T max)>&& function,
NodeHandle node = NodeHandle:: Null) const
Bind a function to storage data update along with min/max values.
| Parameters | |
|---|---|
| function | Function to call when data get updated |
| node | Node to attach to |
| Returns | New data handle |
Expects that storage() is still valid in the layer(), StorageQuery::function is not nullptr. The function gets called with the result of query along with min and max values with AbstractUserInterface::storage is marked as dirty. The data is marked as dirty initially.
Delegates to AbstractLayer::
template<class T>
DataHandle Magnum:: Ui:: StorageQuery<T>:: onUpdate(Containers:: Function<void(DataHandle handle, const T&value)>&& function,
NodeHandle node = NodeHandle:: Null) const
Bind a function to storage data update along with the data handle itself.
| Parameters | |
|---|---|
| function | Function to call when data get updated |
| node | Node to attach to |
| Returns | New data handle |
Like onUpdate(Containers::handle is guaranteed to be valid in this layer. See documentation of onUpdate(Containers::
template<class T>
DataHandle Magnum:: Ui:: StorageQuery<T>:: onUpdate(Containers:: Function<void(DataHandle handle, T value)>&& function,
NodeHandle node = NodeHandle:: Null) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
StorageUpdateState Magnum:: Ui:: StorageQuery<T>:: set(const T& value) const
Update the storage value.
Expects that storage() is still valid in the layer() and operations() list StorageOperation::
Calling this function causes the storage to get marked as dirty and LayerState::
template<class T>
T Magnum:: Ui:: StorageQuery<T>:: min() const
Minimum allowed storage value.
Expects that storage() is still valid in the layer() and operations() list StorageOperation::
template<class T>
T Magnum:: Ui:: StorageQuery<T>:: max() const
Maximum allowed storage value.
Expects that storage() is still valid in the layer() and operations() list StorageOperation::