![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Core/SubPropertyList.h>
The SubPropertyList class represents nested records of Configurable entities. More...
The SubPropertyList class represents nested records of Configurable entities.
It is very similar to SubProperty, with the addition that you can store multiple Configurable entities for which it also offers functionality to conveniently access them. The SubPropertyList class provides functions like the index operator, for easy access of the nested elements:
The nested objects are stored as multiple sub-properties inside the given Properties preserving the order and using the name of the SubPropertyList.
The signal signalValueChanged
is only emitted whenever the nested objects are changed using setValue(), configure(), or if one of their Configurable::signalParametersChanged was emitted.
Note: In contrast to SubProperty, SubPropertyList currently only supports T
being a regular value type implementing Configurable.
T | Underlying type of the parameter, must be default-constructible, copyable and implement the Configurable interface. |
Public Types | |
using | Iterator = typename std::vector<T>::iterator |
Public Member Functions | |
SubPropertyList (const std::string &name, const std::vector< T > &init, Configurable *parent=nullptr) | |
Creates a SubPropertyList that will be configured under the given name and with the given initial value. | |
SubPropertyList (const std::string &name, const std::vector< T > &init, Configurable &parent) | |
SubPropertyList (const SubPropertyList< T > &other) | |
SubPropertyList (SubPropertyList< T > &&other) noexcept | |
SubPropertyList< T > & | operator= (const SubPropertyList< T > &other) |
Assigns the value and attributes from another SubPropertyList instance of the same type and emits signalValueChanged. | |
SubPropertyList< T > & | operator= (SubPropertyList< T > &other) |
Assigns the value and attributes from another SubPropertyList instance of the same type and emits signalValueChanged. | |
SubPropertyList< T > & | operator= (SubPropertyList< T > &&other) noexcept |
Assigns the value and attributes from another SubPropertyList instance of the same type and emits signalValueChanged. | |
SubPropertyList< T > & | operator= (const std::vector< T > &value) |
Assign a new value to this SubPropertyList, emits signalValueChanged. | |
void | setValue (const std::vector< T > &value) |
Assign a new value to this SubPropertyList, emits signalValueChanged. | |
SubPropertyList< T > & | append (T &&value) |
Append a new value to this SubPropertyList, emits signalValueChanged. | |
void | erase (Iterator position) |
Erase an element from the SubPropertyList, emits signalValueChanged. | |
auto | begin () const noexcept |
auto | begin () noexcept |
auto | end () const noexcept |
auto | end () noexcept |
const auto & | operator[] (size_t pos) const |
auto & | operator[] (size_t pos) |
bool | empty () const |
size_t | size () const |
void | configure (const Properties *p) override |
Configure this parameter/sub property by de-serializing the given Properties. | |
void | configuration (Properties *p) const override |
Serialize the current parameter/sub property state into the given Properties object. | |
![]() | |
ParameterBase (const std::string &name) | |
const Configurable * | parent () const |
Return the parent Configurable instance that this parameter is registered with. | |
virtual const std::string & | name () const |
Returns parameter name, can only be set during construction. | |
void | setAttribute (const std::string &key, const std::string &value) |
Add the given attribute key-value pair to the set of parameter attributes. | |
void | removeAttribute (const std::string &key) |
Remove the attribute with the given key. | |
const std::map< std::string, std::string > & | attributes () const |
Get the attribute map. | |
void | setLabel (const std::string &label) |
Sets an optional label for the Parameter if displayed in the UI. | |
void | addDeprecatedName (const std::string &deprecatedName) |
Adds an optional alternative parameter name that should be used for param lookup for during configure() in case de-serialization from m_name was not successful. | |
const std::vector< std::string > & | deprecatedNames () const |
Returns the list of deprecated parameter names that should be used for param lookup (see addDeprecatedName()). | |
![]() | |
SignalReceiver ()=default | |
Default constructor. | |
SignalReceiver (const SignalReceiver &other) | |
Copy constructor, does not copy any existing signal connections from other. | |
SignalReceiver & | operator= (SignalReceiver rhs) |
Assignment operator, disconnects all existing connections, does not copy any existing signal connections from rhs. | |
virtual | ~SignalReceiver () |
Virtual destructor disconnects from all connected signals. | |
Protected Attributes | |
std::vector< T > | m_value |
![]() | |
Configurable * | m_parent = nullptr |
const std::string | m_name |
std::vector< std::string > | m_deprecatedNames |
std::map< std::string, std::string > | m_attributes |
Additional Inherited Members | |
![]() | |
Signal | signalValueChanged |
Signal gets emitted when the underlying value of the Parameter/SubProperty has changed (either through setValue() or configure()). | |
![]() | |
void | setParentFromCopy (const ParameterBase &other) |
Helper function to be called from a copy/move ctor in order to correctly set the parent relation ship to the new parent Configurable. | |
![]() | |
void | disconnectAll () |
Disconnects all existing connections. | |
SubPropertyList | ( | const std::string & | name, |
const std::vector< T > & | init, | ||
Configurable * | parent = nullptr ) |
Creates a SubPropertyList that will be configured under the given name and with the given initial value.
If parent != nullptr creates a SubPropertyList that is directly registered to the parent Configurable instance. The parent instance is stored and thus must have a lifetime longer than this object.
SubPropertyList< T > & operator= | ( | const SubPropertyList< T > & | other | ) |
Assigns the value and attributes from another SubPropertyList instance of the same type and emits signalValueChanged.
Expects name and deprecated names to be the same and will not change the parent relationship.
SubPropertyList< T > & operator= | ( | SubPropertyList< T > & | other | ) |
Assigns the value and attributes from another SubPropertyList instance of the same type and emits signalValueChanged.
Expects name and deprecated names to be the same and will not change the parent relationship.
|
noexcept |
Assigns the value and attributes from another SubPropertyList instance of the same type and emits signalValueChanged.
Expects name and deprecated names to be the same and will not change the parent relationship.
|
overridevirtual |
Configure this parameter/sub property by de-serializing the given Properties.
The behavior of configure() is as follows:
p
, i.e. delete all elements of the payload and append default-constructed T
if there are sub-properties present in p
. Therefore, T
must be default-constructible.p
. Thus, the order of the sub-properties is preserved. Implements ParameterBase.
|
overridevirtual |
Serialize the current parameter/sub property state into the given Properties object.
Implements ParameterBase.