19template<
typename T,
typename S = std::
string>
51 void assign(std::initializer_list<value_type> list);
183 ssize_t _changing{0};
184 bool _hexadecimal{
false};
190#include <misc/gen/TTypedList.hpp>
Encapsulates the std::function() template.
Definition TClosure.h:14
Interface class for managing an indexed lists. Sends out events when about to change and when changed...
Definition TTypedList.h:21
void setHexadecimal(bool flag)
Enables integral types as hexadecimals in the string from toString() function.
void set(index_type index, const value_type &value)
Sets an entry value using the given index position.
void clear()
Clears the all items from the store.
virtual void beginChange()
Enables to track when the list of strings is changing. Can be overloaded when needed for change event...
void checkIndex(index_type index) const
Checks the validity of the passed index and when not valid throws an exception.
TClosure< void, void * > onChanged
Event callback function for when a change is done.
Definition TTypedList.h:158
bool isEqual(const TTypedList &other) const
Compares the other list with this one.
virtual void remove(index_type index, index_type sz)
Removes the item at the position given by the index argument. When the underlying list is static do n...
value_type get(index_type index) const
Gets the const entry reference from the given index position.
T value_type
Type of the stored values.
Definition TTypedList.h:24
TClosure< void, void * > onChanging
Event callback function for when a change is about to happen.
Definition TTypedList.h:154
bool operator!=(const TTypedList &other) const
Equal operator calling isEqual().
virtual ssize_t add(const value_type &value)
Adds an integer to the end of the list.
virtual void endChange()
Enables the to keep track of when the list has finished changing. Can be overloaded when needed for c...
S toString(const S &separator={}) const
Gets the values as a string separated by the given separator.
virtual index_type size() const =0
Gets the size of the underlying data store.
TTypedList()=default
Default constructor.
void fromString(const S &str, value_type def={}, const S &separator={})
Gets the values as a string separated by the given separator.
value_type operator[](index_type index) const
Const array operator calling get().
static constexpr index_type npos
Value for no index position.
Definition TTypedList.h:29
index_type indexOf(const value_type &value) const
Gets the found index of the given value in the list.
bool operator==(const TTypedList &other) const
Equal operator calling isEqual().
ssize_t index_type
Type of the indices used by this class.
Definition TTypedList.h:23
void assign(std::initializer_list< value_type > list)
Assigns a list of values to the list.
virtual void exchange(index_type from_index, index_type to_index)
Swap underling index positions.
virtual ~TTypedList()=default
Virtual destructor.
virtual void resize(index_type)
Resizes the underlying store. When the store is static do not override it.
void assign(const TTypedList &other)
Assign the values from the other typed list.
virtual value_type store(index_type index, const value_type *value=nullptr)=0
Handles Accesses the actual store.
Definition Application.h:10