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
+1 -2
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;
+7 -6
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_ */
+2 -3
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
+2
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*);
+3
View File
@@ -49,6 +49,9 @@ public:
~Native() {
clear();
}
Native(const Native &) = delete;
Native& operator=(const Native &) = delete;
void clear() {
deleteZ(xenquire);
deleteZ(subdecider);
+5 -3
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;}
+9 -15
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);
};
}
-1
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;
-7
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);