diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-11-02 16:30:05 +0100 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-11-06 10:16:31 +0100 |
commit | dfec79f5d818e3cf1390e9c149501603c36d409b (patch) | |
tree | 7c3144886d5bc958f68b14565e88f560b9b1ce99 /src/gui/text | |
parent | 4a66fb9d763c94620f44fba61790078c132a5370 (diff) |
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 <jonas.karlsson@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src/gui/text')
-rw-r--r-- | src/gui/text/qtextobject.cpp | 17 | ||||
-rw-r--r-- | src/gui/text/qtextobject.h | 35 |
2 files changed, 20 insertions, 32 deletions
diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp index 91e607ca0e..45e07ac5b5 100644 --- a/src/gui/text/qtextobject.cpp +++ b/src/gui/text/qtextobject.cpp @@ -648,27 +648,12 @@ QTextFrame::iterator QTextFrame::end() const */ /*! - \internal -*/ -QTextFrame::iterator::iterator(QTextFrame *frame, int block, int begin, int end) -{ - f = frame; - b = begin; - e = end; - cf = nullptr; - cb = block; -} - -/*! + \fn QTextFrame *QTextFrame::iterator::currentFrame() const Returns the current frame pointed to by the iterator, or \nullptr if the iterator currently points to a block. \sa currentBlock() */ -QTextFrame *QTextFrame::iterator::currentFrame() const -{ - return cf; -} /*! Returns the current block the iterator points to. If the iterator 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<QTextFrame *> 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; } }; |