diff options
author | Ahmad Samir <a.samirh78@gmail.com> | 2021-02-23 13:08:15 +0200 |
---|---|---|
committer | Ahmad Samir <a.samirh78@gmail.com> | 2021-02-24 05:38:32 +0000 |
commit | cae1e9b6d2ec957f8bc4643b898308a404d00a5f (patch) | |
tree | 1524789c5d560ff21af3fd54e4bec2007571965c /src/core/kconfig.cpp | |
parent | 48c132be8aa983165126b0641a083848dd5c6620 (diff) | |
download | kconfig-cae1e9b6d2ec957f8bc4643b898308a404d00a5f.tar.gz kconfig-cae1e9b6d2ec957f8bc4643b898308a404d00a5f.tar.bz2 |
Add KEntryMap::constFindEntry() method
- This has the same logic as QMap::constFind(); less detaching and now we
can use auto keyword when creating iterators and always get a const_iterator
even when calling constFindEntry() on a non-const map.
- Use QCOMPARE() where appropriate in the unit tests.
Diffstat (limited to 'src/core/kconfig.cpp')
-rw-r--r-- | src/core/kconfig.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/core/kconfig.cpp b/src/core/kconfig.cpp index ab6ac5c5..7f53847f 100644 --- a/src/core/kconfig.cpp +++ b/src/core/kconfig.cpp @@ -332,8 +332,8 @@ QStringList KConfigPrivate::keyListImpl(const QByteArray &theGroup) const { QStringList keys; - const KEntryMapConstIterator theEnd = entryMap.constEnd(); - KEntryMapConstIterator it = entryMap.findEntry(theGroup); + const auto theEnd = entryMap.constEnd(); + auto it = entryMap.constFindEntry(theGroup); if (it != theEnd) { ++it; // advance past the special group entry marker @@ -363,8 +363,8 @@ QMap<QString, QString> KConfig::entryMap(const QString &aGroup) const QMap<QString, QString> theMap; const QByteArray theGroup(aGroup.isEmpty() ? "<default>" : aGroup.toUtf8()); - const KEntryMapConstIterator theEnd = d->entryMap.constEnd(); - KEntryMapConstIterator it = d->entryMap.findEntry(theGroup, {}, {}); + const auto theEnd = d->entryMap.constEnd(); + auto it = d->entryMap.constFindEntry(theGroup, {}, {}); if (it != theEnd) { ++it; // advance past the special group entry marker @@ -981,7 +981,7 @@ QByteArray KConfigPrivate::lookupData(const QByteArray &group, const char *key, if (bReadDefaults) { flags |= KEntryMap::SearchDefaults; } - const KEntryMapConstIterator it = entryMap.findEntry(group, key, flags); + const auto it = entryMap.constFindEntry(group, key, flags); if (it == entryMap.constEnd()) { return QByteArray(); } |