Fixed namespace decls issues

This commit is contained in:
Jean-Francois Dockes 2018-04-18 09:34:58 +02:00
parent 2176d81e60
commit ea3bd23d7c
5 changed files with 115 additions and 109 deletions

View File

@ -3752,6 +3752,13 @@ alink="#0000FF">
problems with the Qt HTML display, you can uncheck
it to display the plain text version instead.</p>
</li>
<li class="listitem">
<p><span class="guilabel">Activate links in
preview</span> if set, Recoll will turn HTTP links
found inside plain text into proper HTML anchors,
and clicking a link inside a preview window will
start the default browser on the link target.</p>
</li>
<li class="listitem">
<p><span class="guilabel">Plain text to HTML line
style</span>: when displaying plain text inside the

View File

@ -18,7 +18,6 @@
#define _beaglequeue_h_included_
#include <list>
using std::list;
/**
* Process the Beagle indexing queue.
@ -56,11 +55,11 @@ public:
/** Index a list of files. No db cleaning or stemdb updating.
* Used by the real time monitor */
bool indexFiles(list<string>& files);
bool indexFiles(std::list<std::string>& files);
/** Purge a list of files. No way to do this currently and dont want
* to do anything as this is mostly called by the monitor when *I* delete
* files inside the queue dir */
bool purgeFiles(list<string>& files) {return true;}
bool purgeFiles(std::list<std::string>& files) {return true;}
/** Called when indexing data from the cache, and from internfile for
* search result preview */

View File

@ -37,6 +37,10 @@
#include "rclaspell.h"
#endif
using std::list;
using std::string;
using std::vector;
// This would more logically live in recollindex.cpp, but then librecoll would
// have an undefined symbol
ConfSimple idxreasons;
@ -182,9 +186,8 @@ bool ConfIndexer::indexFiles(list<string>& ifiles, int flag)
{
list<string> myfiles;
string origcwd = m_config->getOrigCwd();
for (list<string>::const_iterator it = ifiles.begin();
it != ifiles.end(); it++) {
myfiles.push_back(path_canon(*it, &origcwd));
for (const auto& entry : ifiles) {
myfiles.push_back(path_canon(entry, &origcwd));
}
myfiles.sort();
@ -229,7 +232,7 @@ bool ConfIndexer::indexFiles(list<string>& ifiles, int flag)
// Update index for specific documents. The docs come from an index
// query, so the udi, backend etc. fields are filled.
bool ConfIndexer::updateDocs(std::vector<Rcl::Doc> &docs, IxFlag flag)
bool ConfIndexer::updateDocs(vector<Rcl::Doc> &docs, IxFlag flag)
{
vector<string> paths;
docsToPaths(docs, paths);
@ -240,13 +243,12 @@ bool ConfIndexer::updateDocs(std::vector<Rcl::Doc> &docs, IxFlag flag)
return true;
}
bool ConfIndexer::purgeFiles(std::list<string> &files, int flag)
bool ConfIndexer::purgeFiles(list<string> &files, int flag)
{
list<string> myfiles;
string origcwd = m_config->getOrigCwd();
for (list<string>::const_iterator it = files.begin();
it != files.end(); it++) {
myfiles.push_back(path_canon(*it, &origcwd));
for (const auto& entry : files) {
myfiles.push_back(path_canon(entry, &origcwd));
}
myfiles.sort();

View File

@ -158,7 +158,7 @@ public:
int getMaxExp() {return m_maxexp;}
int getMaxCl() {return m_maxcl;}
int getSoftMaxExp() {return m_softmaxexpand;}
void dump(ostream& o) const;
void dump(std::ostream& o) const;
friend class ::AdvSearch;
@ -292,7 +292,7 @@ public:
virtual Relation getrel() {
return m_rel;
}
virtual void dump(ostream& o) const;
virtual void dump(std::ostream& o) const;
friend class SearchData;
protected:
@ -342,7 +342,7 @@ public:
virtual void setfield(const string& field) {
m_field = field;
}
virtual void dump(ostream& o) const;
virtual void dump(std::ostream& o) const;
protected:
std::string m_text; // Raw user entry text.
@ -384,7 +384,7 @@ public:
}
virtual ~SearchDataClauseRange() {}
virtual void dump(ostream& o) const;
virtual void dump(std::ostream& o) const;
virtual const std::string& gettext2() const {
return m_t2;
}
@ -413,7 +413,7 @@ public:
virtual ~SearchDataClauseFilename() {}
virtual bool toNativeQuery(Rcl::Db &, void *);
virtual void dump(ostream& o) const;
virtual void dump(std::ostream& o) const;
};
@ -448,7 +448,7 @@ public:
virtual ~SearchDataClausePath() {}
virtual bool toNativeQuery(Rcl::Db &, void *);
virtual void dump(ostream& o) const;
virtual void dump(std::ostream& o) const;
};
/**
@ -470,7 +470,7 @@ public:
virtual void setslack(int slack) {
m_slack = slack;
}
virtual void dump(ostream& o) const;
virtual void dump(std::ostream& o) const;
private:
int m_slack;
};
@ -493,7 +493,7 @@ public:
virtual std::shared_ptr<SearchData> getSub() {
return m_sub;
}
virtual void dump(ostream& o) const;
virtual void dump(std::ostream& o) const;
protected:
std::shared_ptr<SearchData> m_sub;

View File

@ -65,20 +65,14 @@
#include "pathut.h"
using std::string;
using std::vector;
using std::map;
using std::istream;
using std::ostream;
/** Internal class used for storing presentation information */
class ConfLine {
public:
enum Kind {CFL_COMMENT, CFL_SK, CFL_VAR, CFL_VARCOMMENT};
Kind m_kind;
string m_data;
string m_aux;
ConfLine(Kind k, const string& d, string a = string())
std::string m_data;
std::string m_aux;
ConfLine(Kind k, const std::string& d, std::string a = std::string())
: m_kind(k), m_data(d), m_aux(a) {
}
bool operator==(const ConfLine& o) {
@ -93,18 +87,19 @@ class ConfNull {
public:
enum StatusCode {STATUS_ERROR = 0, STATUS_RO = 1, STATUS_RW = 2};
virtual ~ConfNull() {};
virtual int get(const string& name, string& value,
const string& sk = string()) const = 0;
virtual bool hasNameAnywhere(const string& nm) const = 0;
virtual int set(const string& nm, const string& val,
const string& sk = string()) = 0;
virtual int get(const std::string& name, std::string& value,
const std::string& sk = std::string()) const = 0;
virtual bool hasNameAnywhere(const std::string& nm) const = 0;
virtual int set(const std::string& nm, const std::string& val,
const std::string& sk = std::string()) = 0;
virtual bool ok() const = 0;
virtual vector<string> getNames(const string& sk, const char* = 0)const = 0;
virtual int erase(const string&, const string&) = 0;
virtual int eraseKey(const string&) = 0;
virtual std::vector<std::string> getNames(const std::string& sk,
const char* = 0)const = 0;
virtual int erase(const std::string&, const std::string&) = 0;
virtual int eraseKey(const std::string&) = 0;
virtual void showall() const {};
virtual vector<string> getSubKeys() const = 0;
virtual vector<string> getSubKeys(bool) const = 0;
virtual std::vector<std::string> getSubKeys() const = 0;
virtual std::vector<std::string> getSubKeys(bool) const = 0;
virtual bool holdWrites(bool) = 0;
virtual bool sourceChanged() const = 0;
};
@ -130,7 +125,7 @@ public:
* @param readonly if true open readonly, else rw
* @param tildexp try tilde (home dir) expansion for subsection names
*/
ConfSimple(const string& data, int readonly = 0, bool tildexp = false,
ConfSimple(const std::string& data, int readonly = 0, bool tildexp = false,
bool trimvalues = true);
/**
@ -160,7 +155,7 @@ public:
}
/** Clear, then reparse from string */
void reparse(const string& in);
void reparse(const std::string& in);
/** Clear all content */
void clear() {
@ -173,40 +168,40 @@ public:
* in global space if sk is empty).
* @return 0 if name not found, 1 else
*/
virtual int get(const string& name, string& value,
const string& sk = string()) const;
virtual int get(const std::string& name, std::string& value,
const std::string& sk = std::string()) const;
/**
* Get integer value for named parameter, from specified subsection (looks
* in global space if sk is empty).
* @return 0 if name not found, 1 else
*/
virtual int get(const string& name, int* value,
const string& sk = string()) const;
virtual int get(const std::string& name, int* value,
const std::string& sk = std::string()) const;
/**
* Set value for named string parameter in specified subsection (or global)
* @return 0 for error, 1 else
*/
virtual int set(const string& nm, const string& val,
const string& sk = string());
virtual int set(const std::string& nm, const std::string& val,
const std::string& sk = std::string());
/**
* Set value for named integer parameter in specified subsection (or global)
* @return 0 for error, 1 else
*/
virtual int set(const string& nm, long long val,
const string& sk = string());
virtual int set(const std::string& nm, long long val,
const std::string& sk = std::string());
/**
* Remove name and value from config
*/
virtual int erase(const string& name, const string& sk);
virtual int erase(const std::string& name, const std::string& sk);
/**
* Erase all names under given subkey (and subkey itself)
*/
virtual int eraseKey(const string& sk);
virtual int eraseKey(const std::string& sk);
virtual StatusCode getStatus() const;
virtual bool ok() const {
@ -222,47 +217,47 @@ public:
*/
enum WalkerCode {WALK_STOP, WALK_CONTINUE};
virtual WalkerCode sortwalk(WalkerCode
(*wlkr)(void *cldata, const string& nm,
const string& val),
(*wlkr)(void *cldata, const std::string& nm,
const std::string& val),
void *clidata) const;
/** Print all values to stdout */
virtual void showall() const;
/** Return all names in given submap. */
virtual vector<string> getNames(const string& sk, const char *pattern = 0)
const;
virtual std::vector<std::string> getNames(const std::string& sk,
const char *pattern = 0) const;
/** Check if name is present in any submap. This is relatively expensive
* but useful for saving further processing sometimes */
virtual bool hasNameAnywhere(const string& nm) const;
virtual bool hasNameAnywhere(const std::string& nm) const;
/**
* Return all subkeys
*/
virtual vector<string> getSubKeys(bool) const {
virtual std::vector<std::string> getSubKeys(bool) const {
return getSubKeys();
}
virtual vector<string> getSubKeys() const;
virtual std::vector<std::string> getSubKeys() const;
/** Return subkeys in file order. BEWARE: only for the original from the
* file: the data is not duplicated to further copies */
virtual vector<string> getSubKeys_unsorted(bool = false) const {
virtual std::vector<std::string> getSubKeys_unsorted(bool = false) const {
return m_subkeys_unsorted;
}
/** Test for subkey existence */
virtual bool hasSubKey(const string& sk) const {
virtual bool hasSubKey(const std::string& sk) const {
return m_submaps.find(sk) != m_submaps.end();
}
virtual string getFilename() const {
virtual std::string getFilename() const {
return m_filename;
}
/** Used with config files with specially formatted, xml-like comments.
* Extract the comments as text */
virtual bool commentsAsXML(ostream& out);
virtual bool commentsAsXML(std::ostream& out);
/** !! Note that assignment and copy constructor do not copy the
auxiliary data (m_order and subkeys_unsorted). */
@ -295,10 +290,10 @@ public:
/**
* Write in file format to out
*/
bool write(ostream& out) const;
bool write(std::ostream& out) const;
/** Give access to semi-parsed file contents */
const vector<ConfLine>& getlines() const {
const std::vector<ConfLine>& getlines() const {
return m_order;
}
@ -308,24 +303,24 @@ protected:
StatusCode status;
private:
// Set if we're working with a file
string m_filename;
std::string m_filename;
time_t m_fmtime;
// Configuration data submaps (one per subkey, the main data has a
// null subkey)
map<string, map<string, string> > m_submaps;
vector<string> m_subkeys_unsorted;
std::map<std::string, std::map<std::string, std::string> > m_submaps;
std::vector<std::string> m_subkeys_unsorted;
// Presentation data. We keep the comments, empty lines and
// variable and subkey ordering information in there (for
// rewriting the file while keeping hand-edited information)
vector<ConfLine> m_order;
std::vector<ConfLine> m_order;
// Control if we're writing to the backing store
bool m_holdWrites;
void parseinput(istream& input);
void parseinput(std::istream& input);
bool write();
// Internal version of set: no RW checking
virtual int i_set(const string& nm, const string& val,
const string& sk, bool init = false);
virtual int i_set(const std::string& nm, const std::string& val,
const std::string& sk, bool init = false);
bool i_changed(bool upd);
};
@ -353,7 +348,7 @@ public:
* expansion */
ConfTree(const char *fname, int readonly = 0, bool trimvalues=true)
: ConfSimple(fname, readonly, true, trimvalues) {}
ConfTree(const string& data, int readonly = 0, bool trimvalues=true)
ConfTree(const std::string& data, int readonly = 0, bool trimvalues=true)
: ConfSimple(data, readonly, true, trimvalues) {}
ConfTree(int readonly = 0, bool trimvalues=true)
: ConfSimple(readonly, true, trimvalues) {}
@ -369,7 +364,8 @@ public:
* parents.
* @return 0 if name not found, 1 else
*/
virtual int get(const string& name, string& value, const string& sk) const;
virtual int get(const std::string& name, std::string& value,
const std::string& sk) const;
using ConfSimple::get;
};
@ -389,13 +385,14 @@ public:
/// Construct from configuration file names. The earler
/// files in have priority when fetching values. Only the first
/// file will be updated if ro is false and set() is used.
ConfStack(const vector<string>& fns, bool ro = true) {
ConfStack(const std::vector<std::string>& fns, bool ro = true) {
construct(fns, ro);
}
/// Construct out of single file name and multiple directories
ConfStack(const string& nm, const vector<string>& dirs, bool ro = true) {
vector<string> fns;
for (vector<string>::const_iterator it = dirs.begin();
ConfStack(const std::string& nm, const std::vector<std::string>& dirs,
bool ro = true) {
std::vector<std::string> fns;
for (std::vector<std::string>::const_iterator it = dirs.begin();
it != dirs.end(); it++) {
fns.push_back(path_cat(*it, nm));
}
@ -424,7 +421,7 @@ public:
}
virtual bool sourceChanged() const {
typename vector<T*>::const_iterator it;
typename std::vector<T*>::const_iterator it;
for (it = m_confs.begin(); it != m_confs.end(); it++) {
if ((*it)->sourceChanged()) {
return true;
@ -433,9 +430,9 @@ public:
return false;
}
virtual int get(const string& name, string& value, const string& sk,
bool shallow) const {
typename vector<T*>::const_iterator it;
virtual int get(const std::string& name, std::string& value,
const std::string& sk, bool shallow) const {
typename std::vector<T*>::const_iterator it;
for (it = m_confs.begin(); it != m_confs.end(); it++) {
if ((*it)->get(name, value, sk)) {
return true;
@ -446,12 +443,13 @@ public:
}
return false;
}
virtual int get(const string& name, string& value, const string& sk) const {
virtual int get(const std::string& name, std::string& value,
const std::string& sk) const {
return get(name, value, sk, false);
}
virtual bool hasNameAnywhere(const string& nm) const {
typename vector<T*>::const_iterator it;
virtual bool hasNameAnywhere(const std::string& nm) const {
typename std::vector<T*>::const_iterator it;
for (it = m_confs.begin(); it != m_confs.end(); it++) {
if ((*it)->hasNameAnywhere(nm)) {
return true;
@ -460,8 +458,8 @@ public:
return false;
}
virtual int set(const string& nm, const string& val,
const string& sk = string()) {
virtual int set(const std::string& nm, const std::string& val,
const std::string& sk = std::string()) {
if (!m_ok) {
return 0;
}
@ -470,10 +468,10 @@ public:
// Avoid adding unneeded entries: if the new value matches the
// one out from the deeper configs, erase or dont add it
// from/to the topmost file
typename vector<T*>::iterator it = m_confs.begin();
typename std::vector<T*>::iterator it = m_confs.begin();
it++;
while (it != m_confs.end()) {
string value;
std::string value;
if ((*it)->get(nm, value, sk)) {
// This file has value for nm/sk. If it is the same as the new
// one, no need for an entry in the topmost file. Else, stop
@ -491,34 +489,34 @@ public:
return m_confs.front()->set(nm, val, sk);
}
virtual int erase(const string& nm, const string& sk) {
virtual int erase(const std::string& nm, const std::string& sk) {
return m_confs.front()->erase(nm, sk);
}
virtual int eraseKey(const string& sk) {
virtual int eraseKey(const std::string& sk) {
return m_confs.front()->eraseKey(sk);
}
virtual bool holdWrites(bool on) {
return m_confs.front()->holdWrites(on);
}
virtual vector<string> getNames(const string& sk, const char *pattern = 0)
const {
virtual std::vector<std::string> getNames(const std::string& sk,
const char *pattern = 0) const {
return getNames1(sk, pattern, false);
}
virtual vector<string> getNamesShallow(const string& sk,
virtual std::vector<std::string> getNamesShallow(const std::string& sk,
const char *patt = 0) const {
return getNames1(sk, patt, true);
}
virtual vector<string> getNames1(const string& sk, const char *pattern,
bool shallow) const {
vector<string> nms;
typename vector<T*>::const_iterator it;
virtual std::vector<std::string> getNames1(
const std::string& sk, const char *pattern, bool shallow) const {
std::vector<std::string> nms;
typename std::vector<T*>::const_iterator it;
bool skfound = false;
for (it = m_confs.begin(); it != m_confs.end(); it++) {
if ((*it)->hasSubKey(sk)) {
skfound = true;
vector<string> lst = (*it)->getNames(sk, pattern);
std::vector<std::string> lst = (*it)->getNames(sk, pattern);
nms.insert(nms.end(), lst.begin(), lst.end());
}
if (shallow && skfound) {
@ -526,19 +524,19 @@ public:
}
}
sort(nms.begin(), nms.end());
vector<string>::iterator uit = unique(nms.begin(), nms.end());
std::vector<std::string>::iterator uit = unique(nms.begin(), nms.end());
nms.resize(uit - nms.begin());
return nms;
}
virtual vector<string> getSubKeys() const {
virtual std::vector<std::string> getSubKeys() const {
return getSubKeys(false);
}
virtual vector<string> getSubKeys(bool shallow) const {
vector<string> sks;
typename vector<T*>::const_iterator it;
virtual std::vector<std::string> getSubKeys(bool shallow) const {
std::vector<std::string> sks;
typename std::vector<T*>::const_iterator it;
for (it = m_confs.begin(); it != m_confs.end(); it++) {
vector<string> lst;
std::vector<std::string> lst;
lst = (*it)->getSubKeys();
sks.insert(sks.end(), lst.begin(), lst.end());
if (shallow) {
@ -546,7 +544,7 @@ public:
}
}
sort(sks.begin(), sks.end());
vector<string>::iterator uit = unique(sks.begin(), sks.end());
std::vector<std::string>::iterator uit = unique(sks.begin(), sks.end());
sks.resize(uit - sks.begin());
return sks;
}
@ -557,11 +555,11 @@ public:
private:
bool m_ok;
vector<T*> m_confs;
std::vector<T*> m_confs;
/// Reset to pristine
void clear() {
typename vector<T*>::iterator it;
typename std::vector<T*>::iterator it;
for (it = m_confs.begin(); it != m_confs.end(); it++) {
delete(*it);
}
@ -571,7 +569,7 @@ private:
/// Common code to initialize from existing object
void init_from(const ConfStack& rhs) {
if ((m_ok = rhs.m_ok)) {
typename vector<T*>::const_iterator it;
typename std::vector<T*>::const_iterator it;
for (it = rhs.m_confs.begin(); it != rhs.m_confs.end(); it++) {
m_confs.push_back(new T(**it));
}
@ -579,8 +577,8 @@ private:
}
/// Common construct from file names code
void construct(const vector<string>& fns, bool ro) {
vector<string>::const_iterator it;
void construct(const std::vector<std::string>& fns, bool ro) {
std::vector<std::string>::const_iterator it;
bool lastok = false;
for (it = fns.begin(); it != fns.end(); it++) {
T* p = new T(it->c_str(), ro);