From 756a944ef3899d79a0baca792d53a3652c419d26 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Tue, 23 Nov 2021 16:38:11 +0100 Subject: [PATCH] Probably null change: make sure that all classes with destructors also have copy constructors and assignment operators --- src/aspell/rclaspell.h | 2 ++ src/common/rclconfig.h | 16 ++++++------- src/common/textsplit.h | 2 ++ src/common/webstore.h | 2 ++ src/index/exefetcher.cpp | 6 ++--- src/index/exefetcher.h | 5 ++-- src/index/fetcher.h | 12 +++++----- src/index/fsfetcher.h | 6 ++++- src/index/fsindexer.h | 2 ++ src/index/idxstatus.h | 2 ++ src/index/indexer.h | 2 ++ src/index/rclmon.h | 2 ++ src/index/webqueue.h | 2 ++ src/index/webqueuefetcher.h | 9 ++++--- src/internfile/htmlparse.h | 1 - src/internfile/internfile.h | 31 ++++++++++++------------ src/internfile/mh_execm.h | 2 ++ src/internfile/mh_html.h | 2 ++ src/internfile/mh_mail.h | 2 ++ src/internfile/mh_mbox.h | 2 ++ src/internfile/mh_null.h | 2 ++ src/internfile/mh_symlink.h | 43 +++++++++++++++++----------------- src/internfile/mh_text.h | 2 ++ src/internfile/mh_unknown.h | 18 +++++++------- src/internfile/mh_xslt.h | 2 ++ src/internfile/mimehandler.h | 2 ++ src/internfile/myhtmlparse.h | 9 ++++--- src/internfile/uncomp.h | 4 ++++ src/python/recoll/pyrecoll.cpp | 8 +++---- src/qtgui/advshist.h | 2 ++ src/qtgui/fragbuts.h | 2 ++ src/qtgui/preview_load.h | 5 ++-- src/qtgui/rclmain_w.h | 2 ++ src/qtgui/reslist.h | 2 ++ src/qtgui/restable.h | 2 ++ src/qtgui/scbase.h | 2 ++ src/qtgui/uiprefs_w.h | 2 ++ src/qtgui/viewaction_w.h | 2 ++ src/qtgui/webcache.h | 2 ++ src/query/docseq.h | 4 ++++ src/query/docseqdb.h | 2 ++ src/query/docseqdocs.h | 8 +++---- src/query/docseqhist.h | 4 ++++ src/query/dynconf.h | 5 ++++ src/query/filtseq.h | 2 ++ src/query/plaintorich.h | 3 +++ src/query/qresultstore.h | 8 +++---- src/query/reslistpager.h | 2 ++ src/query/sortseq.h | 7 +++--- src/query/wasaparserdriver.h | 2 ++ src/rcldb/expansiondbs.cpp | 3 +-- src/rcldb/expansiondbs.h | 13 +++++----- src/rcldb/rcldb.h | 5 ++-- src/rcldb/rcldb_p.h | 2 ++ src/rcldb/rclquery_p.h | 3 +++ src/rcldb/searchdata.h | 8 ++++--- src/rcldb/stemdb.h | 24 +++++++------------ src/rcldb/stoplist.h | 1 - src/rcldb/synfamily.h | 7 ------ src/utils/circache.h | 7 ++---- src/utils/cmdtalk.h | 4 ++-- src/utils/conftree.h | 3 +++ src/utils/execmd.h | 13 ++++++---- src/utils/fstreewalk.h | 9 +++++-- src/utils/hldata.h | 6 ++--- src/utils/netcon.h | 10 ++++++++ src/utils/pathut.h | 5 ++++ src/utils/picoxml.h | 2 ++ src/utils/rclutil.h | 6 ++--- src/utils/readfile.h | 3 +++ src/utils/smallut.h | 2 ++ src/utils/strmatcher.cpp | 12 +++++----- src/utils/strmatcher.h | 24 ++++++++++++------- src/utils/workqueue.h | 2 ++ src/utils/zlibut.h | 3 +++ 75 files changed, 282 insertions(+), 165 deletions(-) diff --git a/src/aspell/rclaspell.h b/src/aspell/rclaspell.h index 67126f7b..84b725b3 100644 --- a/src/aspell/rclaspell.h +++ b/src/aspell/rclaspell.h @@ -41,6 +41,8 @@ class Aspell { public: Aspell(const RclConfig *cnf); ~Aspell(); + Aspell(const Aspell &) = delete; + Aspell& operator=(const Aspell &) = delete; /** Check health */ bool ok() const; diff --git a/src/common/rclconfig.h b/src/common/rclconfig.h index 78222b95..a528bc75 100644 --- a/src/common/rclconfig.h +++ b/src/common/rclconfig.h @@ -103,6 +103,14 @@ public: freeAll(); } + RclConfig& operator=(const RclConfig &r) { + if (this != &r) { + freeAll(); + initFrom(r); + } + return *this; + } + // Return a writable clone of the main config. This belongs to the // caller (must delete it when done) ConfNull *cloneMainConfig(); @@ -362,14 +370,6 @@ public: return o_origcwd; } - RclConfig& operator=(const RclConfig &r) { - if (this != &r) { - freeAll(); - initFrom(r); - } - return *this; - } - friend class ParamStale; private: diff --git a/src/common/textsplit.h b/src/common/textsplit.h index a13b6729..0821ee04 100644 --- a/src/common/textsplit.h +++ b/src/common/textsplit.h @@ -50,6 +50,8 @@ public: TextSplit(Flags flags = Flags(TXTS_NONE)) : m_flags(flags) {} virtual ~TextSplit() {} + TextSplit(const TextSplit&) = delete; + TextSplit& operator=(const TextSplit&) = delete; /** Call at program initialization to read non default values from the configuration */ diff --git a/src/common/webstore.h b/src/common/webstore.h index 9127c9ee..aa3eae8e 100644 --- a/src/common/webstore.h +++ b/src/common/webstore.h @@ -34,6 +34,8 @@ class WebStore { public: WebStore(RclConfig *config); ~WebStore(); + WebStore(const WebStore&) = delete; + WebStore& operator=(const WebStore&) = delete; bool getFromCache(const std::string& udi, Rcl::Doc &doc, std::string& data, std::string *hittype = 0); diff --git a/src/index/exefetcher.cpp b/src/index/exefetcher.cpp index 3c404b48..b4e4aeec 100644 --- a/src/index/exefetcher.cpp +++ b/src/index/exefetcher.cpp @@ -61,8 +61,7 @@ public: EXEDocFetcher::EXEDocFetcher(const EXEDocFetcher::Internal& _m) { m = new Internal(_m); - LOGDEB("EXEDocFetcher::EXEDocFetcher: fetch is " << - stringsToString(m->sfetch) << "\n"); + LOGDEB("EXEDocFetcher::EXEDocFetcher: fetch is " << stringsToString(m->sfetch) << "\n"); } bool EXEDocFetcher::fetch(RclConfig*, const Rcl::Doc& idoc, RawDoc& out) @@ -77,8 +76,7 @@ bool EXEDocFetcher::makesig(RclConfig*, const Rcl::Doc& idoc, string& sig) } // Lookup bckid in the config and create an appropriate fetcher. -std::unique_ptr exeDocFetcherMake(RclConfig *config, - const string& bckid) +std::unique_ptr exeDocFetcherMake(RclConfig *config, const string& bckid) { // The config we only read once, not gonna change. static ConfSimple *bconf; diff --git a/src/index/exefetcher.h b/src/index/exefetcher.h index 0af151b7..6ca46bf1 100644 --- a/src/index/exefetcher.h +++ b/src/index/exefetcher.h @@ -40,6 +40,8 @@ public: class Internal; EXEDocFetcher(const Internal&); virtual ~EXEDocFetcher() {} + EXEDocFetcher(const EXEDocFetcher&) = delete; + EXEDocFetcher& operator=(const EXEDocFetcher&) = delete; virtual bool fetch(RclConfig* cnf, const Rcl::Doc& idoc, RawDoc& out); /** Calls stat to retrieve file signature data */ @@ -51,7 +53,6 @@ private: }; // Lookup bckid in the config and create an appropriate fetcher. -std::unique_ptr exeDocFetcherMake(RclConfig *config, - const std::string& bckid); +std::unique_ptr exeDocFetcherMake(RclConfig *config, const std::string& bckid); #endif /* _EXEFETCHER_H_INCLUDED_ */ diff --git a/src/index/fetcher.h b/src/index/fetcher.h index f42f8603..29568c73 100644 --- a/src/index/fetcher.h +++ b/src/index/fetcher.h @@ -72,18 +72,18 @@ public: * @param idoc the data gathered from the index for this doc (udi/ipath) * @param sig output. */ - virtual bool makesig(RclConfig* cnf, const Rcl::Doc& idoc, - std::string& sig) = 0; + virtual bool makesig(RclConfig* cnf, const Rcl::Doc& idoc, std::string& sig) = 0; enum Reason{FetchOk, FetchNotExist, FetchNoPerm, FetchOther}; virtual Reason testAccess(RclConfig*, const Rcl::Doc&) { return FetchOther; } + DocFetcher() {} virtual ~DocFetcher() {} + DocFetcher(const DocFetcher&) = delete; + DocFetcher& operator=(const DocFetcher&) = delete; }; -/** Return an appropriate fetcher object given the backend string - * identifier inside idoc*/ -std::unique_ptr docFetcherMake(RclConfig *config, - const Rcl::Doc& idoc); +/** Return an appropriate fetcher object given the backend string identifier inside idoc*/ +std::unique_ptr docFetcherMake(RclConfig *config, const Rcl::Doc& idoc); #endif /* _FETCHER_H_INCLUDED_ */ diff --git a/src/index/fsfetcher.h b/src/index/fsfetcher.h index 363855a8..7817856b 100644 --- a/src/index/fsfetcher.h +++ b/src/index/fsfetcher.h @@ -23,14 +23,18 @@ /** * The file-system fetcher: */ -class FSDocFetcher : public DocFetcher{ +class FSDocFetcher : public DocFetcher { +public: /** FSDocFetcher::fetch always returns a file name */ virtual bool fetch(RclConfig* cnf, const Rcl::Doc& idoc, RawDoc& out); /** Calls stat to retrieve file signature data */ virtual bool makesig(RclConfig* cnf,const Rcl::Doc& idoc, std::string& sig); virtual DocFetcher::Reason testAccess(RclConfig* cnf, const Rcl::Doc& idoc); + FSDocFetcher() {} virtual ~FSDocFetcher() {} + FSDocFetcher(const FSDocFetcher&) = delete; + FSDocFetcher& operator=(const FSDocFetcher&) = delete; }; extern void fsmakesig(const struct PathStat *stp, std::string& out); diff --git a/src/index/fsindexer.h b/src/index/fsindexer.h index 261cd8e5..4934a985 100644 --- a/src/index/fsindexer.h +++ b/src/index/fsindexer.h @@ -55,6 +55,8 @@ public: */ FsIndexer(RclConfig *cnf, Rcl::Db *db); virtual ~FsIndexer(); + FsIndexer(const FsIndexer&) = delete; + FsIndexer& operator=(const FsIndexer&) = delete; /** * Top level file system tree index method for updating a given database. diff --git a/src/index/idxstatus.h b/src/index/idxstatus.h index 9920daed..6cd021a4 100644 --- a/src/index/idxstatus.h +++ b/src/index/idxstatus.h @@ -57,6 +57,8 @@ class DbIxStatusUpdater { public: DbIxStatusUpdater(const RclConfig *config, bool nox11monitor); virtual ~DbIxStatusUpdater(){} + DbIxStatusUpdater(const DbIxStatusUpdater&) = delete; + DbIxStatusUpdater& operator=(const DbIxStatusUpdater&) = delete; enum Incr {IncrNone, IncrDocsDone = 0x1, IncrFilesDone = 0x2, IncrFileErrors = 0x4}; // Change phase/fn and update diff --git a/src/index/indexer.h b/src/index/indexer.h index 307aeb3d..6efff3c4 100644 --- a/src/index/indexer.h +++ b/src/index/indexer.h @@ -41,6 +41,8 @@ public: enum runStatus {IndexerOk, IndexerError}; ConfIndexer(RclConfig *cnf); virtual ~ConfIndexer(); + ConfIndexer(const ConfIndexer&) = delete; + ConfIndexer& operator=(const ConfIndexer&) = delete; // Indexer types. Maybe we'll have something more dynamic one day enum ixType {IxTNone, IxTFs=1, IxTWebQueue=2, diff --git a/src/index/rclmon.h b/src/index/rclmon.h index 083fba6e..3703ec24 100644 --- a/src/index/rclmon.h +++ b/src/index/rclmon.h @@ -79,6 +79,8 @@ class RclMonEventQueue { public: RclMonEventQueue(); ~RclMonEventQueue(); + RclMonEventQueue(const RclMonEventQueue&) = delete; + RclMonEventQueue& operator=(const RclMonEventQueue&) = delete; /** Wait for event or timeout. Returns with the queue locked */ std::unique_lock wait(int secs = -1, bool *timedout = 0); /** Add event. */ diff --git a/src/index/webqueue.h b/src/index/webqueue.h index bf66f961..3307c77b 100644 --- a/src/index/webqueue.h +++ b/src/index/webqueue.h @@ -41,6 +41,8 @@ class WebQueueIndexer : public FsTreeWalkerCB { public: WebQueueIndexer(RclConfig *cnf, Rcl::Db *db); ~WebQueueIndexer(); + WebQueueIndexer(const WebQueueIndexer&) = delete; + WebQueueIndexer& operator=(const WebQueueIndexer&) = delete; /** This is called by the top indexer in recollindex. * Does the walking and the talking */ diff --git a/src/index/webqueuefetcher.h b/src/index/webqueuefetcher.h index 1ea8c239..adeca225 100644 --- a/src/index/webqueuefetcher.h +++ b/src/index/webqueuefetcher.h @@ -22,11 +22,14 @@ /** * The WEB queue cache fetcher: */ -class WQDocFetcher : public DocFetcher{ +class WQDocFetcher : public DocFetcher { +public: virtual bool fetch(RclConfig* cnf, const Rcl::Doc& idoc, RawDoc& out); - virtual bool makesig(RclConfig* cnf, const Rcl::Doc& idoc, - std::string& sig); + virtual bool makesig(RclConfig* cnf, const Rcl::Doc& idoc, std::string& sig); + WQDocFetcher() {} virtual ~WQDocFetcher() {} + WQDocFetcher(const WQDocFetcher&) = delete; + WQDocFetcher& operator=(const WQDocFetcher&) = delete; }; #endif /* _WEBQUEUEFETCHER_H_INCLUDED_ */ diff --git a/src/internfile/htmlparse.h b/src/internfile/htmlparse.h index f2810414..66522943 100644 --- a/src/internfile/htmlparse.h +++ b/src/internfile/htmlparse.h @@ -46,7 +46,6 @@ class HtmlParser { virtual void parse_html(const string &text); virtual void do_eof() {} HtmlParser(); - virtual ~HtmlParser() { } }; #endif diff --git a/src/internfile/internfile.h b/src/internfile/internfile.h index 4f494692..5f87876c 100644 --- a/src/internfile/internfile.h +++ b/src/internfile/internfile.h @@ -50,10 +50,11 @@ public: FIMissingStore() {} FIMissingStore(const string& in); virtual ~FIMissingStore() {} - virtual void addMissing(const string& prog, const string& mt) - { - m_typesForMissing[prog].insert(mt); - } + FIMissingStore(const FIMissingStore&) = delete; + FIMissingStore& operator=(const FIMissingStore&) = delete; + virtual void addMissing(const string& prog, const string& mt) { + m_typesForMissing[prog].insert(mt); + } // Get simple progs list string virtual void getMissingExternal(string& out); // Get progs + assoc mtypes description string @@ -137,6 +138,8 @@ public: FileInterner(const Rcl::Doc& idoc, RclConfig *cnf, int flags); ~FileInterner(); + FileInterner(const FileInterner&) = delete; + FileInterner& operator=(const FileInterner&) = delete; void setMissingStore(FIMissingStore *st) { m_missingdatap = st; @@ -183,14 +186,12 @@ public: we keep it around to save work for our caller, which can get it here */ TempFile get_imgtmp() {return m_imgtmp;} - const string& getReason() const - { - return m_reason; - } - bool ok() const - { - return m_ok; - } + const string& getReason() const { + return m_reason; + } + bool ok() const { + return m_ok; + } /** * Get UDI for immediate parent for document. @@ -206,8 +207,7 @@ public: static std::string getLastIpathElt(const std::string& ipath); /** Check that 2nd param is child of first */ - static bool ipathContains(const std::string& parent, - const std::string& child); + static bool ipathContains(const std::string& parent, const std::string& child); /** * Build sig for doc coming from rcldb. This is here because we know how * to query the right backend. Used to check up-to-dateness at query time */ @@ -250,8 +250,7 @@ public: /** Try to get a top level reason after an operation failed. This * is just for "simple" issues, like file missing, permissions, * etc. */ - enum ErrorPossibleCause{FetchMissing, FetchPerm, FetchNoBackend, - InternfileOther}; + enum ErrorPossibleCause{FetchMissing, FetchPerm, FetchNoBackend, InternfileOther}; static ErrorPossibleCause tryGetReason(RclConfig *, const Rcl::Doc&); private: diff --git a/src/internfile/mh_execm.h b/src/internfile/mh_execm.h index c3547c21..7956de8e 100644 --- a/src/internfile/mh_execm.h +++ b/src/internfile/mh_execm.h @@ -107,6 +107,8 @@ class MimeHandlerExecMultiple : public MimeHandlerExec { } // No resources to clean up, the ExecCmd destructor does it. virtual ~MimeHandlerExecMultiple() {} + MimeHandlerExecMultiple(const MimeHandlerExecMultiple&) = delete; + MimeHandlerExecMultiple& operator=(const MimeHandlerExecMultiple&) = delete; virtual bool next_document() override; diff --git a/src/internfile/mh_html.h b/src/internfile/mh_html.h index d86cd08e..7d0fd52e 100644 --- a/src/internfile/mh_html.h +++ b/src/internfile/mh_html.h @@ -30,6 +30,8 @@ public: : RecollFilter(cnf, id) { } virtual ~MimeHandlerHtml() {} + MimeHandlerHtml(const MimeHandlerHtml&) = delete; + MimeHandlerHtml& operator=(const MimeHandlerHtml&) = delete; virtual bool is_data_input_ok(DataInput input) const override { if (input == DOCUMENT_FILE_NAME || input == DOCUMENT_STRING) diff --git a/src/internfile/mh_mail.h b/src/internfile/mh_mail.h index 2147b37f..3530118d 100644 --- a/src/internfile/mh_mail.h +++ b/src/internfile/mh_mail.h @@ -37,6 +37,8 @@ class MimeHandlerMail : public RecollFilter { public: MimeHandlerMail(RclConfig *cnf, const std::string &id); virtual ~MimeHandlerMail(); + MimeHandlerMail(const MimeHandlerMail&) = delete; + MimeHandlerMail& operator=(const MimeHandlerMail&) = delete; virtual bool is_data_input_ok(DataInput input) const override { return (input == DOCUMENT_FILE_NAME || input == DOCUMENT_STRING); } diff --git a/src/internfile/mh_mbox.h b/src/internfile/mh_mbox.h index 7e48ac58..97ea639e 100644 --- a/src/internfile/mh_mbox.h +++ b/src/internfile/mh_mbox.h @@ -32,6 +32,8 @@ class MimeHandlerMbox : public RecollFilter { public: MimeHandlerMbox(RclConfig *cnf, const std::string& id); virtual ~MimeHandlerMbox(); + MimeHandlerMbox(const MimeHandlerMbox&) = delete; + MimeHandlerMbox& operator=(const MimeHandlerMbox&) = delete; virtual bool next_document() override; virtual bool skip_to_document(const std::string& ipath) override; virtual void clear_impl() override; diff --git a/src/internfile/mh_null.h b/src/internfile/mh_null.h index 4ee725ea..8571a6ca 100644 --- a/src/internfile/mh_null.h +++ b/src/internfile/mh_null.h @@ -38,6 +38,8 @@ class MimeHandlerNull : public RecollFilter { : RecollFilter(cnf, id) { } virtual ~MimeHandlerNull() {} + MimeHandlerNull(const MimeHandlerNull&) = delete; + MimeHandlerNull& operator=(const MimeHandlerNull&) = delete; virtual bool is_data_input_ok(DataInput) const { return true; diff --git a/src/internfile/mh_symlink.h b/src/internfile/mh_symlink.h index e747df49..99572de6 100644 --- a/src/internfile/mh_symlink.h +++ b/src/internfile/mh_symlink.h @@ -34,35 +34,36 @@ * to enable. */ class MimeHandlerSymlink : public RecollFilter { - public: +public: MimeHandlerSymlink(RclConfig *cnf, const std::string& id) - : RecollFilter(cnf, id) { + : RecollFilter(cnf, id) { } virtual ~MimeHandlerSymlink() {} + MimeHandlerSymlink(const MimeHandlerSymlink&) = delete; + MimeHandlerSymlink& operator=(const MimeHandlerSymlink&) = delete; - virtual bool next_document() - { - if (m_havedoc == false) - return false; - m_havedoc = false; - m_metaData[cstr_dj_keycontent] = cstr_null; - char lc[1024]; - ssize_t bytes = readlink(m_fn.c_str(), lc, 1024); - if (bytes != (ssize_t)-1) { - string slc(lc, bytes); - transcode(path_getsimple(slc), m_metaData[cstr_dj_keycontent], - m_config->getDefCharset(true), "UTF-8"); - } else { - LOGDEB("Symlink: readlink [" << m_fn << "] failed, errno " << + virtual bool next_document() { + if (m_havedoc == false) + return false; + m_havedoc = false; + m_metaData[cstr_dj_keycontent] = cstr_null; + char lc[1024]; + ssize_t bytes = readlink(m_fn.c_str(), lc, 1024); + if (bytes != (ssize_t)-1) { + string slc(lc, bytes); + transcode(path_getsimple(slc), m_metaData[cstr_dj_keycontent], + m_config->getDefCharset(true), "UTF-8"); + } else { + LOGDEB("Symlink: readlink [" << m_fn << "] failed, errno " << errno << "\n"); - } - m_metaData[cstr_dj_keymt] = cstr_textplain; - return true; + } + m_metaData[cstr_dj_keymt] = cstr_textplain; + return true; } protected: virtual bool set_document_file_impl(const string&, const string& fn) { - m_fn = fn; - return m_havedoc = true; + m_fn = fn; + return m_havedoc = true; } private: diff --git a/src/internfile/mh_text.h b/src/internfile/mh_text.h index e7bb449d..73ae3eb6 100644 --- a/src/internfile/mh_text.h +++ b/src/internfile/mh_text.h @@ -35,6 +35,8 @@ public: : RecollFilter(cnf, id), m_paging(false), m_offs(0), m_pagesz(0) { } virtual ~MimeHandlerText() {} + MimeHandlerText(const MimeHandlerText&) = delete; + MimeHandlerText& operator=(const MimeHandlerText&) = delete; virtual bool is_data_input_ok(DataInput input) const override { if (input == DOCUMENT_FILE_NAME || input == DOCUMENT_STRING) diff --git a/src/internfile/mh_unknown.h b/src/internfile/mh_unknown.h index 2ed22555..0b82a591 100644 --- a/src/internfile/mh_unknown.h +++ b/src/internfile/mh_unknown.h @@ -27,22 +27,24 @@ * */ class MimeHandlerUnknown : public RecollFilter { - public: +public: MimeHandlerUnknown(RclConfig *cnf, const string& id) - : RecollFilter(cnf, id) { + : RecollFilter(cnf, id) { } virtual ~MimeHandlerUnknown() {} + MimeHandlerUnknown(const MimeHandlerUnknown&) = delete; + MimeHandlerUnknown& operator=(const MimeHandlerUnknown&) = delete; virtual bool is_data_input_ok(DataInput) const { return true; } virtual bool next_document() { - if (m_havedoc == false) - return false; - m_havedoc = false; - m_metaData[cstr_dj_keycontent] = cstr_null; - m_metaData[cstr_dj_keymt] = cstr_textplain; - return true; + if (m_havedoc == false) + return false; + m_havedoc = false; + m_metaData[cstr_dj_keycontent] = cstr_null; + m_metaData[cstr_dj_keymt] = cstr_textplain; + return true; } virtual bool is_unknown() {return true;} }; diff --git a/src/internfile/mh_xslt.h b/src/internfile/mh_xslt.h index 16ad866b..f52531e1 100644 --- a/src/internfile/mh_xslt.h +++ b/src/internfile/mh_xslt.h @@ -26,6 +26,8 @@ class MimeHandlerXslt : public RecollFilter { MimeHandlerXslt(RclConfig *cnf, const std::string& id, const std::vector& params); virtual ~MimeHandlerXslt(); + MimeHandlerXslt(const MimeHandlerXslt&) = delete; + MimeHandlerXslt& operator=(const MimeHandlerXslt&) = delete; virtual bool next_document() override; virtual void clear_impl() override; diff --git a/src/internfile/mimehandler.h b/src/internfile/mimehandler.h index 2627ee91..2d065df8 100644 --- a/src/internfile/mimehandler.h +++ b/src/internfile/mimehandler.h @@ -34,6 +34,8 @@ public: : m_config(config), m_id(id) { } virtual ~RecollFilter() {} + RecollFilter(const RecollFilter&) = delete; + RecollFilter& operator=(const RecollFilter&) = delete; virtual void setConfig(RclConfig *config) override { m_config = config; diff --git a/src/internfile/myhtmlparse.h b/src/internfile/myhtmlparse.h index 69cd9aa0..83262d6d 100644 --- a/src/internfile/myhtmlparse.h +++ b/src/internfile/myhtmlparse.h @@ -33,7 +33,7 @@ using std::map; #define WHITESPACE " \t\n\r" class MyHtmlParser : public HtmlParser { - public: +public: bool in_script_tag; bool in_style_tag; bool in_pre_tag; @@ -60,10 +60,9 @@ class MyHtmlParser : public HtmlParser { void do_eof(); void decode_entities(string &s); void reset_charsets() {fromcharset = tocharset = "";} - void set_charsets(const string& f, const string& t) - { - fromcharset = f; - tocharset = t; + void set_charsets(const string& f, const string& t) { + fromcharset = f; + tocharset = t; } // Return charset as determined from html const string& get_charset() {return charset;} diff --git a/src/internfile/uncomp.h b/src/internfile/uncomp.h index 7d51bca3..eb41b6b6 100644 --- a/src/internfile/uncomp.h +++ b/src/internfile/uncomp.h @@ -29,6 +29,8 @@ class Uncomp { public: explicit Uncomp(bool docache = false); ~Uncomp(); + Uncomp(const Uncomp&) = delete; + Uncomp& operator=(const Uncomp&) = delete; /** Uncompress the input file into a temporary one, by executing the * script given as input. @@ -52,6 +54,8 @@ private: ~UncompCache() { delete m_dir; } + UncompCache(const UncompCache&) = delete; + UncompCache& operator=(const UncompCache&) = delete; std::mutex m_lock; TempDir *m_dir{0}; std::string m_tfile; diff --git a/src/python/recoll/pyrecoll.cpp b/src/python/recoll/pyrecoll.cpp index 7b46fcd6..52a93780 100644 --- a/src/python/recoll/pyrecoll.cpp +++ b/src/python/recoll/pyrecoll.cpp @@ -1418,17 +1418,17 @@ Query_getsnippets(recoll_QueryObject* self, PyObject *args, PyObject *kwargs) PyObject *sniplist = PyList_New(snippets.size()); int i = 0; HighlightData hldata; - PyPlainToRich hler; + std::unique_ptr hler; if (hlmethods) { sd->getTerms(hldata); - hler = PyPlainToRich(hlmethods); - hler.set_inputhtml(0); + hler = std::unique_ptr(new PyPlainToRich(hlmethods)); + hler->set_inputhtml(0); } for (const auto& snip : snippets) { const std::string *textp = &snip.snippet; list lr; if (hlmethods) { - hler.plaintorich(snip.snippet, lr, hldata); + hler->plaintorich(snip.snippet, lr, hldata); textp = &lr.front(); } PyList_SetItem( diff --git a/src/qtgui/advshist.h b/src/qtgui/advshist.h index a8ac2b63..d0876e40 100644 --- a/src/qtgui/advshist.h +++ b/src/qtgui/advshist.h @@ -42,6 +42,8 @@ class AdvSearchHist { public: AdvSearchHist(); ~AdvSearchHist(); + AdvSearchHist(const AdvSearchHist&) = delete; + AdvSearchHist& operator=(const AdvSearchHist&) = delete; // Add entry bool push(std::shared_ptr); diff --git a/src/qtgui/fragbuts.h b/src/qtgui/fragbuts.h index 55b4591d..df04f626 100644 --- a/src/qtgui/fragbuts.h +++ b/src/qtgui/fragbuts.h @@ -39,6 +39,8 @@ public: FragButs(QWidget* parent = 0); virtual ~FragButs(); + FragButs(const FragButs&) = delete; + FragButs& operator=(const FragButs&) = delete; struct ButFrag { QAbstractButton *button; diff --git a/src/qtgui/preview_load.h b/src/qtgui/preview_load.h index 63b9a0e6..7af94076 100644 --- a/src/qtgui/preview_load.h +++ b/src/qtgui/preview_load.h @@ -38,8 +38,9 @@ public: LoadThread(RclConfig *conf, const Rcl::Doc& idoc, bool pvhtml, QObject *parent = 0); - virtual ~LoadThread() { - } + virtual ~LoadThread() {} + LoadThread(const LoadThread&) = delete; + LoadThread& operator=(const LoadThread&) = delete; virtual void run(); diff --git a/src/qtgui/rclmain_w.h b/src/qtgui/rclmain_w.h index 592e9ad4..05899cb4 100644 --- a/src/qtgui/rclmain_w.h +++ b/src/qtgui/rclmain_w.h @@ -65,6 +65,8 @@ public: init(); } ~RclMain() {} + RclMain(const RclMain&) = delete; + RclMain& operator=(const RclMain&) = delete; QString getQueryDescription(); diff --git a/src/qtgui/reslist.h b/src/qtgui/reslist.h index dbbce845..fba42ac4 100644 --- a/src/qtgui/reslist.h +++ b/src/qtgui/reslist.h @@ -54,6 +54,8 @@ class ResList : public RESLIST_PARENTCLASS public: ResList(QWidget* parent = 0, const char* name = 0); virtual ~ResList(); + ResList(const ResList&) = delete; + ResList& operator=(const ResList&) = delete; // Return document for given docnum. We mostly act as an // intermediary to the docseq here, but this has also the diff --git a/src/qtgui/restable.h b/src/qtgui/restable.h index ed4e3249..59fcda28 100644 --- a/src/qtgui/restable.h +++ b/src/qtgui/restable.h @@ -144,6 +144,8 @@ public: } virtual ~ResTable() {} + ResTable(const ResTable&) = delete; + ResTable& operator=(const ResTable&) = delete; virtual RecollModel *getModel() {return m_model;} virtual ResTableDetailArea* getDetailArea() {return m_detail;} virtual int getDetailDocNumOrTopRow(); diff --git a/src/qtgui/scbase.h b/src/qtgui/scbase.h index a2217b6a..04a74934 100644 --- a/src/qtgui/scbase.h +++ b/src/qtgui/scbase.h @@ -49,6 +49,8 @@ class SCBase : public QObject { Q_OBJECT; public: ~SCBase(); + SCBase(const SCBase&) = delete; + SCBase& operator=(const SCBase&) = delete; /* Return a reference to the instantiated singleton */ static SCBase& scBase(); diff --git a/src/qtgui/uiprefs_w.h b/src/qtgui/uiprefs_w.h index 76975b80..13543a4e 100644 --- a/src/qtgui/uiprefs_w.h +++ b/src/qtgui/uiprefs_w.h @@ -39,6 +39,8 @@ public: init(); } ~UIPrefsDialog(){}; + UIPrefsDialog(const UIPrefsDialog&) = delete; + UIPrefsDialog& operator=(const UIPrefsDialog&) = delete; virtual void init(); void setFromPrefs(); diff --git a/src/qtgui/viewaction_w.h b/src/qtgui/viewaction_w.h index 984bfe19..d4404ec3 100644 --- a/src/qtgui/viewaction_w.h +++ b/src/qtgui/viewaction_w.h @@ -36,6 +36,8 @@ public: init(); } ~ViewAction() {} + ViewAction(const ViewAction&) = delete; + ViewAction& operator=(const ViewAction&) = delete; void selectMT(const QString& mt); public slots: diff --git a/src/qtgui/webcache.h b/src/qtgui/webcache.h index 53c222b0..e5909159 100644 --- a/src/qtgui/webcache.h +++ b/src/qtgui/webcache.h @@ -35,6 +35,8 @@ class WebcacheModel : public QAbstractTableModel { public: WebcacheModel(QObject *parent = 0); ~WebcacheModel(); + WebcacheModel(const WebcacheModel&) = delete; + WebcacheModel& operator=(const WebcacheModel&) = delete; // Reimplemented methods virtual int rowCount (const QModelIndex& = QModelIndex()) const; diff --git a/src/query/docseq.h b/src/query/docseq.h index 4e64c6d0..4dd6f50f 100644 --- a/src/query/docseq.h +++ b/src/query/docseq.h @@ -78,6 +78,8 @@ class DocSequence { public: DocSequence(const std::string &t) : m_title(t) {} virtual ~DocSequence() {} + DocSequence(const DocSequence&) = delete; + DocSequence& operator=(const DocSequence&) = delete; /** Get document at given rank. * @@ -181,6 +183,8 @@ public: : DocSequence(""), m_seq(iseq) {} virtual ~DocSeqModifier() {} + DocSeqModifier(const DocSeqModifier&) = delete; + DocSeqModifier& operator=(const DocSeqModifier&) = delete; virtual bool getAbstract(Rcl::Doc& doc, std::vector& abs) override{ diff --git a/src/query/docseqdb.h b/src/query/docseqdb.h index 0c9f395c..69535d79 100644 --- a/src/query/docseqdb.h +++ b/src/query/docseqdb.h @@ -30,6 +30,8 @@ public: std::shared_ptr q, const std::string &t, std::shared_ptr sdata); virtual ~DocSequenceDb() {} + DocSequenceDb(const DocSequenceDb&) = delete; + DocSequenceDb& operator=(const DocSequenceDb&) = delete; virtual bool getDoc(int num, Rcl::Doc &doc, std::string * = 0) override; virtual int getResCnt() override; virtual void getTerms(HighlightData& hld) override; diff --git a/src/query/docseqdocs.h b/src/query/docseqdocs.h index f19df5f5..ab8c6cce 100644 --- a/src/query/docseqdocs.h +++ b/src/query/docseqdocs.h @@ -31,10 +31,10 @@ class DocSequenceDocs : public DocSequence { public: DocSequenceDocs(std::shared_ptr d, const std::vector docs, const string &t) - : DocSequence(t), m_db(d), m_docs(docs) { - } - virtual ~DocSequenceDocs() { - } + : DocSequence(t), m_db(d), m_docs(docs) {} + virtual ~DocSequenceDocs() {} + DocSequenceDocs(const DocSequenceDocs&) = delete; + DocSequenceDocs& operator=(const DocSequenceDocs&) = delete; virtual bool getDoc(int num, Rcl::Doc &doc, string *sh = 0) { if (sh) *sh = string(); diff --git a/src/query/docseqhist.h b/src/query/docseqhist.h index c1979e69..d0c5f005 100644 --- a/src/query/docseqhist.h +++ b/src/query/docseqhist.h @@ -35,6 +35,8 @@ class RclDHistoryEntry : public DynConfEntry { RclDHistoryEntry(time_t t, const std::string& u, const std::string& d) : unixtime(t), udi(u), dbdir(d) {} virtual ~RclDHistoryEntry() {} + RclDHistoryEntry(const RclDHistoryEntry&) = default; + RclDHistoryEntry& operator=(const RclDHistoryEntry&) = default; virtual bool decode(const std::string &value); virtual bool encode(std::string& value); virtual bool equal(const DynConfEntry& other); @@ -52,6 +54,8 @@ class DocSequenceHistory : public DocSequence { const std::string &t) : DocSequence(t), m_db(db), m_hist(h) {} virtual ~DocSequenceHistory() {} + DocSequenceHistory(const DocSequenceHistory&) = delete; + DocSequenceHistory& operator=(const DocSequenceHistory&) = delete; virtual bool getDoc(int num, Rcl::Doc &doc, std::string *sh = 0); virtual int getResCnt(); diff --git a/src/query/dynconf.h b/src/query/dynconf.h index 8c92f371..9d1e2aec 100644 --- a/src/query/dynconf.h +++ b/src/query/dynconf.h @@ -49,7 +49,10 @@ /** Interface for a stored object. */ class DynConfEntry { public: + DynConfEntry() {} virtual ~DynConfEntry() {} + DynConfEntry(const DynConfEntry&) = default; + DynConfEntry& operator=(const DynConfEntry&) = default; /** Decode object-as-string coming out from storage */ virtual bool decode(const std::string &value) = 0; /** Encode object state into state for storing */ @@ -63,6 +66,8 @@ class RclSListEntry : public DynConfEntry { public: RclSListEntry() {} virtual ~RclSListEntry() {} + RclSListEntry(const RclSListEntry&) = default; + RclSListEntry& operator=(const RclSListEntry&) = default; RclSListEntry(const std::string& v) : value(v) { } diff --git a/src/query/filtseq.h b/src/query/filtseq.h index d89e2bb6..c9109c42 100644 --- a/src/query/filtseq.h +++ b/src/query/filtseq.h @@ -37,6 +37,8 @@ class DocSeqFiltered : public DocSeqModifier { public: DocSeqFiltered(RclConfig *conf, std::shared_ptr iseq, DocSeqFiltSpec &filtspec); virtual ~DocSeqFiltered() {} + DocSeqFiltered(const DocSeqFiltered&) = delete; + DocSeqFiltered& operator=(const DocSeqFiltered&) = delete; virtual bool canFilter() {return true;} virtual bool setFiltSpec(const DocSeqFiltSpec &filtspec); virtual bool getDoc(int num, Rcl::Doc &doc, std::string *sh = 0); diff --git a/src/query/plaintorich.h b/src/query/plaintorich.h index ba1519b6..9118ea5a 100644 --- a/src/query/plaintorich.h +++ b/src/query/plaintorich.h @@ -31,7 +31,10 @@ */ class PlainToRich { public: + PlainToRich() {} virtual ~PlainToRich() {} + PlainToRich(const PlainToRich&) = delete; + PlainToRich& operator=(const PlainToRich&) = delete; void set_inputhtml(bool v) { m_inputhtml = v; diff --git a/src/query/qresultstore.h b/src/query/qresultstore.h index a899bf30..e6aca15a 100644 --- a/src/query/qresultstore.h +++ b/src/query/qresultstore.h @@ -37,6 +37,8 @@ class QResultStore { public: QResultStore(); ~QResultStore(); + QResultStore(const QResultStore&) = delete; + QResultStore& operator=(const QResultStore&) = delete; /** * Fetch and store the results of the input query. @@ -46,8 +48,7 @@ public: * @param isinc if true, the field list defines the fields to be stored, * else, those to be excluded. */ - bool storeQuery(Rcl::Query& q, std::set fldspec = {}, - bool isinc = false); + bool storeQuery(Rcl::Query& q, std::set fldspec = {}, bool isinc = false); /** Retrieve count of stored results */ int getCount(); @@ -60,9 +61,6 @@ public: */ const char *fieldValue(int docindex, const std::string& fldname); - - QResultStore(const QResultStore&) = delete; - QResultStore& operator=(const QResultStore&) = delete; class Internal; private: Internal *m{nullptr}; diff --git a/src/query/reslistpager.h b/src/query/reslistpager.h index b03dc1db..ad2726e2 100644 --- a/src/query/reslistpager.h +++ b/src/query/reslistpager.h @@ -35,6 +35,8 @@ class ResListPager { public: ResListPager(int pagesize=10, bool alwaysSnippets = false); virtual ~ResListPager() {} + ResListPager(const ResListPager&) = delete; + ResListPager& operator=(const ResListPager&) = delete; void setHighLighter(PlainToRich *ptr) { m_hiliter = ptr; diff --git a/src/query/sortseq.h b/src/query/sortseq.h index c6209bed..36a1cc1f 100644 --- a/src/query/sortseq.h +++ b/src/query/sortseq.h @@ -31,11 +31,12 @@ class DocSeqSorted : public DocSeqModifier { public: DocSeqSorted(std::shared_ptr iseq, DocSeqSortSpec &sortspec) - : DocSeqModifier(iseq) - { - setSortSpec(sortspec); + : DocSeqModifier(iseq) { + setSortSpec(sortspec); } virtual ~DocSeqSorted() {} + DocSeqSorted(const DocSeqSorted&) = delete; + DocSeqSorted& operator=(const DocSeqSorted&) = delete; virtual bool canSort() {return true;} virtual bool setSortSpec(const DocSeqSortSpec &sortspec); virtual bool getDoc(int num, Rcl::Doc &doc, string *sh = 0); diff --git a/src/query/wasaparserdriver.h b/src/query/wasaparserdriver.h index a76c2e54..256028c1 100644 --- a/src/query/wasaparserdriver.h +++ b/src/query/wasaparserdriver.h @@ -39,6 +39,8 @@ public: : m_stemlang(sl), m_autosuffs(as), m_config(c) {} ~WasaParserDriver() {} + WasaParserDriver(const WasaParserDriver&) = delete; + WasaParserDriver& operator=(const WasaParserDriver&) = delete; Rcl::SearchData *parse(const std::string&); bool addClause(Rcl::SearchData *sd, Rcl::SearchDataClauseSimple* cl); diff --git a/src/rcldb/expansiondbs.cpp b/src/rcldb/expansiondbs.cpp index 6d9b2670..24e7ce74 100644 --- a/src/rcldb/expansiondbs.cpp +++ b/src/rcldb/expansiondbs.cpp @@ -40,8 +40,7 @@ namespace Rcl { * Create all expansion dbs used to transform user input term to widen a query * We use Xapian synonyms subsets to store the expansions. */ -bool createExpansionDbs(Xapian::WritableDatabase& wdb, - const vector& langs) +bool createExpansionDbs(Xapian::WritableDatabase& wdb, const vector& langs) { LOGDEB("StemDb::createExpansionDbs: languages: " <& langs); + const std::vector& langs); } #endif /* _EXPANSIONDBS_H_INCLUDED_ */ diff --git a/src/rcldb/rcldb.h b/src/rcldb/rcldb.h index b382d594..af8860b2 100644 --- a/src/rcldb/rcldb.h +++ b/src/rcldb/rcldb.h @@ -205,6 +205,8 @@ public: /* General stuff (valid for query or update) ****************************/ Db(const RclConfig *cfp); ~Db(); + Db(const Db&) = delete; + Db& operator=(const Db&) = delete; enum OpenMode {DbRO, DbUpd, DbTrunc}; bool isWriteMode(OpenMode mode) { @@ -629,9 +631,6 @@ private: bool getDoc(const std::string& udi, int idxi, Doc& doc); - /* Copyconst and assignment private and forbidden */ - Db(const Db &) {} - Db& operator=(const Db &) {return *this;}; }; // This has to go somewhere, and as it needs the Xapian version, this is diff --git a/src/rcldb/rcldb_p.h b/src/rcldb/rcldb_p.h index dc575efa..7fc75b5b 100644 --- a/src/rcldb/rcldb_p.h +++ b/src/rcldb/rcldb_p.h @@ -98,6 +98,8 @@ class Db::Native { Native(Db *db); ~Native(); + Native(const Native &) = delete; + Native& operator=(const Native &) = delete; #ifdef IDX_THREADS friend void *DbUpdWorker(void*); diff --git a/src/rcldb/rclquery_p.h b/src/rcldb/rclquery_p.h index 65279ea7..6db023e8 100644 --- a/src/rcldb/rclquery_p.h +++ b/src/rcldb/rclquery_p.h @@ -49,6 +49,9 @@ public: ~Native() { clear(); } + Native(const Native &) = delete; + Native& operator=(const Native &) = delete; + void clear() { deleteZ(xenquire); deleteZ(subdecider); diff --git a/src/rcldb/searchdata.h b/src/rcldb/searchdata.h index dd2460ae..6a102d97 100644 --- a/src/rcldb/searchdata.h +++ b/src/rcldb/searchdata.h @@ -87,6 +87,8 @@ public: } ~SearchData(); + SearchData(const SearchData &) = delete; + SearchData& operator=(const SearchData&) = delete; /** Is there anything but a file name search in here ? */ bool fileNameOnly(); @@ -225,9 +227,6 @@ private: bool clausesToQuery(Rcl::Db &db, SClType tp, std::vector& query, string& reason, void *d); - /* Copyconst and assignment private and forbidden */ - SearchData(const SearchData &) {} - SearchData& operator=(const SearchData&) {return *this;}; }; class SearchDataClause { @@ -247,6 +246,9 @@ public: m_modifiers(SDCM_NONE), m_weight(1.0), m_exclude(false), m_rel(REL_CONTAINS) {} virtual ~SearchDataClause() {} + SearchDataClause(const SearchDataClause &) = default; + SearchDataClause& operator=(const SearchDataClause&) = default; + virtual bool toNativeQuery(Rcl::Db &db, void *) = 0; bool isFileName() const {return m_tp == SCLT_FILENAME ? true: false;} virtual std::string getReason() const {return m_reason;} diff --git a/src/rcldb/stemdb.h b/src/rcldb/stemdb.h index 5501fc4b..af73348a 100644 --- a/src/rcldb/stemdb.h +++ b/src/rcldb/stemdb.h @@ -66,15 +66,12 @@ namespace Rcl { class SynTermTransStem : public SynTermTrans { public: SynTermTransStem(const std::string& lang) - : m_stemmer(lang), m_lang(lang) - { - } - virtual ~SynTermTransStem() {} - virtual std::string operator()(const std::string& in) - { - string out = m_stemmer(in); - LOGDEB2("SynTermTransStem(" << (m_lang) << "): in [" << (in) << "] out [" << (out) << "]\n" ); - return out; + : m_stemmer(lang), m_lang(lang) {} + + virtual std::string operator()(const std::string& in) { + string out = m_stemmer(in); + LOGDEB2("SynTermTransStem(" << m_lang << "): in [" << in << "] out [" << out << "]\n"); + return out; } Xapian::Stem m_stemmer; std::string m_lang; @@ -85,17 +82,14 @@ public: class StemDb : public XapSynFamily { public: StemDb(Xapian::Database& xdb) - : XapSynFamily(xdb, synFamStem) - { - } + : XapSynFamily(xdb, synFamStem) {} /** Expand for a number of languages * @param langs space-separated set of languages * @param term term to expand */ - bool stemExpand(const std::string& langs, - const std::string& term, - std::vector& result); + bool stemExpand( + const std::string& langs, const std::string& term, std::vector& result); }; } diff --git a/src/rcldb/stoplist.h b/src/rcldb/stoplist.h index cb4f85e1..d65f1faa 100644 --- a/src/rcldb/stoplist.h +++ b/src/rcldb/stoplist.h @@ -38,7 +38,6 @@ class StopList { public: StopList() {} StopList(const string &filename) {setFile(filename);} - virtual ~StopList() {} bool setFile(const string &filename); bool isStop(const string &term) const; diff --git a/src/rcldb/synfamily.h b/src/rcldb/synfamily.h index 4536fc3a..b9a300dd 100644 --- a/src/rcldb/synfamily.h +++ b/src/rcldb/synfamily.h @@ -52,7 +52,6 @@ public: : m_rdb(xdb) { m_prefix1 = std::string(":") + familyname; } - virtual ~XapSynFamily() {} /** Retrieve all members of this family (e.g: french english german...) */ virtual bool getMembers(std::vector&); @@ -95,8 +94,6 @@ public: XapWritableSynFamily(Xapian::WritableDatabase db, const std::string& familyname) : XapSynFamily(db, familyname), m_wdb(db) {} - virtual ~XapWritableSynFamily() {} - /** Delete all entries for one member (e.g. french), and remove from list * of members */ virtual bool deleteMember(const std::string& membername); @@ -113,7 +110,6 @@ protected: /** A functor which transforms a string */ class SynTermTrans { public: - virtual ~SynTermTrans() {} virtual std::string operator()(const std::string&) = 0; virtual std::string name() { return "SynTermTrans: unknown";} }; @@ -130,7 +126,6 @@ public: : m_family(xdb, familyname), m_membername(membername), m_trans(trans), m_prefix(m_family.entryprefix(m_membername)) {} - virtual ~XapComputableSynFamMember() {} /** Expand a term to its list of synonyms. If filtertrans is set we * keep only the results which transform to the same value as the input @@ -161,8 +156,6 @@ public: : m_family(xdb, familyname), m_membername(membername), m_trans(trans), m_prefix(m_family.entryprefix(m_membername)) {} - virtual ~XapWritableComputableSynFamMember() {} - virtual bool addSynonym(const std::string& term) { LOGDEB2("addSynonym:me " << this << " term [" << term << "] m_trans " << m_trans << "\n"); std::string transformed = (*m_trans)(term); diff --git a/src/utils/circache.h b/src/utils/circache.h index b13e6394..7569f9d2 100644 --- a/src/utils/circache.h +++ b/src/utils/circache.h @@ -46,6 +46,8 @@ class CirCache { public: CirCache(const std::string& dir); virtual ~CirCache(); + CirCache(const CirCache&) = delete; + CirCache& operator=(const CirCache&) = delete; virtual std::string getReason(); @@ -135,11 +137,6 @@ public: protected: CirCacheInternal *m_d; std::string m_dir; -private: - CirCache(const CirCache&) {} - CirCache& operator=(const CirCache&) { - return *this; - } }; #endif /* _circache_h_included_ */ diff --git a/src/utils/cmdtalk.h b/src/utils/cmdtalk.h index 288e920e..2cf46a5c 100644 --- a/src/utils/cmdtalk.h +++ b/src/utils/cmdtalk.h @@ -70,6 +70,8 @@ class CmdTalk { public: CmdTalk(int timeosecs); virtual ~CmdTalk(); + CmdTalk(const CmdTalk&) = delete; + CmdTalk& operator=(const CmdTalk&) = delete; // @param env each entry should be of the form name=value. They // augment the subprocess environnement. @@ -99,8 +101,6 @@ class CmdTalk { const std::unordered_map& args, std::unordered_map& rep); - CmdTalk(const CmdTalk&) = delete; - CmdTalk &operator=(const CmdTalk &) = delete; private: class Internal; Internal *m{0}; diff --git a/src/utils/conftree.h b/src/utils/conftree.h index 9b0ffbb2..d868e436 100644 --- a/src/utils/conftree.h +++ b/src/utils/conftree.h @@ -86,7 +86,10 @@ public: class ConfNull { public: enum StatusCode {STATUS_ERROR = 0, STATUS_RO = 1, STATUS_RW = 2}; + ConfNull() {} virtual ~ConfNull() {}; + ConfNull(const ConfNull&) = delete; + ConfNull &operator=(const ConfNull &) = delete; virtual int get(const std::string& name, std::string& value, const std::string& sk = std::string()) const = 0; virtual int set(const std::string& nm, const std::string& val, diff --git a/src/utils/execmd.h b/src/utils/execmd.h index 1e34d161..623569c1 100644 --- a/src/utils/execmd.h +++ b/src/utils/execmd.h @@ -37,7 +37,10 @@ typedef int pid_t; */ class ExecCmdAdvise { public: + ExecCmdAdvise() {} virtual ~ExecCmdAdvise() {} + ExecCmdAdvise(const ExecCmdAdvise&) = delete; + ExecCmdAdvise &operator=(const ExecCmdAdvise &) = delete; virtual void newData(int cnt) = 0; }; @@ -47,7 +50,10 @@ public: */ class ExecCmdProvide { public: + ExecCmdProvide() {} virtual ~ExecCmdProvide() {} + ExecCmdProvide(const ExecCmdProvide&) = delete; + ExecCmdProvide &operator=(const ExecCmdProvide &) = delete; virtual void newData() = 0; }; @@ -220,6 +226,8 @@ public: }; ExecCmd(int flags = 0); ~ExecCmd(); + ExecCmd(const ExecCmd&) = delete; + ExecCmd &operator=(const ExecCmd &) = delete; /** * Utility routine: check if/where a command is found according to the @@ -242,11 +250,6 @@ public: class Internal; private: Internal *m; - /* Copyconst and assignment are private and forbidden */ - ExecCmd(const ExecCmd&) {} - ExecCmd& operator=(const ExecCmd&) { - return *this; - }; }; diff --git a/src/utils/fstreewalk.h b/src/utils/fstreewalk.h index e1d26acb..90778ec0 100644 --- a/src/utils/fstreewalk.h +++ b/src/utils/fstreewalk.h @@ -84,6 +84,8 @@ public: static const int FtwTravMask; FsTreeWalker(int opts = FtwTravNatural); ~FsTreeWalker(); + FsTreeWalker(const FsTreeWalker&) = delete; + FsTreeWalker& operator=(const FsTreeWalker&) = delete; void setOpts(int opts); int getOpts(); @@ -132,11 +134,14 @@ private: class FsTreeWalkerCB { public: + FsTreeWalkerCB() {} virtual ~FsTreeWalkerCB() {} + FsTreeWalkerCB(const FsTreeWalkerCB&) = delete; + FsTreeWalkerCB& operator=(const FsTreeWalkerCB&) = delete; + // Only st_mtime, st_ctime, st_size, st_mode (filetype bits: dir/reg/lnk), virtual FsTreeWalker::Status - processone(const std::string&, const struct PathStat *, - FsTreeWalker::CbFlag) = 0; + processone(const std::string&, const struct PathStat *, FsTreeWalker::CbFlag) = 0; }; // Utility function. Somewhat like du. diff --git a/src/utils/hldata.h b/src/utils/hldata.h index ac3d75b4..529826a3 100644 --- a/src/utils/hldata.h +++ b/src/utils/hldata.h @@ -77,9 +77,9 @@ struct HighlightData { std::vector index_term_groups; void clear() { - uterms.clear(); - ugroups.clear(); - index_term_groups.clear(); + uterms.clear(); + ugroups.clear(); + index_term_groups.clear(); } void append(const HighlightData&); diff --git a/src/utils/netcon.h b/src/utils/netcon.h index d9cfb426..df930b58 100644 --- a/src/utils/netcon.h +++ b/src/utils/netcon.h @@ -53,6 +53,8 @@ public: m_loop(0) { } virtual ~Netcon(); + Netcon(const Netcon&) = delete; + Netcon& operator=(const Netcon&) = delete; /// Remember whom we're talking to. We let external code do this because /// the application may have a non-dns method to find the peer name. virtual void setpeer(const char *hostname); @@ -181,7 +183,11 @@ class NetconData; /// NetconData derived classes). class NetconWorker { public: + NetconWorker() {} virtual ~NetconWorker() {} + NetconWorker(const NetconWorker&) = delete; + NetconWorker& operator=(const NetconWorker&) = delete; + virtual int data(NetconData *con, Netcon::Event reason) = 0; }; @@ -190,6 +196,8 @@ class NetconData : public Netcon { public: NetconData(bool cancellable = false); virtual ~NetconData(); + NetconData(const NetconData&) = delete; + NetconData& operator=(const NetconData&) = delete; /// Write data to the connection. /// @param buf the data buffer @@ -300,6 +308,8 @@ public: #endif /* NETCON_ACCESSCONTROL */ } ~NetconServLis(); + NetconServLis(const NetconServLis&) = delete; + NetconServLis& operator=(const NetconServLis&) = delete; /// Open named service. Used absolute pathname to create an /// AF_UNIX path-based socket instead of an IP one. int openservice(const char *serv, int backlog = 10); diff --git a/src/utils/pathut.h b/src/utils/pathut.h index e19203d9..85fdd2ea 100644 --- a/src/utils/pathut.h +++ b/src/utils/pathut.h @@ -138,6 +138,8 @@ class PathDirContents { public: PathDirContents(const std::string& dirpath); ~PathDirContents(); + PathDirContents(const PathDirContents&) = delete; + PathDirContents& operator=(const PathDirContents&) = delete; bool opendir(); struct Entry { @@ -233,6 +235,9 @@ class Pidfile { public: Pidfile(const std::string& path) : m_path(path), m_fd(-1) {} ~Pidfile(); + Pidfile(const Pidfile&) = delete; + Pidfile& operator=(const Pidfile&) = delete; + /// Open/create the pid file. /// @return 0 if ok, > 0 for pid of existing process, -1 for other error. int open(); diff --git a/src/utils/picoxml.h b/src/utils/picoxml.h index 8c8c52f6..68c999a3 100644 --- a/src/utils/picoxml.h +++ b/src/utils/picoxml.h @@ -72,6 +72,8 @@ public: : m_in(input), m_pos(0) {} virtual ~PicoXMLParser() {} + PicoXMLParser(const PicoXMLParser&) = delete; + PicoXMLParser& operator=(const PicoXMLParser&) = delete; virtual bool parse() { return _parse(); diff --git a/src/utils/rclutil.h b/src/utils/rclutil.h index 8f8866da..3187da29 100644 --- a/src/utils/rclutil.h +++ b/src/utils/rclutil.h @@ -88,6 +88,8 @@ class TempDir { public: TempDir(); ~TempDir(); + TempDir(const TempDir&) = delete; + TempDir& operator=(const TempDir&) = delete; const char *dirname() { return m_dirname.c_str(); } @@ -102,10 +104,6 @@ public: private: std::string m_dirname; std::string m_reason; - TempDir(const TempDir&) {} - TempDir& operator=(const TempDir&) { - return *this; - }; }; // Freedesktop thumbnail standard path routine diff --git a/src/utils/readfile.h b/src/utils/readfile.h index 86eda6a7..22b56717 100644 --- a/src/utils/readfile.h +++ b/src/utils/readfile.h @@ -26,7 +26,10 @@ class FileScanUpstream; /** Data sink for the file reader. */ class FileScanDo { public: + FileScanDo() {} virtual ~FileScanDo() {} + FileScanDo(const FileScanDo&) = delete; + FileScanDo& operator=(const FileScanDo&) = delete; /* Initialize and allocate. * @param size if set, lower bound of data size. * @param reason[output] set to error message in case of error. diff --git a/src/utils/smallut.h b/src/utils/smallut.h index 6e425cd1..04300a47 100644 --- a/src/utils/smallut.h +++ b/src/utils/smallut.h @@ -227,6 +227,8 @@ public: /// @param nmatch must be >= the number of parenthesed subexp in exp SimpleRegexp(const std::string& exp, int flags, int nmatch = 0); ~SimpleRegexp(); + SimpleRegexp(const SimpleRegexp&) = delete; + SimpleRegexp& operator=(const SimpleRegexp&) = delete; /// Match input against exp, return true if matches bool simpleMatch(const std::string& val) const; /// After simpleMatch success, get nth submatch, 0 is the whole diff --git a/src/utils/strmatcher.cpp b/src/utils/strmatcher.cpp index 62602fb1..1da0edf7 100644 --- a/src/utils/strmatcher.cpp +++ b/src/utils/strmatcher.cpp @@ -51,21 +51,21 @@ string::size_type StrWildMatcher::baseprefixlen() const StrRegexpMatcher::StrRegexpMatcher(const string& exp) : StrMatcher(exp), - m_re(exp, SimpleRegexp::SRE_NOSUB) + m_re(new SimpleRegexp(exp, SimpleRegexp::SRE_NOSUB)) { } bool StrRegexpMatcher::setExp(const string& exp) { - m_re = SimpleRegexp(exp, SimpleRegexp::SRE_NOSUB); - return m_re.ok(); + m_re = std::unique_ptr(new SimpleRegexp(exp, SimpleRegexp::SRE_NOSUB)); + return ok(); } bool StrRegexpMatcher::match(const string& val) const { - if (!m_re.ok()) + if (ok()) return false; - return m_re(val); + return (*m_re)(val); } string::size_type StrRegexpMatcher::baseprefixlen() const @@ -75,5 +75,5 @@ string::size_type StrRegexpMatcher::baseprefixlen() const bool StrRegexpMatcher::ok() const { - return m_re.ok(); + return m_re && m_re->ok(); } diff --git a/src/utils/strmatcher.h b/src/utils/strmatcher.h index 3be5407d..ae0a395f 100644 --- a/src/utils/strmatcher.h +++ b/src/utils/strmatcher.h @@ -18,6 +18,8 @@ #define _STRMATCHER_H_INCLUDED_ #include +#include + #include "smallut.h" // Encapsulating simple wildcard/regexp string matching. @@ -28,21 +30,23 @@ public: StrMatcher(const std::string& exp) : m_sexp(exp) {} virtual ~StrMatcher() {}; + StrMatcher(const StrMatcher&) = delete; + StrMatcher& operator=(const StrMatcher&) = delete; virtual bool match(const std::string &val) const = 0; virtual std::string::size_type baseprefixlen() const = 0; virtual bool setExp(const std::string& newexp) { - m_sexp = newexp; - return true; + m_sexp = newexp; + return true; } virtual bool ok() const { - return true; + return true; } virtual const std::string& exp() const { - return m_sexp; + return m_sexp; } virtual StrMatcher *clone() const = 0; const std::string& getreason() const { - return m_reason; + return m_reason; } protected: std::string m_sexp; @@ -54,10 +58,12 @@ public: StrWildMatcher(const std::string& exp) : StrMatcher(exp) {} virtual ~StrWildMatcher() {} + StrWildMatcher(const StrWildMatcher&) = delete; + StrWildMatcher& operator=(const StrWildMatcher&) = delete; virtual bool match(const std::string& val) const override; virtual std::string::size_type baseprefixlen() const override; virtual StrWildMatcher *clone() const override { - return new StrWildMatcher(m_sexp); + return new StrWildMatcher(m_sexp); } }; @@ -66,14 +72,16 @@ public: StrRegexpMatcher(const std::string& exp); virtual bool setExp(const std::string& newexp) override; virtual ~StrRegexpMatcher() {}; + StrRegexpMatcher(const StrRegexpMatcher&) = delete; + StrRegexpMatcher& operator=(const StrRegexpMatcher&) = delete; virtual bool match(const std::string& val) const override; virtual std::string::size_type baseprefixlen() const override; virtual bool ok() const override; virtual StrRegexpMatcher *clone() const override { - return new StrRegexpMatcher(m_sexp); + return new StrRegexpMatcher(m_sexp); } private: - SimpleRegexp m_re; + std::unique_ptr m_re; }; #endif /* _STRMATCHER_H_INCLUDED_ */ diff --git a/src/utils/workqueue.h b/src/utils/workqueue.h index 4d7aa0a9..2a0a7fe7 100644 --- a/src/utils/workqueue.h +++ b/src/utils/workqueue.h @@ -71,6 +71,8 @@ public: setTerminateAndWait(); } } + WorkQueue(const WorkQueue&) = delete; + WorkQueue& operator=(const WorkQueue&) = delete; /** Task deleter * If put() is called with the flush option, and the tasks allocate memory, diff --git a/src/utils/zlibut.h b/src/utils/zlibut.h index 4e9016c8..3dbca5e0 100644 --- a/src/utils/zlibut.h +++ b/src/utils/zlibut.h @@ -7,6 +7,9 @@ class ZLibUtBuf { public: ZLibUtBuf(); ~ZLibUtBuf(); + ZLibUtBuf(const ZLibUtBuf&) = delete; + ZLibUtBuf& operator=(const ZLibUtBuf&) = delete; + char *getBuf() const; char *takeBuf(); size_t getCnt();