mirror of
https://github.com/silverqx/TinyORM.git
synced 2026-01-06 02:49:31 -06:00
passed * clang-tidy (hpp files)
Following clang-tidy checks bugprone-*, concurrency-*, modernize-*, and google-*. - namespace-comments - using-namespaces - virtual vs override/final - explicit ctor/conversion operator
This commit is contained in:
@@ -14,7 +14,7 @@ namespace Orm
|
||||
namespace Query
|
||||
{
|
||||
class Expression;
|
||||
}
|
||||
} // namespace Query
|
||||
|
||||
/*! QString container concept (QStringList or QVector<QString>). */
|
||||
template<typename T>
|
||||
|
||||
@@ -12,7 +12,7 @@ TINY_SYSTEM_HEADER
|
||||
|
||||
namespace std
|
||||
{
|
||||
template<typename ..._Types>
|
||||
template<typename ...Types>
|
||||
class variant;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,22 +23,22 @@ namespace Concerns
|
||||
/*! Detect lost connection by passed exception message. */
|
||||
class DetectsLostConnections
|
||||
{
|
||||
/*! Deleted copy constructor. */
|
||||
DetectsLostConnections(const DetectsLostConnections &) = delete;
|
||||
/*! Deleted copy assignment operator. */
|
||||
DetectsLostConnections &operator=(const DetectsLostConnections &) = delete;
|
||||
|
||||
public:
|
||||
/*! Default constructor. */
|
||||
DetectsLostConnections() = default;
|
||||
/*! Virtual destructor, to pass -Weffc++. */
|
||||
inline virtual ~DetectsLostConnections() = default;
|
||||
|
||||
/*! Deleted copy constructor. */
|
||||
DetectsLostConnections(const DetectsLostConnections &) = delete;
|
||||
/*! Deleted copy assignment operator. */
|
||||
DetectsLostConnections &operator=(const DetectsLostConnections &) = delete;
|
||||
|
||||
/*! Determine if the given exception was caused by a lost connection. */
|
||||
bool causedByLostConnection(const Exceptions::SqlError &e) const;
|
||||
};
|
||||
|
||||
} // namespace Orm::Concerns
|
||||
} // namespace Concerns
|
||||
} // namespace Orm
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Concerns
|
||||
inline static ConnectionResolverInterface *m_resolver = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Orm::Concerns
|
||||
} // namespace Concerns
|
||||
} // namespace Orm
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Processors
|
||||
{
|
||||
class Processor;
|
||||
}
|
||||
} // Orm::Query
|
||||
} // namespace Query
|
||||
|
||||
namespace Schema
|
||||
{
|
||||
@@ -43,7 +43,7 @@ namespace Grammars
|
||||
{
|
||||
class SchemaGrammar;
|
||||
}
|
||||
} // Orm::Schema
|
||||
} // namespace Schema
|
||||
|
||||
using QueryBuilder = Query::Builder;
|
||||
using QueryGrammar = Query::Grammars::Grammar;
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace Connectors
|
||||
void validateHosts(const QStringList &hosts) const;
|
||||
};
|
||||
|
||||
} // namespace Orm::Connectors
|
||||
} // namespace Connectors
|
||||
} // namespace Orm
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Orm::Connectors
|
||||
{
|
||||
public:
|
||||
/*! Pure virtual destructor. */
|
||||
virtual ~Connector() = 0;
|
||||
~Connector() override = 0;
|
||||
|
||||
/*! Create a new QSqlDatabase connection, factory method. */
|
||||
QSqlDatabase
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Orm
|
||||
const QString &database = "", const QString &tablePrefix = "",
|
||||
const QVariantHash &config = {});
|
||||
/*! Pure virtual destructor. */
|
||||
virtual ~DatabaseConnection() = 0;
|
||||
~DatabaseConnection() override = 0;
|
||||
|
||||
/*! Begin a fluent query against a database table. */
|
||||
QSharedPointer<QueryBuilder>
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Query
|
||||
|
||||
public:
|
||||
/*! Virtual destructor. */
|
||||
virtual ~DatabaseManager();
|
||||
~DatabaseManager() final;
|
||||
|
||||
/*! Factory method to create DatabaseManager instance and register a new connection as default connection at once. */
|
||||
static std::unique_ptr<DatabaseManager>
|
||||
@@ -106,7 +106,7 @@ namespace Query
|
||||
static DatabaseManager *instance();
|
||||
|
||||
/*! Get a database connection instance. */
|
||||
ConnectionInterface &connection(const QString &name = "") override;
|
||||
ConnectionInterface &connection(const QString &name = "") final;
|
||||
/*! Register a connection with the manager. */
|
||||
DatabaseManager &
|
||||
addConnection(const QVariantHash &config,
|
||||
@@ -127,9 +127,9 @@ namespace Query
|
||||
QStringList openedConnectionNames() const;
|
||||
|
||||
/*! Get the default connection name. */
|
||||
const QString &getDefaultConnection() const override;
|
||||
const QString &getDefaultConnection() const final;
|
||||
/*! Set the default connection name. */
|
||||
void setDefaultConnection(const QString &defaultConnection) override;
|
||||
void setDefaultConnection(const QString &defaultConnection) final;
|
||||
|
||||
// TODO duplicate, extract to some internal types silverqx
|
||||
/*! Reconnector lambda type. */
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Orm::Exceptions
|
||||
using LogicError::LogicError;
|
||||
};
|
||||
|
||||
} // namespace Orm
|
||||
} // namespace Orm::Exceptions
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Orm::Exceptions
|
||||
using LogicError::LogicError;
|
||||
};
|
||||
|
||||
} // namespace Orm
|
||||
} // namespace Orm::Exceptions
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Orm::Exceptions
|
||||
using LogicError::LogicError;
|
||||
};
|
||||
|
||||
} // namespace Orm
|
||||
} // namespace Orm::Exceptions
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Orm::Exceptions
|
||||
using InvalidArgumentError::InvalidArgumentError;
|
||||
};
|
||||
|
||||
} // namespace Orm
|
||||
} // namespace Orm::Exceptions
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Orm::Exceptions
|
||||
return m_message;
|
||||
}
|
||||
|
||||
} // namespace Orm
|
||||
} // namespace Orm::Exceptions
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Orm::Exceptions
|
||||
const QVector<QVariant> m_bindings;
|
||||
};
|
||||
|
||||
} // namespace Orm
|
||||
} // namespace Orm::Exceptions
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Orm::Exceptions
|
||||
return m_message;
|
||||
}
|
||||
|
||||
} // namespace Orm
|
||||
} // namespace Orm::Exceptions
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Orm::Exceptions
|
||||
const QSqlError m_sqlError;
|
||||
};
|
||||
|
||||
} // namespace Orm
|
||||
} // namespace Orm::Exceptions
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Orm::Exceptions
|
||||
using SqlError::SqlError;
|
||||
};
|
||||
|
||||
} // namespace Orm
|
||||
} // namespace Orm::Exceptions
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
|
||||
@@ -19,29 +19,29 @@ namespace Orm
|
||||
|
||||
public:
|
||||
/*! Constructor. */
|
||||
MySqlConnection(
|
||||
explicit MySqlConnection(
|
||||
std::function<Connectors::ConnectionName()> &&connection,
|
||||
const QString &database = "", const QString &tablePrefix = "",
|
||||
const QVariantHash &config = {});
|
||||
/*! Virtual destructor. */
|
||||
inline virtual ~MySqlConnection() = default;
|
||||
inline ~MySqlConnection() final = default;
|
||||
|
||||
/*! Get a schema builder instance for the connection. */
|
||||
std::unique_ptr<SchemaBuilder> getSchemaBuilder() override;
|
||||
std::unique_ptr<SchemaBuilder> getSchemaBuilder() final;
|
||||
|
||||
/*! Determine if the connected database is a MariaDB database. */
|
||||
bool isMaria();
|
||||
|
||||
/*! Check database connection and show warnings when the state changed. */
|
||||
bool pingDatabase() override;
|
||||
bool pingDatabase() final;
|
||||
|
||||
protected:
|
||||
/*! Get the default query grammar instance. */
|
||||
std::unique_ptr<QueryGrammar> getDefaultQueryGrammar() const override;
|
||||
std::unique_ptr<QueryGrammar> getDefaultQueryGrammar() const final;
|
||||
/*! Get the default schema grammar instance. */
|
||||
std::unique_ptr<SchemaGrammar> getDefaultSchemaGrammar() const override;
|
||||
std::unique_ptr<SchemaGrammar> getDefaultSchemaGrammar() const final;
|
||||
/*! Get the default post processor instance. */
|
||||
std::unique_ptr<QueryProcessor> getDefaultPostProcessor() const override;
|
||||
std::unique_ptr<QueryProcessor> getDefaultPostProcessor() const final;
|
||||
|
||||
/*! If the connected database is a MariaDB database. */
|
||||
std::optional<bool> m_isMaria;
|
||||
|
||||
@@ -85,8 +85,8 @@ namespace Query
|
||||
{
|
||||
Column column {};
|
||||
QVariant value {};
|
||||
QString comparison {EQ};
|
||||
QString condition {AND};
|
||||
QString comparison {Orm::Constants::EQ};
|
||||
QString condition {Orm::Constants::AND};
|
||||
WhereType type {WhereType::UNDEFINED};
|
||||
QSharedPointer<QueryBuilder> nestedQuery {nullptr};
|
||||
QVector<QVariant> values {};
|
||||
@@ -107,8 +107,8 @@ namespace Query
|
||||
{
|
||||
Column column {};
|
||||
QVariant value {};
|
||||
QString comparison {EQ};
|
||||
QString condition {AND};
|
||||
QString comparison {Orm::Constants::EQ};
|
||||
QString condition {Orm::Constants::AND};
|
||||
HavingType type {HavingType::UNDEFINED};
|
||||
QString sql {};
|
||||
};
|
||||
@@ -117,7 +117,7 @@ namespace Query
|
||||
struct OrderByItem
|
||||
{
|
||||
Column column {};
|
||||
QString direction {ASC};
|
||||
QString direction {Orm::Constants::ASC};
|
||||
QString sql {};
|
||||
};
|
||||
|
||||
@@ -137,7 +137,7 @@ namespace Query
|
||||
QVariant value;
|
||||
|
||||
/*! Converting operator to the UpdateItem. */
|
||||
operator UpdateItem() const;
|
||||
explicit operator UpdateItem() const;
|
||||
};
|
||||
|
||||
/*! Comparison operator for the AttributeItem. */
|
||||
@@ -148,11 +148,11 @@ namespace Query
|
||||
{
|
||||
Column column;
|
||||
QVariant value;
|
||||
QString comparison {EQ};
|
||||
QString comparison {Orm::Constants::EQ};
|
||||
QString condition {};
|
||||
|
||||
/*! Converting operator to the AttributeItem. */
|
||||
operator AttributeItem() const;
|
||||
operator AttributeItem() const; // NOLINT(google-explicit-constructor)
|
||||
};
|
||||
|
||||
/*! Where item to compare two columns, primarily used in vector overloads. */
|
||||
@@ -160,7 +160,7 @@ namespace Query
|
||||
{
|
||||
Column first;
|
||||
Column second;
|
||||
QString comparison {EQ};
|
||||
QString comparison {Orm::Constants::EQ};
|
||||
QString condition {};
|
||||
};
|
||||
|
||||
|
||||
@@ -19,23 +19,23 @@ namespace Orm
|
||||
|
||||
public:
|
||||
/*! Constructor. */
|
||||
PostgresConnection(
|
||||
explicit PostgresConnection(
|
||||
std::function<Connectors::ConnectionName()> &&connection,
|
||||
const QString &database = "", const QString &tablePrefix = "",
|
||||
const QVariantHash &config = {});
|
||||
/*! Virtual destructor. */
|
||||
inline virtual ~PostgresConnection() = default;
|
||||
inline ~PostgresConnection() final = default;
|
||||
|
||||
/*! Get a schema builder instance for the connection. */
|
||||
std::unique_ptr<SchemaBuilder> getSchemaBuilder() override;
|
||||
std::unique_ptr<SchemaBuilder> getSchemaBuilder() final;
|
||||
|
||||
protected:
|
||||
/*! Get the default query grammar instance. */
|
||||
std::unique_ptr<QueryGrammar> getDefaultQueryGrammar() const override;
|
||||
std::unique_ptr<QueryGrammar> getDefaultQueryGrammar() const final;
|
||||
/*! Get the default schema grammar instance. */
|
||||
std::unique_ptr<SchemaGrammar> getDefaultSchemaGrammar() const override;
|
||||
std::unique_ptr<SchemaGrammar> getDefaultSchemaGrammar() const final;
|
||||
/*! Get the default post processor instance. */
|
||||
std::unique_ptr<QueryProcessor> getDefaultPostProcessor() const override;
|
||||
std::unique_ptr<QueryProcessor> getDefaultPostProcessor() const final;
|
||||
};
|
||||
|
||||
} // namespace Orm
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Orm::Query
|
||||
Expression &operator=(Expression &&) = default;
|
||||
|
||||
/*! Converting operator, QVariant(Expression). */
|
||||
operator QVariant() const;
|
||||
operator QVariant() const; // NOLINT(google-explicit-constructor)
|
||||
|
||||
/*! Obtain expression's value. */
|
||||
const QVariant &getValue() const;
|
||||
@@ -59,7 +59,7 @@ namespace Orm::Query
|
||||
return m_value;
|
||||
}
|
||||
|
||||
} // namespace Orm
|
||||
} // namespace Orm::Query
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@ namespace Orm::Query::Grammars
|
||||
public:
|
||||
/*! Default constructor. */
|
||||
MySqlGrammar() = default;
|
||||
/*! Virtual destructor. */
|
||||
inline ~MySqlGrammar() override = default;
|
||||
|
||||
/*! Compile an insert statement into SQL. */
|
||||
QString compileInsert(const QueryBuilder &query,
|
||||
|
||||
@@ -20,6 +20,8 @@ namespace Orm::Query::Grammars
|
||||
public:
|
||||
/*! Default constructor. */
|
||||
PostgresGrammar() = default;
|
||||
/*! Virtual destructor. */
|
||||
inline ~PostgresGrammar() override = default;
|
||||
|
||||
/*! Compile an insert ignore statement into SQL. */
|
||||
QString compileInsertOrIgnore(const QueryBuilder &query,
|
||||
|
||||
@@ -20,6 +20,8 @@ namespace Orm::Query::Grammars
|
||||
public:
|
||||
/*! Default constructor. */
|
||||
SQLiteGrammar() = default;
|
||||
/*! Virtual destructor. */
|
||||
inline ~SQLiteGrammar() override = default;
|
||||
|
||||
/*! Compile an insert ignore statement into SQL. */
|
||||
QString compileInsertOrIgnore(const QueryBuilder &query,
|
||||
|
||||
@@ -19,6 +19,9 @@ namespace Orm::Query
|
||||
/*! Join table type. */
|
||||
using JoinTable = FromClause;
|
||||
|
||||
/*! Virtual destructor. */
|
||||
inline ~JoinClause() override = default;
|
||||
|
||||
/*! Constructor with the table as QString. */
|
||||
JoinClause(const Builder &query, const QString &type, const QString &table);
|
||||
/*! Constructor with the table as Expression. */
|
||||
@@ -42,11 +45,11 @@ namespace Orm::Query
|
||||
getTable() const;
|
||||
|
||||
/*! Get a new instance of the join clause builder. */
|
||||
QSharedPointer<Builder> newQuery() const override;
|
||||
QSharedPointer<Builder> newQuery() const final;
|
||||
|
||||
protected:
|
||||
/*! Create a new query instance for a sub-query. */
|
||||
QSharedPointer<Builder> forSubQuery() const override;
|
||||
QSharedPointer<Builder> forSubQuery() const final;
|
||||
|
||||
private:
|
||||
/*! The type of join being performed. */
|
||||
|
||||
@@ -20,6 +20,8 @@ namespace Orm::Query::Processors
|
||||
public:
|
||||
/*! Default constructor. */
|
||||
MySqlProcessor() = default;
|
||||
/*! Virtual destructor. */
|
||||
inline ~MySqlProcessor() override = default;
|
||||
|
||||
/*! Process the results of a column listing query. */
|
||||
QStringList processColumnListing(QSqlQuery &query) const override;
|
||||
|
||||
@@ -20,6 +20,8 @@ namespace Orm::Query::Processors
|
||||
public:
|
||||
/*! Default constructor. */
|
||||
PostgresProcessor() = default;
|
||||
/*! Virtual destructor. */
|
||||
inline ~PostgresProcessor() override = default;
|
||||
|
||||
/*! Process the results of a column listing query. */
|
||||
QStringList processColumnListing(QSqlQuery &query) const override;
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Orm::Query::Processors
|
||||
public:
|
||||
/*! Default constructor. */
|
||||
Processor() = default;
|
||||
/*! Virtual destructor. */
|
||||
/*! Virtual destructor, this class is used so can not be pure. */
|
||||
inline virtual ~Processor() = default;
|
||||
|
||||
/*! Process the results of a column listing query. */
|
||||
|
||||
@@ -20,6 +20,8 @@ namespace Orm::Query::Processors
|
||||
public:
|
||||
/*! Default constructor. */
|
||||
SQLiteProcessor() = default;
|
||||
/*! Virtual destructor. */
|
||||
inline ~SQLiteProcessor() override = default;
|
||||
|
||||
/*! Process the results of a column listing query. */
|
||||
QStringList processColumnListing(QSqlQuery &query) const override;
|
||||
|
||||
@@ -1201,7 +1201,7 @@ namespace Query
|
||||
return *this;
|
||||
}
|
||||
|
||||
} // namespace Orm::Query
|
||||
} // namespace Query
|
||||
} // namespace Orm
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
@@ -20,6 +20,8 @@ namespace Orm::Schema::Grammars
|
||||
public:
|
||||
/*! Default constructor. */
|
||||
MySqlSchemaGrammar() = default;
|
||||
/*! Virtual destructor. */
|
||||
inline ~MySqlSchemaGrammar() override = default;
|
||||
|
||||
/*! Compile the query to determine the list of columns. */
|
||||
QString compileColumnListing(const QString &table = "") const override;
|
||||
|
||||
@@ -20,6 +20,8 @@ namespace Orm::Schema::Grammars
|
||||
public:
|
||||
/*! Default constructor. */
|
||||
PostgresSchemaGrammar() = default;
|
||||
/*! Virtual destructor. */
|
||||
inline ~PostgresSchemaGrammar() override = default;
|
||||
|
||||
/*! Compile the query to determine the list of columns. */
|
||||
QString compileColumnListing(const QString &table = "") const override;
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Orm::Schema::Grammars
|
||||
/*! Default constructor. */
|
||||
SchemaGrammar() = default;
|
||||
/*! Pure virtual destructor. */
|
||||
virtual ~SchemaGrammar() = 0;
|
||||
~SchemaGrammar() override = 0;
|
||||
|
||||
/*! Compile the query to determine the list of columns. */
|
||||
virtual QString compileColumnListing(const QString &table = "") const = 0;
|
||||
|
||||
@@ -20,6 +20,8 @@ namespace Orm::Schema::Grammars
|
||||
public:
|
||||
/*! Default constructor. */
|
||||
SQLiteSchemaGrammar() = default;
|
||||
/*! Virtual destructor. */
|
||||
inline ~SQLiteSchemaGrammar() override = default;
|
||||
|
||||
/*! Compile the query to determine the list of columns. */
|
||||
QString compileColumnListing(const QString &table = "") const override;
|
||||
|
||||
@@ -20,6 +20,9 @@ namespace Orm::Schema
|
||||
public:
|
||||
using SchemaBuilder::SchemaBuilder;
|
||||
|
||||
/*! Virtual destructor. */
|
||||
inline ~MySqlSchemaBuilder() override = default;
|
||||
|
||||
/*! Get the column listing for a given table. */
|
||||
QStringList getColumnListing(const QString &table) const override;
|
||||
};
|
||||
|
||||
@@ -20,6 +20,9 @@ namespace Orm::Schema
|
||||
public:
|
||||
using SchemaBuilder::SchemaBuilder;
|
||||
|
||||
/*! Virtual destructor. */
|
||||
inline ~PostgresSchemaBuilder() override = default;
|
||||
|
||||
/*! Get the column listing for a given table. */
|
||||
QStringList getColumnListing(const QString &table) const override;
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Grammars
|
||||
const SchemaGrammar &m_grammar;
|
||||
};
|
||||
|
||||
} // namespace Orm::Schema
|
||||
} // namespace Schema
|
||||
} // namespace Orm
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
@@ -19,6 +19,9 @@ namespace Orm::Schema
|
||||
|
||||
public:
|
||||
using SchemaBuilder::SchemaBuilder;
|
||||
|
||||
/*! Virtual destructor. */
|
||||
inline ~SQLiteSchemaBuilder() override = default;
|
||||
};
|
||||
|
||||
} // namespace Orm::Schema
|
||||
|
||||
@@ -19,23 +19,23 @@ namespace Orm
|
||||
|
||||
public:
|
||||
/*! Constructor. */
|
||||
SQLiteConnection(
|
||||
explicit SQLiteConnection(
|
||||
std::function<Connectors::ConnectionName()> &&connection,
|
||||
const QString &database = "", const QString &tablePrefix = "",
|
||||
const QVariantHash &config = {});
|
||||
/*! Virtual destructor. */
|
||||
inline virtual ~SQLiteConnection() = default;
|
||||
inline ~SQLiteConnection() final = default;
|
||||
|
||||
/*! Get a schema builder instance for the connection. */
|
||||
std::unique_ptr<SchemaBuilder> getSchemaBuilder() override;
|
||||
std::unique_ptr<SchemaBuilder> getSchemaBuilder() final;
|
||||
|
||||
protected:
|
||||
/*! Get the default query grammar instance. */
|
||||
std::unique_ptr<QueryGrammar> getDefaultQueryGrammar() const override;
|
||||
std::unique_ptr<QueryGrammar> getDefaultQueryGrammar() const final;
|
||||
/*! Get the default schema grammar instance. */
|
||||
std::unique_ptr<SchemaGrammar> getDefaultSchemaGrammar() const override;
|
||||
std::unique_ptr<SchemaGrammar> getDefaultSchemaGrammar() const final;
|
||||
/*! Get the default post processor instance. */
|
||||
std::unique_ptr<QueryProcessor> getDefaultPostProcessor() const override;
|
||||
std::unique_ptr<QueryProcessor> getDefaultPostProcessor() const final;
|
||||
};
|
||||
|
||||
} // namespace Orm
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Support
|
||||
{
|
||||
public:
|
||||
/*! Constructor. */
|
||||
ConfigurationOptionsParser(const Connectors::Connector &connector);
|
||||
explicit ConfigurationOptionsParser(const Connectors::Connector &connector);
|
||||
|
||||
/*! Parse the database configuration, validate, prepare, and merge connection
|
||||
options. */
|
||||
@@ -53,7 +53,7 @@ namespace Support
|
||||
const Connectors::Connector &m_connector;
|
||||
};
|
||||
|
||||
} // namespace Orm::Support
|
||||
} // namespace Support
|
||||
} // namespace Orm
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
@@ -393,7 +393,7 @@ namespace Concerns
|
||||
return static_cast<const Model<Derived, AllRelations...> &>(*this);
|
||||
}
|
||||
|
||||
} // namespace Orm::Tiny::Concerns
|
||||
} // namespace Concerns
|
||||
} // namespace Orm::Tiny
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
@@ -180,7 +180,7 @@ namespace Concerns
|
||||
|
||||
public:
|
||||
/*! Constructor. */
|
||||
LazyRelationStore(HasRelationStore &hasRelationStore);
|
||||
explicit LazyRelationStore(HasRelationStore &hasRelationStore);
|
||||
|
||||
/*! Method called after visitation. */
|
||||
template<typename Method>
|
||||
@@ -770,7 +770,7 @@ namespace Concerns
|
||||
return static_cast<const Derived &>(*this);
|
||||
}
|
||||
|
||||
} // namespace Orm::Tiny::Concerns
|
||||
} // namespace Concerns
|
||||
} // namespace Orm::Tiny
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
@@ -35,11 +35,6 @@ namespace Private
|
||||
template<typename T>
|
||||
friend class Tiny::Concerns::QueriesRelationships;
|
||||
|
||||
/*! Deleted constructor, this is a pure library class. */
|
||||
HasNestedStore() = delete;
|
||||
/*! Deleted destructor. */
|
||||
~HasNestedStore() = delete;
|
||||
|
||||
/*! Arguments needed to save for the last relation in a hasNested(). */
|
||||
template<typename Related>
|
||||
struct NestedStore
|
||||
@@ -68,8 +63,14 @@ namespace Private
|
||||
#endif
|
||||
inline static
|
||||
std::stack<std::type_index> STORE_TYPEID = {};
|
||||
|
||||
public:
|
||||
/*! Deleted constructor, this is a pure library class. */
|
||||
HasNestedStore() = delete;
|
||||
/*! Deleted destructor. */
|
||||
~HasNestedStore() = delete;
|
||||
};
|
||||
}
|
||||
} // namespace Private
|
||||
|
||||
/*! Queries Relationship Existence/Absence with nesting support. */
|
||||
template<typename Model>
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Orm::Tiny::Exceptions
|
||||
using Orm::Exceptions::RuntimeError::RuntimeError;
|
||||
};
|
||||
|
||||
} // namespace Orm::Tiny
|
||||
} // namespace Orm::Tiny::Exceptions
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Orm::Tiny::Exceptions
|
||||
return m_ids;
|
||||
}
|
||||
|
||||
} // namespace Orm::Tiny
|
||||
} // namespace Orm::Tiny::Exceptions
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace Orm::Tiny::Exceptions
|
||||
return m_relation;
|
||||
}
|
||||
|
||||
} // namespace Orm::Tiny
|
||||
} // namespace Orm::Tiny::Exceptions
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace Orm::Tiny::Exceptions
|
||||
return m_relation;
|
||||
}
|
||||
|
||||
} // namespace Orm::Tiny
|
||||
} // namespace Orm::Tiny::Exceptions
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
|
||||
@@ -107,6 +107,12 @@ namespace Relations {
|
||||
// FUTURE linux, add linker version script https://github.com/sailfishos/qtbase/commit/72ba0079c3967bdfa26acdce78ce6cb98b30c27b?view=parallel https://www.gnu.org/software/gnulib/manual/html_node/Exported-Symbols-of-Shared-Libraries.html https://stackoverflow.com/questions/41061220/where-do-object-file-version-references-come-from silverqx
|
||||
// TODO Visual Studio memory analyzer https://docs.microsoft.com/en-us/visualstudio/profiling/memory-usage-without-debugging2?view=vs-2019 silverqx
|
||||
// CUR fix all modernize-pass-by-value silverqx
|
||||
// CUR check all virtual ~dtor() and change it to ~dtor() override where appropriate silverqx
|
||||
// CUR also move all inline ~dtor() outside class silverqx
|
||||
// CUR use final instead of override in final classes silverqx
|
||||
// CUR solve using ns_name::name in header files silverqx
|
||||
// CUR use using inside classes where appropriate silverqx
|
||||
// CUR explicitly define all virtual dtors silverqx
|
||||
/*! Base model class. */
|
||||
template<typename Derived, AllRelationsConcept ...AllRelations>
|
||||
class Model :
|
||||
@@ -150,10 +156,10 @@ namespace Relations {
|
||||
|
||||
/*! Create a new TinORM model instance from attributes
|
||||
(converting constructor). */
|
||||
Model(const QVector<AttributeItem> &attributes);
|
||||
explicit Model(const QVector<AttributeItem> &attributes);
|
||||
/*! Create a new TinORM model instance from attributes
|
||||
(converting constructor). */
|
||||
Model(QVector<AttributeItem> &&attributes);
|
||||
explicit Model(QVector<AttributeItem> &&attributes);
|
||||
|
||||
/*! Create a new TinORM model instance from attributes
|
||||
(list initialization). */
|
||||
@@ -386,11 +392,12 @@ namespace Relations {
|
||||
/*! Accesses the contained value. */
|
||||
QVariant operator*() const;
|
||||
/*! Converting operator to the QVariant type. */
|
||||
operator QVariant() const;
|
||||
operator QVariant() const; // NOLINT(google-explicit-constructor)
|
||||
|
||||
private:
|
||||
/*! AttributeReference's private constructor. */
|
||||
AttributeReference(Model<Derived, AllRelations...> &model,
|
||||
// NOLINTNEXTLINE(modernize-pass-by-value)
|
||||
const QString &attribute);
|
||||
|
||||
/*! The model on which is an attribute set. */
|
||||
@@ -2415,7 +2422,9 @@ namespace Relations {
|
||||
|
||||
template<typename Derived, AllRelationsConcept ...AllRelations>
|
||||
Model<Derived, AllRelations...>::AttributeReference::AttributeReference(
|
||||
Model<Derived, AllRelations...> &model, const QString &attribute
|
||||
Model<Derived, AllRelations...> &model,
|
||||
// NOLINTNEXTLINE(modernize-pass-by-value)
|
||||
const QString &attribute
|
||||
)
|
||||
: m_model(model)
|
||||
, m_attribute(attribute)
|
||||
@@ -3305,7 +3314,7 @@ namespace Relations {
|
||||
return Derived::u_guarded;
|
||||
}
|
||||
|
||||
} // namespace Orm::Tiny
|
||||
} // namespace Tiny
|
||||
} // namespace Orm
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
@@ -2333,7 +2333,7 @@ namespace Relations
|
||||
return Model<Derived, AllRelations...>::query();
|
||||
}
|
||||
|
||||
} // namespace Orm::Tiny
|
||||
} // namespace Tiny
|
||||
} // namespace Orm
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace Concerns {
|
||||
return cached;
|
||||
}
|
||||
|
||||
} // namespace Orm::Tiny::Relations::Concerns
|
||||
} // namespace Concerns
|
||||
} // namespace Orm::Tiny::Relations
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
@@ -365,7 +365,7 @@ namespace Relations
|
||||
return std::move(query);
|
||||
}
|
||||
|
||||
} // namespace Orm::Tiny::Relations
|
||||
} // namespace Relations
|
||||
} // namespace Orm::Tiny
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
@@ -2109,8 +2109,8 @@ namespace Tiny::Relations
|
||||
return getQuery().getQuery();
|
||||
}
|
||||
|
||||
} // namespace Orm::Tiny::Relations
|
||||
} // namespace Orm::Tiny
|
||||
} // namespace Tiny::Relations
|
||||
} // namespace Orm
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
|
||||
@@ -1427,7 +1427,7 @@ namespace Tiny
|
||||
return builder().getQuery();
|
||||
}
|
||||
|
||||
} // namespace Orm::Tiny
|
||||
} // namespace Tiny
|
||||
} // namespace Orm
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Concerns
|
||||
std::conditional_t<std::is_void_v<Related>, QueryBuilder,
|
||||
TinyBuilder<Related>>;
|
||||
|
||||
} // namespace Orm::Tiny::Concerns
|
||||
} // namespace Concerns
|
||||
} // namespace Orm::Tiny
|
||||
|
||||
#endif // ORM_TINYTYPES_HPP
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Types
|
||||
int affected = -1;
|
||||
};
|
||||
|
||||
} // namespace Orm::Types
|
||||
} // namespace Types
|
||||
|
||||
using Log = Types::Log;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Types
|
||||
int transactional = -1;
|
||||
};
|
||||
|
||||
} // namespace Orm::Types
|
||||
} // namespace Types
|
||||
|
||||
using StatementsCounter = Types::StatementsCounter;
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ namespace Orm::Utils::Attribute
|
||||
joinAttributesForFirstOr(const QVector<WhereItem> &attributes,
|
||||
const QVector<AttributeItem> &values,
|
||||
const QString &keyName);
|
||||
|
||||
} // namespace Orm::Utils::Attribute
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
@@ -18,8 +18,10 @@ TINY_SYSTEM_HEADER
|
||||
#include "orm/macros/export.hpp"
|
||||
|
||||
#ifdef __GNUG__
|
||||
// NOLINTNEXTLINE(bugprone-reserved-identifier)
|
||||
# define __tiny_func__ Orm::Utils::Type::prettyFunction(__PRETTY_FUNCTION__)
|
||||
#elif _MSC_VER
|
||||
// NOLINTNEXTLINE(bugprone-reserved-identifier)
|
||||
# define __tiny_func__ Orm::Utils::Type::prettyFunction(__FUNCTION__)
|
||||
#else
|
||||
# define __tiny_func__ __FUNCTION__
|
||||
|
||||
@@ -14,6 +14,7 @@ TINY_SYSTEM_HEADER
|
||||
// Should be empty for stable releases, and use hypen before for SemVer compatibility!
|
||||
#define TINYORM_VERSION_STATUS ""
|
||||
|
||||
// NOLINTNEXTLINE(bugprone-reserved-identifier)
|
||||
#define TINYORM__STRINGIFY(x) #x
|
||||
#define TINYORM_STRINGIFY(x) TINYORM__STRINGIFY(x)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user