diff options
Diffstat (limited to 'src/qmldom')
| -rw-r--r-- | src/qmldom/qqmldomastcreator.cpp | 26 | ||||
| -rw-r--r-- | src/qmldom/qqmldomcomments.cpp | 10 | ||||
| -rw-r--r-- | src/qmldom/qqmldomcomments_p.h | 4 | ||||
| -rw-r--r-- | src/qmldom/qqmldomelements_p.h | 2 | ||||
| -rw-r--r-- | src/qmldom/qqmldomerrormessage.cpp | 14 | ||||
| -rw-r--r-- | src/qmldom/qqmldomexternalitems_p.h | 6 | ||||
| -rw-r--r-- | src/qmldom/qqmldomitem_p.h | 24 | ||||
| -rw-r--r-- | src/qmldom/qqmldomlinewriter.cpp | 12 | ||||
| -rw-r--r-- | src/qmldom/qqmldomlinewriter_p.h | 2 | ||||
| -rw-r--r-- | src/qmldom/qqmldommoduleindex.cpp | 4 | ||||
| -rw-r--r-- | src/qmldom/qqmldompath.cpp | 62 | ||||
| -rw-r--r-- | src/qmldom/qqmldomstringdumper.cpp | 8 | ||||
| -rw-r--r-- | src/qmldom/qqmldomtop_p.h | 4 |
13 files changed, 89 insertions, 89 deletions
diff --git a/src/qmldom/qqmldomastcreator.cpp b/src/qmldom/qqmldomastcreator.cpp index 2559a6febf..78c896619e 100644 --- a/src/qmldom/qqmldomastcreator.cpp +++ b/src/qmldom/qqmldomastcreator.cpp @@ -133,9 +133,9 @@ class QmlDomAstCreator final : public AST::Visitor template<typename T> StackEl ¤tEl(int idx = 0) { - Q_ASSERT_X(idx < nodeStack.length() && idx >= 0, "currentQmlObjectOrComponentEl", + Q_ASSERT_X(idx < nodeStack.size() && idx >= 0, "currentQmlObjectOrComponentEl", "Stack does not contain enough elements!"); - int i = nodeStack.length() - idx; + int i = nodeStack.size() - idx; while (i-- > 0) { DomType k = nodeStack.at(i).item.kind; if (k == T::kindValue) @@ -155,9 +155,9 @@ class QmlDomAstCreator final : public AST::Visitor StackEl ¤tQmlObjectOrComponentEl(int idx = 0) { - Q_ASSERT_X(idx < nodeStack.length() && idx >= 0, "currentQmlObjectOrComponentEl", + Q_ASSERT_X(idx < nodeStack.size() && idx >= 0, "currentQmlObjectOrComponentEl", "Stack does not contain enough elements!"); - int i = nodeStack.length() - idx; + int i = nodeStack.size() - idx; while (i-- > 0) { DomType k = nodeStack.at(i).item.kind; if (k == DomType::QmlObject || k == DomType::QmlComponent) @@ -169,16 +169,16 @@ class QmlDomAstCreator final : public AST::Visitor StackEl ¤tNodeEl(int i = 0) { - Q_ASSERT_X(i < nodeStack.length() && i >= 0, "currentNode", + Q_ASSERT_X(i < nodeStack.size() && i >= 0, "currentNode", "Stack does not contain element!"); - return nodeStack[nodeStack.length() - i - 1]; + return nodeStack[nodeStack.size() - i - 1]; } DomValue ¤tNode(int i = 0) { - Q_ASSERT_X(i < nodeStack.length() && i >= 0, "currentNode", + Q_ASSERT_X(i < nodeStack.size() && i >= 0, "currentNode", "Stack does not contain element!"); - return nodeStack[nodeStack.length() - i - 1].item; + return nodeStack[nodeStack.size() - i - 1].item; } void removeCurrentNode(std::optional<DomType> expectedType) @@ -471,7 +471,7 @@ public: currentEl<QmlObject>() .path.field(Fields::bindings) .key(pDef.name) - .index(obj.m_bindings.values(pDef.name).length() - 1), + .index(obj.m_bindings.values(pDef.name).size() - 1), ann); } } @@ -591,11 +591,11 @@ public: scope.addPrototypePath(Paths::lookupTypePath(scope.name())); QmlObject *sPtr = nullptr; Path sPathFromOwner; - if (!arrayBindingLevels.isEmpty() && nodeStack.length() == arrayBindingLevels.last()) { + if (!arrayBindingLevels.isEmpty() && nodeStack.size() == arrayBindingLevels.last()) { if (currentNode().kind == DomType::Binding) { QList<QmlObject> *vals = std::get<Binding>(currentNode().value).arrayValue(); if (vals) { - int idx = vals->length(); + int idx = vals->size(); vals->append(scope); sPathFromOwner = currentNodeEl().path.field(Fields::value).index(idx); sPtr = &((*vals)[idx]); @@ -631,7 +631,7 @@ public: { QmlObject &obj = current<QmlObject>(); int idx = currentIndex(); - if (!arrayBindingLevels.isEmpty() && nodeStack.length() == arrayBindingLevels.last() + 1) { + if (!arrayBindingLevels.isEmpty() && nodeStack.size() == arrayBindingLevels.last() + 1) { if (currentNode(1).kind == DomType::Binding) { Binding &b = std::get<Binding>(currentNode(1).value); QList<QmlObject> *vals = b.arrayValue(); @@ -814,7 +814,7 @@ public: createMap(currentNodeEl().fileLocations, Path::Field(Fields::value), nullptr); FileLocations::addRegion(arrayList, u"leftSquareBrace", el->lbracketToken); FileLocations::addRegion(arrayList, u"rightSquareBrace", el->lbracketToken); - arrayBindingLevels.append(nodeStack.length()); + arrayBindingLevels.append(nodeStack.size()); return true; } diff --git a/src/qmldom/qqmldomcomments.cpp b/src/qmldom/qqmldomcomments.cpp index 19e1328d6e..257916cffa 100644 --- a/src/qmldom/qqmldomcomments.cpp +++ b/src/qmldom/qqmldomcomments.cpp @@ -68,12 +68,12 @@ CommentInfo gets such a raw comment string and makes the various pieces availabl CommentInfo::CommentInfo(QStringView rawComment) : rawComment(rawComment) { commentBegin = 0; - while (commentBegin < quint32(rawComment.length()) && rawComment.at(commentBegin).isSpace()) { + while (commentBegin < quint32(rawComment.size()) && rawComment.at(commentBegin).isSpace()) { if (rawComment.at(commentBegin) == QLatin1Char('\n')) hasStartNewline = true; ++commentBegin; } - if (commentBegin < quint32(rawComment.length())) { + if (commentBegin < quint32(rawComment.size())) { QString expectedEnd; switch (rawComment.at(commentBegin).unicode()) { case '/': @@ -98,7 +98,7 @@ CommentInfo::CommentInfo(QStringView rawComment) : rawComment(rawComment) break; } commentEnd = commentBegin + commentStartStr.size(); - quint32 rawEnd = quint32(rawComment.length()); + quint32 rawEnd = quint32(rawComment.size()); while (commentEnd < rawEnd && rawComment.at(commentEnd).isSpace()) ++commentEnd; commentContentEnd = commentContentBegin = commentEnd; @@ -106,9 +106,9 @@ CommentInfo::CommentInfo(QStringView rawComment) : rawComment(rawComment) while (commentEnd < rawEnd) { QChar c = rawComment.at(commentEnd); if (c == e1) { - if (expectedEnd.length() > 1) { + if (expectedEnd.size() > 1) { if (++commentEnd < rawEnd && rawComment.at(commentEnd) == expectedEnd.at(1)) { - Q_ASSERT(expectedEnd.length() == 2); + Q_ASSERT(expectedEnd.size() == 2); commentEndStr = rawComment.mid(++commentEnd - 2, 2); break; } else { diff --git a/src/qmldom/qqmldomcomments_p.h b/src/qmldom/qqmldomcomments_p.h index fe7638913a..5dd541684e 100644 --- a/src/qmldom/qqmldomcomments_p.h +++ b/src/qmldom/qqmldomcomments_p.h @@ -145,7 +145,7 @@ public: Path addPreComment(const Comment &comment, QString regionName) { auto &preList = regionComments[regionName].preComments; - index_type idx = preList.length(); + index_type idx = preList.size(); preList.append(comment); return Path::Field(Fields::regionComments) .key(regionName) @@ -156,7 +156,7 @@ public: Path addPostComment(const Comment &comment, QString regionName) { auto &postList = regionComments[regionName].postComments; - index_type idx = postList.length(); + index_type idx = postList.size(); postList.append(comment); return Path::Field(Fields::regionComments) .key(regionName) diff --git a/src/qmldom/qqmldomelements_p.h b/src/qmldom/qqmldomelements_p.h index 0f5159e535..341ca1e68f 100644 --- a/src/qmldom/qqmldomelements_p.h +++ b/src/qmldom/qqmldomelements_p.h @@ -541,7 +541,7 @@ public: bool isSignalHandler() const { QString baseName = m_name.split(QLatin1Char('.')).last(); - if (baseName.startsWith(u"on") && baseName.length() > 2 && baseName.at(2).isUpper()) + if (baseName.startsWith(u"on") && baseName.size() > 2 && baseName.at(2).isUpper()) return true; return false; } diff --git a/src/qmldom/qqmldomerrormessage.cpp b/src/qmldom/qqmldomerrormessage.cpp index 6eb9ce98ea..d4b95850e2 100644 --- a/src/qmldom/qqmldomerrormessage.cpp +++ b/src/qmldom/qqmldomerrormessage.cpp @@ -72,20 +72,20 @@ and use it to create new ErrorMessages using its debug, warning, error,... metho void ErrorGroups::dump(Sink sink) const { - for (int i = 0; i < groups.length(); ++i) + for (int i = 0; i < groups.size(); ++i) groups.at(i).dump(sink); } void ErrorGroups::dumpId(Sink sink) const { - for (int i = 0; i < groups.length(); ++i) + for (int i = 0; i < groups.size(); ++i) groups.at(i).dumpId(sink); } QCborArray ErrorGroups::toCbor() const { QCborArray res; - for (int i = 0; i < groups.length(); ++i) + for (int i = 0; i < groups.size(); ++i) res.append(QCborValue(groups.at(i).groupId())); return res; } @@ -163,7 +163,7 @@ void ErrorGroups::fatal(Dumper msg, Path element, QStringView canonicalFilePath, int ibuf = 0; auto sink = [&ibuf, &buf](QStringView s) { int is = 0; - while (ibuf < FatalMsgMaxLen && is < s.length()) { + while (ibuf < FatalMsgMaxLen && is < s.size()) { QChar c = s.at(is); if (c == QChar::fromLatin1('\n') || c == QChar::fromLatin1('\r') || (c >= QChar::fromLatin1(' ') && c <= QChar::fromLatin1('~'))) buf[ibuf++] = c.toLatin1(); @@ -236,11 +236,11 @@ int ErrorGroups::cmp(const ErrorGroups &o1, const ErrorGroups &o2) { auto &g1 = o1.groups; auto &g2 = o2.groups; - if (g1.length() < g2.length()) + if (g1.size() < g2.size()) return -1; - if (g1.length() < g2.length()) + if (g1.size() < g2.size()) return 1; - for (int i = 0; i < g1.length(); ++i) { + for (int i = 0; i < g1.size(); ++i) { int c = std::strcmp(g1.at(i).groupId().data(), g2.at(i).groupId().data()); if (c != 0) return c; diff --git a/src/qmldom/qqmldomexternalitems_p.h b/src/qmldom/qqmldomexternalitems_p.h index 4f6648f9e4..7bd51a30d1 100644 --- a/src/qmldom/qqmldomexternalitems_p.h +++ b/src/qmldom/qqmldomexternalitems_p.h @@ -286,7 +286,7 @@ public: void setImports(const QList<Import> &imports) { m_imports = imports; } Path addImport(const Import &i) { - index_type idx = index_type(m_imports.length()); + index_type idx = index_type(m_imports.size()); m_imports.append(i); if (i.uri.isModule()) { m_importScope.addImport((i.importId.isEmpty() @@ -313,7 +313,7 @@ public: void setPragmas(QList<Pragma> pragmas) { m_pragmas = pragmas; } Path addPragma(const Pragma &pragma) { - int idx = m_pragmas.length(); + int idx = m_pragmas.size(); m_pragmas.append(pragma); return Path::Field(Fields::pragmas).index(idx); } @@ -383,7 +383,7 @@ public: void setExports(QMultiMap<QString, Export> e) { m_exports = e; } Path addExport(const Export &e) { - index_type i = m_exports.values(e.typeName).length(); + index_type i = m_exports.values(e.typeName).size(); m_exports.insert(e.typeName, e); addUri(e.uri, e.version.majorVersion); return canonicalPath().field(Fields::exports).index(i); diff --git a/src/qmldom/qqmldomitem_p.h b/src/qmldom/qqmldomitem_p.h index f5fca3bc41..10945734da 100644 --- a/src/qmldom/qqmldomitem_p.h +++ b/src/qmldom/qqmldomitem_p.h @@ -407,7 +407,7 @@ public: for (void *p : pList) m_pList.append(p); } else if (options == ListOptions::Reverse) { - for (qsizetype i = pList.length(); i-- != 0;) + for (qsizetype i = pList.size(); i-- != 0;) // probably writing in reverse and reading sequentially would be better m_pList.append(pList.at(i)); } else { @@ -1204,21 +1204,21 @@ List List::fromQList( std::function<DomItem(DomItem &, const PathEls::PathComponent &, T &)> elWrapper, ListOptions options) { - index_type len = list.length(); + index_type len = list.size(); if (options == ListOptions::Reverse) { return List( pathFromOwner, [list, elWrapper](DomItem &self, index_type i) mutable { - if (i < 0 || i >= list.length()) + if (i < 0 || i >= list.size()) return DomItem(); - return elWrapper(self, PathEls::Index(i), list[list.length() - i - 1]); + return elWrapper(self, PathEls::Index(i), list[list.size() - i - 1]); }, [len](DomItem &) { return len; }, nullptr, QLatin1String(typeid(T).name())); } else { return List( pathFromOwner, [list, elWrapper](DomItem &self, index_type i) mutable { - if (i < 0 || i >= list.length()) + if (i < 0 || i >= list.size()) return DomItem(); return elWrapper(self, PathEls::Index(i), list[i]); }, @@ -1236,21 +1236,21 @@ List List::fromQListRef( return List( pathFromOwner, [&list, elWrapper](DomItem &self, index_type i) { - if (i < 0 || i >= list.length()) + if (i < 0 || i >= list.size()) return DomItem(); - return elWrapper(self, PathEls::Index(i), list[list.length() - i - 1]); + return elWrapper(self, PathEls::Index(i), list[list.size() - i - 1]); }, - [&list](DomItem &) { return list.length(); }, nullptr, + [&list](DomItem &) { return list.size(); }, nullptr, QLatin1String(typeid(T).name())); } else { return List( pathFromOwner, [&list, elWrapper](DomItem &self, index_type i) { - if (i < 0 || i >= list.length()) + if (i < 0 || i >= list.size()) return DomItem(); return elWrapper(self, PathEls::Index(i), list[i]); }, - [&list](DomItem &) { return list.length(); }, nullptr, + [&list](DomItem &) { return list.size(); }, nullptr, QLatin1String(typeid(T).name())); } } @@ -1635,7 +1635,7 @@ template<typename T> Path appendUpdatableElementInQList(Path listPathFromOwner, QList<T> &list, const T &value, T **vPtr = nullptr) { - int idx = list.length(); + int idx = list.size(); list.append(value); Path newPath = listPathFromOwner.index(idx); T &targetV = list[idx]; @@ -1946,7 +1946,7 @@ bool ListPT<T>::iterateDirectSubpaths(DomItem &self, DirectVisitor v) template<typename T> DomItem ListPT<T>::index(DomItem &self, index_type index) const { - if (index >= 0 && index < m_pList.length()) + if (index >= 0 && index < m_pList.size()) return self.wrap(PathEls::Index(index), *reinterpret_cast<T *>(m_pList.value(index))); return DomItem(); } diff --git a/src/qmldom/qqmldomlinewriter.cpp b/src/qmldom/qqmldomlinewriter.cpp index cb312b4fa7..c0110e8bf9 100644 --- a/src/qmldom/qqmldomlinewriter.cpp +++ b/src/qmldom/qqmldomlinewriter.cpp @@ -94,10 +94,10 @@ LineWriter &LineWriter::ensureSpace(QStringView space, TextAddType t) if (ind.nNewlines > 0) ensureNewline(ind.nNewlines, t); if (cc != counter() || m_currentLine.isEmpty() - || !m_currentLine.at(m_currentLine.length() - 1).isSpace()) + || !m_currentLine.at(m_currentLine.size() - 1).isSpace()) write(ind.trailingString, t); else { - int len = m_currentLine.length(); + int len = m_currentLine.size(); int i = len; while (i != 0 && m_currentLine.at(i - 1).isSpace()) --i; @@ -109,8 +109,8 @@ LineWriter &LineWriter::ensureSpace(QStringView space, TextAddType t) ind = IndentInfo(space, tabSize, trailingSpaceStartColumn); if (i == 0) { if (indExisting.column < ind.column) { - qint32 utf16Change = ind.trailingString.length() - trailingSpace.length(); - m_currentColumnNr += ind.trailingString.length() - trailingSpace.length(); + qint32 utf16Change = ind.trailingString.size() - trailingSpace.size(); + m_currentColumnNr += ind.trailingString.size() - trailingSpace.size(); m_currentLine.replace( i, len - i, ind.trailingString.toString()); // invalidates most QStringViews changeAtOffset(i, utf16Change, utf16Change, 0); @@ -341,8 +341,8 @@ void LineWriter::changeAtOffset(quint32 offset, qint32 change, qint32 colChange, int LineWriter::column(int index) { - if (index > m_currentLine.length()) - index = m_currentLine.length(); + if (index > m_currentLine.size()) + index = m_currentLine.size(); IndentInfo iInfo(QStringView(m_currentLine).mid(0, index), m_options.formatOptions.tabSize, m_columnNr); return iInfo.column; diff --git a/src/qmldom/qqmldomlinewriter_p.h b/src/qmldom/qqmldomlinewriter_p.h index b3efadd958..ff7c075899 100644 --- a/src/qmldom/qqmldomlinewriter_p.h +++ b/src/qmldom/qqmldomlinewriter_p.h @@ -45,7 +45,7 @@ public: column = initialColumn + fixup; const QChar tab = QLatin1Char('\t'); int iStart = 0; - int len = line.length(); + int len = line.size(); for (int i = 0; i < len; i++) { if (line[i] == tab) column = ((column / tabSize) + 1) * tabSize; diff --git a/src/qmldom/qqmldommoduleindex.cpp b/src/qmldom/qqmldommoduleindex.cpp index 5dfb4d7917..37a33c328a 100644 --- a/src/qmldom/qqmldommoduleindex.cpp +++ b/src/qmldom/qqmldommoduleindex.cpp @@ -154,7 +154,7 @@ QSet<QString> ModuleIndex::exportNames(DomItem &self) const { QSet<QString> res; QList<Path> mySources = sources(); - for (int i = 0; i < mySources.length(); ++i) { + for (int i = 0; i < mySources.size(); ++i) { DomItem source = self.path(mySources.at(i)); res += source.field(Fields::exports).keys(); } @@ -230,7 +230,7 @@ QList<DomItem> ModuleIndex::exportsWithNameAndMinorVersion(DomItem &self, QStrin if (minorVersion < 0) minorVersion = std::numeric_limits<int>::max(); int vNow = Version::Undefined; - for (int i = 0; i < mySources.length(); ++i) { + for (int i = 0; i < mySources.size(); ++i) { DomItem source = self.path(mySources.at(i)); DomItem exports = source.field(Fields::exports).key(name); int nExports = exports.indexes(); diff --git a/src/qmldom/qqmldompath.cpp b/src/qmldom/qqmldompath.cpp index 447e0479c4..4554a7cb40 100644 --- a/src/qmldom/qqmldompath.cpp +++ b/src/qmldom/qqmldompath.cpp @@ -90,7 +90,7 @@ QString Filter::name() const { bool Filter::checkName(QStringView s) const { return s.startsWith(u"?(") - && s.mid(2, s.length()-3) == filterDescription + && s.mid(2, s.size()-3) == filterDescription && s.endsWith(u")"); } @@ -181,7 +181,7 @@ const PathEls::PathComponent &Path::component(int i) const i = i - m_length - m_endOffset; auto data = m_data.get(); while (data) { - i += data->components.length(); + i += data->components.size(); if (i >= 0) return qAsConst(data)->components[i]; data = data->parent.get(); @@ -311,7 +311,7 @@ Path Path::fromString(QStringView s, ErrorHandler errorHandler) const QChar backslash = QChar::fromLatin1('\\'); const QChar underscore = QChar::fromLatin1('_'); const QChar tilda = QChar::fromLatin1('~'); - for (int i=0; i < s.length(); ++i) + for (int i=0; i < s.size(); ++i) if (s.at(i) == lsBrace || s.at(i) == dot) ++len; QVector<Component> components; @@ -320,25 +320,25 @@ Path Path::fromString(QStringView s, ErrorHandler errorHandler) int i0 = 0; PathEls::ParserState state = PathEls::ParserState::Start; QStringList strVals; - while (i < s.length()) { + while (i < s.size()) { // skip space - while (i < s.length() && s.at(i).isSpace()) + while (i < s.size() && s.at(i).isSpace()) ++i; - if (i >= s.length()) + if (i >= s.size()) break; QChar c = s.at(i++); switch (state) { case PathEls::ParserState::Start: if (c == dollar) { i0 = i; - while (i < s.length() && s.at(i).isLetterOrNumber()){ + while (i < s.size() && s.at(i).isLetterOrNumber()){ ++i; } components.append(Component(PathEls::Root(s.mid(i0,i-i0)))); state = PathEls::ParserState::End; } else if (c == at) { i0 = i; - while (i < s.length() && s.at(i).isLetterOrNumber()){ + while (i < s.size() && s.at(i).isLetterOrNumber()){ ++i; } components.append(Component(PathEls::Current(s.mid(i0,i-i0)))); @@ -355,7 +355,7 @@ Path Path::fromString(QStringView s, ErrorHandler errorHandler) case PathEls::ParserState::IndexOrKey: if (c.isDigit()) { i0 = i-1; - while (i < s.length() && s.at(i).isDigit()) + while (i < s.size() && s.at(i).isDigit()) ++i; bool ok; components.append(Component(static_cast<index_type>(s.mid(i0,i-i0).toString() @@ -367,14 +367,14 @@ Path Path::fromString(QStringView s, ErrorHandler errorHandler) } } else if (c.isLetter() || c == tilda || c == underscore) { i0 = i-1; - while (i < s.length() && (s.at(i).isLetterOrNumber() || s.at(i) == underscore || s.at(i) == tilda)) + while (i < s.size() && (s.at(i).isLetterOrNumber() || s.at(i) == underscore || s.at(i) == tilda)) ++i; components.append(Component(PathEls::Key(s.mid(i0, i - i0).toString()))); } else if (c == quote) { i0 = i; QString strVal; bool properEnd = false; - while (i < s.length()) { + while (i < s.size()) { c = s.at(i); if (c == quote) { properEnd = true; @@ -406,16 +406,16 @@ Path Path::fromString(QStringView s, ErrorHandler errorHandler) } else if (c == QChar::fromLatin1('*')) { components.append(Component(PathEls::Any())); } else if (c == QChar::fromLatin1('?')) { - while (i < s.length() && s.at(i).isSpace()) + while (i < s.size() && s.at(i).isSpace()) ++i; - if (i >= s.length() || s.at(i) != QChar::fromLatin1('(')) { + if (i >= s.size() || s.at(i) != QChar::fromLatin1('(')) { myErrors().error(tr("Expected a brace in filter after the question mark (at char %1).") .arg(QString::number(i))).handle(errorHandler); return Path(); } i0 = ++i; - while (i < s.length() && s.at(i) != QChar::fromLatin1(')')) ++i; // check matching braces when skipping?? - if (i >= s.length() || s.at(i) != QChar::fromLatin1(')')) { + while (i < s.size() && s.at(i) != QChar::fromLatin1(')')) ++i; // check matching braces when skipping?? + if (i >= s.size() || s.at(i) != QChar::fromLatin1(')')) { myErrors().error(tr("Expected a closing brace in filter after the question mark (at char %1).") .arg(QString::number(i))).handle(errorHandler); return Path(); @@ -429,8 +429,8 @@ Path Path::fromString(QStringView s, ErrorHandler errorHandler) .arg(c).arg(i-1)).handle(errorHandler); return Path(); } - while (i < s.length() && s.at(i).isSpace()) ++i; - if (i >= s.length() || s.at(i) != rsBrace) { + while (i < s.size() && s.at(i).isSpace()) ++i; + if (i >= s.size() || s.at(i) != rsBrace) { myErrors().error(tr("square braces misses closing brace at char %1.") .arg(QString::number(i))).handle(errorHandler); return Path(); @@ -441,20 +441,20 @@ Path Path::fromString(QStringView s, ErrorHandler errorHandler) break; case PathEls::ParserState::End: if (c == dot) { - while (i < s.length() && s.at(i).isSpace()) ++i; - if (i == s.length()) { + while (i < s.size() && s.at(i).isSpace()) ++i; + if (i == s.size()) { components.append(Component()); state = PathEls::ParserState::End; } else if (s.at(i).isLetter() || s.at(i) == underscore || s.at(i) == tilda) { i0 = i; - while (i < s.length() && (s.at(i).isLetterOrNumber() || s.at(i) == underscore || s.at(i) == tilda)) { + while (i < s.size() && (s.at(i).isLetterOrNumber() || s.at(i) == underscore || s.at(i) == tilda)) { ++i; } components.append(Component(PathEls::Field(s.mid(i0,i-i0)))); state = PathEls::ParserState::End; } else if (s.at(i).isDigit()) { i0 = i; - while (i < s.length() && s.at(i).isDigit()){ + while (i < s.size() && s.at(i).isDigit()){ ++i; } bool ok; @@ -474,14 +474,14 @@ Path Path::fromString(QStringView s, ErrorHandler errorHandler) state = PathEls::ParserState::End; } else if (s.at(i) == at) { i0 = ++i; - while (i < s.length() && s.at(i).isLetterOrNumber()){ + while (i < s.size() && s.at(i).isLetterOrNumber()){ ++i; } components.append(Component(PathEls::Current(s.mid(i0,i-i0)))); state = PathEls::ParserState::End; } else if (s.at(i) == dollar) { i0 = ++i; - while (i < s.length() && s.at(i).isLetterOrNumber()){ + while (i < s.size() && s.at(i).isLetterOrNumber()){ ++i; } components.append(Component(PathEls::Root(s.mid(i0,i-i0)))); @@ -512,7 +512,7 @@ Path Path::fromString(QStringView s, ErrorHandler errorHandler) return Path(); case PathEls::ParserState::End: - return Path(0, components.length(), std::shared_ptr<PathEls::PathData>( + return Path(0, components.size(), std::shared_ptr<PathEls::PathData>( new PathEls::PathData(strVals, components))); } Q_ASSERT(false && "Unexpected state in Path::fromString"); @@ -728,9 +728,9 @@ Path Path::path(Path toAdd, bool avoidToAddAsBase) const } data = toAdd.m_data.get(); while (data) { - for (int ij = 0; ij < data->strData.length(); ++ij) { + for (int ij = 0; ij < data->strData.size(); ++ij) { bool hasAlready = false; - for (int ii = 0; ii < myStrs.length() && !hasAlready; ++ii) + for (int ii = 0; ii < myStrs.size() && !hasAlready; ++ii) hasAlready = inQString(data->strData[ij], myStrs[ii]); if (!hasAlready) addedStrs.append(data->strData[ij]); @@ -743,7 +743,7 @@ Path Path::path(Path toAdd, bool avoidToAddAsBase) const components.append(toAdd.component(i)); QStringView compStrView = toAdd.component(i).stringView(); if (!compStrView.isEmpty()) { - for (int j = 0; j < addedStrs.length(); ++j) { + for (int j = 0; j < addedStrs.size(); ++j) { if (inQString(compStrView, addedStrs[j])) { toAddStrs.append(addedStrs[j]); addedStrs.removeAt(j); @@ -761,7 +761,7 @@ Path Path::expandFront() const int newLen = 0; auto data = m_data.get(); while (data) { - newLen += data->components.length(); + newLen += data->components.size(); data = data->parent.get(); } newLen -= m_endOffset; @@ -822,14 +822,14 @@ Path Path::noEndOffset() const // peel back qint16 endOffset = m_endOffset; std::shared_ptr<PathEls::PathData> lastData = m_data; - while (lastData && endOffset >= lastData->components.length()) { - endOffset -= lastData->components.length(); + while (lastData && endOffset >= lastData->components.size()) { + endOffset -= lastData->components.size(); lastData = lastData->parent; } if (endOffset > 0) { Q_ASSERT(lastData && "Internal problem, reference to non existing PathData"); return Path(0, m_length, std::shared_ptr<PathEls::PathData>( - new PathEls::PathData(lastData->strData, lastData->components.mid(0, lastData->components.length() - endOffset), lastData->parent))); + new PathEls::PathData(lastData->strData, lastData->components.mid(0, lastData->components.size() - endOffset), lastData->parent))); } return Path(0, m_length, lastData); } diff --git a/src/qmldom/qqmldomstringdumper.cpp b/src/qmldom/qqmldomstringdumper.cpp index a964a542e0..081a6abf81 100644 --- a/src/qmldom/qqmldomstringdumper.cpp +++ b/src/qmldom/qqmldomstringdumper.cpp @@ -63,7 +63,7 @@ void sinkEscaped(Sink sink, QStringView s, EscapeOptions options) { if (options == EscapeOptions::OuterQuotes) sink(u"\""); int it0=0; - for (int it = 0; it < s.length();++it) { + for (int it = 0; it < s.size();++it) { QChar c=s[it]; bool noslash = c != QLatin1Char('\\'); bool noquote = c != QLatin1Char('"'); @@ -84,7 +84,7 @@ void sinkEscaped(Sink sink, QStringView s, EscapeOptions options) { else Q_ASSERT(0); } - sink(s.mid(it0, s.length() - it0)); + sink(s.mid(it0, s.size() - it0)); if (options == EscapeOptions::OuterQuotes) sink(u"\""); } @@ -161,9 +161,9 @@ void sinkIndent(Sink s, int indent) { if (indent > 0) { QStringView spaces = u" "; - while (indent > spaces.length()) { + while (indent > spaces.size()) { s(spaces); - indent -= spaces.length(); + indent -= spaces.size(); } s(spaces.left(indent)); } diff --git a/src/qmldom/qqmldomtop_p.h b/src/qmldom/qqmldomtop_p.h index f1b0a3b76a..1e020600fc 100644 --- a/src/qmldom/qqmldomtop_p.h +++ b/src/qmldom/qqmldomtop_p.h @@ -567,7 +567,7 @@ public: int nNotDone() const { QMutexLocker l(mutex()); - return m_toDo.length() + m_inProgress.length(); + return m_toDo.size() + m_inProgress.size(); } QList<Dependency> inProgress() const @@ -585,7 +585,7 @@ public: int nCallbacks() const { QMutexLocker l(mutex()); - return m_endCallbacks.length(); + return m_endCallbacks.size(); } private: |
