QcIdList Class
template <typename Id, typename T> class QcIdListA read-only view of the definitions (of the type T) of a content registry list, indexed by their strong id type Id instead of an integer (decision E-952). More...
| Header: | #include <common/core/QcIdList.h> |
Public Functions
| QcIdList(const QList<T> &items) | |
| QcIdList(const QList<T> &&) | |
| const T & | at(Id id) const |
| typename QList<T>::const_iterator | begin() const |
| bool | contains(Id id) const |
| typename QList<T>::const_iterator | end() const |
| Id | idOf(typename QList<T>::const_iterator it) const |
| auto | ids() const |
| bool | isEmpty() const |
| const QList<T> & | list() const |
| qsizetype | size() const |
| const T & | operator[](Id id) const |
Detailed Description
Id has an explicit constructor from int and index(). The view holds a pointer to the list: it is valid as long as the registry it came from. Iterating it yields the definitions in registration order; ids() yields their ids.
Member Function Documentation
[explicit] QcIdList::QcIdList(const QList<T> &items)
Constructs a view of items.
[delete] QcIdList::QcIdList(const QList<T> &&)
A view of a temporary list would dangle.
const T &QcIdList::at(Id id) const
Returns the definition of id; id must be in the list (contains()).
typename QList<T>::const_iterator QcIdList::begin() const
Returns an iterator to the first definition.
bool QcIdList::contains(Id id) const
Returns whether id names a definition of the list.
typename QList<T>::const_iterator QcIdList::end() const
Returns the iterator past the last definition.
Id QcIdList::idOf(typename QList<T>::const_iterator it) const
Returns the id of the definition it points to (an iterator of this list).
auto QcIdList::ids() const
Returns the ids of all definitions in registration order.
bool QcIdList::isEmpty() const
Returns whether the list holds no definition.
const QList<T> &QcIdList::list() const
Returns the underlying list, for code that hands it on unchanged.
qsizetype QcIdList::size() const
Returns the number of definitions.
const T &QcIdList::operator[](Id id) const
Returns the definition of id; id must be in the list (contains()).