From dfec79f5d818e3cf1390e9c149501603c36d409b Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Mon, 2 Nov 2020 16:30:05 +0100 Subject: Unexport QTextFrame/Block::iterator classes Inline private constructors, use class initialization consistently. Export only non-inline'd members. Change-Id: I18f38214bbd03af711fe7ee1314d59e06733a0ec Reviewed-by: Jonas Karlsson Reviewed-by: Giuseppe D'Angelo --- src/gui/text/qtextobject.h | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'src/gui/text/qtextobject.h') diff --git a/src/gui/text/qtextobject.h b/src/gui/text/qtextobject.h index fbe3e7b9e4..c41893f37a 100644 --- a/src/gui/text/qtextobject.h +++ b/src/gui/text/qtextobject.h @@ -135,7 +135,7 @@ public: QList childFrames() const; QTextFrame *parentFrame() const; - class Q_GUI_EXPORT iterator { + class iterator { QTextFrame *f = nullptr; int b = 0; int e = 0; @@ -145,21 +145,23 @@ public: friend class QTextFrame; friend class QTextTableCell; friend class QTextDocumentLayoutPrivate; - iterator(QTextFrame *frame, int block, int begin, int end); + inline iterator(QTextFrame *frame, int block, int begin, int end) + : f(frame), b(begin), e(end), cb(block) + {} public: constexpr iterator() noexcept = default; QTextFrame *parentFrame() const { return f; } - QTextFrame *currentFrame() const; - QTextBlock currentBlock() const; + QTextFrame *currentFrame() const { return cf; } + Q_GUI_EXPORT QTextBlock currentBlock() const; bool atEnd() const { return !cf && cb == e; } inline bool operator==(const iterator &o) const { return f == o.f && cf == o.cf && cb == o.cb; } inline bool operator!=(const iterator &o) const { return f != o.f || cf != o.cf || cb != o.cb; } - iterator &operator++(); + Q_GUI_EXPORT iterator &operator++(); inline iterator operator++(int) { iterator tmp = *this; operator++(); return tmp; } - iterator &operator--(); + Q_GUI_EXPORT iterator &operator--(); inline iterator operator--(int) { iterator tmp = *this; operator--(); return tmp; } }; @@ -241,25 +243,26 @@ public: void setLineCount(int count); int lineCount() const; - class Q_GUI_EXPORT iterator { - const QTextDocumentPrivate *p; - int b; - int e; - int n; + class iterator { + const QTextDocumentPrivate *p = nullptr; + int b = 0; + int e = 0; + int n = 0; friend class QTextBlock; - iterator(const QTextDocumentPrivate *priv, int begin, int end, int f) : p(priv), b(begin), e(end), n(f) {} + iterator(const QTextDocumentPrivate *priv, int begin, int end, int f) + : p(priv), b(begin), e(end), n(f) {} public: - iterator() : p(nullptr), b(0), e(0), n(0) {} + constexpr iterator() = default; - QTextFragment fragment() const; + Q_GUI_EXPORT QTextFragment fragment() const; bool atEnd() const { return n == e; } inline bool operator==(const iterator &o) const { return p == o.p && n == o.n; } inline bool operator!=(const iterator &o) const { return p != o.p || n != o.n; } - iterator &operator++(); + Q_GUI_EXPORT iterator &operator++(); inline iterator operator++(int) { iterator tmp = *this; operator++(); return tmp; } - iterator &operator--(); + Q_GUI_EXPORT iterator &operator--(); inline iterator operator--(int) { iterator tmp = *this; operator--(); return tmp; } }; -- cgit v1.2.3