4#ifndef QSCOPEDPOINTER_H
5#define QSCOPEDPOINTER_H
7#include <QtCore/qglobal.h>
14struct QScopedPointerDeleter
16 static inline void cleanup(T *pointer)
noexcept
21 typedef char IsIncompleteType[
sizeof(T) ? 1 : -1 ];
22 (
void)
sizeof(IsIncompleteType);
26 void operator()(T *pointer)
const noexcept
35 static inline void cleanup(T *pointer)
noexcept
40 typedef char IsIncompleteType[
sizeof(T) ? 1 : -1 ];
41 (
void)
sizeof(IsIncompleteType);
53 static inline void cleanup(
void *pointer)
noexcept { free(pointer); }
61 static inline void cleanup(T *pointer) {
if (pointer) pointer->deleteLater(); }
69template <
typename T,
typename Cleanup = QScopedPointerDeleter<T> >
81 Cleanup::cleanup(oldD);
124 T *oldD = std::exchange(d, other);
125 Cleanup::cleanup(oldD);
128#if QT_DEPRECATED_SINCE(6
, 1
)
137#if QT_DEPRECATED_SINCE(6
, 2
)
149 return lhs.data() == rhs.data();
154 return lhs.data() != rhs.data();
169 return !lhs.isNull();
174 return !rhs.isNull();
177#if QT_DEPRECATED_SINCE(6
, 2
)
190template <
typename T,
typename Cleanup = QScopedPointerArrayDeleter<T> >
193 template <
typename Ptr>
217#if QT_DEPRECATED_SINCE(6
, 2
)
224 explicit inline QScopedArrayPointer(
void *)
239#if QT_DEPRECATED_SINCE(6
, 2
)
240template <
typename T,
typename Cleanup>
241QT_DEPRECATED_VERSION_X_6_2(
"Use std::unique_ptr instead of QScopedArrayPointer.")
242inline void swap(QScopedArrayPointer<T, Cleanup> &lhs, QScopedArrayPointer<T, Cleanup> &rhs)
noexcept
~QScopedArrayPointer()=default
const T & operator[](qsizetype i) const
Provides access to entry i of the scoped pointer's array of objects.
T & operator[](qsizetype i)
Provides access to entry i of the scoped pointer's array of objects.
friend bool operator==(std::nullptr_t, const QScopedPointer< T, Cleanup > &rhs) noexcept
bool operator!() const noexcept
Returns true if this object refers to \nullptr.
T & operator*() const
Provides access to the scoped pointer's object.
friend bool operator==(const QScopedPointer< T, Cleanup > &lhs, std::nullptr_t) noexcept
T * operator->() const noexcept
Provides access to the scoped pointer's object.
bool isNull() const noexcept
Returns true if this object refers to \nullptr.
void reset(T *other=nullptr) noexcept(noexcept(Cleanup::cleanup(std::declval< T * >())))
Deletes the existing object it is pointing to (if any), and sets its pointer to other.
friend bool operator!=(std::nullptr_t, const QScopedPointer< T, Cleanup > &rhs) noexcept
friend bool operator!=(const QScopedPointer< T, Cleanup > &lhs, std::nullptr_t) noexcept
T * data() const noexcept
Returns the value of the pointer referenced by this object.
friend bool operator!=(const QScopedPointer< T, Cleanup > &lhs, const QScopedPointer< T, Cleanup > &rhs) noexcept
Returns true if lhs and rhs refer to distinct pointers.
friend bool operator==(const QScopedPointer< T, Cleanup > &lhs, const QScopedPointer< T, Cleanup > &rhs) noexcept
Returns true if lhs and rhs refer to the same pointer.
~QScopedPointer()
Destroys this QScopedPointer object.
operator bool() const
Returns true if the contained pointer is not \nullptr.
Combined button and popup list for selecting options.
#define QFILE_MAYBE_EXPLICIT
static const char * qt_build_string() noexcept
static QString getPrefix(QLibraryInfoPrivate::UsageMode usageMode)
static QString prefixFromAppDirHelper()
static bool keepQtBuildDefaults()
QScopedPointerObjectDeleteLater< QObject > QScopedPointerDeleteLater
bool contains(QLatin1StringView str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
qsizetype indexOf(const QString &str, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
bool contains(const QString &str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
QStringList filter(const QLatin1StringMatcher &matcher) const
void sort(Qt::CaseSensitivity cs=Qt::CaseSensitive)
QString join(const QString &sep) const
qsizetype indexOf(QStringView needle, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
QStringList & replaceInStrings(const QString &before, const QString &after, Qt::CaseSensitivity cs=Qt::CaseSensitive)
QString join(QStringView sep) const
qsizetype lastIndexOf(QStringView str, qsizetype from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
QStringList filter(QLatin1StringView needle, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
qsizetype removeDuplicates()
QStringList filter(const QString &str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
QStringList & replaceInStrings(QStringView before, const QString &after, Qt::CaseSensitivity cs=Qt::CaseSensitive)
QStringList & replaceInStrings(QStringView before, QStringView after, Qt::CaseSensitivity cs=Qt::CaseSensitive)
QStringList & replaceInStrings(const QString &before, QStringView after, Qt::CaseSensitivity cs=Qt::CaseSensitive)
QStringList filter(const QStringMatcher &matcher) const
qsizetype lastIndexOf(const QString &str, qsizetype from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
static void cleanup(T *pointer) noexcept
void operator()(T *pointer) const noexcept
void operator()(T *pointer) const
static void cleanup(T *pointer)
void operator()(void *pointer) const noexcept
static void cleanup(void *pointer) noexcept