From f903add3e120e0084767a8cf60ad4305c5aa5c4a Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Mon, 26 Dec 2016 02:36:50 +0100 Subject: [PATCH] Disable copy constructor. --- include/MUtils/Hash.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/MUtils/Hash.h b/include/MUtils/Hash.h index 313d827..e8336b5 100644 --- a/include/MUtils/Hash.h +++ b/include/MUtils/Hash.h @@ -41,7 +41,6 @@ namespace MUtils class MUTILS_API Hash { public: - Hash(const char* key = NULL) {}; virtual ~Hash(void) {}; bool update(const quint8 *const data, const quint32 len) { return process(data, len); } @@ -51,10 +50,15 @@ namespace MUtils QByteArray digest(const bool bAsHex = true) { return bAsHex ? finalize().toHex() : finalize(); } protected: + Hash(const char* key = NULL) {/*nothing to do*/}; virtual bool process(const quint8 *const data, const quint32 len) = 0; virtual QByteArray finalize(void) = 0; + + private: + Hash &operator=(const Hash&) { throw "Disabled"; } + Hash(const Hash&) { throw "Disabled"; } }; - Hash *create(const quint16 &hashId, const char *const key = NULL); + MUTILS_API Hash *create(const quint16 &hashId, const char *const key = NULL); } }