mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 18:32:55 +00:00
get rid of QLinkedList<T>
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
d4785c2987
commit
a25d34bb05
26 changed files with 49 additions and 1856 deletions
|
@ -699,9 +699,6 @@ katie_generate_obsolete(QLatin1Char QtCore qchar.h)
|
|||
katie_generate_obsolete(QLatin1String QtCore qstring.h)
|
||||
katie_generate_obsolete(QLinearGradient QtGui qbrush.h)
|
||||
katie_generate_obsolete(QLineF QtCore qline.h)
|
||||
katie_generate_obsolete(QLinkedListData QtCore qlinkedlist.h)
|
||||
katie_generate_obsolete(QLinkedListIterator QtCore qlinkedlist.h)
|
||||
katie_generate_obsolete(QLinkedListNode QtCore qlinkedlist.h)
|
||||
katie_generate_obsolete(QListData QtCore qlist.h)
|
||||
katie_generate_obsolete(QListIterator QtCore qlist.h)
|
||||
katie_generate_obsolete(QListWidgetItem QtGui qlistwidget.h)
|
||||
|
|
|
@ -76,10 +76,6 @@ include/katie/QtCore/QLibrary
|
|||
include/katie/QtCore/QLibraryInfo
|
||||
include/katie/QtCore/QLine
|
||||
include/katie/QtCore/QLineF
|
||||
include/katie/QtCore/QLinkedList
|
||||
include/katie/QtCore/QLinkedListData
|
||||
include/katie/QtCore/QLinkedListIterator
|
||||
include/katie/QtCore/QLinkedListNode
|
||||
include/katie/QtCore/QList
|
||||
include/katie/QtCore/QListData
|
||||
include/katie/QtCore/QListIterator
|
||||
|
@ -251,7 +247,6 @@ include/katie/QtCore/qjsondocument.h
|
|||
include/katie/QtCore/qlibrary.h
|
||||
include/katie/QtCore/qlibraryinfo.h
|
||||
include/katie/QtCore/qline.h
|
||||
include/katie/QtCore/qlinkedlist.h
|
||||
include/katie/QtCore/qlist.h
|
||||
include/katie/QtCore/qlocale.h
|
||||
include/katie/QtCore/qmap.h
|
||||
|
|
|
@ -79,10 +79,6 @@ include/katie/QtCore/QLibrary
|
|||
include/katie/QtCore/QLibraryInfo
|
||||
include/katie/QtCore/QLine
|
||||
include/katie/QtCore/QLineF
|
||||
include/katie/QtCore/QLinkedList
|
||||
include/katie/QtCore/QLinkedListData
|
||||
include/katie/QtCore/QLinkedListIterator
|
||||
include/katie/QtCore/QLinkedListNode
|
||||
include/katie/QtCore/QList
|
||||
include/katie/QtCore/QListData
|
||||
include/katie/QtCore/QListIterator
|
||||
|
@ -254,7 +250,6 @@ include/katie/QtCore/qjsondocument.h
|
|||
include/katie/QtCore/qlibrary.h
|
||||
include/katie/QtCore/qlibraryinfo.h
|
||||
include/katie/QtCore/qline.h
|
||||
include/katie/QtCore/qlinkedlist.h
|
||||
include/katie/QtCore/qlist.h
|
||||
include/katie/QtCore/qlocale.h
|
||||
include/katie/QtCore/qmap.h
|
||||
|
|
|
@ -79,10 +79,6 @@ include/katie/QtCore/QLibrary
|
|||
include/katie/QtCore/QLibraryInfo
|
||||
include/katie/QtCore/QLine
|
||||
include/katie/QtCore/QLineF
|
||||
include/katie/QtCore/QLinkedList
|
||||
include/katie/QtCore/QLinkedListData
|
||||
include/katie/QtCore/QLinkedListIterator
|
||||
include/katie/QtCore/QLinkedListNode
|
||||
include/katie/QtCore/QList
|
||||
include/katie/QtCore/QListData
|
||||
include/katie/QtCore/QListIterator
|
||||
|
@ -254,7 +250,6 @@ include/katie/QtCore/qjsondocument.h
|
|||
include/katie/QtCore/qlibrary.h
|
||||
include/katie/QtCore/qlibraryinfo.h
|
||||
include/katie/QtCore/qline.h
|
||||
include/katie/QtCore/qlinkedlist.h
|
||||
include/katie/QtCore/qlist.h
|
||||
include/katie/QtCore/qlocale.h
|
||||
include/katie/QtCore/qmap.h
|
||||
|
|
|
@ -37,9 +37,6 @@ incmap = {
|
|||
'QLatin1Char': 'qchar.h',
|
||||
'QLatin1String': 'qstring.h',
|
||||
'QLineF': 'qline.h',
|
||||
'QLinkedListData': 'qlinkedlist.h',
|
||||
'QLinkedListIterator': 'qlinkedlist.h',
|
||||
'QLinkedListNode': 'qlinkedlist.h',
|
||||
'QListData': 'qlist.h',
|
||||
'QListIterator': 'qlist.h',
|
||||
'QMapData': 'qmap.h',
|
||||
|
|
|
@ -343,10 +343,6 @@ classlist = [
|
|||
"QLinearGradient",
|
||||
"QLineEdit",
|
||||
"QLineF",
|
||||
"QLinkedList",
|
||||
"QLinkedListData",
|
||||
"QLinkedListIterator",
|
||||
"QLinkedListNode",
|
||||
"QList",
|
||||
"QListData",
|
||||
"QListIterator",
|
||||
|
|
|
@ -62,7 +62,6 @@ set(CORE_PUBLIC_HEADERS
|
|||
QFutureWatcher
|
||||
QVector
|
||||
QLibraryInfo
|
||||
QLinkedList
|
||||
QSemaphore
|
||||
QFutureSynchronizer
|
||||
QStack
|
||||
|
@ -246,7 +245,6 @@ set(CORE_HEADERS
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/tools/qhash.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tools/qjsondocument.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tools/qline.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tools/qlinkedlist.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tools/qlist.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tools/qlocale.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tools/qlocale_p.h
|
||||
|
@ -376,7 +374,6 @@ set(CORE_SOURCES
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/tools/qhash.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tools/qjsondocument.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tools/qline.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tools/qlinkedlist.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tools/qlist.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tools/qlocale.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tools/qlocale_tools.cpp
|
||||
|
|
|
@ -141,7 +141,7 @@ QT_BEGIN_NAMESPACE
|
|||
\section1 Reading and writing Qt collection classes
|
||||
|
||||
The Qt container classes can also be serialized to a QDataStream.
|
||||
These include QList, QLinkedList, QVector, QSet, QHash, and QMap.
|
||||
These include QList, QVector, QSet, QHash, and QMap.
|
||||
The stream operators are declared as non-members of the classes.
|
||||
|
||||
\target Serializing Qt Classes
|
||||
|
|
|
@ -31,7 +31,6 @@ QT_BEGIN_NAMESPACE
|
|||
class QByteArray;
|
||||
|
||||
template <typename T> class QList;
|
||||
template <typename T> class QLinkedList;
|
||||
template <typename T> class QVector;
|
||||
template <typename T> class QSet;
|
||||
template <class Key, class T> class QHash;
|
||||
|
@ -213,33 +212,6 @@ QDataStream& operator<<(QDataStream& s, const QList<T>& l)
|
|||
return s;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
QDataStream& operator>>(QDataStream& s, QLinkedList<T>& l)
|
||||
{
|
||||
l.clear();
|
||||
quint32 c;
|
||||
s >> c;
|
||||
for(quint32 i = 0; i < c; ++i)
|
||||
{
|
||||
T t;
|
||||
s >> t;
|
||||
l.append(t);
|
||||
if (s.atEnd())
|
||||
break;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
QDataStream& operator<<(QDataStream& s, const QLinkedList<T>& l)
|
||||
{
|
||||
s << quint32(l.size());
|
||||
typename QLinkedList<T>::const_iterator it = l.constBegin();
|
||||
for(; it != l.constEnd(); ++it)
|
||||
s << *it;
|
||||
return s;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
QDataStream& operator>>(QDataStream& s, QVector<T>& v)
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
<QtAlgorithms> that work on containers and perform well-know
|
||||
algorithms. You can use these algorithms with any \l {container
|
||||
class} that provides STL-style iterators, including Qt's QList,
|
||||
QLinkedList, QVector, QMap, and QHash classes.
|
||||
QVector, QMap, and QHash classes.
|
||||
|
||||
These functions have taken their inspiration from similar
|
||||
functions available in the STL \c <algorithm> header. Most of them
|
||||
|
|
|
@ -29,7 +29,6 @@ QT_BEGIN_NAMESPACE
|
|||
|
||||
template <class Key, class T> class QCache;
|
||||
template <class Key, class T> class QHash;
|
||||
template <class T> class QLinkedList;
|
||||
template <class T> class QList;
|
||||
template <class Key, class T> class QMap;
|
||||
template <class Key, class T> class QMultiHash;
|
||||
|
|
|
@ -70,54 +70,6 @@
|
|||
\sa QMutableListIterator, QList::const_iterator
|
||||
*/
|
||||
|
||||
/*!
|
||||
\class QLinkedListIterator
|
||||
\inmodule QtCore
|
||||
|
||||
\brief The QLinkedListIterator class provides a Java-style const iterator for QLinkedList.
|
||||
|
||||
QLinkedList has both \l{Java-style iterators} and
|
||||
\l{STL-style iterators}. The Java-style iterators are more
|
||||
high-level and easier to use than the STL-style iterators; on the
|
||||
other hand, they are slightly less efficient.
|
||||
|
||||
QLinkedListIterator\<T\> allows you to iterate over a
|
||||
QLinkedList\<T\>. If you want to modify the list as you iterate
|
||||
over it, use QMutableLinkedListIterator\<T\> instead.
|
||||
|
||||
The QLinkedListIterator constructor takes a QLinkedList as
|
||||
argument. After construction, the iterator is located at the very
|
||||
beginning of the list (before the first item). Here's how to
|
||||
iterate over all the elements sequentially:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_qiterator.cpp 2
|
||||
|
||||
The next() function returns the next item in the list and
|
||||
advances the iterator. Unlike STL-style iterators, Java-style
|
||||
iterators point \e between items rather than directly \e at
|
||||
items. The first call to next() advances the iterator to the
|
||||
position between the first and second item, and returns the first
|
||||
item; the second call to next() advances the iterator to the
|
||||
position between the second and third item, and returns the second
|
||||
item; and so on.
|
||||
|
||||
\img javaiterators1.png
|
||||
|
||||
Here's how to iterate over the elements in reverse order:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_qiterator.cpp 3
|
||||
|
||||
If you want to find all occurrences of a particular value, use
|
||||
findNext() or findPrevious() in a loop.
|
||||
|
||||
Multiple iterators can be used on the same list. If the list is
|
||||
modified while a QLinkedListIterator is active, the
|
||||
QLinkedListIterator will continue iterating over the original
|
||||
list, ignoring the modified copy.
|
||||
|
||||
\sa QMutableLinkedListIterator, QLinkedList::const_iterator
|
||||
*/
|
||||
|
||||
/*!
|
||||
\class QVectorIterator
|
||||
\inmodule QtCore
|
||||
|
@ -283,67 +235,6 @@
|
|||
\sa QListIterator, QList::iterator
|
||||
*/
|
||||
|
||||
/*!
|
||||
\class QMutableLinkedListIterator
|
||||
\inmodule QtCore
|
||||
|
||||
\brief The QMutableLinkedListIterator class provides a Java-style non-const iterator for QLinkedList.
|
||||
|
||||
QLinkedList has both \l{Java-style iterators} and
|
||||
\l{STL-style iterators}. The Java-style iterators are more
|
||||
high-level and easier to use than the STL-style iterators; on the
|
||||
other hand, they are slightly less efficient.
|
||||
|
||||
QMutableLinkedListIterator\<T\> allows you to iterate over a
|
||||
QLinkedList\<T\> and modify the list. If you don't want to modify
|
||||
the list (or have a const QLinkedList), use the slightly faster
|
||||
QLinkedListIterator\<T\> instead.
|
||||
|
||||
The QMutableLinkedListIterator constructor takes a QLinkedList as
|
||||
argument. After construction, the iterator is located at the very
|
||||
beginning of the list (before the first item). Here's how to
|
||||
iterate over all the elements sequentially:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_qiterator.cpp 11
|
||||
|
||||
The next() function returns the next item in the list and
|
||||
advances the iterator. Unlike STL-style iterators, Java-style
|
||||
iterators point \e between items rather than directly \e at
|
||||
items. The first call to next() advances the iterator to the
|
||||
position between the first and second item, and returns the first
|
||||
item; the second call to next() advances the iterator to the
|
||||
position between the second and third item, returning the second
|
||||
item; and so on.
|
||||
|
||||
\img javaiterators1.png
|
||||
|
||||
Here's how to iterate over the elements in reverse order:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_qiterator.cpp 12
|
||||
|
||||
If you want to find all occurrences of a particular value, use
|
||||
findNext() or findPrevious() in a loop.
|
||||
|
||||
If you want to remove items as you iterate over the list, use
|
||||
remove(). If you want to modify the value of an item, use
|
||||
setValue(). If you want to insert a new item in the list, use
|
||||
insert().
|
||||
|
||||
Example:
|
||||
\snippet doc/src/snippets/code/doc_src_qiterator.cpp 13
|
||||
|
||||
The example traverses a list, replacing negative numbers with
|
||||
their absolute values, and eliminating zeroes.
|
||||
|
||||
Only one mutable iterator can be active on a given list at any
|
||||
time. Furthermore, no changes should be done directly to the list
|
||||
while the iterator is active (as opposed to through the
|
||||
iterator), since this could invalidate the iterator and lead to
|
||||
undefined behavior.
|
||||
|
||||
\sa QLinkedListIterator, QLinkedList::iterator
|
||||
*/
|
||||
|
||||
/*!
|
||||
\class QMutableVectorIterator
|
||||
\inmodule QtCore
|
||||
|
@ -463,9 +354,7 @@
|
|||
|
||||
/*!
|
||||
\fn QListIterator::QListIterator(const QList<T> &list)
|
||||
\fn QLinkedListIterator::QLinkedListIterator(const QLinkedList<T> &list)
|
||||
\fn QMutableListIterator::QMutableListIterator(QList<T> &list)
|
||||
\fn QMutableLinkedListIterator::QMutableLinkedListIterator(QLinkedList<T> &list)
|
||||
|
||||
Constructs an iterator for traversing \a list. The iterator is
|
||||
set to be at the front of the list (before the first item).
|
||||
|
@ -505,9 +394,7 @@
|
|||
*/
|
||||
|
||||
/*! \fn QMutableListIterator &QMutableListIterator::operator=(QList<T> &list)
|
||||
\fn QMutableLinkedListIterator &QMutableLinkedListIterator::operator=(QLinkedList<T> &list)
|
||||
\fn QListIterator &QListIterator::operator=(const QList<T> &list)
|
||||
\fn QLinkedListIterator &QLinkedListIterator::operator=(const QLinkedList<T> &list)
|
||||
|
||||
Makes the iterator operate on \a list. The iterator is set to be
|
||||
at the front of the list (before the first item).
|
||||
|
@ -534,7 +421,6 @@
|
|||
*/
|
||||
|
||||
/*! \fn void QListIterator::toFront()
|
||||
\fn void QLinkedListIterator::toFront()
|
||||
\fn void QVectorIterator::toFront()
|
||||
\fn void QSetIterator::toFront()
|
||||
\fn void QMutableListIterator::toFront()
|
||||
|
@ -549,7 +435,6 @@
|
|||
*/
|
||||
|
||||
/*! \fn void QListIterator::toBack()
|
||||
\fn void QLinkedListIterator::toBack()
|
||||
\fn void QVectorIterator::toBack()
|
||||
\fn void QSetIterator::toBack()
|
||||
\fn void QMutableListIterator::toBack()
|
||||
|
@ -564,7 +449,6 @@
|
|||
*/
|
||||
|
||||
/*! \fn bool QListIterator::hasNext() const
|
||||
\fn bool QLinkedListIterator::hasNext() const
|
||||
\fn bool QVectorIterator::hasNext() const
|
||||
\fn bool QSetIterator::hasNext() const
|
||||
\fn bool QMutableListIterator::hasNext() const
|
||||
|
@ -580,7 +464,6 @@
|
|||
*/
|
||||
|
||||
/*! \fn const T &QListIterator::next()
|
||||
\fn const T &QLinkedListIterator::next()
|
||||
\fn const T &QVectorIterator::next()
|
||||
\fn const T &QSetIterator::next()
|
||||
\fn const T &QMutableSetIterator::next()
|
||||
|
@ -607,7 +490,6 @@
|
|||
*/
|
||||
|
||||
/*! \fn const T &QListIterator::peekNext() const
|
||||
\fn const T &QLinkedListIterator::peekNext() const
|
||||
\fn const T &QVectorIterator::peekNext() const
|
||||
\fn const T &QSetIterator::peekNext() const
|
||||
\fn const T &QMutableSetIterator::peekNext() const
|
||||
|
@ -633,7 +515,6 @@
|
|||
*/
|
||||
|
||||
/*! \fn bool QListIterator::hasPrevious() const
|
||||
\fn bool QLinkedListIterator::hasPrevious() const
|
||||
\fn bool QVectorIterator::hasPrevious() const
|
||||
\fn bool QSetIterator::hasPrevious() const
|
||||
\fn bool QMutableListIterator::hasPrevious() const
|
||||
|
@ -649,7 +530,6 @@
|
|||
*/
|
||||
|
||||
/*! \fn const T &QListIterator::previous()
|
||||
\fn const T &QLinkedListIterator::previous()
|
||||
\fn const T &QVectorIterator::previous()
|
||||
\fn const T &QSetIterator::previous()
|
||||
\fn const T &QMutableSetIterator::previous()
|
||||
|
@ -677,7 +557,6 @@
|
|||
*/
|
||||
|
||||
/*! \fn const T &QListIterator::peekPrevious() const
|
||||
\fn const T &QLinkedListIterator::peekPrevious() const
|
||||
\fn const T &QVectorIterator::peekPrevious() const
|
||||
\fn const T &QSetIterator::peekPrevious() const
|
||||
\fn const T &QMutableSetIterator::peekPrevious() const
|
||||
|
@ -703,7 +582,6 @@
|
|||
*/
|
||||
|
||||
/*! \fn bool QListIterator::findNext(const T &value)
|
||||
\fn bool QLinkedListIterator::findNext(const T &value)
|
||||
\fn bool QVectorIterator::findNext(const T &value)
|
||||
\fn bool QSetIterator::findNext(const T &value)
|
||||
\fn bool QMutableListIterator::findNext(const T &value)
|
||||
|
@ -722,7 +600,6 @@
|
|||
*/
|
||||
|
||||
/*! \fn bool QListIterator::findPrevious(const T &value)
|
||||
\fn bool QLinkedListIterator::findPrevious(const T &value)
|
||||
\fn bool QVectorIterator::findPrevious(const T &value)
|
||||
\fn bool QSetIterator::findPrevious(const T &value)
|
||||
\fn bool QMutableListIterator::findPrevious(const T &value)
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,458 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Copyright (C) 2016 Ivailo Monev
|
||||
**
|
||||
** This file is part of the QtCore module of the Katie Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QLINKEDLIST_H
|
||||
#define QLINKEDLIST_H
|
||||
|
||||
#include <QtCore/qiterator.h>
|
||||
#include <QtCore/qatomic.h>
|
||||
|
||||
#include <iterator>
|
||||
#include <list>
|
||||
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
struct Q_CORE_EXPORT QLinkedListData
|
||||
{
|
||||
QLinkedListData *n, *p;
|
||||
QAtomicInt ref;
|
||||
int size;
|
||||
|
||||
static QLinkedListData shared_null;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct QLinkedListNode
|
||||
{
|
||||
inline QLinkedListNode(const T &arg): t(arg) { }
|
||||
QLinkedListNode *n, *p;
|
||||
T t;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class Q_CORE_EXPORT QLinkedList
|
||||
{
|
||||
typedef QLinkedListNode<T> Node;
|
||||
union { QLinkedListData *d; QLinkedListNode<T> *e; };
|
||||
|
||||
public:
|
||||
inline QLinkedList() : d(&QLinkedListData::shared_null) { d->ref.ref(); }
|
||||
inline QLinkedList(const QLinkedList<T> &l) : d(l.d) { d->ref.ref(); }
|
||||
~QLinkedList();
|
||||
QLinkedList<T> &operator=(const QLinkedList<T> &);
|
||||
inline QLinkedList<T> &operator=(QLinkedList<T> &&other)
|
||||
{ qSwap(d, other.d); return *this; }
|
||||
inline void swap(QLinkedList<T> &other) { qSwap(d, other.d); }
|
||||
bool operator==(const QLinkedList<T> &l) const;
|
||||
inline bool operator!=(const QLinkedList<T> &l) const { return !(*this == l); }
|
||||
|
||||
inline int size() const { return d->size; }
|
||||
inline bool isEmpty() const { return d->size == 0; }
|
||||
|
||||
void clear();
|
||||
|
||||
void append(const T &);
|
||||
void prepend(const T &);
|
||||
T takeFirst();
|
||||
T takeLast();
|
||||
int removeAll(const T &t);
|
||||
bool removeOne(const T &t);
|
||||
bool contains(const T &t) const;
|
||||
int count(const T &t) const;
|
||||
|
||||
class const_iterator;
|
||||
|
||||
class iterator
|
||||
{
|
||||
public:
|
||||
typedef std::bidirectional_iterator_tag iterator_category;
|
||||
typedef qptrdiff difference_type;
|
||||
typedef T value_type;
|
||||
typedef T *pointer;
|
||||
typedef T &reference;
|
||||
Node *i;
|
||||
inline iterator() : i(nullptr) {}
|
||||
inline iterator(Node *n) : i(n) {}
|
||||
inline iterator(const iterator &o) : i(o.i) {}
|
||||
inline iterator &operator=(const iterator &o) { i = o.i; return *this; }
|
||||
inline T &operator*() const { return i->t; }
|
||||
inline T *operator->() const { return &i->t; }
|
||||
inline bool operator==(const iterator &o) const { return i == o.i; }
|
||||
inline bool operator!=(const iterator &o) const { return i != o.i; }
|
||||
inline bool operator==(const const_iterator &o) const
|
||||
{ return i == o.i; }
|
||||
inline bool operator!=(const const_iterator &o) const
|
||||
{ return i != o.i; }
|
||||
inline iterator &operator++() { i = i->n; return *this; }
|
||||
inline iterator operator++(int) { Node *n = i; i = i->n; return n; }
|
||||
inline iterator &operator--() { i = i->p; return *this; }
|
||||
inline iterator operator--(int) { Node *n = i; i = i->p; return n; }
|
||||
inline iterator operator+(int j) const
|
||||
{ Node *n = i; if (j > 0) while (j--) n = n->n; else while (j++) n = n->p; return n; }
|
||||
inline iterator operator-(int j) const { return operator+(-j); }
|
||||
inline iterator &operator+=(int j) { return *this = *this + j; }
|
||||
inline iterator &operator-=(int j) { return *this = *this - j; }
|
||||
};
|
||||
friend class iterator;
|
||||
|
||||
class const_iterator
|
||||
{
|
||||
public:
|
||||
typedef std::bidirectional_iterator_tag iterator_category;
|
||||
typedef qptrdiff difference_type;
|
||||
typedef T value_type;
|
||||
typedef const T *pointer;
|
||||
typedef const T &reference;
|
||||
Node *i;
|
||||
inline const_iterator() : i(nullptr) {}
|
||||
inline const_iterator(Node *n) : i(n) {}
|
||||
inline const_iterator(const const_iterator &o) : i(o.i){}
|
||||
inline const_iterator(iterator ci) : i(ci.i){}
|
||||
inline const_iterator &operator=(const const_iterator &o) { i = o.i; return *this; }
|
||||
inline const T &operator*() const { return i->t; }
|
||||
inline const T *operator->() const { return &i->t; }
|
||||
inline bool operator==(const const_iterator &o) const { return i == o.i; }
|
||||
inline bool operator!=(const const_iterator &o) const { return i != o.i; }
|
||||
inline const_iterator &operator++() { i = i->n; return *this; }
|
||||
inline const_iterator operator++(int) { Node *n = i; i = i->n; return n; }
|
||||
inline const_iterator &operator--() { i = i->p; return *this; }
|
||||
inline const_iterator operator--(int) { Node *n = i; i = i->p; return n; }
|
||||
inline const_iterator operator+(int j) const
|
||||
{ Node *n = i; if (j > 0) while (j--) n = n->n; else while (j++) n = n->p; return n; }
|
||||
inline const_iterator operator-(int j) const { return operator+(-j); }
|
||||
inline const_iterator &operator+=(int j) { return *this = *this + j; }
|
||||
inline const_iterator &operator-=(int j) { return *this = *this - j; }
|
||||
};
|
||||
friend class const_iterator;
|
||||
|
||||
// stl style
|
||||
inline iterator begin() { detach(); return e->n; }
|
||||
inline const_iterator begin() const { return e->n; }
|
||||
inline const_iterator constBegin() const { return e->n; }
|
||||
inline iterator end() { detach(); return e; }
|
||||
inline const_iterator end() const { return e; }
|
||||
inline const_iterator constEnd() const { return e; }
|
||||
iterator insert(iterator before, const T &t);
|
||||
iterator erase(iterator pos);
|
||||
iterator erase(iterator first, iterator last);
|
||||
|
||||
// more Qt
|
||||
typedef iterator Iterator;
|
||||
typedef const_iterator ConstIterator;
|
||||
inline int count() const { return d->size; }
|
||||
inline T& first() { Q_ASSERT(!isEmpty()); return *begin(); }
|
||||
inline const T& first() const { Q_ASSERT(!isEmpty()); return *begin(); }
|
||||
T& last() { Q_ASSERT(!isEmpty()); return *(--end()); }
|
||||
const T& last() const { Q_ASSERT(!isEmpty()); return *(--end()); }
|
||||
inline void removeFirst() { Q_ASSERT(!isEmpty()); erase(begin()); }
|
||||
inline void removeLast() { Q_ASSERT(!isEmpty()); erase(--end()); }
|
||||
inline bool startsWith(const T &t) const { return !isEmpty() && first() == t; }
|
||||
inline bool endsWith(const T &t) const { return !isEmpty() && last() == t; }
|
||||
|
||||
// stl compatibility
|
||||
inline void push_back(const T &t) { append(t); }
|
||||
inline void push_front(const T &t) { prepend(t); }
|
||||
inline T& front() { return first(); }
|
||||
inline const T& front() const { return first(); }
|
||||
inline T& back() { return last(); }
|
||||
inline const T& back() const { return last(); }
|
||||
inline void pop_front() { removeFirst(); }
|
||||
inline void pop_back() { removeLast(); }
|
||||
inline bool empty() const { return isEmpty(); }
|
||||
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;
|
||||
|
||||
static inline QLinkedList<T> fromStdList(const std::list<T> &list)
|
||||
{ QLinkedList<T> tmp; qCopy(list.begin(), list.end(), std::back_inserter(tmp)); return tmp; }
|
||||
inline std::list<T> toStdList() const
|
||||
{ std::list<T> tmp; qCopy(constBegin(), constEnd(), std::back_inserter(tmp)); return tmp; }
|
||||
|
||||
|
||||
// comfort
|
||||
QLinkedList<T> &operator+=(const QLinkedList<T> &l);
|
||||
QLinkedList<T> operator+(const QLinkedList<T> &l) const;
|
||||
inline QLinkedList<T> &operator+=(const T &t) { append(t); return *this; }
|
||||
inline QLinkedList<T> &operator<< (const T &t) { append(t); return *this; }
|
||||
inline QLinkedList<T> &operator<<(const QLinkedList<T> &l) { *this += l; return *this; }
|
||||
|
||||
private:
|
||||
inline void detach() { if (d->ref != 1) detach_helper(); }
|
||||
void detach_helper();
|
||||
void freeData(QLinkedListData*);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
inline QLinkedList<T>::~QLinkedList()
|
||||
{
|
||||
if (!d->ref.deref())
|
||||
freeData(d);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void QLinkedList<T>::detach_helper()
|
||||
{
|
||||
union { QLinkedListData *d; Node *e; } x;
|
||||
x.d = new QLinkedListData;
|
||||
x.d->ref = 1;
|
||||
x.d->size = d->size;
|
||||
Node *original = e->n;
|
||||
Node *copy = x.e;
|
||||
while (original != e) {
|
||||
copy->n = new Node(original->t);
|
||||
copy->n->p = copy;
|
||||
original = original->n;
|
||||
copy = copy->n;
|
||||
}
|
||||
copy->n = x.e;
|
||||
x.e->p = copy;
|
||||
if (!d->ref.deref())
|
||||
freeData(d);
|
||||
d = x.d;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void QLinkedList<T>::freeData(QLinkedListData *x)
|
||||
{
|
||||
Node *y = reinterpret_cast<Node*>(x);
|
||||
Node *i = y->n;
|
||||
if (x->ref == 0) {
|
||||
while(i != y) {
|
||||
Node *n = i;
|
||||
i = i->n;
|
||||
delete n;
|
||||
}
|
||||
delete x;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void QLinkedList<T>::clear()
|
||||
{
|
||||
*this = QLinkedList<T>();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
QLinkedList<T> &QLinkedList<T>::operator=(const QLinkedList<T> &l)
|
||||
{
|
||||
if (d != l.d) {
|
||||
QLinkedListData *o = l.d;
|
||||
o->ref.ref();
|
||||
if (!d->ref.deref())
|
||||
freeData(d);
|
||||
d = o;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool QLinkedList<T>::operator== (const QLinkedList<T> &l) const
|
||||
{
|
||||
if (d->size != l.d->size)
|
||||
return false;
|
||||
if (e == l.e)
|
||||
return true;
|
||||
Node *i = e->n;
|
||||
Node *il = l.e->n;
|
||||
while (i != e) {
|
||||
if (! (i->t == il->t))
|
||||
return false;
|
||||
i = i->n;
|
||||
il = il->n;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void QLinkedList<T>::append(const T &t)
|
||||
{
|
||||
detach();
|
||||
Node *i = new Node(t);
|
||||
i->n = e;
|
||||
i->p = e->p;
|
||||
i->p->n = i;
|
||||
e->p = i;
|
||||
d->size++;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void QLinkedList<T>::prepend(const T &t)
|
||||
{
|
||||
detach();
|
||||
Node *i = new Node(t);
|
||||
i->n = e->n;
|
||||
i->p = e;
|
||||
i->n->p = i;
|
||||
e->n = i;
|
||||
d->size++;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
int QLinkedList<T>::removeAll(const T &_t)
|
||||
{
|
||||
detach();
|
||||
const T t = _t;
|
||||
Node *i = e->n;
|
||||
int c = 0;
|
||||
while (i != e) {
|
||||
if (i->t == t) {
|
||||
Node *n = i;
|
||||
i->n->p = i->p;
|
||||
i->p->n = i->n;
|
||||
i = i->n;
|
||||
delete n;
|
||||
c++;
|
||||
} else {
|
||||
i = i->n;
|
||||
}
|
||||
}
|
||||
d->size-=c;
|
||||
return c;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool QLinkedList<T>::removeOne(const T &_t)
|
||||
{
|
||||
detach();
|
||||
iterator it = qFind(begin(), end(), _t);
|
||||
if (it != end()) {
|
||||
erase(it);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T QLinkedList<T>::takeFirst()
|
||||
{
|
||||
T t = first();
|
||||
removeFirst();
|
||||
return t;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T QLinkedList<T>::takeLast()
|
||||
{
|
||||
T t = last();
|
||||
removeLast();
|
||||
return t;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool QLinkedList<T>::contains(const T &t) const
|
||||
{
|
||||
Node *i = e;
|
||||
while ((i = i->n) != e)
|
||||
if (i->t == t)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
int QLinkedList<T>::count(const T &t) const
|
||||
{
|
||||
Node *i = e;
|
||||
int c = 0;
|
||||
while ((i = i->n) != e)
|
||||
if (i->t == t)
|
||||
c++;
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
typename QLinkedList<T>::iterator QLinkedList<T>::insert(iterator before, const T &t)
|
||||
{
|
||||
Node *i = before.i;
|
||||
Node *m = new Node(t);
|
||||
m->n = i;
|
||||
m->p = i->p;
|
||||
m->p->n = m;
|
||||
i->p = m;
|
||||
d->size++;
|
||||
return m;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
typename QLinkedList<T>::iterator QLinkedList<T>::erase(typename QLinkedList<T>::iterator afirst,
|
||||
typename QLinkedList<T>::iterator alast)
|
||||
{
|
||||
while (afirst != alast)
|
||||
erase(afirst++);
|
||||
return alast;
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
typename QLinkedList<T>::iterator QLinkedList<T>::erase(iterator pos)
|
||||
{
|
||||
detach();
|
||||
Node *i = pos.i;
|
||||
if (i != e) {
|
||||
Node *n = i;
|
||||
i->n->p = i->p;
|
||||
i->p->n = i->n;
|
||||
i = i->n;
|
||||
delete n;
|
||||
d->size--;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
QLinkedList<T> &QLinkedList<T>::operator+=(const QLinkedList<T> &l)
|
||||
{
|
||||
detach();
|
||||
int n = l.d->size;
|
||||
d->size += n;
|
||||
Node *original = l.e->n;
|
||||
while (n--) {
|
||||
Node *copy = new Node(original->t);
|
||||
original = original->n;
|
||||
copy->n = e;
|
||||
copy->p = e->p;
|
||||
copy->p->n = copy;
|
||||
e->p = copy;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
QLinkedList<T> QLinkedList<T>::operator+(const QLinkedList<T> &l) const
|
||||
{
|
||||
QLinkedList<T> n = *this;
|
||||
n += l;
|
||||
return n;
|
||||
}
|
||||
|
||||
Q_DECLARE_SEQUENTIAL_ITERATOR(LinkedList)
|
||||
Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR(LinkedList)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
||||
#endif // QLINKEDLIST_H
|
|
@ -280,18 +280,14 @@ void **QListData::erase(void **xi)
|
|||
stores a list of values and provides fast index-based access as
|
||||
well as fast insertions and removals.
|
||||
|
||||
QList\<T\>, QLinkedList\<T\>, and QVector\<T\> provide similar
|
||||
functionality. Here's an overview:
|
||||
QList\<T\>, and QVector\<T\> provide similar functionality.
|
||||
Here's an overview:
|
||||
|
||||
\list
|
||||
\i For most purposes, QList is the right class to use. Its
|
||||
index-based API is more convenient than QLinkedList's
|
||||
iterator-based API, and it is usually faster than
|
||||
QVector because of the way it stores its items in
|
||||
memory. It also expands to less code in your executable.
|
||||
\i If you need a real linked list, with guarantees of \l{constant
|
||||
time} insertions in the middle of the list and iterators to
|
||||
items rather than indexes, use QLinkedList.
|
||||
\i For most purposes, QList is the right class to use. It is
|
||||
usually faster than QVector because of the way it stores
|
||||
its items in memory. It also expands to less code in your
|
||||
executable.
|
||||
\i If you want the items to occupy adjacent memory positions,
|
||||
use QVector.
|
||||
\endlist
|
||||
|
@ -415,7 +411,7 @@ void **QListData::erase(void **xi)
|
|||
value that might not be in the valid range, check that it is less
|
||||
than the value returned by size() but \e not less than 0.
|
||||
|
||||
\sa QListIterator, QMutableListIterator, QLinkedList, QVector
|
||||
\sa QListIterator, QMutableListIterator, QVector
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -1162,9 +1158,7 @@ void **QListData::erase(void **xi)
|
|||
|
||||
Multiple iterators can be used on the same list. However, be
|
||||
aware that any non-const function call performed on the QList
|
||||
will render all existing iterators undefined. If you need to keep
|
||||
iterators over a long period of time, we recommend that you use
|
||||
QLinkedList rather than QList.
|
||||
will render all existing iterators undefined.
|
||||
|
||||
\sa QList::const_iterator, QMutableListIterator
|
||||
*/
|
||||
|
@ -1411,9 +1405,7 @@ void **QListData::erase(void **xi)
|
|||
|
||||
Multiple iterators can be used on the same list. However, be
|
||||
aware that any non-const function call performed on the QList
|
||||
will render all existing iterators undefined. If you need to keep
|
||||
iterators over a long period of time, we recommend that you use
|
||||
QLinkedList rather than QList.
|
||||
will render all existing iterators undefined.
|
||||
|
||||
\sa QList::iterator, QListIterator
|
||||
*/
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
places inside Qt and was added to Qt's public API for the
|
||||
convenience of advanced users.
|
||||
|
||||
\sa QVector, QList, QLinkedList
|
||||
\sa QVector, QList
|
||||
*/
|
||||
|
||||
/*! \fn QVarLengthArray::QVarLengthArray(int size)
|
||||
|
@ -354,8 +354,7 @@
|
|||
For large arrays, this operation can be slow (\l{linear time}),
|
||||
because it requires moving all the items in the vector by one
|
||||
position further in memory. If you want a container class that
|
||||
provides a fast prepend() function, use QList or QLinkedList
|
||||
instead.
|
||||
provides a fast prepend() function, use QList instead.
|
||||
|
||||
\sa append(), insert()
|
||||
*/
|
||||
|
@ -468,9 +467,7 @@
|
|||
|
||||
For large arrays, this operation can be slow (\l{linear time}),
|
||||
because it requires moving all the items at indexes \a i and
|
||||
above by one position further in memory. If you want a container
|
||||
class that provides a fast insert() function, use QLinkedList
|
||||
instead.
|
||||
above by one position further in memory.
|
||||
|
||||
\sa remove()
|
||||
*/
|
||||
|
|
|
@ -89,20 +89,15 @@ int QVectorData::grow(int sizeofTypedData, int size, int sizeofT, bool excessive
|
|||
stores its items in adjacent memory locations and provides fast
|
||||
index-based access.
|
||||
|
||||
QList\<T\>, QLinkedList\<T\>, and QVarLengthArray\<T\> provide
|
||||
similar functionality. Here's an overview:
|
||||
QList\<T\> and QVarLengthArray\<T\> provide similar functionality.
|
||||
Here's an overview:
|
||||
|
||||
\list
|
||||
\i For most purposes, QList is the right class to use. Operations
|
||||
like prepend() and insert() are usually faster than with
|
||||
QVector because of the way QList stores its items in memory
|
||||
(see \l{Algorithmic Complexity} for details),
|
||||
and its index-based API is more convenient than QLinkedList's
|
||||
iterator-based API. It also expands to less code in your
|
||||
executable.
|
||||
\i If you need a real linked list, with guarantees of \l{constant
|
||||
time} insertions in the middle of the list and iterators to
|
||||
items rather than indexes, use QLinkedList.
|
||||
(see \l{Algorithmic Complexity} for details). It also expands
|
||||
to less code in your executable.
|
||||
\i If you want the items to occupy adjacent memory positions, or
|
||||
if your items are larger than a pointer and you want to avoid
|
||||
the overhead of allocating them on the heap individually at
|
||||
|
@ -171,7 +166,7 @@ int QVectorData::grow(int sizeofTypedData, int size, int sizeofT, bool excessive
|
|||
(\l{linear time}) for large vectors, because they require moving many
|
||||
items in the vector by one position in memory. If you want a container
|
||||
class that provides fast insertion/removal in the middle, use
|
||||
QList or QLinkedList instead.
|
||||
QList instead.
|
||||
|
||||
Unlike plain C++ arrays, QVectors can be resized at any time by
|
||||
calling resize(). If the new size is larger than the old size,
|
||||
|
@ -210,7 +205,7 @@ int QVectorData::grow(int sizeofTypedData, int size, int sizeofT, bool excessive
|
|||
with references to its own values. Doing so will cause your application to
|
||||
abort with an error message.
|
||||
|
||||
\sa QVectorIterator, QMutableVectorIterator, QList, QLinkedList
|
||||
\sa QVectorIterator, QMutableVectorIterator, QList
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -486,8 +481,7 @@ int QVectorData::grow(int sizeofTypedData, int size, int sizeofT, bool excessive
|
|||
For large vectors, this operation can be slow (\l{linear time}),
|
||||
because it requires moving all the items in the vector by one
|
||||
position further in memory. If you want a container class that
|
||||
provides a fast prepend() function, use QList or QLinkedList
|
||||
instead.
|
||||
provides a fast prepend() function, use QList instead.
|
||||
|
||||
\sa append(), insert()
|
||||
*/
|
||||
|
@ -503,9 +497,7 @@ int QVectorData::grow(int sizeofTypedData, int size, int sizeofT, bool excessive
|
|||
|
||||
For large vectors, this operation can be slow (\l{linear time}),
|
||||
because it requires moving all the items at indexes \a i and
|
||||
above by one position further in memory. If you want a container
|
||||
class that provides a fast insert() function, use QLinkedList
|
||||
instead.
|
||||
above by one position further in memory.
|
||||
|
||||
\sa append(), prepend(), remove()
|
||||
*/
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include <QtGui/qwidget.h>
|
||||
#include <QtGui/qapplication.h>
|
||||
#include <QtCore/qlinkedlist.h>
|
||||
#include <QtCore/qlist.h>
|
||||
#include <QtCore/qstack.h>
|
||||
#include <QtCore/qqueue.h>
|
||||
|
||||
|
@ -2482,7 +2482,7 @@ QGraphicsAnchorLayoutPrivate::getGraphParts(Orientation orientation)
|
|||
edgeL1 = graph[orientation].edgeData(layoutFirstVertex[orientation], layoutLastVertex[orientation]);
|
||||
}
|
||||
|
||||
QLinkedList<QSimplexConstraint *> remainingConstraints;
|
||||
QList<QSimplexConstraint *> remainingConstraints;
|
||||
for (int i = 0; i < constraints[orientation].count(); ++i) {
|
||||
remainingConstraints += constraints[orientation].at(i);
|
||||
}
|
||||
|
@ -2501,7 +2501,7 @@ QGraphicsAnchorLayoutPrivate::getGraphParts(Orientation orientation)
|
|||
do {
|
||||
dirty = false;
|
||||
|
||||
QLinkedList<QSimplexConstraint *>::iterator it = remainingConstraints.begin();
|
||||
QList<QSimplexConstraint *>::iterator it = remainingConstraints.begin();
|
||||
while (it != remainingConstraints.end()) {
|
||||
QSimplexConstraint *c = *it;
|
||||
bool match = false;
|
||||
|
@ -2541,7 +2541,7 @@ QGraphicsAnchorLayoutPrivate::getGraphParts(Orientation orientation)
|
|||
|
||||
if (!remainingConstraints.isEmpty()) {
|
||||
QList<QSimplexConstraint *> nonTrunkConstraints;
|
||||
QLinkedList<QSimplexConstraint *>::iterator it = remainingConstraints.begin();
|
||||
QList<QSimplexConstraint *>::iterator it = remainingConstraints.begin();
|
||||
while (it != remainingConstraints.end()) {
|
||||
nonTrunkConstraints += *it;
|
||||
++it;
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
//
|
||||
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QLinkedList>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QSet>
|
||||
#include <QtCore/QDebug>
|
||||
|
@ -92,7 +91,7 @@ public:
|
|||
void updateRemovedRows(int start, int end);
|
||||
void updateRemovedColumns(int start, int end);
|
||||
|
||||
typedef QLinkedList<Span *> SpanList;
|
||||
typedef QList<Span *> SpanList;
|
||||
SpanList spans; //lists of all spans
|
||||
private:
|
||||
//the indexes are negative so the QMap::lowerBound do what i need.
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "qscriptengine.h"
|
||||
#include "qscriptengine_p.h"
|
||||
#include "qscriptvalue_p.h"
|
||||
#include "qlinkedlist.h"
|
||||
#include "qlist.h"
|
||||
|
||||
|
||||
#include "JSObject.h"
|
||||
|
@ -123,9 +123,9 @@ public:
|
|||
}
|
||||
|
||||
QScriptValue objectValue;
|
||||
QLinkedList<JSC::Identifier> propertyNames;
|
||||
QLinkedList<JSC::Identifier>::iterator it;
|
||||
QLinkedList<JSC::Identifier>::iterator current;
|
||||
QList<JSC::Identifier> propertyNames;
|
||||
QList<JSC::Identifier>::iterator it;
|
||||
QList<JSC::Identifier>::iterator current;
|
||||
bool initialized;
|
||||
};
|
||||
|
||||
|
|
|
@ -358,8 +358,6 @@ static const struct ClassTblData {
|
|||
{ QLatin1String("QLineEdit"), QLatin1String("QtGui/qlineedit.h") },
|
||||
{ QLatin1String("QLineF"), QLatin1String("QtCore/qline.h") },
|
||||
{ QLatin1String("QLinearGradient"), QLatin1String("QtGui/qbrush.h") },
|
||||
{ QLatin1String("QLinkedList"), QLatin1String("QtCore/qlinkedlist.h") },
|
||||
{ QLatin1String("QLinkedListData"), QLatin1String("QtCore/qlinkedlist.h") },
|
||||
{ QLatin1String("QList"), QLatin1String("QtCore/qlist.h") },
|
||||
{ QLatin1String("QListData"), QLatin1String("QtCore/qlist.h") },
|
||||
{ QLatin1String("QListView"), QLatin1String("QtGui/qlistview.h") },
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include <QtTest/QtTest>
|
||||
#include <QtCore/QBuffer>
|
||||
#include <QLinkedList>
|
||||
#include <QList>
|
||||
#include <QtCore/qendian.h>
|
||||
#include <QtGui/QtGui>
|
||||
#include <QtSvg/QtSvg>
|
||||
|
@ -167,7 +167,7 @@ private slots:
|
|||
|
||||
void status_QHash_QMap();
|
||||
|
||||
void status_QLinkedList_QList_QVector();
|
||||
void status_QList_QVector();
|
||||
|
||||
void streamToAndFromQByteArray();
|
||||
|
||||
|
@ -2814,17 +2814,6 @@ void tst_QDataStream::status_QHash_QMap()
|
|||
QCOMPARE(list.size(), expectedList.size()); \
|
||||
QCOMPARE(list, expectedList); \
|
||||
} \
|
||||
{ \
|
||||
LinkedList expectedLinkedList; \
|
||||
for (int i = 0; i < expectedList.count(); ++i) \
|
||||
expectedLinkedList << expectedList.at(i); \
|
||||
QByteArray ba = byteArray; \
|
||||
QDataStream stream(&ba, QIODevice::ReadOnly); \
|
||||
stream >> linkedList; \
|
||||
QCOMPARE((int)stream.status(), (int)expectedStatus); \
|
||||
QCOMPARE(linkedList.size(), expectedLinkedList.size()); \
|
||||
QCOMPARE(linkedList, expectedLinkedList); \
|
||||
} \
|
||||
{ \
|
||||
Vector expectedVector; \
|
||||
for (int i = 0; i < expectedList.count(); ++i) \
|
||||
|
@ -2837,12 +2826,10 @@ void tst_QDataStream::status_QHash_QMap()
|
|||
QCOMPARE(vector, expectedVector); \
|
||||
}
|
||||
|
||||
void tst_QDataStream::status_QLinkedList_QList_QVector()
|
||||
void tst_QDataStream::status_QList_QVector()
|
||||
{
|
||||
typedef QLinkedList<QString> LinkedList;
|
||||
typedef QList<QString> List;
|
||||
typedef QVector<QString> Vector;
|
||||
LinkedList linkedList;
|
||||
List list;
|
||||
Vector vector;
|
||||
|
||||
|
|
|
@ -205,7 +205,7 @@ void CppGenerator::operator () ()
|
|||
<< endl;
|
||||
}
|
||||
|
||||
QBitArray used_rules (grammar.rules.count ());
|
||||
QBitArray used_rules (grammar.rules.size ());
|
||||
|
||||
int q = 0;
|
||||
for (StatePointer state = aut.states.begin (); state != aut.states.end (); ++state, ++q)
|
||||
|
|
|
@ -313,7 +313,7 @@ QPair<StatePointer, bool> Automaton::internState (const State &state)
|
|||
|
||||
struct _Bucket
|
||||
{
|
||||
QLinkedList<ItemPointer> items;
|
||||
QList<ItemPointer> items;
|
||||
|
||||
void insert (ItemPointer item)
|
||||
{ items.push_back (item); }
|
||||
|
@ -322,7 +322,7 @@ struct _Bucket
|
|||
{
|
||||
State st (aut->_M_grammar);
|
||||
|
||||
for (QLinkedList<ItemPointer>::iterator item = items.begin (); item != items.end (); ++item)
|
||||
for (QList<ItemPointer>::iterator item = items.begin (); item != items.end (); ++item)
|
||||
st.insert ((*item)->next ());
|
||||
|
||||
return st;
|
||||
|
|
|
@ -27,11 +27,12 @@
|
|||
#include <QtCore/QSet>
|
||||
#include <QtCore/QStack>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QLinkedList>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QTextStream>
|
||||
#include <QtCore/QPair>
|
||||
|
||||
#include <vector>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class Rule;
|
||||
|
@ -127,21 +128,21 @@ public:
|
|||
};
|
||||
|
||||
// names
|
||||
typedef QLinkedList<QString>::iterator Name;
|
||||
typedef QLinkedList<Name> NameList;
|
||||
typedef std::vector<QString>::iterator Name;
|
||||
typedef std::vector<Name> NameList;
|
||||
typedef OrderedSet<Name> NameSet;
|
||||
|
||||
// items
|
||||
typedef QLinkedList<Item> ItemList;
|
||||
typedef std::vector<Item> ItemList;
|
||||
typedef ItemList::iterator ItemPointer;
|
||||
|
||||
// rules
|
||||
typedef QLinkedList<Rule> debug_infot;
|
||||
typedef std::vector<Rule> debug_infot;
|
||||
typedef debug_infot::iterator RulePointer;
|
||||
typedef QMultiMap<Name, RulePointer> RuleMap;
|
||||
|
||||
// states
|
||||
typedef QLinkedList<State> StateList;
|
||||
typedef std::vector<State> StateList;
|
||||
typedef StateList::iterator StatePointer;
|
||||
|
||||
// arrows
|
||||
|
@ -239,7 +240,7 @@ class Node
|
|||
public:
|
||||
typedef OrderedSet<Node<_Tp> > Repository;
|
||||
typedef typename Repository::iterator iterator;
|
||||
typedef typename QLinkedList<iterator>::iterator edge_iterator;
|
||||
typedef typename std::vector<iterator>::iterator edge_iterator;
|
||||
|
||||
public:
|
||||
static iterator get (_Tp data);
|
||||
|
@ -277,7 +278,7 @@ public: // attributes
|
|||
mutable bool root;
|
||||
mutable int dfn;
|
||||
mutable _Tp data;
|
||||
mutable QLinkedList<iterator> outs;
|
||||
mutable std::vector<iterator> outs;
|
||||
|
||||
protected:
|
||||
inline Node () {}
|
||||
|
@ -299,7 +300,7 @@ typename Node<_Tp>::iterator Node<_Tp>::get (_Tp data)
|
|||
}
|
||||
|
||||
template <typename _Tp>
|
||||
QPair<typename QLinkedList<typename Node<_Tp>::iterator>::iterator, bool> Node<_Tp>::insertEdge (typename Node<_Tp>::iterator other) const
|
||||
QPair<typename std::vector<typename Node<_Tp>::iterator>::iterator, bool> Node<_Tp>::insertEdge (typename Node<_Tp>::iterator other) const
|
||||
{
|
||||
edge_iterator it = qFind (outs.begin (), outs.end (), other);
|
||||
|
||||
|
@ -335,7 +336,7 @@ public:
|
|||
QString decl_file_name;
|
||||
QString impl_file_name;
|
||||
QString token_prefix;
|
||||
QLinkedList<QString> names;
|
||||
std::vector<QString> names;
|
||||
Name start;
|
||||
NameSet terminals;
|
||||
NameSet non_terminals;
|
||||
|
|
|
@ -104,7 +104,7 @@ int main (int argc, char *argv[])
|
|||
if (! p.parse (file_name))
|
||||
exit (EXIT_FAILURE);
|
||||
|
||||
if (grammar.rules.isEmpty ())
|
||||
if (grammar.rules.size() == 0)
|
||||
{
|
||||
qerr << "*** Fatal. No rules!" << endl;
|
||||
exit (EXIT_FAILURE);
|
||||
|
|
Loading…
Add table
Reference in a new issue