Clean up special functions for QTextFrame::iterator

Member initialization syntax allows declaring now inline default
constructor as default. Remove copy/move/assignment operators, which
had already been disabled.

Change-Id: Ie407e65aa39c72f5e6436a6beaf9323663f78cfc
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
Volker Hilsheimer 2020-06-08 21:31:44 +02:00
parent 84e76c37a5
commit ea09e2f466
2 changed files with 8 additions and 53 deletions

View File

@ -642,16 +642,10 @@ QTextFrame::iterator QTextFrame::end() const
} }
/*! /*!
\fn QTextFrame::iterator::iterator()
Constructs an invalid iterator. Constructs an invalid iterator.
*/ */
QTextFrame::iterator::iterator()
{
f = nullptr;
b = 0;
e = 0;
cf = nullptr;
cb = 0;
}
/*! /*!
\internal \internal
@ -665,36 +659,6 @@ QTextFrame::iterator::iterator(QTextFrame *frame, int block, int begin, int end)
cb = block; cb = block;
} }
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
/*!
Copy constructor. Constructs a copy of the \a other iterator.
*/
QTextFrame::iterator::iterator(const iterator &other) noexcept
{
f = other.f;
b = other.b;
e = other.e;
cf = other.cf;
cb = other.cb;
}
/*!
Assigns \a other to this iterator and returns a reference to
this iterator.
*/
QTextFrame::iterator &QTextFrame::iterator::operator=(const iterator &other) noexcept
{
f = other.f;
b = other.b;
e = other.e;
cf = other.cf;
cb = other.cb;
return *this;
}
#endif
/*! /*!
Returns the current frame pointed to by the iterator, or \nullptr Returns the current frame pointed to by the iterator, or \nullptr
if the iterator currently points to a block. if the iterator currently points to a block.

View File

@ -136,27 +136,18 @@ public:
QTextFrame *parentFrame() const; QTextFrame *parentFrame() const;
class Q_GUI_EXPORT iterator { class Q_GUI_EXPORT iterator {
QTextFrame *f; QTextFrame *f = nullptr;
int b; int b = 0;
int e; int e = 0;
QTextFrame *cf; QTextFrame *cf = nullptr;
int cb; int cb = 0;
friend class QTextFrame; friend class QTextFrame;
friend class QTextTableCell; friend class QTextTableCell;
friend class QTextDocumentLayoutPrivate; friend class QTextDocumentLayoutPrivate;
iterator(QTextFrame *frame, int block, int begin, int end); iterator(QTextFrame *frame, int block, int begin, int end);
public: public:
iterator(); // ### Qt 6: inline constexpr iterator() noexcept = default;
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
iterator(const iterator &o) noexcept; // = default
iterator &operator=(const iterator &o) noexcept; // = default
iterator(iterator &&other) noexcept // = default
{ memcpy(static_cast<void *>(this), static_cast<void *>(&other), sizeof(iterator)); }
iterator &operator=(iterator &&other) noexcept // = default
{ memcpy(static_cast<void *>(this), static_cast<void *>(&other), sizeof(iterator)); return *this; }
#endif
QTextFrame *parentFrame() const { return f; } QTextFrame *parentFrame() const { return f; }
QTextFrame *currentFrame() const; QTextFrame *currentFrame() const;