diff options
author | Dan Raviv <dan@soundradix.com> | 2017-09-16 13:06:05 +0300 |
---|---|---|
committer | Dan Raviv <dan@soundradix.com> | 2017-09-16 13:06:05 +0300 |
commit | 2a07f878a80003f2142d5052d015a9ac81a3a6bc (patch) | |
tree | 43e85852061f076a5a247cbb2eea8a8c59c73ce8 /src/wallet | |
parent | e278f86c536921032e8288625dc5f3af610f2ec8 (diff) |
Refactor: Modernize disallowed copy constructors/assignment
Use C++11's better capability of expressing an interface of a non-copyable class by publicly deleting its copy ctor and assignment operator instead of just declaring them private.
Diffstat (limited to 'src/wallet')
-rw-r--r-- | src/wallet/db.h | 7 | ||||
-rw-r--r-- | src/wallet/walletdb.h | 5 |
2 files changed, 5 insertions, 7 deletions
diff --git a/src/wallet/db.h b/src/wallet/db.h index 6f3cfe9557..14283ac8f8 100644 --- a/src/wallet/db.h +++ b/src/wallet/db.h @@ -156,6 +156,9 @@ public: explicit CDB(CWalletDBWrapper& dbw, const char* pszMode = "r+", bool fFlushOnCloseIn=true); ~CDB() { Close(); } + CDB(const CDB&) = delete; + CDB& operator=(const CDB&) = delete; + void Flush(); void Close(); static bool Recover(const std::string& filename, void *callbackDataIn, bool (*recoverKVcallback)(void* callbackData, CDataStream ssKey, CDataStream ssValue), std::string& out_backup_filename); @@ -168,10 +171,6 @@ public: /* verifies the database file */ static bool VerifyDatabaseFile(const std::string& walletFile, const fs::path& dataDir, std::string& warningStr, std::string& errorStr, CDBEnv::recoverFunc_type recoverFunc); -private: - CDB(const CDB&); - void operator=(const CDB&); - public: template <typename K, typename T> bool Read(const K& key, T& value) diff --git a/src/wallet/walletdb.h b/src/wallet/walletdb.h index 4f8ea185d5..3a146179af 100644 --- a/src/wallet/walletdb.h +++ b/src/wallet/walletdb.h @@ -167,6 +167,8 @@ public: m_dbw(dbw) { } + CWalletDB(const CWalletDB&) = delete; + CWalletDB& operator=(const CWalletDB&) = delete; bool WriteName(const std::string& strAddress, const std::string& strName); bool EraseName(const std::string& strAddress); @@ -244,9 +246,6 @@ public: private: CDB batch; CWalletDBWrapper& m_dbw; - - CWalletDB(const CWalletDB&); - void operator=(const CWalletDB&); }; //! Compacts BDB state so that wallet.dat is self-contained (if there are changes) |