diff options
author | Isak Fyksen <isak.fyksen@qt.io> | 2023-11-10 16:46:33 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2024-03-20 14:21:00 +0000 |
commit | b1e8287b8db5463f9a933302a27671b2b0ca1fa5 (patch) | |
tree | 2f56a2a8ee2a9b00bf2dcc336e5a40371851bdb8 /src/xml/dom/qdom_p.h | |
parent | e5ebb9022ab9e00ab01d0bce527755da77083217 (diff) |
Extract method `bool QDomNodeListPrivate::maybeCreateList()`
Extract duplicated logic to own method, and call where previously used.
Also, make `QDomNodeListPrivate::[list|timestamp]` mutable, to allow
`maybeCreateList()` and `createList()` to be `const` methods, and avoid
`const_cast` in `QDomNodeListPrivate::length()`.
Task-number: QTBUG-115076
Change-Id: I4f3a27315da28082a12cc4f5653567039b4cb376
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/xml/dom/qdom_p.h')
-rw-r--r-- | src/xml/dom/qdom_p.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/xml/dom/qdom_p.h b/src/xml/dom/qdom_p.h index fb71f8ce23..b2ecd534c8 100644 --- a/src/xml/dom/qdom_p.h +++ b/src/xml/dom/qdom_p.h @@ -142,7 +142,8 @@ public: bool operator==(const QDomNodeListPrivate &) const; bool operator!=(const QDomNodeListPrivate &) const; - void createList(); + void createList() const; + bool maybeCreateList() const; QDomNodePrivate *item(int index); int length() const; @@ -153,8 +154,8 @@ public: QDomNodePrivate *node_impl; QString tagname; QString nsURI; - QList<QDomNodePrivate *> list; - long timestamp; + mutable QList<QDomNodePrivate *> list; + mutable long timestamp; }; class QDomNamedNodeMapPrivate |