mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 18:32:55 +00:00
get rid of QScopedArrayPointer<T> [ci reset]
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
6282dac25c
commit
24a9adf12d
10 changed files with 3 additions and 130 deletions
|
@ -758,8 +758,6 @@ katie_generate_obsolete(QRectF QtCore qrect.h)
|
|||
katie_generate_obsolete(QRegExpValidator QtGui qvalidator.h)
|
||||
katie_generate_obsolete(QResizeEvent QtGui qevent.h)
|
||||
katie_generate_obsolete(QReturnArgument QtCore qobjectdefs.h)
|
||||
katie_generate_obsolete(QScopedArrayPointer QtCore qscopedpointer.h)
|
||||
katie_generate_obsolete(QScopedPointerArrayDeleter QtCore qscopedpointer.h)
|
||||
katie_generate_obsolete(QScopedPointerPodDeleter QtCore qscopedpointer.h)
|
||||
katie_generate_obsolete(QSetIterator QtCore qset.h)
|
||||
katie_generate_obsolete(QSharedDataPointer QtCore qshareddata.h)
|
||||
|
|
|
@ -280,7 +280,7 @@ endfunction()
|
|||
# depend on KtNetwork depend on plugins that depend on it too
|
||||
add_custom_target(plugins_dependant_tests)
|
||||
function(KATIE_SETUP_PLUGIN FORPLUGIN)
|
||||
add_dependencies(plugins_dependant_tests ${FORPLUGIN})
|
||||
# add_dependencies(plugins_dependant_tests ${FORPLUGIN})
|
||||
endfunction()
|
||||
|
||||
# a macro to ensure that object targets are build with PIC if the target they
|
||||
|
|
|
@ -132,9 +132,7 @@ include/katie/QtCore/QRegExp
|
|||
include/katie/QtCore/QResource
|
||||
include/katie/QtCore/QReturnArgument
|
||||
include/katie/QtCore/QRunnable
|
||||
include/katie/QtCore/QScopedArrayPointer
|
||||
include/katie/QtCore/QScopedPointer
|
||||
include/katie/QtCore/QScopedPointerArrayDeleter
|
||||
include/katie/QtCore/QScopedPointerPodDeleter
|
||||
include/katie/QtCore/QScopedValueRollback
|
||||
include/katie/QtCore/QSemaphore
|
||||
|
|
|
@ -135,9 +135,7 @@ include/katie/QtCore/QRegExp
|
|||
include/katie/QtCore/QResource
|
||||
include/katie/QtCore/QReturnArgument
|
||||
include/katie/QtCore/QRunnable
|
||||
include/katie/QtCore/QScopedArrayPointer
|
||||
include/katie/QtCore/QScopedPointer
|
||||
include/katie/QtCore/QScopedPointerArrayDeleter
|
||||
include/katie/QtCore/QScopedPointerPodDeleter
|
||||
include/katie/QtCore/QScopedValueRollback
|
||||
include/katie/QtCore/QSemaphore
|
||||
|
|
|
@ -135,9 +135,7 @@ include/katie/QtCore/QRegExp
|
|||
include/katie/QtCore/QResource
|
||||
include/katie/QtCore/QReturnArgument
|
||||
include/katie/QtCore/QRunnable
|
||||
include/katie/QtCore/QScopedArrayPointer
|
||||
include/katie/QtCore/QScopedPointer
|
||||
include/katie/QtCore/QScopedPointerArrayDeleter
|
||||
include/katie/QtCore/QScopedPointerPodDeleter
|
||||
include/katie/QtCore/QScopedValueRollback
|
||||
include/katie/QtCore/QSemaphore
|
||||
|
|
|
@ -71,8 +71,6 @@ incmap = {
|
|||
'QReadLocker': 'qreadwritelock.h',
|
||||
'QRectF': 'qrect.h',
|
||||
'QReturnArgument': 'qobjectdefs.h',
|
||||
'QScopedArrayPointer': 'qscopedpointer.h',
|
||||
'QScopedPointerArrayDeleter': 'qscopedpointer.h',
|
||||
'QScopedPointerPodDeleter': 'qscopedpointer.h',
|
||||
'QSetIterator': 'qset.h',
|
||||
'QSharedDataPointer': 'qshareddata.h',
|
||||
|
|
|
@ -475,9 +475,7 @@ classlist = [
|
|||
"QRgb",
|
||||
"QRubberBand",
|
||||
"QRunnable",
|
||||
"QScopedArrayPointer",
|
||||
"QScopedPointer",
|
||||
"QScopedPointerArrayDeleter",
|
||||
"QScopedPointerPodDeleter",
|
||||
"QScopedValueRollback",
|
||||
"QScriptable",
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "qfilesystementry_p.h"
|
||||
#include "qfilesystemmetadata_p.h"
|
||||
#include "qfilesystemengine_p.h"
|
||||
#include "qvarlengtharray.h"
|
||||
#include "qscopedpointer.h"
|
||||
#include "qcorecommon_p.h"
|
||||
|
||||
|
@ -237,7 +238,7 @@ inline void QDirPrivate::sortFileList(QDir::SortFlags sort, QFileInfoList &l,
|
|||
names->append(l.at(i).fileName());
|
||||
}
|
||||
} else {
|
||||
QScopedArrayPointer<QDirSortItem> si(new QDirSortItem[n]);
|
||||
QVarLengthArray<QDirSortItem> si(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
si[i].item = l.at(i);
|
||||
qSort(si.data(), si.data() + n, QDirSortItemComparator(sort));
|
||||
|
|
|
@ -70,8 +70,6 @@ QT_BEGIN_NAMESPACE
|
|||
|
||||
\list
|
||||
\i QScopedPointerDeleter - the default, deletes the pointer using \c delete
|
||||
\i QScopedPointerArrayDeleter - deletes the pointer using \c{delete []}. Use
|
||||
this handler for pointers that were allocated with \c{new []}.
|
||||
\i QScopedPointerPodDeleter - deletes the pointer using \c{free()}. Use this
|
||||
handler for pointers that were allocated with \c{malloc()}.
|
||||
\endlist
|
||||
|
@ -205,58 +203,4 @@ QT_BEGIN_NAMESPACE
|
|||
Swap this pointer with \a other.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\class QScopedArrayPointer
|
||||
|
||||
\brief The QScopedArrayPointer class stores a pointer to a
|
||||
dynamically allocated array of objects, and deletes it upon
|
||||
destruction.
|
||||
|
||||
\since 4.6
|
||||
\reentrant
|
||||
\ingroup misc
|
||||
|
||||
A QScopedArrayPointer is a QScopedPointer that defaults to
|
||||
deleting the object it is pointing to with the delete[] operator. It
|
||||
also features operator[] for convenience, so we can write:
|
||||
|
||||
\code
|
||||
void foo()
|
||||
{
|
||||
QScopedArrayPointer<int> i(new int[10]);
|
||||
i[2] = 42;
|
||||
...
|
||||
return; // our integer array is now deleted using delete[]
|
||||
}
|
||||
\endcode
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QScopedArrayPointer::QScopedArrayPointer()
|
||||
|
||||
Constructs a QScopedArrayPointer instance.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn T *QScopedArrayPointer::operator[](int i)
|
||||
|
||||
Provides access to entry \a i of the scoped pointer's array of
|
||||
objects.
|
||||
|
||||
If the contained pointer is \c null, behavior is undefined.
|
||||
|
||||
\sa isNull()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn T *QScopedArrayPointer::operator[](int i) const
|
||||
|
||||
Provides access to entry \a i of the scoped pointer's array of
|
||||
objects.
|
||||
|
||||
If the contained pointer is \c null, behavior is undefined.
|
||||
|
||||
\sa isNull()
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
@ -45,22 +45,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class QScopedPointerArrayDeleter
|
||||
{
|
||||
public:
|
||||
static inline void cleanup(T *pointer)
|
||||
{
|
||||
// Enforce a complete type.
|
||||
// If you get a compile error here, read the section on forward declared
|
||||
// classes in the QScopedPointer documentation.
|
||||
typedef char IsIncompleteType[ sizeof(T) ? 1 : -1 ];
|
||||
(void) sizeof(IsIncompleteType);
|
||||
|
||||
delete [] pointer;
|
||||
}
|
||||
};
|
||||
|
||||
struct QScopedPointerPodDeleter
|
||||
{
|
||||
static inline void cleanup(void *pointer) { if (pointer) free(pointer); }
|
||||
|
@ -168,50 +152,6 @@ namespace std {
|
|||
}
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
namespace QtPrivate {
|
||||
template <typename X, typename Y> struct QScopedArrayEnsureSameType;
|
||||
template <typename X> struct QScopedArrayEnsureSameType<X,X> { typedef X* Type; };
|
||||
template <typename X> struct QScopedArrayEnsureSameType<const X, X> { typedef X* Type; };
|
||||
}
|
||||
|
||||
template <typename T, typename Cleanup = QScopedPointerArrayDeleter<T> >
|
||||
class QScopedArrayPointer : public QScopedPointer<T, Cleanup>
|
||||
{
|
||||
public:
|
||||
inline QScopedArrayPointer() : QScopedPointer<T, Cleanup>(0) {}
|
||||
|
||||
template <typename D>
|
||||
explicit inline QScopedArrayPointer(D *p, typename QtPrivate::QScopedArrayEnsureSameType<T,D>::Type = 0)
|
||||
: QScopedPointer<T, Cleanup>(p)
|
||||
{
|
||||
}
|
||||
|
||||
inline T &operator[](int i)
|
||||
{
|
||||
return this->d[i];
|
||||
}
|
||||
|
||||
inline const T &operator[](int i) const
|
||||
{
|
||||
return this->d[i];
|
||||
}
|
||||
|
||||
private:
|
||||
explicit inline QScopedArrayPointer(void *) {
|
||||
// Enforce the same type.
|
||||
|
||||
// If you get a compile error here, make sure you declare
|
||||
// QScopedArrayPointer with the same template type as you pass to the
|
||||
// constructor. See also the QScopedPointer documentation.
|
||||
|
||||
// Storing a scalar array as a pointer to a different type is not
|
||||
// allowed and results in undefined behavior.
|
||||
}
|
||||
|
||||
Q_DISABLE_COPY(QScopedArrayPointer)
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QSCOPEDPOINTER_H
|
||||
|
|
Loading…
Add table
Reference in a new issue