Merge branch 'master' of https://framagit.org/medoc88/recoll
This commit is contained in:
commit
7baffdaea6
@ -35,11 +35,11 @@ public:
|
||||
}
|
||||
virtual ~RecollFilter() {}
|
||||
|
||||
virtual void setConfig(RclConfig *config) {
|
||||
virtual void setConfig(RclConfig *config) override {
|
||||
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) {
|
||||
case DJF_UDI:
|
||||
m_udi = v;
|
||||
@ -58,31 +58,26 @@ public:
|
||||
}
|
||||
|
||||
// We don't use this for now
|
||||
virtual bool set_document_uri(const std::string& mtype,
|
||||
const std::string &) {
|
||||
virtual bool set_document_uri(const std::string& mtype, const std::string &) override {
|
||||
m_mimeType = mtype;
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool set_document_file(const std::string& mtype,
|
||||
const std::string &file_path) {
|
||||
virtual bool set_document_file(const std::string& mtype,const std::string &file_path) override {
|
||||
m_mimeType = mtype;
|
||||
return set_document_file_impl(mtype, file_path);
|
||||
}
|
||||
|
||||
virtual bool set_document_string(const std::string& mtype,
|
||||
const std::string &contents) {
|
||||
virtual bool set_document_string(const std::string& mtype,const std::string &contents) override{
|
||||
m_mimeType = mtype;
|
||||
return set_document_string_impl(mtype, contents);
|
||||
}
|
||||
|
||||
virtual bool set_document_data(const std::string& mtype,
|
||||
const char *cp, size_t sz)
|
||||
{
|
||||
return set_document_string(mtype, std::string(cp, sz));
|
||||
}
|
||||
virtual bool set_document_data(const std::string& mtype, const char *cp, size_t sz) override {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -90,24 +85,24 @@ public:
|
||||
return m_docsize;
|
||||
}
|
||||
|
||||
virtual bool has_documents() const {
|
||||
virtual bool has_documents() const override {
|
||||
return m_havedoc;
|
||||
}
|
||||
|
||||
// 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())
|
||||
return true;
|
||||
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)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual std::string get_error() const {
|
||||
virtual std::string get_error() const override {
|
||||
return m_reason;
|
||||
}
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -360,7 +360,7 @@ public:
|
||||
* @return 0 if name not found, 1 else
|
||||
*/
|
||||
virtual int get(const std::string& name, std::string& value,
|
||||
const std::string& sk) const;
|
||||
const std::string& sk) const override;
|
||||
using ConfSimple::get;
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user