![]() |
Scanframe Modular Application 0.1.0
|
String list with optional object association and sorting. More...
#include <TStringList.h>
Public Member Functions | |
| TStringList () | |
| Constructs a list not allowing duplicates by default. | |
| TStringList (bool duplicates, bool sorted) | |
| Constructs a list configuring duplicate behavior and sorting. | |
| ~TStringList () | |
| Destroys the string list and releases resources. | |
| ssize_t | add (const S &text, O *object=nullptr) |
| Adds a string to the list. | |
| ssize_t | addAt (ssize_t index, const S &text, O *object=nullptr) |
| Inserts a string at the given index but when sorting it is calling add() instead. | |
| void | clear () |
| Clears all items from the list. | |
| void | removeAt (ssize_t index) |
| Deletes the item at the given index. | |
| void | exchange (ssize_t i, ssize_t j) |
| Exchanges two items. | |
| ssize_t | indexOf (const S &text) const |
| Returns the index of the string. | |
| void | setSorted (bool flag=true) |
| Sorts the list and sets a flag so the new entries are sorted as well. | |
| bool | isSorted () const |
| Whether the list is sorted. | |
| ssize_t | count () const |
| Returns the number of items. | |
| const S & | at (ssize_t index) const |
| Returns the string at index. | |
| void | setObject (ssize_t index, O *obj) |
| Sets the object at index. | |
| O * | objectAt (ssize_t index) const |
| Gets the associated object at index. | |
| void | beginChange () |
| Prevents calling onChanging and onChanged when modifying. Call this before updating or adding multiple items. | |
| void | endChange () |
| Prevents calling onChanging and onChanged when modifying. Call this after updating or adding multiple items. | |
Public Attributes | |
| std::function< void(void *)> | onChanged |
| Event handler when the list has changed. | |
| std::function< void(void *)> | onChanging |
| Event handler before the list changes. | |
String list with optional object association and sorting.
| sf::TStringList< S, O >::TStringList | ( | ) |
Constructs a list not allowing duplicates by default.
| sf::TStringList< S, O >::TStringList | ( | bool | duplicates, |
| bool | sorted | ||
| ) |
Constructs a list configuring duplicate behavior and sorting.
| sf::TStringList< S, O >::~TStringList | ( | ) |
Destroys the string list and releases resources.
| ssize_t sf::TStringList< S, O >::add | ( | const S & | text, |
| O * | object = nullptr |
||
| ) |
Adds a string to the list.
| text | The string to add. |
| object | Optional pointer to the object. |
| ssize_t sf::TStringList< S, O >::addAt | ( | ssize_t | index, |
| const S & | text, | ||
| O * | object = nullptr |
||
| ) |
Inserts a string at the given index but when sorting it is calling add() instead.
| index | Position to insert into the list. |
| text | The string to insert. |
| object | Optional pointer to the object. |
| const S & sf::TStringList< S, O >::at | ( | ssize_t | index | ) | const |
Returns the string at index.
| index | Index of the item. |
| void sf::TStringList< S, O >::beginChange | ( | ) |
Prevents calling onChanging and onChanged when modifying. Call this before updating or adding multiple items.
| void sf::TStringList< S, O >::clear | ( | ) |
Clears all items from the list.
| ssize_t sf::TStringList< S, O >::count | ( | ) | const |
Returns the number of items.
| void sf::TStringList< S, O >::endChange | ( | ) |
Prevents calling onChanging and onChanged when modifying. Call this after updating or adding multiple items.
| void sf::TStringList< S, O >::exchange | ( | ssize_t | i, |
| ssize_t | j | ||
| ) |
Exchanges two items.
| i | First index. |
| j | Second index. |
| ssize_t sf::TStringList< S, O >::indexOf | ( | const S & | text | ) | const |
Returns the index of the string.
| text | The string to locate. |
| bool sf::TStringList< S, O >::isSorted | ( | ) | const |
Whether the list is sorted.
| O * sf::TStringList< S, O >::objectAt | ( | ssize_t | index | ) | const |
Gets the associated object at index.
| index | Index of the item. |
| void sf::TStringList< S, O >::removeAt | ( | ssize_t | index | ) |
Deletes the item at the given index.
| index | Index of the item to delete. |
| void sf::TStringList< S, O >::setObject | ( | ssize_t | index, |
| O * | obj | ||
| ) |
Sets the object at index.
| index | Index of the item. |
| obj | Pointer to associated object. |
| void sf::TStringList< S, O >::setSorted | ( | bool | flag = true | ) |
Sorts the list and sets a flag so the new entries are sorted as well.
| flag | true when sorting is required. |
| std::function<void(void*)> sf::TStringList< S, O >::onChanged |
Event handler when the list has changed.
| std::function<void(void*)> sf::TStringList< S, O >::onChanging |
Event handler before the list changes.