mirror of
https://github.com/silverqx/TinyORM.git
synced 2026-01-06 02:49:31 -06:00
used constBegin/End() for Qt containers
This commit is contained in:
@@ -140,7 +140,7 @@ bool MySqlUtilsPrivate::isNumber(const QStringView string)
|
||||
return std::isdigit(ch.toLatin1()) == 0;
|
||||
});
|
||||
|
||||
return nonDigit == string.cend();
|
||||
return nonDigit == string.constEnd();
|
||||
}
|
||||
|
||||
/* Prepared queries */
|
||||
|
||||
@@ -380,7 +380,7 @@ namespace Orm::Tiny::Relations
|
||||
const auto it = std::ranges::find(mergedAttributes, attribute.key, keyProj);
|
||||
|
||||
// Doesn't contain, so append
|
||||
if (it == mergedAttributes.cend())
|
||||
if (it == mergedAttributes.constEnd())
|
||||
mergedAttributes << attribute;
|
||||
// Already contains, update value
|
||||
else
|
||||
|
||||
@@ -98,7 +98,8 @@ const BasicCommand &Blueprint::dropIfExists()
|
||||
const DropColumnsCommand &Blueprint::dropColumns(const QList<QString> &columns)
|
||||
{
|
||||
return addCommand<DropColumnsCommand>(
|
||||
{{}, DropColumn, QList<Column>(columns.cbegin(), columns.cend())});
|
||||
{{}, DropColumn, QList<Column>(columns.constBegin(),
|
||||
columns.constEnd())});
|
||||
}
|
||||
|
||||
const DropColumnsCommand &Blueprint::dropColumn(const QString &column)
|
||||
@@ -169,7 +170,7 @@ Blueprint::foreign(const QList<QString> &columns, const QString &indexName)
|
||||
{{}, Foreign,
|
||||
indexName.isEmpty() ? createIndexName(Foreign, columns)
|
||||
: indexName,
|
||||
QList<Column>(columns.cbegin(), columns.cend())});
|
||||
QList<Column>(columns.constBegin(), columns.constEnd())});
|
||||
|
||||
}
|
||||
|
||||
@@ -715,7 +716,7 @@ Blueprint::indexCommand(const QString &type, const QList<QString> &columns,
|
||||
{{}, type,
|
||||
indexName.isEmpty() ? createIndexName(type, columns)
|
||||
: indexName,
|
||||
QList<Column>(columns.cbegin(), columns.cend()),
|
||||
QList<Column>(columns.constBegin(), columns.constEnd()),
|
||||
algorithm, language});
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ bool String::isNumber(const QStringView string, const bool allowFloating,
|
||||
if (string.isEmpty())
|
||||
return false;
|
||||
|
||||
const auto *itBegin = string.cbegin();
|
||||
const auto *itBegin = string.constBegin();
|
||||
if (string.front() == PLUS || string.front() == MINUS) {
|
||||
if (allowPlusMinus)
|
||||
++itBegin; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
|
||||
@@ -59,7 +59,7 @@ bool String::isNumber(const QStringView string, const bool allowFloating,
|
||||
auto dotAlreadyFound = false;
|
||||
|
||||
const auto *const nonDigit = std::find_if(
|
||||
itBegin, string.cend(),
|
||||
itBegin, string.constEnd(),
|
||||
[allowFloating, &dotAlreadyFound](const auto &ch)
|
||||
{
|
||||
// Integer type
|
||||
@@ -81,7 +81,7 @@ bool String::isNumber(const QStringView string, const bool allowFloating,
|
||||
return result;
|
||||
});
|
||||
|
||||
return nonDigit == string.cend();
|
||||
return nonDigit == string.constEnd();
|
||||
}
|
||||
|
||||
namespace
|
||||
|
||||
@@ -211,7 +211,7 @@ Type::classPureBasenameMsvc(const QString &className, const bool withNamespace)
|
||||
};
|
||||
|
||||
// Find the beginning of the class name
|
||||
const auto *itBegin = className.cbegin();
|
||||
const auto *itBegin = className.constBegin();
|
||||
|
||||
// Include the namespace in the result
|
||||
if (withNamespace)
|
||||
@@ -232,7 +232,7 @@ Type::classPureBasenameMsvc(const QString &className, const bool withNamespace)
|
||||
}
|
||||
|
||||
// Find the end of the class name
|
||||
const auto *itEnd = std::find_if(itBegin, className.cend(),
|
||||
const auto *itEnd = std::find_if(itBegin, className.constEnd(),
|
||||
[](const QChar ch)
|
||||
{
|
||||
// The class name can end with < or space (anything else can't be at the end)
|
||||
@@ -250,7 +250,7 @@ Type::classPureBasenameGcc(const QString &className, const bool withNamespace)
|
||||
"in Orm::Utils::Type::classPureBasenameGcc().");
|
||||
|
||||
// Find the beginning of the class name
|
||||
const auto *itBegin = className.cbegin();
|
||||
const auto *itBegin = className.constBegin();
|
||||
|
||||
if (!withNamespace)
|
||||
// Have the namespace and :: found, +2 to point after
|
||||
@@ -260,7 +260,7 @@ Type::classPureBasenameGcc(const QString &className, const bool withNamespace)
|
||||
itBegin += toBegin + 2; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
|
||||
|
||||
// Find the end of the class name
|
||||
const auto *itEnd = std::find_if(itBegin, className.cend(),
|
||||
const auto *itEnd = std::find_if(itBegin, className.constEnd(),
|
||||
[](const QChar ch)
|
||||
{
|
||||
// The class name can end with <, * or space, anything else
|
||||
|
||||
@@ -2066,7 +2066,7 @@ void tst_Model_Relations::push_EagerLoad() const
|
||||
|
||||
const auto files = torrent->getRelation<TorrentPreviewableFileEager>("torrentFiles");
|
||||
const auto itFile = std::ranges::find_if(files, findFile2);
|
||||
if (itFile == files.cend())
|
||||
if (itFile == files.constEnd())
|
||||
QFAIL("File was not found in the files vector.");
|
||||
auto *file = *itFile;
|
||||
auto *fileProperty =
|
||||
@@ -2105,7 +2105,7 @@ void tst_Model_Relations::push_EagerLoad() const
|
||||
const auto filesVerify = torrentVerify->getRelation<TorrentPreviewableFileEager>(
|
||||
"torrentFiles");
|
||||
const auto itFileVerify = std::ranges::find_if(filesVerify, findFile2);
|
||||
if (itFileVerify == filesVerify.cend())
|
||||
if (itFileVerify == filesVerify.constEnd())
|
||||
QFAIL("File to verify was not found in the filesVerify vector.");
|
||||
auto *fileVerify = *itFileVerify;
|
||||
auto *filePropertyVerify =
|
||||
@@ -2151,7 +2151,7 @@ void tst_Model_Relations::push_LazyLoad() const
|
||||
|
||||
const auto files = torrent->getRelationValue<TorrentPreviewableFile>("torrentFiles");
|
||||
const auto itFile = std::ranges::find_if(files, findFile2);
|
||||
if (itFile == files.cend())
|
||||
if (itFile == files.constEnd())
|
||||
QFAIL("File was not found in the files vector.");
|
||||
auto *file = *itFile;
|
||||
auto *fileProperty =
|
||||
@@ -2189,7 +2189,7 @@ void tst_Model_Relations::push_LazyLoad() const
|
||||
const auto filesVerify = torrentVerify->getRelationValue<TorrentPreviewableFile>(
|
||||
"torrentFiles");
|
||||
const auto itFileVerify = std::ranges::find_if(filesVerify, findFile2);
|
||||
if (itFileVerify == filesVerify.cend())
|
||||
if (itFileVerify == filesVerify.constEnd())
|
||||
QFAIL("File to verify was not found in the filesVerify vector.");
|
||||
auto *fileVerify = *itFileVerify;
|
||||
auto *filePropertyVerify =
|
||||
|
||||
Reference in New Issue
Block a user