Clang: Improve interfaces

The interfaces should never used to handle ownership. So it is now using
protected destructors. Copy operations are forbidden too.

https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#c35-a-base-class-destructor-should-be-either-public-and-virtual-or-protected-and-nonvirtual

Change-Id: Ib0b60a73a7ec130973b5cb0095cc5b2f10fa0758
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Marco Bubke
2018-03-12 14:08:18 +01:00
parent f1e02c0826
commit 9c4bfbe20a
52 changed files with 186 additions and 316 deletions

View File

@@ -53,6 +53,9 @@ class SQLITE_EXPORT BaseStatement
public:
explicit BaseStatement(Utils::SmallStringView sqlStatement, Database &database);
BaseStatement(const BaseStatement &) = delete;
BaseStatement &operator=(const BaseStatement &) = delete;
static void deleteCompiledStatement(sqlite3_stmt *m_compiledStatement);
bool next() const;
@@ -123,6 +126,9 @@ public:
Database &database() const;
protected:
~BaseStatement() = default;
private:
std::unique_ptr<sqlite3_stmt, void (*)(sqlite3_stmt*)> m_compiledStatement;
Database &m_database;
@@ -146,7 +152,7 @@ extern template SQLITE_EXPORT Utils::SmallString BaseStatement::fetchValue<Utils
extern template SQLITE_EXPORT Utils::PathString BaseStatement::fetchValue<Utils::PathString>(int column) const;
template <typename BaseStatement>
class SQLITE_EXPORT StatementImplementation : public BaseStatement
class StatementImplementation : public BaseStatement
{
public:
@@ -290,6 +296,8 @@ public:
return statement.template fetchValue<Type>(0);
}
protected:
~StatementImplementation() = default;
private:
struct Resetter