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
+7 -7
View File
@@ -253,21 +253,21 @@ public:
DocSource(RclConfig *config, std::shared_ptr<DocSequence> iseq)
: DocSeqModifier(iseq), m_config(config)
{}
virtual bool canFilter() {return true;}
virtual bool canSort() {return true;}
virtual bool setFiltSpec(const DocSeqFiltSpec &);
virtual bool setSortSpec(const DocSeqSortSpec &);
virtual bool getDoc(int num, Rcl::Doc &doc, std::string *sh = 0) {
virtual bool canFilter() override {return true;}
virtual bool canSort() override {return true;}
virtual bool setFiltSpec(const DocSeqFiltSpec &) override;
virtual bool setSortSpec(const DocSeqSortSpec &) override;
virtual bool getDoc(int num, Rcl::Doc &doc, std::string *sh = 0) override {
if (!m_seq)
return false;
return m_seq->getDoc(num, doc, sh);
}
virtual int getResCnt() {
virtual int getResCnt() override {
if (!m_seq)
return 0;
return m_seq->getResCnt();
}
virtual std::string title();
virtual std::string title() override;
private:
bool buildStack();
void stripStack();
+28 -28
View File
@@ -48,7 +48,7 @@
/** Interface for a stored object. */
class DynConfEntry {
public:
public:
virtual ~DynConfEntry() {}
/** Decode object-as-string coming out from storage */
virtual bool decode(const std::string &value) = 0;
@@ -60,23 +60,23 @@ class DynConfEntry {
/** Stored object specialization for generic string storage */
class RclSListEntry : public DynConfEntry {
public:
public:
RclSListEntry() {}
virtual ~RclSListEntry() {}
RclSListEntry(const std::string& v)
: value(v) {
: value(v) {
}
virtual bool decode(const std::string &enc) {
base64_decode(enc, value);
return true;
virtual bool decode(const std::string &enc) override {
base64_decode(enc, value);
return true;
}
virtual bool encode(std::string& enc) {
base64_encode(value, enc);
return true;
virtual bool encode(std::string& enc) override {
base64_encode(value, enc);
return true;
}
virtual bool equal(const DynConfEntry& other) {
const RclSListEntry& e = dynamic_cast<const RclSListEntry&>(other);
return e.value == value;
virtual bool equal(const DynConfEntry& other) override {
const RclSListEntry& e = dynamic_cast<const RclSListEntry&>(other);
return e.value == value;
}
std::string value;
@@ -84,20 +84,20 @@ class RclSListEntry : public DynConfEntry {
/** The dynamic configuration class */
class RclDynConf {
public:
public:
RclDynConf(const std::string &fn);
bool ro() {
return m_data.getStatus() == ConfSimple::STATUS_RO;
return m_data.getStatus() == ConfSimple::STATUS_RO;
}
bool rw() {
return m_data.getStatus() == ConfSimple::STATUS_RW;
return m_data.getStatus() == ConfSimple::STATUS_RW;
}
bool ok() {
return m_data.getStatus() != ConfSimple::STATUS_ERROR;
return m_data.getStatus() != ConfSimple::STATUS_ERROR;
}
std::string getFilename() {
return m_data.getFilename();
return m_data.getFilename();
}
// Generic methods
@@ -125,38 +125,38 @@ class RclDynConf {
int maxlen = -1);
template <template <class, class> class Container>
Container<std::string, std::allocator<std::string>>
getStringEntries(const std::string& sk);
getStringEntries(const std::string& sk);
private:
private:
ConfSimple m_data;
};
template <template <class, class> class Container, class Type>
Container<Type, std::allocator<Type>>
RclDynConf::getEntries(const std::string& sk)
RclDynConf::getEntries(const std::string& sk)
{
Container<Type, std::allocator<Type>> out;
Type entry;
std::vector<std::string> names = m_data.getNames(sk);
for (const auto& name : names) {
std::string value;
if (m_data.get(name, value, sk)) {
if (!entry.decode(value))
continue;
out.push_back(entry);
}
std::string value;
if (m_data.get(name, value, sk)) {
if (!entry.decode(value))
continue;
out.push_back(entry);
}
}
return out;
}
template <template <class, class> class Container>
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);
Container<std::string, std::allocator<std::string>> sl;
for (const auto& entry : el) {
sl.push_back(entry.value);
sl.push_back(entry.value);
}
return sl;
}