#include <qlist.h>

Classes |
|
| class | const_iterator |
| class | iterator |
| struct | Node |
Public Types |
|
| typedef iterator | Iterator |
| typedef const_iterator | ConstIterator |
| typedef int | size_type |
| typedef T | value_type |
| typedef value_type * | pointer |
| typedef const value_type * | const_pointer |
| typedef value_type & | reference |
| typedef const value_type & | const_reference |
| typedef qptrdiff | difference_type |
Public Member Functions |
|
| QList () | |
| QList (const QList< T > &l) | |
| ~QList () | |
| QList< T > & | operator= (const QList< T > &l) |
| 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 |
Static Public Member Functions |
|
| static QList< T > | fromVector (const QVector< T > &vector) |
| static QList< T > | fromSet (const QSet< T > &set) |
| static QList< T > | fromStdList (const std::list< T > &list) |
Friends |
|
| class | iterator |
| class | const_iterator |
| typedef const_iterator ConstIterator |
| typedef int size_type |
| typedef T value_type |
| typedef value_type* pointer |
| typedef const value_type* const_pointer |
| typedef value_type& reference |
| typedef const value_type& const_reference |
| typedef qptrdiff difference_type |
| QList | ( | ) | [inline] |
| Q_OUTOFLINE_TEMPLATE ~QList | ( | ) |
| Q_OUTOFLINE_TEMPLATE bool operator== | ( | const QList< T > & | l | ) | const |
| bool operator!= | ( | const QList< T > & | l | ) | const [inline] |
| int size | ( | ) | const [inline] |
| void detach | ( | ) | [inline] |
| void detachShared | ( | ) | [inline] |
Definition at line 128 of file qlist.h.
{
// The "this->" qualification is needed for GCCE.
if (d->ref != 1 && this->d != &QListData::shared_null)
detach_helper();
}
| bool isDetached | ( | ) | const [inline] |
| void setSharable | ( | bool | sharable | ) | [inline] |
| bool isSharedWith | ( | const QList< T > & | other | ) | const [inline] |
| bool isEmpty | ( | ) | const [inline] |
| Q_OUTOFLINE_TEMPLATE void clear | ( | ) |
| const T & at | ( | int | i | ) | const [inline] |
| const T & operator[] | ( | int | i | ) | const [inline] |
| T & operator[] | ( | int | i | ) | [inline] |
| Q_OUTOFLINE_TEMPLATE void reserve | ( | int | size | ) |
| Q_OUTOFLINE_TEMPLATE void append | ( | const T & | t | ) |
Definition at line 494 of file qlist.h.
{
if (d->ref != 1) {
Node *n = detach_helper_grow(INT_MAX, 1);
QT_TRY {
node_construct(n, t);
} QT_CATCH(...) {
--d->end;
QT_RETHROW;
}
} else {
if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) {
Node *n = reinterpret_cast<Node *>(p.append());
QT_TRY {
node_construct(n, t);
} QT_CATCH(...) {
--d->end;
QT_RETHROW;
}
} else {
Node *n, copy;
node_construct(©, t); // t might be a reference to an object in the array
QT_TRY {
n = reinterpret_cast<Node *>(p.append());;
} QT_CATCH(...) {
node_destruct(©);
QT_RETHROW;
}
*n = copy;
}
}
}
| void append | ( | const QList< T > & | t | ) | [inline] |
| void prepend | ( | const T & | t | ) | [inline] |
Definition at line 528 of file qlist.h.
{
if (d->ref != 1) {
Node *n = detach_helper_grow(0, 1);
QT_TRY {
node_construct(n, t);
} QT_CATCH(...) {
++d->begin;
QT_RETHROW;
}
} else {
if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) {
Node *n = reinterpret_cast<Node *>(p.prepend());
QT_TRY {
node_construct(n, t);
} QT_CATCH(...) {
++d->begin;
QT_RETHROW;
}
} else {
Node *n, copy;
node_construct(©, t); // t might be a reference to an object in the array
QT_TRY {
n = reinterpret_cast<Node *>(p.prepend());;
} QT_CATCH(...) {
node_destruct(©);
QT_RETHROW;
}
*n = copy;
}
}
}
| void insert | ( | int | i, |
| const T & | t | ||
| ) | [inline] |
Definition at line 562 of file qlist.h.
{
if (d->ref != 1) {
Node *n = detach_helper_grow(i, 1);
QT_TRY {
node_construct(n, t);
} QT_CATCH(...) {
p.remove(i);
QT_RETHROW;
}
} else {
if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) {
Node *n = reinterpret_cast<Node *>(p.insert(i));
QT_TRY {
node_construct(n, t);
} QT_CATCH(...) {
p.remove(i);
QT_RETHROW;
}
} else {
Node *n, copy;
node_construct(©, t); // t might be a reference to an object in the array
QT_TRY {
n = reinterpret_cast<Node *>(p.insert(i));;
} QT_CATCH(...) {
node_destruct(©);
QT_RETHROW;
}
*n = copy;
}
}
}
| void replace | ( | int | i, |
| const T & | t | ||
| ) | [inline] |
| void removeAt | ( | int | i | ) | [inline] |
| Q_OUTOFLINE_TEMPLATE int removeAll | ( | const T & | t | ) |
| Q_OUTOFLINE_TEMPLATE bool removeOne | ( | const T & | t | ) |
Definition at line 774 of file qlist.h.
{
detachShared();
int index = indexOf(_t);
if (index != -1) {
removeAt(index);
return true;
}
return false;
}
| T takeAt | ( | int | i | ) | [inline] |
| T takeFirst | ( | ) | [inline] |
Definition at line 476 of file qlist.h.
{ T t = first(); removeFirst(); return t; }
| T takeLast | ( | ) | [inline] |
Definition at line 479 of file qlist.h.
{ T t = last(); removeLast(); return t; }
| void move | ( | int | from, |
| int | to | ||
| ) | [inline] |
| void swap | ( | int | i, |
| int | j | ||
| ) | [inline] |
| Q_OUTOFLINE_TEMPLATE int indexOf | ( | const T & | t, |
| int | from = 0 |
||
| ) | const |
| Q_OUTOFLINE_TEMPLATE int lastIndexOf | ( | const T & | t, |
| int | from = -1 |
||
| ) | const |
| Q_OUTOFLINE_TEMPLATE QBool contains | ( | const T & | t | ) | const |
| Q_OUTOFLINE_TEMPLATE int count | ( | const T & | t | ) | const |
| iterator begin | ( | ) | [inline] |
| const_iterator begin | ( | ) | const [inline] |
| const_iterator constBegin | ( | ) | const [inline] |
| iterator end | ( | ) | [inline] |
| const_iterator end | ( | ) | const [inline] |
| const_iterator constEnd | ( | ) | const [inline] |
| int count | ( | ) | const [inline] |
| int length | ( | ) | const [inline] |
| T& first | ( | ) | [inline] |
| const T& first | ( | ) | const [inline] |
| T& last | ( | ) | [inline] |
| const T& last | ( | ) | const [inline] |
| void removeFirst | ( | ) | [inline] |
| void removeLast | ( | ) | [inline] |
| 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 624 of file qlist.h.
{
if (alength < 0 || pos + alength > size())
alength = size() - pos;
if (pos == 0 && alength == size())
return *this;
QList<T> cpy;
cpy.reserve(alength);
cpy.d->end = alength;
QT_TRY {
cpy.node_copy(reinterpret_cast<Node *>(cpy.p.begin()),
reinterpret_cast<Node *>(cpy.p.end()),
reinterpret_cast<Node *>(p.begin() + pos));
} QT_CATCH(...) {
// restore the old end
cpy.d->end = 0;
QT_RETHROW;
}
return cpy;
}
| Q_OUTOFLINE_TEMPLATE T value | ( | int | i | ) | const |
| Q_OUTOFLINE_TEMPLATE T value | ( | int | i, |
| const T & | defaultValue | ||
| ) | const |
| void push_back | ( | const T & | t | ) | [inline] |
| void push_front | ( | const T & | t | ) | [inline] |
| T& front | ( | ) | [inline] |
| const T& front | ( | ) | const [inline] |
| T& back | ( | ) | [inline] |
| const T& back | ( | ) | const [inline] |
| void pop_front | ( | ) | [inline] |
| void pop_back | ( | ) | [inline] |
| bool empty | ( | ) | const [inline] |
Definition at line 797 of file qlist.h.
{
if (!l.isEmpty()) {
if (isEmpty()) {
*this = l;
} else {
Node *n = (d->ref != 1)
? detach_helper_grow(INT_MAX, l.size())
: reinterpret_cast<Node *>(p.append2(l.p));
QT_TRY {
node_copy(n, reinterpret_cast<Node *>(p.end()),
reinterpret_cast<Node *>(l.p.begin()));
} QT_CATCH(...) {
// restore the old end
d->end -= int(reinterpret_cast<Node *>(p.end()) - n);
QT_RETHROW;
}
}
}
return *this;
}
| QList<T>& operator+= | ( | const T & | t | ) | [inline] |
| QList<T>& operator<< | ( | const T & | t | ) | [inline] |
| Q_OUTOFLINE_TEMPLATE QVector< T > toVector | ( | ) | const |
| Q_OUTOFLINE_TEMPLATE QSet< T > toSet | ( | ) | const |
| static QList<T> fromStdList | ( | const std::list< T > & | list | ) | [inline, static] |
| std::list<T> toStdList | ( | ) | const [inline] |
Definition at line 334 of file qlist.h.
{ std::list<T> tmp; qCopy(constBegin(), constEnd(), std::back_inserter(tmp)); return tmp; }
friend class iterator
[friend] |
friend class const_iterator
[friend] |