Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_safe_read_list.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2010 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#ifndef KIS_SAFE_READ_LIST_H_
8#define KIS_SAFE_READ_LIST_H_
9
10
11#include <QList>
12
27template<class T> class KisSafeReadList : private QList<T> {
28public:
30
31 using typename QList<T>::const_iterator;
32
46 inline const T& first() const {
47 return QList<T>::first();
48 }
49
50 inline const T& last() const {
51 return QList<T>::last();
52 }
53
54 inline const T& at(int i) const {
55 return QList<T>::at(i);
56 }
57
58 using QList<T>::constBegin;
59 using QList<T>::constEnd;
60 using QList<T>::isEmpty;
61 using QList<T>::size;
62 using QList<T>::indexOf;
63 using QList<T>::contains;
64
69 using QList<T>::append;
70 using QList<T>::prepend;
71 using QList<T>::insert;
72 using QList<T>::removeAt;
73 using QList<T>::clear;
74
75private:
76 Q_DISABLE_COPY(KisSafeReadList)
77};
78
79
80#define FOREACH_SAFE(_iter, _container) \
81 for(_iter = _container.constBegin(); \
82 _iter != _container.constEnd(); \
83 _iter++)
84
85
86#endif /* KIS_SAFE_READ_LIST_H_ */
const T & last() const
const T & at(int i) const
const T & first() const