Probably null change: make sure that all classes with destructors also have copy constructors and assignment operators

This commit is contained in:
Jean-Francois Dockes 2021-11-23 16:38:11 +01:00
parent f813c1356e
commit 756a944ef3
75 changed files with 282 additions and 165 deletions

View File

@ -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;

View File

@ -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:

View File

@ -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 */

View File

@ -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);

View File

@ -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<EXEDocFetcher> exeDocFetcherMake(RclConfig *config,
const string& bckid)
std::unique_ptr<EXEDocFetcher> exeDocFetcherMake(RclConfig *config, const string& bckid)
{
// The config we only read once, not gonna change.
static ConfSimple *bconf;

View File

@ -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<EXEDocFetcher> exeDocFetcherMake(RclConfig *config,
const std::string& bckid);
std::unique_ptr<EXEDocFetcher> exeDocFetcherMake(RclConfig *config, const std::string& bckid);
#endif /* _EXEFETCHER_H_INCLUDED_ */

View File

@ -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<DocFetcher> docFetcherMake(RclConfig *config,
const Rcl::Doc& idoc);
/** Return an appropriate fetcher object given the backend string identifier inside idoc*/
std::unique_ptr<DocFetcher> docFetcherMake(RclConfig *config, const Rcl::Doc& idoc);
#endif /* _FETCHER_H_INCLUDED_ */

View File

@ -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);

View File

@ -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.

View File

@ -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

View File

@ -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,

View File

@ -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<std::mutex> wait(int secs = -1, bool *timedout = 0);
/** Add event. */

View File

@ -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 */

View File

@ -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_ */

View File

@ -46,7 +46,6 @@ class HtmlParser {
virtual void parse_html(const string &text);
virtual void do_eof() {}
HtmlParser();
virtual ~HtmlParser() { }
};
#endif

View File

@ -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:

View File

@ -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;

View File

@ -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)

View File

@ -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);
}

View File

@ -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;

View File

@ -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;

View File

@ -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:

View File

@ -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)

View File

@ -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;}
};

View File

@ -26,6 +26,8 @@ class MimeHandlerXslt : public RecollFilter {
MimeHandlerXslt(RclConfig *cnf, const std::string& id,
const std::vector<std::string>& params);
virtual ~MimeHandlerXslt();
MimeHandlerXslt(const MimeHandlerXslt&) = delete;
MimeHandlerXslt& operator=(const MimeHandlerXslt&) = delete;
virtual bool next_document() override;
virtual void clear_impl() override;

View File

@ -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;

View File

@ -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;}

View File

@ -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;

View File

@ -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<PyPlainToRich> hler;
if (hlmethods) {
sd->getTerms(hldata);
hler = PyPlainToRich(hlmethods);
hler.set_inputhtml(0);
hler = std::unique_ptr<PyPlainToRich>(new PyPlainToRich(hlmethods));
hler->set_inputhtml(0);
}
for (const auto& snip : snippets) {
const std::string *textp = &snip.snippet;
list<string> lr;
if (hlmethods) {
hler.plaintorich(snip.snippet, lr, hldata);
hler->plaintorich(snip.snippet, lr, hldata);
textp = &lr.front();
}
PyList_SetItem(

View File

@ -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<Rcl::SearchData>);

View File

@ -39,6 +39,8 @@ public:
FragButs(QWidget* parent = 0);
virtual ~FragButs();
FragButs(const FragButs&) = delete;
FragButs& operator=(const FragButs&) = delete;
struct ButFrag {
QAbstractButton *button;

View File

@ -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();

View File

@ -65,6 +65,8 @@ public:
init();
}
~RclMain() {}
RclMain(const RclMain&) = delete;
RclMain& operator=(const RclMain&) = delete;
QString getQueryDescription();

View File

@ -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

View File

@ -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();

View File

@ -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();

View File

@ -39,6 +39,8 @@ public:
init();
}
~UIPrefsDialog(){};
UIPrefsDialog(const UIPrefsDialog&) = delete;
UIPrefsDialog& operator=(const UIPrefsDialog&) = delete;
virtual void init();
void setFromPrefs();

View File

@ -36,6 +36,8 @@ public:
init();
}
~ViewAction() {}
ViewAction(const ViewAction&) = delete;
ViewAction& operator=(const ViewAction&) = delete;
void selectMT(const QString& mt);
public slots:

View File

@ -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;

View File

@ -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<std::string>& abs)
override{

View File

@ -30,6 +30,8 @@ public:
std::shared_ptr<Rcl::Query> q, const std::string &t,
std::shared_ptr<Rcl::SearchData> 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;

View File

@ -31,10 +31,10 @@ class DocSequenceDocs : public DocSequence {
public:
DocSequenceDocs(std::shared_ptr<Rcl::Db> d,
const std::vector<Rcl::Doc> 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();

View File

@ -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();

View File

@ -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) {
}

View File

@ -37,6 +37,8 @@ class DocSeqFiltered : public DocSeqModifier {
public:
DocSeqFiltered(RclConfig *conf, std::shared_ptr<DocSequence> 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);

View File

@ -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;

View File

@ -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<std::string> fldspec = {},
bool isinc = false);
bool storeQuery(Rcl::Query& q, std::set<std::string> 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};

View File

@ -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;

View File

@ -31,11 +31,12 @@
class DocSeqSorted : public DocSeqModifier {
public:
DocSeqSorted(std::shared_ptr<DocSequence> 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);

View File

@ -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);

View File

@ -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<string>& langs)
bool createExpansionDbs(Xapian::WritableDatabase& wdb, const vector<string>& langs)
{
LOGDEB("StemDb::createExpansionDbs: languages: " <<stringsToString(langs) << "\n");
Chrono cron;

View File

@ -40,7 +40,8 @@ public:
* @param op defines if we remove diacritics, case or both
*/
SynTermTransUnac(UnacOp op)
: m_op(op) { }
: m_op(op) {}
virtual std::string name() {
std::string nm("Unac: ");
if (m_op & UNACOP_UNAC)
@ -49,19 +50,19 @@ public:
nm += "FOLD ";
return nm;
}
virtual std::string operator()(const std::string& in) {
std::string out;
unacmaybefold(in, out, "UTF-8", m_op);
LOGDEB2("SynTermTransUnac(" << m_op << "): in [" << in << "] out [" <<
out << "]\n");
return out;
unacmaybefold(in, out, "UTF-8", m_op);
LOGDEB2("SynTermTransUnac(" << m_op << "): in [" << in << "] out [" << out << "]\n");
return out;
}
UnacOp m_op;
};
/** Walk the Xapian term list and create all the expansion dbs in one go. */
extern bool createExpansionDbs(Xapian::WritableDatabase& wdb,
const std::vector<std::string>& langs);
const std::vector<std::string>& langs);
}
#endif /* _EXPANSIONDBS_H_INCLUDED_ */

View File

@ -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

View File

@ -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*);

View File

@ -49,6 +49,9 @@ public:
~Native() {
clear();
}
Native(const Native &) = delete;
Native& operator=(const Native &) = delete;
void clear() {
deleteZ(xenquire);
deleteZ(subdecider);

View File

@ -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<SearchDataClause*>& 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;}

View File

@ -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<std::string>& result);
bool stemExpand(
const std::string& langs, const std::string& term, std::vector<std::string>& result);
};
}

View File

@ -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;

View File

@ -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<std::string>&);
@ -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);

View File

@ -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_ */

View File

@ -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<std::string, std::string>& args,
std::unordered_map<std::string, std::string>& rep);
CmdTalk(const CmdTalk&) = delete;
CmdTalk &operator=(const CmdTalk &) = delete;
private:
class Internal;
Internal *m{0};

View File

@ -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,

View File

@ -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;
};
};

View File

@ -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.

View File

@ -77,9 +77,9 @@ struct HighlightData {
std::vector<TermGroup> 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&);

View File

@ -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);

View File

@ -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();

View File

@ -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();

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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<SimpleRegexp>(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();
}

View File

@ -18,6 +18,8 @@
#define _STRMATCHER_H_INCLUDED_
#include <string>
#include <memory>
#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<SimpleRegexp> m_re;
};
#endif /* _STRMATCHER_H_INCLUDED_ */

View File

@ -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,

View File

@ -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();