From ea3bd23d7cb98cfbd1f4beb881ee6ec15cb614f9 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Wed, 18 Apr 2018 09:34:58 +0200 Subject: [PATCH] Fixed namespace decls issues --- src/doc/user/usermanual.html | 7 ++ src/index/beaglequeue.h | 5 +- src/index/indexer.cpp | 18 ++-- src/rcldb/searchdata.h | 16 ++-- src/utils/conftree.h | 178 +++++++++++++++++------------------ 5 files changed, 115 insertions(+), 109 deletions(-) diff --git a/src/doc/user/usermanual.html b/src/doc/user/usermanual.html index 60f819e2..bcd911c3 100644 --- a/src/doc/user/usermanual.html +++ b/src/doc/user/usermanual.html @@ -3752,6 +3752,13 @@ alink="#0000FF"> problems with the Qt HTML display, you can uncheck it to display the plain text version instead.

+
  • +

    Activate links in + preview 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.

    +
  • Plain text to HTML line style: when displaying plain text inside the diff --git a/src/index/beaglequeue.h b/src/index/beaglequeue.h index 1c0130b9..e8b98eec 100644 --- a/src/index/beaglequeue.h +++ b/src/index/beaglequeue.h @@ -18,7 +18,6 @@ #define _beaglequeue_h_included_ #include -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& files); + bool indexFiles(std::list& 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& files) {return true;} + bool purgeFiles(std::list& files) {return true;} /** Called when indexing data from the cache, and from internfile for * search result preview */ diff --git a/src/index/indexer.cpp b/src/index/indexer.cpp index 46191d70..669c61e4 100644 --- a/src/index/indexer.cpp +++ b/src/index/indexer.cpp @@ -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& ifiles, int flag) { list myfiles; string origcwd = m_config->getOrigCwd(); - for (list::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& 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 &docs, IxFlag flag) +bool ConfIndexer::updateDocs(vector &docs, IxFlag flag) { vector paths; docsToPaths(docs, paths); @@ -240,13 +243,12 @@ bool ConfIndexer::updateDocs(std::vector &docs, IxFlag flag) return true; } -bool ConfIndexer::purgeFiles(std::list &files, int flag) +bool ConfIndexer::purgeFiles(list &files, int flag) { list myfiles; string origcwd = m_config->getOrigCwd(); - for (list::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(); diff --git a/src/rcldb/searchdata.h b/src/rcldb/searchdata.h index a6f649fa..a36a0685 100644 --- a/src/rcldb/searchdata.h +++ b/src/rcldb/searchdata.h @@ -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 getSub() { return m_sub; } - virtual void dump(ostream& o) const; + virtual void dump(std::ostream& o) const; protected: std::shared_ptr m_sub; diff --git a/src/utils/conftree.h b/src/utils/conftree.h index 46065760..905d7823 100644 --- a/src/utils/conftree.h +++ b/src/utils/conftree.h @@ -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 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 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 getSubKeys() const = 0; - virtual vector getSubKeys(bool) const = 0; + virtual std::vector getSubKeys() const = 0; + virtual std::vector 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 getNames(const string& sk, const char *pattern = 0) - const; + virtual std::vector 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 getSubKeys(bool) const { + virtual std::vector getSubKeys(bool) const { return getSubKeys(); } - virtual vector getSubKeys() const; + virtual std::vector 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 getSubKeys_unsorted(bool = false) const { + virtual std::vector 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& getlines() const { + const std::vector& 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 > m_submaps; - vector m_subkeys_unsorted; + std::map > m_submaps; + std::vector 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 m_order; + std::vector 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& fns, bool ro = true) { + ConfStack(const std::vector& fns, bool ro = true) { construct(fns, ro); } /// Construct out of single file name and multiple directories - ConfStack(const string& nm, const vector& dirs, bool ro = true) { - vector fns; - for (vector::const_iterator it = dirs.begin(); + ConfStack(const std::string& nm, const std::vector& dirs, + bool ro = true) { + std::vector fns; + for (std::vector::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::const_iterator it; + typename std::vector::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::const_iterator it; + virtual int get(const std::string& name, std::string& value, + const std::string& sk, bool shallow) const { + typename std::vector::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::const_iterator it; + virtual bool hasNameAnywhere(const std::string& nm) const { + typename std::vector::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::iterator it = m_confs.begin(); + typename std::vector::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 getNames(const string& sk, const char *pattern = 0) - const { + virtual std::vector getNames(const std::string& sk, + const char *pattern = 0) const { return getNames1(sk, pattern, false); } - virtual vector getNamesShallow(const string& sk, + virtual std::vector getNamesShallow(const std::string& sk, const char *patt = 0) const { return getNames1(sk, patt, true); } - virtual vector getNames1(const string& sk, const char *pattern, - bool shallow) const { - vector nms; - typename vector::const_iterator it; + virtual std::vector getNames1( + const std::string& sk, const char *pattern, bool shallow) const { + std::vector nms; + typename std::vector::const_iterator it; bool skfound = false; for (it = m_confs.begin(); it != m_confs.end(); it++) { if ((*it)->hasSubKey(sk)) { skfound = true; - vector lst = (*it)->getNames(sk, pattern); + std::vector 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::iterator uit = unique(nms.begin(), nms.end()); + std::vector::iterator uit = unique(nms.begin(), nms.end()); nms.resize(uit - nms.begin()); return nms; } - virtual vector getSubKeys() const { + virtual std::vector getSubKeys() const { return getSubKeys(false); } - virtual vector getSubKeys(bool shallow) const { - vector sks; - typename vector::const_iterator it; + virtual std::vector getSubKeys(bool shallow) const { + std::vector sks; + typename std::vector::const_iterator it; for (it = m_confs.begin(); it != m_confs.end(); it++) { - vector lst; + std::vector 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::iterator uit = unique(sks.begin(), sks.end()); + std::vector::iterator uit = unique(sks.begin(), sks.end()); sks.resize(uit - sks.begin()); return sks; } @@ -557,11 +555,11 @@ public: private: bool m_ok; - vector m_confs; + std::vector m_confs; /// Reset to pristine void clear() { - typename vector::iterator it; + typename std::vector::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::const_iterator it; + typename std::vector::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& fns, bool ro) { - vector::const_iterator it; + void construct(const std::vector& fns, bool ro) { + std::vector::const_iterator it; bool lastok = false; for (it = fns.begin(); it != fns.end(); it++) { T* p = new T(it->c_str(), ro);