QList< T > Class Template Reference
#include <backendcapabilities.h>
template<typename T>
class QList< T >
Definition at line 40 of file backendcapabilities.h.
|
| QList () |
|
| QList (const QList< T > &l) |
|
| ~QList () |
|
QList< T > & | operator= (const QList< T > &l) |
|
void | swap (QList< T > &other) |
|
bool | operator== (const QList< T > &l) const |
|
bool | operator!= (const QList< T > &l) const |
|
int | size () const |
|
void | detach () |
|
void | detachShared () |
|
bool | isDetached () const |
|
void | setSharable (bool sharable) |
|
bool | isSharedWith (const QList< T > &other) const |
|
bool | isEmpty () const |
|
void | clear () |
|
const T & | at (int i) const |
|
const T & | operator[] (int i) const |
|
T & | operator[] (int i) |
|
void | reserve (int size) |
|
void | append (const T &t) |
|
void | append (const QList< T > &t) |
|
void | prepend (const T &t) |
|
void | insert (int i, const T &t) |
|
void | replace (int i, const T &t) |
|
void | removeAt (int i) |
|
int | removeAll (const T &t) |
|
bool | removeOne (const T &t) |
|
T | takeAt (int i) |
|
T | takeFirst () |
|
T | takeLast () |
|
void | move (int from, int to) |
|
void | swap (int i, int j) |
|
int | indexOf (const T &t, int from=0) const |
|
int | lastIndexOf (const T &t, int from=-1) const |
|
QBool | contains (const T &t) const |
|
int | count (const T &t) const |
|
iterator | begin () |
|
const_iterator | begin () const |
|
const_iterator | constBegin () const |
|
iterator | end () |
|
const_iterator | end () const |
|
const_iterator | constEnd () const |
|
iterator | insert (iterator before, const T &t) |
|
iterator | erase (iterator pos) |
|
iterator | erase (iterator first, iterator last) |
|
int | count () const |
|
int | length () const |
|
T & | first () |
|
const T & | first () const |
|
T & | last () |
|
const T & | last () const |
|
void | removeFirst () |
|
void | removeLast () |
|
bool | startsWith (const T &t) const |
|
bool | endsWith (const T &t) const |
|
QList< T > | mid (int pos, int length=-1) const |
|
T | value (int i) const |
|
T | value (int i, const T &defaultValue) const |
|
void | push_back (const T &t) |
|
void | push_front (const T &t) |
|
T & | front () |
|
const T & | front () const |
|
T & | back () |
|
const T & | back () const |
|
void | pop_front () |
|
void | pop_back () |
|
bool | empty () const |
|
QList< T > & | operator+= (const QList< T > &l) |
|
QList< T > | operator+ (const QList< T > &l) const |
|
QList< T > & | operator+= (const T &t) |
|
QList< T > & | operator<< (const T &t) |
|
QList< T > & | operator<< (const QList< T > &l) |
|
QVector< T > | toVector () const |
|
QSet< T > | toSet () const |
|
std::list< T > | toStdList () const |
|
Q_OUTOFLINE_TEMPLATE ~QList |
( |
| ) |
|
Q_INLINE_TEMPLATE QList< T > & operator= |
( |
const QList< T > & |
l | ) |
|
Definition at line 129 of file qlist.h.
Q_INLINE_TEMPLATE void qSwap(QScopedPointer< T, Cleanup > &p1, QScopedPointer< T, Cleanup > &p2)
Q_OUTOFLINE_TEMPLATE bool operator== |
( |
const QList< T > & |
l | ) |
const |
Definition at line 736 of file qlist.h.
738 if (
p.size() != l.
p.
size())
742 Node *i =
reinterpret_cast<Node *
>(
p.end());
743 Node *
b =
reinterpret_cast<Node *
>(
p.begin());
744 Node *li =
reinterpret_cast<Node *
>(l.
p.
end());
747 if (!(i->t() == li->t()))
bool operator!= |
( |
const QList< T > & |
l | ) |
const |
|
inline |
Definition at line 135 of file qlist.h.
135 {
return !(*
this == l); }
Definition at line 139 of file qlist.h.
139 {
if (
d->
ref != 1) detach_helper(); }
bool isDetached |
( |
| ) |
const |
|
inline |
void setSharable |
( |
bool |
sharable | ) |
|
|
inline |
bool isSharedWith |
( |
const QList< T > & |
other | ) |
const |
|
inline |
Definition at line 150 of file qlist.h.
150 {
return d == other.
d; }
Definition at line 152 of file qlist.h.
152 {
return p.isEmpty(); }
Q_OUTOFLINE_TEMPLATE void clear |
( |
| ) |
|
const T & at |
( |
int |
i | ) |
const |
|
inline |
Definition at line 468 of file qlist.h.
469 { Q_ASSERT_X(i >= 0 && i <
p.size(),
"QList<T>::at",
"index out of range");
470 return reinterpret_cast<Node *
>(
p.at(i))->
t(); }
const T & operator[] |
( |
int |
i | ) |
const |
|
inline |
Definition at line 472 of file qlist.h.
473 { Q_ASSERT_X(i >= 0 && i <
p.size(),
"QList<T>::operator[]",
"index out of range");
474 return reinterpret_cast<Node *
>(
p.at(i))->
t(); }
Definition at line 476 of file qlist.h.
477 { Q_ASSERT_X(i >= 0 && i <
p.size(),
"QList<T>::operator[]",
"index out of range");
478 detach();
return reinterpret_cast<Node *
>(
p.at(i))->
t(); }
Q_OUTOFLINE_TEMPLATE void reserve |
( |
int |
size | ) |
|
Definition at line 496 of file qlist.h.
500 detach_helper(alloc);
Q_OUTOFLINE_TEMPLATE void append |
( |
const T & |
t | ) |
|
Definition at line 507 of file qlist.h.
510 Node *
n = detach_helper_grow(INT_MAX, 1);
512 node_construct(n,
t);
518 if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) {
519 Node *
n =
reinterpret_cast<Node *
>(
p.append());
521 node_construct(n,
t);
528 node_construct(©,
t);
530 n =
reinterpret_cast<Node *
>(
p.append());;
532 node_destruct(©);
void prepend |
( |
const T & |
t | ) |
|
|
inline |
Definition at line 541 of file qlist.h.
544 Node *
n = detach_helper_grow(0, 1);
546 node_construct(n,
t);
552 if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) {
553 Node *
n =
reinterpret_cast<Node *
>(
p.prepend());
555 node_construct(n,
t);
562 node_construct(©,
t);
564 n =
reinterpret_cast<Node *
>(
p.prepend());;
566 node_destruct(©);
Definition at line 575 of file qlist.h.
578 Node *
n = detach_helper_grow(i, 1);
580 node_construct(n,
t);
586 if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) {
587 Node *n =
reinterpret_cast<Node *
>(
p.insert(i));
589 node_construct(n,
t);
596 node_construct(©,
t);
598 n =
reinterpret_cast<Node *
>(
p.insert(i));;
600 node_destruct(©);
void replace |
( |
int |
i, |
|
|
const T & |
t |
|
) |
| |
|
inline |
Definition at line 609 of file qlist.h.
611 Q_ASSERT_X(i >= 0 && i <
p.size(),
"QList<T>::replace",
"index out of range");
613 reinterpret_cast<Node *
>(
p.at(i))->
t() =
t;
Definition at line 480 of file qlist.h.
481 {
if(i >= 0 && i <
p.size()) {
detach();
482 node_destruct(reinterpret_cast<Node *>(
p.at(i)));
p.remove(i); } }
Q_OUTOFLINE_TEMPLATE int removeAll |
( |
const T & |
t | ) |
|
Definition at line 770 of file qlist.h.
779 Node *i =
reinterpret_cast<Node *
>(
p.at(index));
780 Node *e =
reinterpret_cast<Node *
>(
p.end());
790 int removedCount = e -
n;
791 d->
end -= removedCount;
int indexOf(const T &t, int from=0) const
Q_OUTOFLINE_TEMPLATE bool removeOne |
( |
const T & |
t | ) |
|
Definition at line 796 of file qlist.h.
int indexOf(const T &t, int from=0) const
Definition at line 484 of file qlist.h.
485 { Q_ASSERT_X(i >= 0 && i <
p.size(),
"QList<T>::take",
"index out of range");
486 detach(); Node *
n =
reinterpret_cast<Node *
>(
p.at(i)); T
t = n->t(); node_destruct(n);
487 p.remove(i);
return t; }
Definition at line 628 of file qlist.h.
630 Q_ASSERT_X(from >= 0 && from <
p.size() && to >= 0 && to <
p.size(),
631 "QList<T>::move",
"index out of range");
Definition at line 617 of file qlist.h.
619 Q_ASSERT_X(i >= 0 && i <
p.size() && j >= 0 && j <
p.size(),
620 "QList<T>::swap",
"index out of range");
Q_OUTOFLINE_TEMPLATE int indexOf |
( |
const T & |
t, |
|
|
int |
from = 0 |
|
) |
| const |
Definition at line 847 of file qlist.h.
850 from = qMax(from +
p.size(), 0);
851 if (from <
p.size()) {
852 Node *
n =
reinterpret_cast<Node *
>(
p.at(from -1));
853 Node *e =
reinterpret_cast<Node *
>(
p.end());
856 return int(n - reinterpret_cast<Node *>(
p.begin()));
Q_OUTOFLINE_TEMPLATE int lastIndexOf |
( |
const T & |
t, |
|
|
int |
from = -1 |
|
) |
| const |
Definition at line 862 of file qlist.h.
866 else if (from >=
p.size())
869 Node *
b =
reinterpret_cast<Node *
>(
p.begin());
870 Node *
n =
reinterpret_cast<Node *
>(
p.at(from + 1));
Q_OUTOFLINE_TEMPLATE QBool contains |
( |
const T & |
t | ) |
const |
Definition at line 880 of file qlist.h.
882 Node *
b =
reinterpret_cast<Node *
>(
p.begin());
883 Node *i =
reinterpret_cast<Node *
>(
p.end());
Q_OUTOFLINE_TEMPLATE int count |
( |
const T & |
t | ) |
const |
Definition at line 891 of file qlist.h.
894 Node *
b =
reinterpret_cast<Node *
>(
p.begin());
895 Node *i =
reinterpret_cast<Node *
>(
p.end());
Definition at line 267 of file qlist.h.
267 {
detach();
return reinterpret_cast<Node *
>(
p.begin()); }
Definition at line 268 of file qlist.h.
268 {
return reinterpret_cast<Node *
>(
p.begin()); }
Definition at line 269 of file qlist.h.
269 {
return reinterpret_cast<Node *
>(
p.begin()); }
Definition at line 270 of file qlist.h.
270 {
detach();
return reinterpret_cast<Node *
>(
p.end()); }
Definition at line 271 of file qlist.h.
271 {
return reinterpret_cast<Node *
>(
p.end()); }
Definition at line 272 of file qlist.h.
272 {
return reinterpret_cast<Node *
>(
p.end()); }
Definition at line 451 of file qlist.h.
453 int iBefore =
int(before.i - reinterpret_cast<Node *>(
p.begin()));
454 Node *
n =
reinterpret_cast<Node *
>(
p.insert(iBefore));
456 node_construct(n,
t);
unsigned int(APIENTRYP PFNGLXGETAGPOFFSETMESAPROC)(const void *pointer)
Definition at line 464 of file qlist.h.
465 { node_destruct(it.i);
466 return reinterpret_cast<Node *
>(
p.erase(reinterpret_cast<void**>(it.i))); }
Definition at line 283 of file qlist.h.
const T & at(int i) const
Definition at line 285 of file qlist.h.
const T & at(int i) const
Definition at line 286 of file qlist.h.
iterator erase(iterator pos)
Definition at line 287 of file qlist.h.
iterator erase(iterator pos)
bool startsWith |
( |
const T & |
t | ) |
const |
|
inline |
bool endsWith |
( |
const T & |
t | ) |
const |
|
inline |
Q_OUTOFLINE_TEMPLATE QList< T > mid |
( |
int |
pos, |
|
|
int |
length = -1 |
|
) |
| const |
Definition at line 637 of file qlist.h.
639 if (alength < 0 || pos + alength >
size())
640 alength =
size() - pos;
641 if (pos == 0 && alength ==
size())
647 cpy.
d->
end = alength;
649 cpy.node_copy(reinterpret_cast<Node *>(cpy.
p.
begin()),
650 reinterpret_cast<Node *>(cpy.
p.
end()),
651 reinterpret_cast<Node *>(
p.begin() + pos));
Q_OUTOFLINE_TEMPLATE T value |
( |
int |
i | ) |
const |
Definition at line 661 of file qlist.h.
663 if (i < 0 || i >=
p.size()) {
666 return reinterpret_cast<Node *
>(
p.at(i))->
t();
Q_OUTOFLINE_TEMPLATE T value |
( |
int |
i, |
|
|
const T & |
defaultValue |
|
) |
| const |
Definition at line 670 of file qlist.h.
672 return ((i < 0 || i >=
p.size()) ? defaultValue : reinterpret_cast<Node *>(
p.at(i))->
t());
void push_back |
( |
const T & |
t | ) |
|
|
inline |
void push_front |
( |
const T & |
t | ) |
|
|
inline |
Q_OUTOFLINE_TEMPLATE QList< T > & operator+= |
( |
const QList< T > & |
l | ) |
|
Definition at line 818 of file qlist.h.
824 Node *
n = (
d->
ref != 1)
825 ? detach_helper_grow(INT_MAX, l.
size())
826 : reinterpret_cast<Node *>(
p.append2(l.
p));
828 node_copy(n, reinterpret_cast<Node *>(
p.end()),
829 reinterpret_cast<Node *>(l.
p.
begin()));
832 d->
end -=
int(reinterpret_cast<Node *>(
p.end()) - n);
unsigned int(APIENTRYP PFNGLXGETAGPOFFSETMESAPROC)(const void *pointer)
QList<T>& operator+= |
( |
const T & |
t | ) |
|
|
inline |
QList<T>& operator<< |
( |
const T & |
t | ) |
|
|
inline |
Definition at line 335 of file qlist.h.
336 { *
this += l;
return *
this; }
Q_OUTOFLINE_TEMPLATE QVector< T > toVector |
( |
| ) |
const |
Definition at line 780 of file qvector.h.
783 for (
int i = 0; i <
size(); ++i)
const T & at(int i) const
Q_OUTOFLINE_TEMPLATE QSet< T > toSet |
( |
| ) |
const |
Definition at line 309 of file qset.h.
313 for (
int i = 0; i <
size(); ++i)
const T & at(int i) const
const_iterator insert(const T &value)
Definition at line 795 of file qvector.h.
QList< T > toList() const
Definition at line 325 of file qset.h.
QList< T > toList() const
static QList<T> fromStdList |
( |
const std::list< T > & |
list | ) |
|
|
inlinestatic |
Definition at line 345 of file qlist.h.
346 {
QList<T> tmp;
qCopy(list.begin(), list.end(), std::back_inserter(tmp));
return tmp; }
OutputIterator qCopy(InputIterator begin, InputIterator end, OutputIterator dest)
std::list<T> toStdList |
( |
| ) |
const |
|
inline |
Definition at line 347 of file qlist.h.
const_iterator constEnd() const
const_iterator constBegin() const
OutputIterator qCopy(InputIterator begin, InputIterator end, OutputIterator dest)
The documentation for this class was generated from the following files: