Add override specifications to a bunch of methods to suppress warnings

This commit is contained in:
Jean-Francois Dockes 2021-04-29 08:57:26 +02:00
parent d76e279492
commit b7f6e851f6
4 changed files with 49 additions and 54 deletions

View File

@ -35,11 +35,11 @@ public:
} }
virtual ~RecollFilter() {} virtual ~RecollFilter() {}
virtual void setConfig(RclConfig *config) { virtual void setConfig(RclConfig *config) override {
m_config = config; m_config = config;
} }
virtual bool set_property(Properties p, const std::string &v) { virtual bool set_property(Properties p, const std::string &v) override {
switch (p) { switch (p) {
case DJF_UDI: case DJF_UDI:
m_udi = v; m_udi = v;
@ -58,31 +58,26 @@ public:
} }
// We don't use this for now // We don't use this for now
virtual bool set_document_uri(const std::string& mtype, virtual bool set_document_uri(const std::string& mtype, const std::string &) override {
const std::string &) {
m_mimeType = mtype; m_mimeType = mtype;
return false; return false;
} }
virtual bool set_document_file(const std::string& mtype, virtual bool set_document_file(const std::string& mtype,const std::string &file_path) override {
const std::string &file_path) {
m_mimeType = mtype; m_mimeType = mtype;
return set_document_file_impl(mtype, file_path); return set_document_file_impl(mtype, file_path);
} }
virtual bool set_document_string(const std::string& mtype, virtual bool set_document_string(const std::string& mtype,const std::string &contents) override{
const std::string &contents) {
m_mimeType = mtype; m_mimeType = mtype;
return set_document_string_impl(mtype, contents); return set_document_string_impl(mtype, contents);
} }
virtual bool set_document_data(const std::string& mtype, virtual bool set_document_data(const std::string& mtype, const char *cp, size_t sz) override {
const char *cp, size_t sz) return set_document_string(mtype, std::string(cp, sz));
{ }
return set_document_string(mtype, std::string(cp, sz));
}
virtual void set_docsize(int64_t size) { virtual void set_docsize(int64_t size) override {
m_docsize = size; m_docsize = size;
} }
@ -90,24 +85,24 @@ public:
return m_docsize; return m_docsize;
} }
virtual bool has_documents() const { virtual bool has_documents() const override {
return m_havedoc; return m_havedoc;
} }
// Most doc types are single-doc // Most doc types are single-doc
virtual bool skip_to_document(const std::string& s) { virtual bool skip_to_document(const std::string& s) override {
if (s.empty()) if (s.empty())
return true; return true;
return false; return false;
} }
virtual bool is_data_input_ok(DataInput input) const { virtual bool is_data_input_ok(DataInput input) const override {
if (input == DOCUMENT_FILE_NAME) if (input == DOCUMENT_FILE_NAME)
return true; return true;
return false; return false;
} }
virtual std::string get_error() const { virtual std::string get_error() const override {
return m_reason; return m_reason;
} }

View File

@ -253,21 +253,21 @@ public:
DocSource(RclConfig *config, std::shared_ptr<DocSequence> iseq) DocSource(RclConfig *config, std::shared_ptr<DocSequence> iseq)
: DocSeqModifier(iseq), m_config(config) : DocSeqModifier(iseq), m_config(config)
{} {}
virtual bool canFilter() {return true;} virtual bool canFilter() override {return true;}
virtual bool canSort() {return true;} virtual bool canSort() override {return true;}
virtual bool setFiltSpec(const DocSeqFiltSpec &); virtual bool setFiltSpec(const DocSeqFiltSpec &) override;
virtual bool setSortSpec(const DocSeqSortSpec &); virtual bool setSortSpec(const DocSeqSortSpec &) override;
virtual bool getDoc(int num, Rcl::Doc &doc, std::string *sh = 0) { virtual bool getDoc(int num, Rcl::Doc &doc, std::string *sh = 0) override {
if (!m_seq) if (!m_seq)
return false; return false;
return m_seq->getDoc(num, doc, sh); return m_seq->getDoc(num, doc, sh);
} }
virtual int getResCnt() { virtual int getResCnt() override {
if (!m_seq) if (!m_seq)
return 0; return 0;
return m_seq->getResCnt(); return m_seq->getResCnt();
} }
virtual std::string title(); virtual std::string title() override;
private: private:
bool buildStack(); bool buildStack();
void stripStack(); void stripStack();

View File

@ -48,7 +48,7 @@
/** Interface for a stored object. */ /** Interface for a stored object. */
class DynConfEntry { class DynConfEntry {
public: public:
virtual ~DynConfEntry() {} virtual ~DynConfEntry() {}
/** Decode object-as-string coming out from storage */ /** Decode object-as-string coming out from storage */
virtual bool decode(const std::string &value) = 0; virtual bool decode(const std::string &value) = 0;
@ -60,23 +60,23 @@ class DynConfEntry {
/** Stored object specialization for generic string storage */ /** Stored object specialization for generic string storage */
class RclSListEntry : public DynConfEntry { class RclSListEntry : public DynConfEntry {
public: public:
RclSListEntry() {} RclSListEntry() {}
virtual ~RclSListEntry() {} virtual ~RclSListEntry() {}
RclSListEntry(const std::string& v) RclSListEntry(const std::string& v)
: value(v) { : value(v) {
} }
virtual bool decode(const std::string &enc) { virtual bool decode(const std::string &enc) override {
base64_decode(enc, value); base64_decode(enc, value);
return true; return true;
} }
virtual bool encode(std::string& enc) { virtual bool encode(std::string& enc) override {
base64_encode(value, enc); base64_encode(value, enc);
return true; return true;
} }
virtual bool equal(const DynConfEntry& other) { virtual bool equal(const DynConfEntry& other) override {
const RclSListEntry& e = dynamic_cast<const RclSListEntry&>(other); const RclSListEntry& e = dynamic_cast<const RclSListEntry&>(other);
return e.value == value; return e.value == value;
} }
std::string value; std::string value;
@ -84,20 +84,20 @@ class RclSListEntry : public DynConfEntry {
/** The dynamic configuration class */ /** The dynamic configuration class */
class RclDynConf { class RclDynConf {
public: public:
RclDynConf(const std::string &fn); RclDynConf(const std::string &fn);
bool ro() { bool ro() {
return m_data.getStatus() == ConfSimple::STATUS_RO; return m_data.getStatus() == ConfSimple::STATUS_RO;
} }
bool rw() { bool rw() {
return m_data.getStatus() == ConfSimple::STATUS_RW; return m_data.getStatus() == ConfSimple::STATUS_RW;
} }
bool ok() { bool ok() {
return m_data.getStatus() != ConfSimple::STATUS_ERROR; return m_data.getStatus() != ConfSimple::STATUS_ERROR;
} }
std::string getFilename() { std::string getFilename() {
return m_data.getFilename(); return m_data.getFilename();
} }
// Generic methods // Generic methods
@ -125,38 +125,38 @@ class RclDynConf {
int maxlen = -1); int maxlen = -1);
template <template <class, class> class Container> template <template <class, class> class Container>
Container<std::string, std::allocator<std::string>> Container<std::string, std::allocator<std::string>>
getStringEntries(const std::string& sk); getStringEntries(const std::string& sk);
private: private:
ConfSimple m_data; ConfSimple m_data;
}; };
template <template <class, class> class Container, class Type> template <template <class, class> class Container, class Type>
Container<Type, std::allocator<Type>> Container<Type, std::allocator<Type>>
RclDynConf::getEntries(const std::string& sk) RclDynConf::getEntries(const std::string& sk)
{ {
Container<Type, std::allocator<Type>> out; Container<Type, std::allocator<Type>> out;
Type entry; Type entry;
std::vector<std::string> names = m_data.getNames(sk); std::vector<std::string> names = m_data.getNames(sk);
for (const auto& name : names) { for (const auto& name : names) {
std::string value; std::string value;
if (m_data.get(name, value, sk)) { if (m_data.get(name, value, sk)) {
if (!entry.decode(value)) if (!entry.decode(value))
continue; continue;
out.push_back(entry); out.push_back(entry);
} }
} }
return out; return out;
} }
template <template <class, class> class Container> template <template <class, class> class Container>
Container<std::string, std::allocator<std::string>> Container<std::string, std::allocator<std::string>>
RclDynConf::getStringEntries(const std::string& sk) RclDynConf::getStringEntries(const std::string& sk)
{ {
std::vector<RclSListEntry> el = getEntries<std::vector, RclSListEntry>(sk); std::vector<RclSListEntry> el = getEntries<std::vector, RclSListEntry>(sk);
Container<std::string, std::allocator<std::string>> sl; Container<std::string, std::allocator<std::string>> sl;
for (const auto& entry : el) { for (const auto& entry : el) {
sl.push_back(entry.value); sl.push_back(entry.value);
} }
return sl; return sl;
} }

View File

@ -360,7 +360,7 @@ public:
* @return 0 if name not found, 1 else * @return 0 if name not found, 1 else
*/ */
virtual int get(const std::string& name, std::string& value, virtual int get(const std::string& name, std::string& value,
const std::string& sk) const; const std::string& sk) const override;
using ConfSimple::get; using ConfSimple::get;
}; };