mirror of
https://github.com/silverqx/TinyORM.git
synced 2025-12-30 15:29:36 -06:00
enabled clang-tidy check
cppcoreguidelines-rvalue-reference-param-not-moved
This commit is contained in:
@@ -49,8 +49,6 @@ Checks:
|
||||
- -cppcoreguidelines-noexcept-move-operations
|
||||
- -cppcoreguidelines-noexcept-swap
|
||||
- -cppcoreguidelines-use-default-member-init
|
||||
# tmp
|
||||
- -cppcoreguidelines-rvalue-reference-param-not-moved
|
||||
WarningsAsErrors: '*'
|
||||
HeaderFilterRegex: '[\\\/]+(examples|orm|tests|tom)[\\\/]+.+\.(h|hpp)$'
|
||||
FormatStyle: none
|
||||
@@ -59,6 +57,8 @@ UseColor: true
|
||||
CheckOptions:
|
||||
- key: cppcoreguidelines-avoid-do-while.IgnoreMacros
|
||||
value: true
|
||||
- key: cppcoreguidelines-rvalue-reference-param-not-moved.AllowPartialMove
|
||||
value: true
|
||||
- key: google-readability-namespace-comments.ShortNamespaceLines
|
||||
value: '5'
|
||||
- key: llvm-namespace-comment.ShortNamespaceLines
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace Connectors
|
||||
/*! Create a new connection instance. */
|
||||
static std::shared_ptr<DatabaseConnection>
|
||||
createConnection(
|
||||
QString &&driver, std::function<ConnectionName()> &&connection,
|
||||
const QString &driver, std::function<ConnectionName()> &&connection,
|
||||
QString &&database, QString &&tablePrefix = "",
|
||||
QtTimeZoneConfig &&qtTimeZone = {QtTimeZoneType::QtTimeSpec, Qt::UTC},
|
||||
QVariantHash &&config = {},
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Orm::Connectors
|
||||
static void configureSearchPath(const QSqlDatabase &connection,
|
||||
const QVariantHash &config);
|
||||
/*! Format the 'search_path' for the database query or DSN. */
|
||||
static QString quoteSearchPath(QStringList &&searchPath);
|
||||
static QString quoteSearchPath(const QStringList &searchPath);
|
||||
|
||||
/*! Set an application name for the connection. */
|
||||
static void configureApplicationName(const QSqlDatabase &connection,
|
||||
|
||||
@@ -23,6 +23,11 @@ namespace Orm::Exceptions
|
||||
/*! QString constructor. */
|
||||
SqlError(const QString &message, const QSqlError &error);
|
||||
|
||||
/*! const char * constructor. */
|
||||
SqlError(const char *message, QSqlError &&error);
|
||||
/*! QString constructor. */
|
||||
SqlError(const QString &message, QSqlError &&error);
|
||||
|
||||
/*! Get the original Qt SQL error. */
|
||||
inline const QSqlError &getSqlError() const noexcept;
|
||||
|
||||
|
||||
@@ -213,7 +213,7 @@ namespace Orm::Query::Grammars
|
||||
const QString &wheres) const;
|
||||
|
||||
/*! Concatenate an array of segments, removing empties. */
|
||||
static QString concatenate(QStringList &&segments);
|
||||
static QString concatenate(const QStringList &segments);
|
||||
/*! Remove the leading boolean from a statement. */
|
||||
static QString removeLeadingBoolean(QString &&statement);
|
||||
|
||||
|
||||
@@ -180,7 +180,8 @@ namespace Grammars
|
||||
QString getType(ColumnDefinition &column) const override;
|
||||
|
||||
/*! Format the column definition for a PostGIS spatial type. */
|
||||
static QString formatPostGisType(QString &&type, const ColumnDefinition &column);
|
||||
static QString formatPostGisType(const QString &type,
|
||||
const ColumnDefinition &column);
|
||||
|
||||
/*! Create the column definition for a char type. */
|
||||
QString typeChar(const ColumnDefinition &column) const;
|
||||
|
||||
@@ -192,7 +192,7 @@ void LogsQueries::logQueryInternal(
|
||||
}
|
||||
|
||||
QVector<QVariant>
|
||||
LogsQueries::convertNamedToPositionalBindings(QVariantMap &&bindings)
|
||||
LogsQueries::convertNamedToPositionalBindings(QVariantMap &&bindings) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
QVector<QVariant> result;
|
||||
result.reserve(bindings.size());
|
||||
|
||||
@@ -282,7 +282,7 @@ void ManagesTransactions::throwIfTransactionError(
|
||||
throw Exceptions::SqlTransactionError(
|
||||
QStringLiteral("Statement in %1() failed : %2")
|
||||
.arg(functionName, queryString),
|
||||
error);
|
||||
std::move(error));
|
||||
}
|
||||
|
||||
} // namespace Orm::Concerns
|
||||
|
||||
@@ -54,7 +54,7 @@ ConfigurationOptionsParser::mergeAndConcatenateOptions(
|
||||
/* protected */
|
||||
|
||||
void ConfigurationOptionsParser::copyOptionsFromTopLevel(
|
||||
QVariantHash &options, std::vector<QString> &&optionNames,
|
||||
QVariantHash &options, std::vector<QString> &&optionNames, // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
const bool checkLowerCase) const
|
||||
{
|
||||
/* Copy the given connection options from the top-level configuration level
|
||||
|
||||
@@ -135,7 +135,7 @@ ConnectionFactory::createQSqlDatabaseResolverWithoutHosts(
|
||||
|
||||
std::shared_ptr<DatabaseConnection>
|
||||
ConnectionFactory::createConnection(
|
||||
QString &&driver, std::function<ConnectionName()> &&connection,
|
||||
const QString &driver, std::function<ConnectionName()> &&connection,
|
||||
QString &&database, QString &&tablePrefix, QtTimeZoneConfig &&qtTimeZone,
|
||||
QVariantHash &&config, const std::optional<bool> returnQDateTime)
|
||||
{
|
||||
|
||||
@@ -158,7 +158,7 @@ void PostgresConnector::configureSearchPath(const QSqlDatabase &connection,
|
||||
m_configureErrorMessage.arg(__tiny_func__), query);
|
||||
}
|
||||
|
||||
QString PostgresConnector::quoteSearchPath(QStringList &&searchPath)
|
||||
QString PostgresConnector::quoteSearchPath(const QStringList &searchPath)
|
||||
{
|
||||
// Allow to set an empty search_path
|
||||
if (isSearchPathEmpty(searchPath))
|
||||
|
||||
@@ -22,6 +22,15 @@ SqlError::SqlError(const QString &message, const QSqlError &error)
|
||||
: SqlError(message.toUtf8().constData(), error)
|
||||
{}
|
||||
|
||||
SqlError::SqlError(const char *message, QSqlError &&error)
|
||||
: RuntimeError(formatMessage(message, error))
|
||||
, m_sqlError(std::move(error))
|
||||
{}
|
||||
|
||||
SqlError::SqlError(const QString &message, QSqlError &&error)
|
||||
: SqlError(message.toUtf8().constData(), std::move(error))
|
||||
{}
|
||||
|
||||
/* protected */
|
||||
|
||||
// NOLINTNEXTLINE(modernize-pass-by-value)
|
||||
|
||||
@@ -615,12 +615,12 @@ QString Grammar::compileDeleteWithJoins(const QueryBuilder &query, const QString
|
||||
return QStringLiteral("delete %1 from %2 %3 %4").arg(alias, table, joins, wheres);
|
||||
}
|
||||
|
||||
QString Grammar::concatenate(QStringList &&segments)
|
||||
QString Grammar::concatenate(const QStringList &segments)
|
||||
{
|
||||
QString result;
|
||||
result.reserve(ContainerUtils::countStringSizes(segments, 1) + 8);
|
||||
|
||||
for (auto &&segment : segments) {
|
||||
for (const auto &segment : segments) {
|
||||
if (segment.isEmpty())
|
||||
continue;
|
||||
|
||||
|
||||
@@ -437,7 +437,7 @@ Builder &Builder::addSelect(const Column &column)
|
||||
return *this;
|
||||
}
|
||||
|
||||
Builder &Builder::select(QVector<Column> &&columns)
|
||||
Builder &Builder::select(QVector<Column> &&columns) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
clearColumns();
|
||||
|
||||
@@ -457,7 +457,7 @@ Builder &Builder::select(Column &&column)
|
||||
return *this;
|
||||
}
|
||||
|
||||
Builder &Builder::addSelect(QVector<Column> &&columns)
|
||||
Builder &Builder::addSelect(QVector<Column> &&columns) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
m_columns.reserve(m_columns.size() + columns.size());
|
||||
|
||||
@@ -1272,7 +1272,7 @@ Builder &Builder::addBinding(const QVector<QVariant> &bindings, const BindingTyp
|
||||
return *this;
|
||||
}
|
||||
|
||||
Builder &Builder::addBinding(QVector<QVariant> &&bindings, const BindingType type)
|
||||
Builder &Builder::addBinding(QVector<QVariant> &&bindings, const BindingType type) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
#ifdef TINYORM_DEBUG
|
||||
// Check if m_bindings contain type
|
||||
@@ -1402,8 +1402,8 @@ Builder &Builder::mergeWheres(const QVector<WhereConditionItem> &wheres,
|
||||
return *this;
|
||||
}
|
||||
|
||||
Builder &Builder::mergeWheres(QVector<WhereConditionItem> &&wheres,
|
||||
QVector<QVariant> &&bindings)
|
||||
Builder &
|
||||
Builder::mergeWheres(QVector<WhereConditionItem> &&wheres, QVector<QVariant> &&bindings) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
m_wheres.reserve(wheres.size());
|
||||
std::ranges::move(wheres, std::back_inserter(m_wheres));
|
||||
@@ -1479,7 +1479,7 @@ QVector<QVariant> Builder::cleanBindings(const QVector<QVariant> &bindings)
|
||||
return cleanedBindings;
|
||||
}
|
||||
|
||||
QVector<QVariant> Builder::cleanBindings(QVector<QVariant> &&bindings)
|
||||
QVector<QVariant> Builder::cleanBindings(QVector<QVariant> &&bindings) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
QVector<QVariant> cleanedBindings;
|
||||
cleanedBindings.reserve(bindings.size());
|
||||
@@ -1731,7 +1731,7 @@ Builder &Builder::joinInternal(std::shared_ptr<JoinClause> &&join)
|
||||
}
|
||||
|
||||
Builder &Builder::joinSubInternal(
|
||||
std::pair<QString, QVector<QVariant>> &&subQuery, const QString &as,
|
||||
std::pair<QString, QVector<QVariant>> &&subQuery, const QString &as, // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
const QString &first, const QString &comparison, const QVariant &second,
|
||||
const QString &type, const bool where)
|
||||
{
|
||||
@@ -1745,7 +1745,7 @@ Builder &Builder::joinSubInternal(
|
||||
}
|
||||
|
||||
Builder &Builder::joinSubInternal(
|
||||
std::pair<QString, QVector<QVariant>> &&subQuery, const QString &as,
|
||||
std::pair<QString, QVector<QVariant>> &&subQuery, const QString &as, // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
const std::function<void(JoinClause &)> &callback,
|
||||
const QString &type)
|
||||
{
|
||||
|
||||
@@ -610,7 +610,8 @@ QString PostgresSchemaGrammar::getType(ColumnDefinition &column) const
|
||||
}
|
||||
|
||||
QString
|
||||
PostgresSchemaGrammar::formatPostGisType(QString &&type, const ColumnDefinition &column)
|
||||
PostgresSchemaGrammar::formatPostGisType(const QString &type,
|
||||
const ColumnDefinition &column)
|
||||
{
|
||||
if (!column.isGeometry)
|
||||
return QStringLiteral("geography(%1, %2)")
|
||||
|
||||
@@ -222,7 +222,7 @@ Blueprint SchemaBuilder::createBlueprint(
|
||||
return Blueprint(table, callback, std::move(prefix));
|
||||
}
|
||||
|
||||
void SchemaBuilder::build(Blueprint &&blueprint) const
|
||||
void SchemaBuilder::build(Blueprint &&blueprint) const // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
blueprint.build(*m_connection, *m_grammar);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ WithItem::fromStringVector(const QVector<QString> &relations)
|
||||
}
|
||||
|
||||
QVector<WithItem>
|
||||
WithItem::fromStringVector(QVector<QString> &&relations)
|
||||
WithItem::fromStringVector(QVector<QString> &&relations) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
QVector<WithItem> relationsConverted;
|
||||
relationsConverted.reserve(relations.size());
|
||||
|
||||
@@ -75,7 +75,7 @@ Attribute::convertVectorToUpdateItem(const QVector<AttributeItem> &attributes)
|
||||
}
|
||||
|
||||
QVector<UpdateItem>
|
||||
Attribute::convertVectorToUpdateItem(QVector<AttributeItem> &&attributes)
|
||||
Attribute::convertVectorToUpdateItem(QVector<AttributeItem> &&attributes) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
QVector<UpdateItem> result;
|
||||
result.reserve(attributes.size());
|
||||
@@ -116,7 +116,7 @@ Attribute::removeDuplicateKeys(const QVector<AttributeItem> &attributes)
|
||||
}
|
||||
|
||||
QVector<AttributeItem>
|
||||
Attribute::removeDuplicateKeys(QVector<AttributeItem> &&attributes)
|
||||
Attribute::removeDuplicateKeys(QVector<AttributeItem> &&attributes) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
const auto size = attributes.size();
|
||||
// The helper set, to check duplicate keys
|
||||
|
||||
@@ -253,7 +253,7 @@ QVariantHash &Configuration::insertPostgresSslOptions(QVariantHash &options)
|
||||
/* private */
|
||||
|
||||
QByteArray
|
||||
Configuration::prepareTimeZoneId(QString &&timezoneId, const QString &connection)
|
||||
Configuration::prepareTimeZoneId(QString &&timezoneId, const QString &connection) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
const auto timezoneIdSize = timezoneId.size();
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ Helpers::setTimeZone(QDateTime &datetime, const QtTimeZoneConfig &timezone)
|
||||
}
|
||||
|
||||
QDateTime
|
||||
Helpers::setTimeZone(QDateTime &&datetime, const QtTimeZoneConfig &timezone)
|
||||
Helpers::setTimeZone(QDateTime &&datetime, const QtTimeZoneConfig &timezone) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
return setTimeZone(datetime, timezone);
|
||||
}
|
||||
@@ -150,7 +150,7 @@ Helpers::setTimeZone(QDateTime &datetime, const QString &connection)
|
||||
return setTimeZone(datetime, DB::qtTimeZone(connection));
|
||||
}
|
||||
|
||||
QDateTime Helpers::setTimeZone(QDateTime &&datetime, const QString &connection)
|
||||
QDateTime Helpers::setTimeZone(QDateTime &&datetime, const QString &connection) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)○
|
||||
{
|
||||
return setTimeZone(datetime, connection);
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace
|
||||
|
||||
std::optional<QString>
|
||||
Databases::createConnectionTemp(
|
||||
const QString &connection, ConnectionNameParts &&connectionParts,
|
||||
const QString &connection, const ConnectionNameParts &connectionParts,
|
||||
const QVariantHash &configuration)
|
||||
{
|
||||
Q_ASSERT(configuration.contains(driver_));
|
||||
@@ -144,7 +144,7 @@ Databases::createConnectionTemp(
|
||||
|
||||
std::optional<QString>
|
||||
Databases::createConnectionTempFrom(const QString &fromConfiguration,
|
||||
ConnectionNameParts &&connection)
|
||||
const ConnectionNameParts &connection)
|
||||
{
|
||||
const auto configuration = Databases::configuration(fromConfiguration);
|
||||
|
||||
@@ -162,7 +162,7 @@ Databases::createConnectionTempFrom(const QString &fromConfiguration,
|
||||
|
||||
std::optional<QString>
|
||||
Databases::createConnectionTempFrom(
|
||||
const QString &fromConfiguration, ConnectionNameParts &&connection,
|
||||
const QString &fromConfiguration, const ConnectionNameParts &connection,
|
||||
std::unordered_map<QString, QVariant> &&optionsToUpdate,
|
||||
const std::vector<QString> &optionsToRemove)
|
||||
{
|
||||
@@ -488,7 +488,7 @@ bool Databases::isDriverAvailable(const QString &driver)
|
||||
|
||||
void Databases::updateConfigurationForTemp(
|
||||
QVariantHash &configuration,
|
||||
std::unordered_map<QString, QVariant> &&optionsToUpdate,
|
||||
std::unordered_map<QString, QVariant> &&optionsToUpdate, // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
const std::vector<QString> &optionsToRemove)
|
||||
{
|
||||
// Add or modify the configuration
|
||||
|
||||
@@ -76,16 +76,16 @@ namespace TestUtils
|
||||
/*! Create a temporary database connection for one test method. */
|
||||
static std::optional<QString>
|
||||
createConnectionTemp(
|
||||
const QString &connectionName, ConnectionNameParts &&connectionParts,
|
||||
const QString &connectionName, const ConnectionNameParts &connectionParts,
|
||||
const QVariantHash &configuration);
|
||||
/*! Create a temporary database connection for one test method from config. */
|
||||
static std::optional<QString>
|
||||
createConnectionTempFrom(
|
||||
const QString &fromConfiguration, ConnectionNameParts &&connection);
|
||||
const QString &fromConfiguration, const ConnectionNameParts &connection);
|
||||
/*! Create a temporary database connection for one test method from config. */
|
||||
static std::optional<QString>
|
||||
createConnectionTempFrom(
|
||||
const QString &fromConfiguration, ConnectionNameParts &&connection,
|
||||
const QString &fromConfiguration, const ConnectionNameParts &connection,
|
||||
std::unordered_map<QString, QVariant> &&optionsToUpdate,
|
||||
const std::vector<QString> &optionsToRemove = {});
|
||||
|
||||
|
||||
@@ -728,7 +728,7 @@ void tst_Collection_Models::map_CustomReturnType() const
|
||||
|
||||
// Get result
|
||||
const QVector<QString> result = images.map<QString>(
|
||||
[](AlbumImage &&imageCopy) -> QString
|
||||
[](AlbumImage &&imageCopy) -> QString // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
const auto nameRef = imageCopy[NAME];
|
||||
|
||||
@@ -758,7 +758,7 @@ void tst_Collection_Models::map_CustomReturnType_WithIndex() const
|
||||
|
||||
// Get result
|
||||
const QVector<QString> result = images.map<QString>(
|
||||
[](AlbumImage &&imageCopy, const auto index)
|
||||
[](AlbumImage &&imageCopy, const auto index) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
const auto nameRef = imageCopy[NAME];
|
||||
|
||||
|
||||
@@ -932,7 +932,7 @@ void tst_Collection_Relations::map_CustomReturnType() const
|
||||
QVERIFY(Common::verifyIds(images, {2, 3, 4, 5, 6}));
|
||||
|
||||
// Get result
|
||||
const QVector<QString> result = images.map<QString>([](AlbumImage &&imageCopy)
|
||||
const QVector<QString> result = images.map<QString>([](AlbumImage &&imageCopy) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
const auto nameRef = imageCopy[NAME];
|
||||
|
||||
@@ -968,7 +968,7 @@ void tst_Collection_Relations::map_CustomReturnType_WithIndex() const
|
||||
|
||||
// Get result
|
||||
const QVector<QString> result = images.map<QString>(
|
||||
[](AlbumImage &&imageCopy, const auto index)
|
||||
[](AlbumImage &&imageCopy, const auto index) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
const auto nameRef = imageCopy[NAME];
|
||||
|
||||
|
||||
@@ -1335,7 +1335,7 @@ void tst_Model_Connection_Independent::chunk() const
|
||||
|
||||
auto result = FilePropertyProperty::orderBy(ID)
|
||||
->chunk(3, [&compareResultSize, &ids]
|
||||
(ModelsCollection<FilePropertyProperty> &&models,
|
||||
(ModelsCollection<FilePropertyProperty> &&models, // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
const qint64 page)
|
||||
{
|
||||
compareResultSize(models.size(), page);
|
||||
@@ -1374,7 +1374,7 @@ void tst_Model_Connection_Independent::chunk_ReturnFalse() const
|
||||
|
||||
auto result = FilePropertyProperty::orderBy(ID)
|
||||
->chunk(3, [&compareResultSize, &ids]
|
||||
(ModelsCollection<FilePropertyProperty> &&models,
|
||||
(ModelsCollection<FilePropertyProperty> &&models, // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
const qint64 page)
|
||||
{
|
||||
compareResultSize(models.size(), page);
|
||||
@@ -1422,7 +1422,7 @@ void tst_Model_Connection_Independent::chunk_EnforceOrderBy() const
|
||||
|
||||
auto result = FilePropertyProperty::chunk(
|
||||
3, [&compareResultSize, &ids]
|
||||
(ModelsCollection<FilePropertyProperty> &&models,
|
||||
(ModelsCollection<FilePropertyProperty> &&models, // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
const qint64 page)
|
||||
{
|
||||
compareResultSize(models.size(), page);
|
||||
@@ -1449,7 +1449,7 @@ void tst_Model_Connection_Independent::chunk_EmptyResult() const
|
||||
QStringLiteral("dummy-NON_EXISTENT"))
|
||||
->orderBy(ID)
|
||||
.chunk(3, [&callbackInvoked]
|
||||
(ModelsCollection<FilePropertyProperty> &&/*unused*/,
|
||||
(ModelsCollection<FilePropertyProperty> &&/*unused*/, // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
const qint64 /*unused*/)
|
||||
{
|
||||
callbackInvoked = true;
|
||||
@@ -1470,7 +1470,7 @@ void tst_Model_Connection_Independent::each() const
|
||||
|
||||
auto result = FilePropertyProperty::orderBy(ID)
|
||||
->each([&indexes, &ids]
|
||||
(FilePropertyProperty &&model, const qint64 index)
|
||||
(FilePropertyProperty &&model, const qint64 index) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
indexes.emplace_back(index);
|
||||
ids.emplace_back(model.getKeyCasted());
|
||||
@@ -1498,7 +1498,7 @@ void tst_Model_Connection_Independent::each_ReturnFalse() const
|
||||
|
||||
auto result = FilePropertyProperty::orderBy(ID)
|
||||
->each([&indexes, &ids]
|
||||
(FilePropertyProperty &&model, const qint64 index)
|
||||
(FilePropertyProperty &&model, const qint64 index) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
indexes.emplace_back(index);
|
||||
ids.emplace_back(model.getKeyCasted());
|
||||
@@ -1529,7 +1529,7 @@ void tst_Model_Connection_Independent::each_EnforceOrderBy() const
|
||||
|
||||
auto result = FilePropertyProperty::each(
|
||||
[&indexes, &ids]
|
||||
(FilePropertyProperty &&model, const qint64 index)
|
||||
(FilePropertyProperty &&model, const qint64 index) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
indexes.emplace_back(index);
|
||||
ids.emplace_back(model.getKeyCasted());
|
||||
@@ -1556,7 +1556,7 @@ void tst_Model_Connection_Independent::each_EmptyResult() const
|
||||
QStringLiteral("dummy-NON_EXISTENT"))
|
||||
->orderBy(ID)
|
||||
.each([&callbackInvoked]
|
||||
(FilePropertyProperty &&/*unused*/, const qint64 /*unused*/)
|
||||
(FilePropertyProperty &&/*unused*/, const qint64 /*unused*/) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
callbackInvoked = true;
|
||||
|
||||
@@ -1686,7 +1686,7 @@ void tst_Model_Connection_Independent::chunkMap_EmptyResult() const
|
||||
void tst_Model_Connection_Independent::chunkMap_TemplatedReturnValue() const
|
||||
{
|
||||
auto result = FilePropertyProperty::orderBy(ID)
|
||||
->chunkMap<QString>([](FilePropertyProperty &&model)
|
||||
->chunkMap<QString>([](FilePropertyProperty &&model) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
// Return the modify name directly
|
||||
return QStringLiteral("%1_mapped").arg(model[NAME]->template value<QString>());
|
||||
@@ -1714,7 +1714,7 @@ tst_Model_Connection_Independent::chunkMap_EnforceOrderBy_TemplatedReturnValue()
|
||||
specified, instead it adds a generic 'order by' clause
|
||||
on the Model::getQualifiedKeyName() (it sorts by the primary key by default). */
|
||||
auto result = FilePropertyProperty::chunkMap<QString>(
|
||||
[](FilePropertyProperty &&model)
|
||||
[](FilePropertyProperty &&model) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
// Return the modify name directly
|
||||
return QStringLiteral("%1_mapped").arg(model[NAME]->template value<QString>());
|
||||
@@ -1742,7 +1742,7 @@ void tst_Model_Connection_Independent::chunkMap_EmptyResult_TemplatedReturnValue
|
||||
auto result = FilePropertyProperty::whereEq(NAME,
|
||||
QStringLiteral("dummy-NON_EXISTENT"))
|
||||
->chunkMap<QString>([&callbackInvoked]
|
||||
(FilePropertyProperty &&/*unused*/)
|
||||
(FilePropertyProperty &&/*unused*/) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
-> QString
|
||||
{
|
||||
callbackInvoked = true;
|
||||
@@ -1775,7 +1775,7 @@ void tst_Model_Connection_Independent::chunkById() const
|
||||
|
||||
auto result = FilePropertyProperty::orderBy(ID)
|
||||
->chunkById(3, [&compareResultSize, &ids]
|
||||
(ModelsCollection<FilePropertyProperty> &&models,
|
||||
(ModelsCollection<FilePropertyProperty> &&models, // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
const qint64 page)
|
||||
{
|
||||
compareResultSize(models.size(), page);
|
||||
@@ -1814,7 +1814,7 @@ void tst_Model_Connection_Independent::chunkById_ReturnFalse() const
|
||||
|
||||
auto result = FilePropertyProperty::orderBy(ID)
|
||||
->chunkById(3, [&compareResultSize, &ids]
|
||||
(ModelsCollection<FilePropertyProperty> &&models,
|
||||
(ModelsCollection<FilePropertyProperty> &&models, // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
const qint64 page)
|
||||
{
|
||||
compareResultSize(models.size(), page);
|
||||
@@ -1847,7 +1847,7 @@ void tst_Model_Connection_Independent::chunkById_EmptyResult() const
|
||||
QStringLiteral("dummy-NON_EXISTENT"))
|
||||
->orderBy(ID)
|
||||
.chunkById(3, [&callbackInvoked]
|
||||
(ModelsCollection<FilePropertyProperty> &&/*unused*/,
|
||||
(ModelsCollection<FilePropertyProperty> &&/*unused*/, // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
const qint64 /*unused*/)
|
||||
{
|
||||
callbackInvoked = true;
|
||||
@@ -1880,7 +1880,7 @@ void tst_Model_Connection_Independent::chunkById_WithAlias() const
|
||||
auto result = FilePropertyProperty::select({ASTERISK, "id as id_as"})
|
||||
->orderBy(ID)
|
||||
.chunkById(3, [&compareResultSize, &ids]
|
||||
(ModelsCollection<FilePropertyProperty> &&models,
|
||||
(ModelsCollection<FilePropertyProperty> &&models, // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
const qint64 page)
|
||||
{
|
||||
compareResultSize(models.size(), page);
|
||||
@@ -1921,7 +1921,7 @@ void tst_Model_Connection_Independent::chunkById_ReturnFalse_WithAlias() const
|
||||
auto result = FilePropertyProperty::select({ASTERISK, "id as id_as"})
|
||||
->orderBy(ID)
|
||||
.chunkById(3, [&compareResultSize, &ids]
|
||||
(ModelsCollection<FilePropertyProperty> &&models,
|
||||
(ModelsCollection<FilePropertyProperty> &&models, // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
const qint64 page)
|
||||
{
|
||||
compareResultSize(models.size(), page);
|
||||
@@ -1955,7 +1955,7 @@ void tst_Model_Connection_Independent::chunkById_EmptyResult_WithAlias() const
|
||||
->whereEq(NAME, QStringLiteral("dummy-NON_EXISTENT"))
|
||||
.orderBy(ID)
|
||||
.chunkById(3, [&callbackInvoked]
|
||||
(ModelsCollection<FilePropertyProperty> &&/*unused*/,
|
||||
(ModelsCollection<FilePropertyProperty> &&/*unused*/, // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
const qint64 /*unused*/)
|
||||
{
|
||||
callbackInvoked = true;
|
||||
@@ -1977,7 +1977,7 @@ void tst_Model_Connection_Independent::eachById() const
|
||||
|
||||
auto result = FilePropertyProperty::orderBy(ID)
|
||||
->eachById([&indexes, &ids]
|
||||
(FilePropertyProperty &&model, const qint64 index)
|
||||
(FilePropertyProperty &&model, const qint64 index) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
indexes.emplace_back(index);
|
||||
ids.emplace_back(model.getKeyCasted());
|
||||
@@ -2005,7 +2005,7 @@ void tst_Model_Connection_Independent::eachById_ReturnFalse() const
|
||||
|
||||
auto result = FilePropertyProperty::orderBy(ID)
|
||||
->eachById([&indexes, &ids]
|
||||
(FilePropertyProperty &&model, const qint64 index)
|
||||
(FilePropertyProperty &&model, const qint64 index) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
indexes.emplace_back(index);
|
||||
ids.emplace_back(model.getKeyCasted());
|
||||
@@ -2032,7 +2032,7 @@ void tst_Model_Connection_Independent::eachById_EmptyResult() const
|
||||
QStringLiteral("dummy-NON_EXISTENT"))
|
||||
->orderBy(ID)
|
||||
.eachById([&callbackInvoked]
|
||||
(FilePropertyProperty &&/*unused*/, const qint64 /*unused*/)
|
||||
(FilePropertyProperty &&/*unused*/, const qint64 /*unused*/) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
callbackInvoked = true;
|
||||
|
||||
@@ -2053,7 +2053,7 @@ void tst_Model_Connection_Independent::eachById_WithAlias() const
|
||||
auto result = FilePropertyProperty::select({ASTERISK, "id as id_as"})
|
||||
->orderBy(ID)
|
||||
.eachById([&indexes, &ids]
|
||||
(FilePropertyProperty &&model, const qint64 index)
|
||||
(FilePropertyProperty &&model, const qint64 index) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
indexes.emplace_back(index);
|
||||
ids.emplace_back(model.getKeyCasted());
|
||||
@@ -2083,7 +2083,7 @@ void tst_Model_Connection_Independent::eachById_ReturnFalse_WithAlias() const
|
||||
auto result = FilePropertyProperty::select({ASTERISK, "id as id_as"})
|
||||
->orderBy(ID)
|
||||
.eachById([&indexes, &ids]
|
||||
(FilePropertyProperty &&model, const qint64 index)
|
||||
(FilePropertyProperty &&model, const qint64 index) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
indexes.emplace_back(index);
|
||||
ids.emplace_back(model.getKeyCasted());
|
||||
@@ -2111,7 +2111,7 @@ void tst_Model_Connection_Independent::eachById_EmptyResult_WithAlias() const
|
||||
->whereEq(NAME, QStringLiteral("dummy-NON_EXISTENT"))
|
||||
.orderBy(ID)
|
||||
.eachById([&callbackInvoked]
|
||||
(FilePropertyProperty &&/*unused*/, const qint64 /*unused*/)
|
||||
(FilePropertyProperty &&/*unused*/, const qint64 /*unused*/) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
callbackInvoked = true;
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ void tst_Relations_BuildsQueries::chunk_Relation() const
|
||||
auto result = TorrentPreviewableFileProperty::find(5)->filePropertyProperty()
|
||||
->orderBy(ID)
|
||||
.chunk(2, [&compareResultSize, &ids]
|
||||
(ModelsCollection<FilePropertyProperty> &&models,
|
||||
(ModelsCollection<FilePropertyProperty> &&models, // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
const qint64 page)
|
||||
{
|
||||
compareResultSize(models.size(), page);
|
||||
@@ -162,7 +162,7 @@ void tst_Relations_BuildsQueries::each_Relation() const
|
||||
auto result = TorrentPreviewableFileProperty::find(5)->filePropertyProperty()
|
||||
->orderBy(ID)
|
||||
.each([&indexes, &ids]
|
||||
(FilePropertyProperty &&model, const qint64 index)
|
||||
(FilePropertyProperty &&model, const qint64 index) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
indexes.emplace_back(index);
|
||||
ids.emplace_back(model.getKeyCasted());
|
||||
@@ -245,7 +245,7 @@ void tst_Relations_BuildsQueries::chunkMap_TemplatedReturnValue_Relation() const
|
||||
ConnectionOverride::connection = connection;
|
||||
|
||||
auto result = TorrentPreviewableFileProperty::find(5)->filePropertyProperty()
|
||||
->chunkMap<QString>([](FilePropertyProperty &&model)
|
||||
->chunkMap<QString>([](FilePropertyProperty &&model) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
// Return the modify name directly
|
||||
return QStringLiteral("%1_mapped").arg(model[NAME]->template value<QString>());
|
||||
@@ -286,7 +286,7 @@ void tst_Relations_BuildsQueries::chunkById_Relation() const
|
||||
auto result = TorrentPreviewableFileProperty::find(5)->filePropertyProperty()
|
||||
->orderBy(ID)
|
||||
.chunkById(2, [&compareResultSize, &ids]
|
||||
(ModelsCollection<FilePropertyProperty> &&models,
|
||||
(ModelsCollection<FilePropertyProperty> &&models, // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
const qint64 page)
|
||||
{
|
||||
compareResultSize(models.size(), page);
|
||||
@@ -331,7 +331,7 @@ void tst_Relations_BuildsQueries::chunkById_WithAlias_Relation() const
|
||||
->select({ASTERISK, "id as id_as"})
|
||||
.orderBy(ID)
|
||||
.chunkById(2, [&compareResultSize, &ids]
|
||||
(ModelsCollection<FilePropertyProperty> &&models,
|
||||
(ModelsCollection<FilePropertyProperty> &&models, // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
const qint64 page)
|
||||
{
|
||||
compareResultSize(models.size(), page);
|
||||
@@ -365,7 +365,7 @@ void tst_Relations_BuildsQueries::eachById_Relation() const
|
||||
auto result = TorrentPreviewableFileProperty::find(5)->filePropertyProperty()
|
||||
->orderBy(ID)
|
||||
.eachById([&indexes, &ids]
|
||||
(FilePropertyProperty &&model, const qint64 index)
|
||||
(FilePropertyProperty &&model, const qint64 index) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
indexes.emplace_back(index);
|
||||
ids.emplace_back(model.getKeyCasted());
|
||||
@@ -399,7 +399,7 @@ void tst_Relations_BuildsQueries::eachById_WithAlias_Relation() const
|
||||
->select({ASTERISK, "id as id_as"})
|
||||
.orderBy(ID)
|
||||
.eachById([&indexes, &ids]
|
||||
(FilePropertyProperty &&model, const qint64 index)
|
||||
(FilePropertyProperty &&model, const qint64 index) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
indexes.emplace_back(index);
|
||||
ids.emplace_back(model.getKeyCasted());
|
||||
@@ -469,7 +469,7 @@ void tst_Relations_BuildsQueries::chunk() const
|
||||
|
||||
auto result = Torrent::find(2)->tags()->orderBy(ID)
|
||||
.chunk(2, [&compareResultSize, &ids]
|
||||
(ModelsCollection<Tag> &&models, const qint64 page)
|
||||
(ModelsCollection<Tag> &&models, const qint64 page) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
compareResultSize(models.size(), page);
|
||||
|
||||
@@ -514,7 +514,7 @@ void tst_Relations_BuildsQueries::chunk_ReturnFalse() const
|
||||
|
||||
auto result = Torrent::find(2)->tags()->orderBy(ID)
|
||||
.chunk(2, [&compareResultSize, &ids]
|
||||
(ModelsCollection<Tag> &&models, const qint64 page)
|
||||
(ModelsCollection<Tag> &&models, const qint64 page) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
compareResultSize(models.size(), page);
|
||||
|
||||
@@ -567,7 +567,7 @@ void tst_Relations_BuildsQueries::chunk_EnforceOrderBy() const
|
||||
|
||||
auto result = Torrent::find(2)->tags()
|
||||
->chunk(2, [&compareResultSize, &ids]
|
||||
(ModelsCollection<Tag> &&models, const qint64 page)
|
||||
(ModelsCollection<Tag> &&models, const qint64 page) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
compareResultSize(models.size(), page);
|
||||
|
||||
@@ -600,7 +600,7 @@ void tst_Relations_BuildsQueries::chunk_EmptyResult() const
|
||||
QStringLiteral("dummy-NON_EXISTENT"))
|
||||
.orderBy(ID)
|
||||
.chunk(2, [&callbackInvoked]
|
||||
(ModelsCollection<Tag> &&/*unused*/, const qint64 /*unused*/)
|
||||
(ModelsCollection<Tag> &&/*unused*/, const qint64 /*unused*/) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
callbackInvoked = true;
|
||||
|
||||
@@ -624,7 +624,7 @@ void tst_Relations_BuildsQueries::each() const
|
||||
|
||||
auto result = Torrent::find(2)->tags()->orderBy(ID)
|
||||
.each([&indexes, &ids]
|
||||
(Tag &&model, const qint64 index)
|
||||
(Tag &&model, const qint64 index) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
indexes.emplace_back(index);
|
||||
ids.emplace_back(model.getKeyCasted());
|
||||
@@ -658,7 +658,7 @@ void tst_Relations_BuildsQueries::each_ReturnFalse() const
|
||||
|
||||
auto result = Torrent::find(2)->tags()->orderBy(ID)
|
||||
.each([&indexes, &ids]
|
||||
(Tag &&model, const qint64 index)
|
||||
(Tag &&model, const qint64 index) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
indexes.emplace_back(index);
|
||||
ids.emplace_back(model.getKeyCasted());
|
||||
@@ -695,7 +695,7 @@ void tst_Relations_BuildsQueries::each_EnforceOrderBy() const
|
||||
|
||||
auto result = Torrent::find(2)->tags()
|
||||
->each([&indexes, &ids]
|
||||
(Tag &&model, const qint64 index)
|
||||
(Tag &&model, const qint64 index) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
indexes.emplace_back(index);
|
||||
ids.emplace_back(model.getKeyCasted());
|
||||
@@ -728,7 +728,7 @@ void tst_Relations_BuildsQueries::each_EmptyResult() const
|
||||
QStringLiteral("dummy-NON_EXISTENT"))
|
||||
.orderBy(ID)
|
||||
.each([&callbackInvoked]
|
||||
(Tag &&/*unused*/, const qint64 /*unused*/)
|
||||
(Tag &&/*unused*/, const qint64 /*unused*/) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
callbackInvoked = true;
|
||||
|
||||
@@ -852,7 +852,7 @@ void tst_Relations_BuildsQueries::chunkMap_TemplatedReturnValue() const
|
||||
|
||||
relation->orderBy(ID);
|
||||
|
||||
auto result = relation->chunkMap<QString>([](Tag &&model)
|
||||
auto result = relation->chunkMap<QString>([](Tag &&model) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
verifyTaggedPivot(model);
|
||||
|
||||
@@ -880,7 +880,7 @@ void tst_Relations_BuildsQueries::chunkMap_TemplatedReturnValue_OnRelationRef()
|
||||
/* Even if the chunkMap<> is called on the Relation & it can't crash or fail, it
|
||||
should normally works but the pivot table will not be hydrated. */
|
||||
auto result = Torrent::find(2)->tags()->orderBy(ID)
|
||||
.chunkMap<QString>([](Tag &&model)
|
||||
.chunkMap<QString>([](Tag &&model) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
// Pivot table is not hydrated
|
||||
Q_ASSERT(!model.relationLoaded("tagged"));
|
||||
@@ -914,7 +914,7 @@ tst_Relations_BuildsQueries::chunkMap_EnforceOrderBy_TemplatedReturnValue() cons
|
||||
// Ownership of a unique_ptr()
|
||||
const auto relation = Torrent::find(2)->tags();
|
||||
|
||||
auto result = relation->chunkMap<QString>([](Tag &&model)
|
||||
auto result = relation->chunkMap<QString>([](Tag &&model) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
verifyTaggedPivot(model);
|
||||
|
||||
@@ -946,7 +946,7 @@ void tst_Relations_BuildsQueries::chunkMap_EmptyResult_TemplatedReturnValue() co
|
||||
|
||||
relation->whereEq("torrent_tags.name", QStringLiteral("dummy-NON_EXISTENT"));
|
||||
|
||||
auto result = relation->chunkMap<QString>([&callbackInvoked](Tag &&/*unused*/)
|
||||
auto result = relation->chunkMap<QString>([&callbackInvoked](Tag &&/*unused*/) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
-> QString
|
||||
{
|
||||
callbackInvoked = true;
|
||||
@@ -983,7 +983,7 @@ void tst_Relations_BuildsQueries::chunkById() const
|
||||
|
||||
auto result = Torrent::find(2)->tags()->orderBy(ID)
|
||||
.chunkById(2, [&compareResultSize, &ids]
|
||||
(ModelsCollection<Tag> &&models, const qint64 page)
|
||||
(ModelsCollection<Tag> &&models, const qint64 page) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
compareResultSize(models.size(), page);
|
||||
|
||||
@@ -1028,7 +1028,7 @@ void tst_Relations_BuildsQueries::chunkById_ReturnFalse() const
|
||||
|
||||
auto result = Torrent::find(2)->tags()->orderBy(ID)
|
||||
.chunkById(2, [&compareResultSize, &ids]
|
||||
(ModelsCollection<Tag> &&models, const qint64 page)
|
||||
(ModelsCollection<Tag> &&models, const qint64 page) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
compareResultSize(models.size(), page);
|
||||
|
||||
@@ -1066,7 +1066,7 @@ void tst_Relations_BuildsQueries::chunkById_EmptyResult() const
|
||||
QStringLiteral("dummy-NON_EXISTENT"))
|
||||
.orderBy(ID)
|
||||
.chunkById(2, [&callbackInvoked]
|
||||
(ModelsCollection<Tag> &&/*unused*/,
|
||||
(ModelsCollection<Tag> &&/*unused*/, // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
const qint64 /*unused*/)
|
||||
{
|
||||
callbackInvoked = true;
|
||||
@@ -1104,7 +1104,7 @@ void tst_Relations_BuildsQueries::chunkById_WithAlias() const
|
||||
->select({ASTERISK, "torrent_tags.id as id_as"})
|
||||
.orderBy(ID)
|
||||
.chunkById(2, [&compareResultSize, &ids]
|
||||
(ModelsCollection<Tag> &&models, const qint64 page)
|
||||
(ModelsCollection<Tag> &&models, const qint64 page) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
compareResultSize(models.size(), page);
|
||||
|
||||
@@ -1152,7 +1152,7 @@ void tst_Relations_BuildsQueries::chunkById_ReturnFalse_WithAlias() const
|
||||
->select({ASTERISK, "torrent_tags.id as id_as"})
|
||||
.orderBy(ID)
|
||||
.chunkById(2, [&compareResultSize, &ids]
|
||||
(ModelsCollection<Tag> &&models, const qint64 page)
|
||||
(ModelsCollection<Tag> &&models, const qint64 page) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
compareResultSize(models.size(), page);
|
||||
|
||||
@@ -1192,7 +1192,7 @@ void tst_Relations_BuildsQueries::chunkById_EmptyResult_WithAlias() const
|
||||
.whereEq("torrent_tags.name", QStringLiteral("dummy-NON_EXISTENT"))
|
||||
.orderBy(ID)
|
||||
.chunkById(2, [&callbackInvoked]
|
||||
(ModelsCollection<Tag> &&/*unused*/,
|
||||
(ModelsCollection<Tag> &&/*unused*/, // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
const qint64 /*unused*/)
|
||||
{
|
||||
callbackInvoked = true;
|
||||
@@ -1219,7 +1219,7 @@ void tst_Relations_BuildsQueries::eachById() const
|
||||
auto result = Torrent::find(2)->tags()
|
||||
->orderBy(ID)
|
||||
.eachById([&indexes, &ids]
|
||||
(Tag &&model, const qint64 index)
|
||||
(Tag &&model, const qint64 index) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
indexes.emplace_back(index);
|
||||
ids.emplace_back(model.getKeyCasted());
|
||||
@@ -1254,7 +1254,7 @@ void tst_Relations_BuildsQueries::eachById_ReturnFalse() const
|
||||
auto result = Torrent::find(2)->tags()
|
||||
->orderBy(ID)
|
||||
.eachById([&indexes, &ids]
|
||||
(Tag &&model, const qint64 index)
|
||||
(Tag &&model, const qint64 index) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
indexes.emplace_back(index);
|
||||
ids.emplace_back(model.getKeyCasted());
|
||||
@@ -1287,7 +1287,7 @@ void tst_Relations_BuildsQueries::eachById_EmptyResult() const
|
||||
QStringLiteral("dummy-NON_EXISTENT"))
|
||||
.orderBy(ID)
|
||||
.eachById([&callbackInvoked]
|
||||
(Tag &&/*unused*/, const qint64 /*unused*/)
|
||||
(Tag &&/*unused*/, const qint64 /*unused*/) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
callbackInvoked = true;
|
||||
|
||||
@@ -1313,7 +1313,7 @@ void tst_Relations_BuildsQueries::eachById_WithAlias() const
|
||||
->select({ASTERISK, "torrent_tags.id as id_as"})
|
||||
.orderBy(ID)
|
||||
.eachById([&indexes, &ids]
|
||||
(Tag &&model, const qint64 index)
|
||||
(Tag &&model, const qint64 index) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
indexes.emplace_back(index);
|
||||
ids.emplace_back(model.getKeyCasted());
|
||||
@@ -1350,7 +1350,7 @@ void tst_Relations_BuildsQueries::eachById_ReturnFalse_WithAlias() const
|
||||
->select({ASTERISK, "torrent_tags.id as id_as"})
|
||||
.orderBy(ID)
|
||||
.eachById([&indexes, &ids]
|
||||
(Tag &&model, const qint64 index)
|
||||
(Tag &&model, const qint64 index) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
indexes.emplace_back(index);
|
||||
ids.emplace_back(model.getKeyCasted());
|
||||
@@ -1385,7 +1385,7 @@ void tst_Relations_BuildsQueries::eachById_EmptyResult_WithAlias() const
|
||||
.whereEq("torrent_tags.name", QStringLiteral("dummy-NON_EXISTENT"))
|
||||
.orderBy(ID)
|
||||
.eachById([&callbackInvoked]
|
||||
(Tag &&/*unused*/, const qint64 /*unused*/)
|
||||
(Tag &&/*unused*/, const qint64 /*unused*/) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
callbackInvoked = true;
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ private:
|
||||
/*! Prepare arguments and invoke runCommand(). */
|
||||
[[nodiscard]] static int
|
||||
invokeCommand(const QString &connection, const QString &name,
|
||||
std::vector<const char *> &&arguments = {});
|
||||
const std::vector<const char *> &arguments = {});
|
||||
/*! Create a tom application instance and invoke the given command. */
|
||||
static int runCommand(int &argc, const std::vector<const char *> &argv);
|
||||
|
||||
@@ -764,7 +764,7 @@ void tst_Migrate::refresh_Step_StepMigrate() const
|
||||
/* private */
|
||||
|
||||
int tst_Migrate::invokeCommand(const QString &connection, const QString &name,
|
||||
std::vector<const char *> &&arguments)
|
||||
const std::vector<const char *> &arguments)
|
||||
{
|
||||
static const auto connectionTmpl = QStringLiteral("--database=%1");
|
||||
|
||||
@@ -785,7 +785,7 @@ int tst_Migrate::invokeCommand(const QString &connection, const QString &name,
|
||||
};
|
||||
|
||||
argv.reserve(arguments.size());
|
||||
std::ranges::move(arguments, std::back_inserter(argv));
|
||||
std::ranges::copy(arguments, std::back_inserter(argv));
|
||||
|
||||
int argc = static_cast<int>(argv.size());
|
||||
|
||||
|
||||
@@ -49,7 +49,8 @@ namespace Tom::Commands
|
||||
#endif
|
||||
|
||||
/*! Print all guessed commands. */
|
||||
int printGuessedCommands(std::vector<std::shared_ptr<Command>> &&commands) const;
|
||||
int printGuessedCommands(
|
||||
const std::vector<std::shared_ptr<Command>> &commands) const;
|
||||
/*! Print all or guessed namespace names for the list command. */
|
||||
int printGuessedNamespaces(const QString &word) const;
|
||||
/*! Print all or guessed shell names for the integrate command. */
|
||||
|
||||
@@ -43,9 +43,9 @@ namespace Tom::Commands::Make
|
||||
the default path. */
|
||||
static fspath
|
||||
guessPathForMakeByPwd(const fspath &defaultPath,
|
||||
std::optional<
|
||||
const std::optional<
|
||||
std::reference_wrapper<const fspath>
|
||||
> &&defaultModelsPath = std::nullopt);
|
||||
> &defaultModelsPath = std::nullopt);
|
||||
|
||||
private:
|
||||
/*! Ensure that a file in the given folder doesn't already exist. */
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Tom::Commands::Make::Support
|
||||
|
||||
/*! Populate the place-holders in the seeder stub. */
|
||||
static std::string
|
||||
populateStub(const QString &className, QString &&table);
|
||||
populateStub(const QString &className, const QString &table);
|
||||
|
||||
/*! Get the table name from the seeder class name. */
|
||||
static QString getTableName(QString className);
|
||||
|
||||
@@ -68,8 +68,8 @@ namespace Commands::Migrations
|
||||
protected:
|
||||
/*! Get the status for the given ran migrations. */
|
||||
std::vector<TableRow>
|
||||
getStatusFor(QVector<QVariant> &&ran,
|
||||
std::map<QString, QVariant> &&batches) const;
|
||||
getStatusFor(const QVector<QVariant> &ran,
|
||||
const std::map<QString, QVariant> &batches) const;
|
||||
#ifdef TINYTOM_TESTS_CODE
|
||||
/*! Transform migrations status for comparing in auto tests. */
|
||||
static std::vector<StatusRow>
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Concerns
|
||||
QStringList &¤tArguments);
|
||||
|
||||
/*! Get common command-line arguments from current command-line arguments. */
|
||||
static QStringList getCommonArguments(QStringList &&arguments);
|
||||
static QStringList getCommonArguments(const QStringList &arguments);
|
||||
|
||||
private:
|
||||
/*! Static cast *this to the Command & derived type, const version. */
|
||||
|
||||
@@ -57,33 +57,34 @@ namespace Concerns
|
||||
void optionalPretend(
|
||||
bool pretend, const QString &database,
|
||||
const std::function<void(DatabaseConnection &)> &callback,
|
||||
std::optional<QString> &&title = std::nullopt,
|
||||
const std::optional<QString> &title = std::nullopt,
|
||||
bool newline = false) const;
|
||||
/*! Pretend the callback on the base of a bool value (mainly --pretend option). */
|
||||
void optionalPretend(
|
||||
bool pretend, DatabaseConnection &connection,
|
||||
const std::function<void(DatabaseConnection &)> &callback,
|
||||
std::optional<QString> &&title = std::nullopt,
|
||||
const std::optional<QString> &title = std::nullopt,
|
||||
bool newline = false) const;
|
||||
|
||||
/*! Pretend the callback on the base of a bool value (mainly --pretend option). */
|
||||
void optionalPretend(
|
||||
bool pretend, const QString &database,
|
||||
const std::function<void()> &callback,
|
||||
std::optional<QString> &&title = std::nullopt,
|
||||
const std::optional<QString> &title = std::nullopt,
|
||||
bool newline = false) const;
|
||||
/*! Pretend the callback on the base of a bool value (mainly --pretend option). */
|
||||
void optionalPretend(
|
||||
bool pretend, DatabaseConnection &connection,
|
||||
const std::function<void()> &callback,
|
||||
std::optional<QString> &&title = std::nullopt,
|
||||
const std::optional<QString> &title = std::nullopt,
|
||||
bool newline = false) const;
|
||||
|
||||
private:
|
||||
/*! Common logic for the optionalPretend() method, log gathered queries
|
||||
to the console. */
|
||||
void optionalPretendInternal(QVector<Orm::Log> &&queriesLog,
|
||||
std::optional<QString> &&title, bool newline) const;
|
||||
void optionalPretendInternal(
|
||||
QVector<Orm::Log> &&queriesLog,
|
||||
const std::optional<QString> &title, bool newline) const;
|
||||
|
||||
/*! Dynamic cast *this to the Command & base type, const version. */
|
||||
const Commands::Command &command() const;
|
||||
|
||||
@@ -251,7 +251,7 @@ CompleteCommand::getCurrentTomCommand(const QString &commandlineArg,
|
||||
#endif
|
||||
|
||||
int CompleteCommand::printGuessedCommands(
|
||||
std::vector<std::shared_ptr<Command>> &&commands) const
|
||||
const std::vector<std::shared_ptr<Command>> &commands) const
|
||||
{
|
||||
QStringList guessedCommands;
|
||||
guessedCommands.reserve(static_cast<QStringList::size_type>(commands.size()));
|
||||
|
||||
@@ -53,7 +53,7 @@ void MakeCommand::throwIfContainsNamespaceOrPath(
|
||||
|
||||
fspath MakeCommand::guessPathForMakeByPwd(
|
||||
const fspath &defaultPath,
|
||||
std::optional<std::reference_wrapper<const fspath>> &&defaultModelsPath)
|
||||
const std::optional<std::reference_wrapper<const fspath>> &defaultModelsPath)
|
||||
{
|
||||
/* Method is commented on heavily because the logic is sketchy and unclear. 😵💫🙃
|
||||
It tries to guess a path based on the pwd and the defaultPath (can be relative
|
||||
|
||||
@@ -81,7 +81,7 @@ std::string MigrationCreator::getDatePrefix()
|
||||
}
|
||||
|
||||
std::string
|
||||
MigrationCreator::populateStub(const QString &name, QString &&stub, const QString &table)
|
||||
MigrationCreator::populateStub(const QString &name, QString &&stub, const QString &table) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
const auto className = getClassName(name);
|
||||
|
||||
|
||||
@@ -1290,12 +1290,12 @@ std::size_t ModelCreator::computeReserveForRelationsList(
|
||||
return m_relationsListsSize;
|
||||
}
|
||||
|
||||
QString ModelCreator::joinRelationsList(RelationsWithOrder &&relationsList)
|
||||
QString ModelCreator::joinRelationsList(RelationsWithOrder &&relationsList) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
auto relationsQList = ranges::views::move(relationsList)
|
||||
| ranges::views::transform([](auto &&relationItem) -> QString
|
||||
{
|
||||
return relationItem.content;
|
||||
return std::move(relationItem.content);
|
||||
})
|
||||
| ranges::to<QStringList>();
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ fspath SeederCreator::getPath(const QString &basename, const fspath &path)
|
||||
}
|
||||
|
||||
std::string
|
||||
SeederCreator::populateStub(const QString &className, QString &&table)
|
||||
SeederCreator::populateStub(const QString &className, const QString &table)
|
||||
{
|
||||
QString stub(SeederStub);
|
||||
|
||||
|
||||
@@ -96,8 +96,8 @@ int StatusCommand::run()
|
||||
/* protected */
|
||||
|
||||
std::vector<StatusCommand::TableRow>
|
||||
StatusCommand::getStatusFor(QVector<QVariant> &&ran,
|
||||
std::map<QString, QVariant> &&batches) const
|
||||
StatusCommand::getStatusFor(const QVector<QVariant> &ran,
|
||||
const std::map<QString, QVariant> &batches) const
|
||||
{
|
||||
return m_migrator->migrationNames()
|
||||
| ranges::views::remove_if([&ran, pending = isSet(pending_)]
|
||||
@@ -151,7 +151,7 @@ namespace
|
||||
} // namespace
|
||||
|
||||
std::vector<StatusCommand::StatusRow>
|
||||
StatusCommand::statusForUnitTest(std::vector<TableRow> &&migrations)
|
||||
StatusCommand::statusForUnitTest(std::vector<TableRow> &&migrations) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
return ranges::views::move(migrations)
|
||||
| ranges::views::transform([](auto &&migration)
|
||||
|
||||
@@ -77,7 +77,7 @@ CallsCommands::createCommandLineArguments(
|
||||
#endif
|
||||
|
||||
// Get common allowed command-line arguments from the current command-line arguments
|
||||
newArguments << getCommonArguments(std::move(currentArguments));
|
||||
newArguments << getCommonArguments(currentArguments);
|
||||
|
||||
// Append passed arguments
|
||||
std::ranges::move(ranges::actions::remove_if(std::move(arguments),
|
||||
@@ -87,7 +87,7 @@ CallsCommands::createCommandLineArguments(
|
||||
return newArguments;
|
||||
}
|
||||
|
||||
QStringList CallsCommands::getCommonArguments(QStringList &&arguments)
|
||||
QStringList CallsCommands::getCommonArguments(const QStringList &arguments)
|
||||
{
|
||||
// This way I'm able to re-use global constants
|
||||
/*! Create a long command-line option from the option name (--xyz). */
|
||||
@@ -105,8 +105,8 @@ QStringList CallsCommands::getCommonArguments(QStringList &&arguments)
|
||||
QLatin1String("-vvv"),
|
||||
};
|
||||
|
||||
return ranges::views::move(arguments)
|
||||
| ranges::views::filter([&allowed = allowed](auto &&argument)
|
||||
return arguments
|
||||
| ranges::views::filter([&allowed = allowed](const QString &argument)
|
||||
{
|
||||
return allowed.contains(argument);
|
||||
})
|
||||
|
||||
@@ -17,16 +17,15 @@ namespace Tom::Concerns
|
||||
void Pretendable::optionalPretend(
|
||||
const bool pretend, const QString &database,
|
||||
const std::function<void(DatabaseConnection &)> &callback,
|
||||
std::optional<QString> &&title, const bool newline) const
|
||||
const std::optional<QString> &title, const bool newline) const
|
||||
{
|
||||
optionalPretend(pretend, command().connection(database), callback,
|
||||
std::move(title), newline);
|
||||
optionalPretend(pretend, command().connection(database), callback, title, newline);
|
||||
}
|
||||
|
||||
void Pretendable::optionalPretend(
|
||||
const bool pretend, DatabaseConnection &connection,
|
||||
const std::function<void(DatabaseConnection &)> &callback,
|
||||
std::optional<QString> &&title, const bool newline) const
|
||||
const std::optional<QString> &title, const bool newline) const
|
||||
{
|
||||
// Execute the callback without pretending
|
||||
if (!pretend)
|
||||
@@ -36,22 +35,21 @@ void Pretendable::optionalPretend(
|
||||
auto queriesLog = connection.pretend(callback);
|
||||
|
||||
// Log gathered queries to the console
|
||||
optionalPretendInternal(std::move(queriesLog), std::move(title), newline);
|
||||
optionalPretendInternal(std::move(queriesLog), title, newline);
|
||||
}
|
||||
|
||||
void Pretendable::optionalPretend(
|
||||
const bool pretend, const QString &database,
|
||||
const std::function<void()> &callback,
|
||||
std::optional<QString> &&title, const bool newline) const
|
||||
const std::optional<QString> &title, const bool newline) const
|
||||
{
|
||||
optionalPretend(pretend, command().connection(database), callback,
|
||||
std::move(title), newline);
|
||||
optionalPretend(pretend, command().connection(database), callback, title, newline);
|
||||
}
|
||||
|
||||
void Pretendable::optionalPretend(
|
||||
const bool pretend, DatabaseConnection &connection,
|
||||
const std::function<void()> &callback,
|
||||
std::optional<QString> &&title, const bool newline) const
|
||||
const std::optional<QString> &title, const bool newline) const
|
||||
{
|
||||
// Execute the callback without pretending
|
||||
if (!pretend)
|
||||
@@ -61,13 +59,13 @@ void Pretendable::optionalPretend(
|
||||
auto queriesLog = connection.pretend(callback);
|
||||
|
||||
// Log gathered queries to the console
|
||||
optionalPretendInternal(std::move(queriesLog), std::move(title), newline);
|
||||
optionalPretendInternal(std::move(queriesLog), title, newline);
|
||||
}
|
||||
|
||||
/* private */
|
||||
|
||||
void Pretendable::optionalPretendInternal(
|
||||
QVector<Orm::Log> &&queriesLog, std::optional<QString> &&title,
|
||||
QVector<Orm::Log> &&queriesLog, const std::optional<QString> &title, // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
const bool newline) const
|
||||
{
|
||||
// Log gathered queries to the console
|
||||
|
||||
@@ -70,7 +70,7 @@ DatabaseConnection &UsingConnection::resolveConnection(const QString &name) cons
|
||||
|
||||
template<UsingConnectionCallback F>
|
||||
int UsingConnection::usingConnectionsInternal(
|
||||
QStringList &&names, const bool debugSql,
|
||||
QStringList &&names, const bool debugSql, // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
std::optional<std::reference_wrapper<MigrationRepository>> repository,
|
||||
const F &callback)
|
||||
{
|
||||
|
||||
@@ -276,7 +276,7 @@ Migrator::getMigrationsForRollbackByOptions(const MigrateOptions options) const
|
||||
}
|
||||
|
||||
std::vector<RollbackItem>
|
||||
Migrator::getMigrationsForRollback(std::vector<MigrationItem> &&ran) const
|
||||
Migrator::getMigrationsForRollback(std::vector<MigrationItem> &&ran) const // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
return ranges::views::move(ran)
|
||||
| ranges::views::transform([this](auto &&migrationItem) -> RollbackItem
|
||||
|
||||
@@ -78,7 +78,7 @@ Utils::convertToQCommandLineOptionList(const QList<CommandLineOption> &options)
|
||||
}
|
||||
|
||||
QList<QCommandLineOption>
|
||||
Utils::convertToQCommandLineOptionList(QList<CommandLineOption> &&options)
|
||||
Utils::convertToQCommandLineOptionList(QList<CommandLineOption> &&options) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
{
|
||||
QList<QCommandLineOption> result;
|
||||
result.reserve(options.size());
|
||||
|
||||
Reference in New Issue
Block a user