diff --git a/src/common/beaglequeuecache.cpp b/src/common/beaglequeuecache.cpp index 5478bc60..3127f3eb 100644 --- a/src/common/beaglequeuecache.cpp +++ b/src/common/beaglequeuecache.cpp @@ -70,8 +70,8 @@ bool BeagleQueueCache::getFromCache(const string& udi, Rcl::Doc &dotdoc, cf.get(cstr_fmtime, dotdoc.fmtime, cstr_null); cf.get(cstr_fbytes, dotdoc.pcbytes, cstr_null); dotdoc.sig.clear(); - list names = cf.getNames(cstr_null); - for (list::const_iterator it = names.begin(); + vector names = cf.getNames(cstr_null); + for (vector::const_iterator it = names.begin(); it != names.end(); it++) { cf.get(*it, dotdoc.meta[*it], cstr_null); } diff --git a/src/common/rclconfig.cpp b/src/common/rclconfig.cpp index 58941c74..d3102615 100644 --- a/src/common/rclconfig.cpp +++ b/src/common/rclconfig.cpp @@ -395,8 +395,8 @@ bool RclConfig::addLocalFields(map *tgt) sfields[i] = '\n'; // Parse the result with a confsimple and add the results to the metadata ConfSimple conf(sfields, 1, true); - list nmlst = conf.getNames(cstr_null); - for (list::const_iterator it = nmlst.begin(); + vector nmlst = conf.getNames(cstr_null); + for (vector::const_iterator it = nmlst.begin(); it != nmlst.end(); it++) { conf.get(*it, (*tgt)[*it]); LOGDEB(("RclConfig::addLocalFields: [%s] => [%s]\n", @@ -414,14 +414,12 @@ bool RclConfig::addLocalFields(map *tgt) // // This unfortunately means that searches by file names and mime type // filtering don't work well together. -list RclConfig::getAllMimeTypes() +vector RclConfig::getAllMimeTypes() { - list lst; + vector lst; if (mimeconf == 0) return lst; lst = mimeconf->getNames("index"); - lst.sort(); - lst.unique(); return lst; } @@ -511,9 +509,9 @@ string RclConfig::getMimeTypeFromSuffix(const string& suff) string RclConfig::getSuffixFromMimeType(const string &mt) { string suffix; - listsfs = mimemap->getNames(cstr_null); + vectorsfs = mimemap->getNames(cstr_null); string mt1; - for (list::const_iterator it = sfs.begin(); + for (vector::const_iterator it = sfs.begin(); it != sfs.end(); it++) { if (mimemap->get(*it, mt1, cstr_null)) if (!stringicmp(mt, mt1)) @@ -523,7 +521,7 @@ string RclConfig::getSuffixFromMimeType(const string &mt) } /** Get list of file categories from mimeconf */ -bool RclConfig::getMimeCategories(list& cats) +bool RclConfig::getMimeCategories(vector& cats) { if (!mimeconf) return false; @@ -533,9 +531,9 @@ bool RclConfig::getMimeCategories(list& cats) bool RclConfig::isMimeCategory(string& cat) { - listcats; + vectorcats; getMimeCategories(cats); - for (list::iterator it = cats.begin(); it != cats.end(); it++) { + for (vector::iterator it = cats.begin(); it != cats.end(); it++) { if (!stringicmp(*it,cat)) return true; } @@ -543,7 +541,7 @@ bool RclConfig::isMimeCategory(string& cat) } /** Get list of mime types for category from mimeconf */ -bool RclConfig::getMimeCatTypes(const string& cat, list& tps) +bool RclConfig::getMimeCatTypes(const string& cat, vector& tps) { tps.clear(); if (!mimeconf) @@ -576,7 +574,7 @@ string RclConfig::getMimeHandlerDef(const string &mtype, bool filtertypes) return hs; } -bool RclConfig::getGuiFilterNames(list& cats) +bool RclConfig::getGuiFilterNames(vector& cats) { if (!mimeconf) return false; @@ -652,8 +650,9 @@ bool RclConfig::readFieldsConfig(const string& cnferrloc) // Build a direct map avoiding all indirections for field to // prefix translation // Add direct prefixes from the [prefixes] section - listtps = m_fields->getNames("prefixes"); - for (list::const_iterator it = tps.begin(); it != tps.end();it++) { + vectortps = m_fields->getNames("prefixes"); + for (vector::const_iterator it = tps.begin(); + it != tps.end(); it++) { string val; m_fields->get(*it, val, "prefixes"); ConfSimple attrs; @@ -677,7 +676,7 @@ bool RclConfig::readFieldsConfig(const string& cnferrloc) // Having the aliases in the prefix map avoids an additional indirection // at index time. tps = m_fields->getNames("aliases"); - for (list::const_iterator it = tps.begin(); it != tps.end();it++) { + for (vector::const_iterator it = tps.begin(); it != tps.end();it++) { string canonic = stringtolower(*it); // canonic name FieldTraits ft; map::const_iterator pit = @@ -687,9 +686,9 @@ bool RclConfig::readFieldsConfig(const string& cnferrloc) } string aliases; m_fields->get(canonic, aliases, "aliases"); - list l; + vector l; stringToStrings(aliases, l); - for (list::const_iterator ait = l.begin(); + for (vector::const_iterator ait = l.begin(); ait != l.end(); ait++) { if (pit != m_fldtotraits.end()) m_fldtotraits[stringtolower(*ait)] = ft; @@ -706,9 +705,9 @@ bool RclConfig::readFieldsConfig(const string& cnferrloc) } #endif - list sl = m_fields->getNames("stored"); + vector sl = m_fields->getNames("stored"); if (!sl.empty()) { - for (list::const_iterator it = sl.begin(); + for (vector::const_iterator it = sl.begin(); it != sl.end(); it++) { string fld = fieldCanon(stringtolower(*it)); m_storedFields.insert(fld); @@ -716,8 +715,8 @@ bool RclConfig::readFieldsConfig(const string& cnferrloc) } // Extended file attribute to field translations - listxattrs = m_fields->getNames("xattrtofields"); - for (list::const_iterator it = xattrs.begin(); + vectorxattrs = m_fields->getNames("xattrtofields"); + for (vector::const_iterator it = xattrs.begin(); it != xattrs.end(); it++) { string val; m_fields->get(*it, val, "xattrtofields"); @@ -751,7 +750,7 @@ set RclConfig::getIndexedFields() if (m_fields == 0) return flds; - list sl = m_fields->getNames("prefixes"); + vector sl = m_fields->getNames("prefixes"); flds.insert(sl.begin(), sl.end()); return flds; } @@ -769,10 +768,10 @@ string RclConfig::fieldCanon(const string& f) return fld; } -list RclConfig::getFieldSectNames(const string &sk, const char* patrn) +vector RclConfig::getFieldSectNames(const string &sk, const char* patrn) { if (m_fields == 0) - return list(); + return vector(); return m_fields->getNames(sk, patrn); } @@ -802,8 +801,8 @@ bool RclConfig::getMimeViewerDefs(vector >& defs) { if (mimeview == 0) return false; - listtps = mimeview->getNames("view"); - for (list::const_iterator it = tps.begin(); it != tps.end();it++) { + vectortps = mimeview->getNames("view"); + for (vector::const_iterator it = tps.begin(); it != tps.end();it++) { defs.push_back(pair(*it, getMimeViewerDef(*it, ""))); } return true; @@ -823,7 +822,7 @@ bool RclConfig::setMimeViewerDef(const string& mt, const string& def) return false; } - list cdirs; + vector cdirs; cdirs.push_back(m_confdir); cdirs.push_back(path_cat(m_datadir, "examples")); @@ -934,7 +933,7 @@ string RclConfig::getIdxStatusFile() } } -list& RclConfig::getSkippedNames() +vector& RclConfig::getSkippedNames() { if (m_skpnstate.needrecompute()) { stringToStrings(m_skpnstate.savedvalue, m_skpnlist); @@ -942,9 +941,9 @@ list& RclConfig::getSkippedNames() return m_skpnlist; } -list RclConfig::getSkippedPaths() +vector RclConfig::getSkippedPaths() { - list skpl; + vector skpl; getConfParam("skippedPaths", &skpl); // Always add the dbdir and confdir to the skipped paths. This is @@ -952,30 +951,30 @@ list RclConfig::getSkippedPaths() // don't do this. skpl.push_back(getDbDir()); skpl.push_back(getConfDir()); - for (list::iterator it = skpl.begin(); it != skpl.end(); it++) { + for (vector::iterator it = skpl.begin(); it != skpl.end(); it++) { *it = path_tildexpand(*it); *it = path_canon(*it); } - skpl.sort(); - skpl.unique(); + sort(skpl.begin(), skpl.end()); + unique(skpl.begin(), skpl.end()); return skpl; } -list RclConfig::getDaemSkippedPaths() +vector RclConfig::getDaemSkippedPaths() { - list skpl = getSkippedPaths(); - - list dskpl; + vector dskpl; getConfParam("daemSkippedPaths", &dskpl); - for (list::iterator it = dskpl.begin(); it != dskpl.end(); it++) { + for (vector::iterator it = dskpl.begin(); it != dskpl.end(); it++) { *it = path_tildexpand(*it); *it = path_canon(*it); } - dskpl.sort(); + sort(dskpl.begin(), dskpl.end()); - skpl.merge(dskpl); - skpl.unique(); + vector skpl1 = getSkippedPaths(); + vector skpl; + merge(dskpl.begin(), dskpl.end(), skpl1.begin(), skpl1.end(), skpl.begin()); + unique(skpl.begin(), skpl.end()); return skpl; } @@ -1024,20 +1023,20 @@ string RclConfig::findFilter(const string &icmd) /** * Return decompression command line for given mime type */ -bool RclConfig::getUncompressor(const string &mtype, list& cmd) +bool RclConfig::getUncompressor(const string &mtype, vector& cmd) { string hs; mimeconf->get(mtype, hs, cstr_null); if (hs.empty()) return false; - list tokens; + vector tokens; stringToStrings(hs, tokens); if (tokens.empty()) { LOGERR(("getUncompressor: empty spec for mtype %s\n", mtype.c_str())); return false; } - list::iterator it = tokens.begin(); + vector::iterator it = tokens.begin(); if (tokens.size() < 2) return false; if (stringlowercmp("uncompress", *it++)) @@ -1148,7 +1147,7 @@ void RclConfig::initFrom(const RclConfig& r) #include #include -#include +#include #include using namespace std; @@ -1252,20 +1251,20 @@ int main(int argc, char **argv) } else if (op_flags & OPT_c) { // Check that all known mime types have an icon and belong to // some category - list catnames; + vector catnames; config->getMimeCategories(catnames); cout << "Categories: "; set allmtsfromcats; - for (list::const_iterator it = catnames.begin(); + for (vector::const_iterator it = catnames.begin(); it != catnames.end(); it++) { cout << *it << " "; } cout << endl; - for (list::const_iterator it = catnames.begin(); + for (vector::const_iterator it = catnames.begin(); it != catnames.end(); it++) { - list cts; + vector cts; config->getMimeCatTypes(*it, cts); - for (list::const_iterator it1 = cts.begin(); + for (vector::const_iterator it1 = cts.begin(); it1 != cts.end(); it1++) { // Already in map -> duplicate if (allmtsfromcats.find(*it1) != allmtsfromcats.end()) { @@ -1275,8 +1274,8 @@ int main(int argc, char **argv) } } - list mtypes = config->getAllMimeTypes(); - for (list::const_iterator it = mtypes.begin(); + vector mtypes = config->getAllMimeTypes(); + for (vector::const_iterator it = mtypes.begin(); it != mtypes.end(); it++) { if (allmtsfromcats.find(*it) == allmtsfromcats.end()) { cout << "Not found in catgs: [" << *it << "]" << endl; @@ -1284,10 +1283,8 @@ int main(int argc, char **argv) } } else { config->setKeyDir(cstr_null); - list names = config->getConfNames(); - names.sort(); - names.unique(); - for (list::iterator it = names.begin(); + vector names = config->getConfNames(); + for (vector::iterator it = names.begin(); it != names.end();it++) { string value; config->getConfParam(*it, value); diff --git a/src/common/rclconfig.h b/src/common/rclconfig.h index 6d524fd7..64ce44c6 100644 --- a/src/common/rclconfig.h +++ b/src/common/rclconfig.h @@ -121,7 +121,7 @@ class RclConfig { * Get list of config names under current sk, with possible * wildcard filtering */ - list getConfNames(const char *pattern = 0) { + vector getConfNames(const char *pattern = 0) { return m_conf->getNames(m_keydir, pattern); } @@ -151,13 +151,13 @@ class RclConfig { string getIdxStatusFile(); /** Get list of skipped file names for current keydir */ - list& getSkippedNames(); + vector& getSkippedNames(); /** Get list of skipped paths patterns. Doesn't depend on the keydir */ - list getSkippedPaths(); + vector getSkippedPaths(); /** Get list of skipped paths patterns, daemon version (may add some) Doesn't depend on the keydir */ - list getDaemSkippedPaths(); + vector getDaemSkippedPaths(); /** conf: Add local fields to target dic */ bool addLocalFields(map *tgt); @@ -177,12 +177,12 @@ class RclConfig { * The returned command has substitutable places for input file name * and temp dir name, and will return output name */ - bool getUncompressor(const string &mtpe, list& cmd); + bool getUncompressor(const string &mtpe, vector& cmd); /** mimemap: compute mimetype */ string getMimeTypeFromSuffix(const string &suffix); /** mimemap: get a list of all indexable mime types defined */ - list getAllMimeTypes(); + vector getAllMimeTypes(); /** mimemap: Get appropriate suffix for mime type. This is inefficient */ string getSuffixFromMimeType(const string &mt); @@ -200,14 +200,14 @@ class RclConfig { string getMimeIconName(const string &mtype, string *path = 0); /** mimeconf: get list of file categories */ - bool getMimeCategories(list&); + bool getMimeCategories(vector&); /** mimeconf: is parameter one of the categories ? */ bool isMimeCategory(string&); /** mimeconf: get list of mime types for category */ - bool getMimeCatTypes(const string& cat, list&); + bool getMimeCatTypes(const string& cat, vector&); /** mimeconf: get list of gui filters (doc cats by default */ - bool getGuiFilterNames(list&); + bool getGuiFilterNames(vector&); /** mimeconf: get query lang frag for named filter */ bool getGuiFilter(const string& filtername, string& frag); @@ -222,7 +222,7 @@ class RclConfig { /** Get value of a parameter inside the "fields" file. Only some filters use this (ie: mh_mail). The information specific to a given filter is typically stored in a separate section(ie: [mail]) */ - list getFieldSectNames(const string &sk, const char* = 0); + vector getFieldSectNames(const string &sk, const char* = 0); bool getFieldConfParam(const string &name, const string &sk, string &value); /** mimeview: get/set external viewer exec string(s) for mimetype(s) */ @@ -267,7 +267,7 @@ class RclConfig { string m_keydir; // Current directory used for parameter fetches. int m_keydirgen; // To help with knowing when to update computed data. - list m_cdirs; // directory stack for the confstacks + vector m_cdirs; // directory stack for the confstacks ConfStack *m_conf; // Parsed configuration files ConfStack *mimemap; // The files don't change with keydir, @@ -284,7 +284,7 @@ class RclConfig { ParamStale m_stpsuffstate; ParamStale m_skpnstate; - list m_skpnlist; + vector m_skpnlist; // Parameters auto-fetched on setkeydir string defcharset; diff --git a/src/index/beaglequeue.cpp b/src/index/beaglequeue.cpp index 8542cb09..77339eda 100644 --- a/src/index/beaglequeue.cpp +++ b/src/index/beaglequeue.cpp @@ -127,8 +127,8 @@ public: confstr += line + "\n"; } ConfSimple fields(confstr, 1); - list names = fields.getNames(cstr_null); - for (list::iterator it = names.begin(); + vector names = fields.getNames(cstr_null); + for (vector::iterator it = names.begin(); it != names.end(); it++) { string value; fields.get(*it, value, cstr_null); diff --git a/src/index/beaglequeue.h b/src/index/beaglequeue.h index d1904bcf..f15b5a57 100644 --- a/src/index/beaglequeue.h +++ b/src/index/beaglequeue.h @@ -17,6 +17,9 @@ #ifndef _beaglequeue_h_included_ #define _beaglequeue_h_included_ +#include +using std::list; + /** * Process the Beagle indexing queue. * diff --git a/src/index/indexer.cpp b/src/index/indexer.cpp index b7a9fb59..fce79d0f 100644 --- a/src/index/indexer.cpp +++ b/src/index/indexer.cpp @@ -239,13 +239,13 @@ bool ConfIndexer::createStemmingDatabases() LOGERR(("ConfIndexer::createStemmingDb: could not open db\n")) return false; } - list langs; + vector langs; stringToStrings(slangs, langs); // Get the list of existing stem dbs from the database (some may have // been manually created, we just keep those from the config - list dblangs = m_db.getStemLangs(); - list::const_iterator it; + vector dblangs = m_db.getStemLangs(); + vector::const_iterator it; for (it = dblangs.begin(); it != dblangs.end(); it++) { if (find(langs.begin(), langs.end(), *it) == langs.end()) m_db.deleteStemDb(*it); diff --git a/src/internfile/internfile.cpp b/src/internfile/internfile.cpp index 99da35fe..1e49cedd 100644 --- a/src/internfile/internfile.cpp +++ b/src/internfile/internfile.cpp @@ -130,7 +130,7 @@ bool FileInterner::getEnclosing(const string &url, const string &ipath, // Uncompress input file into a temporary one, by executing the appropriate // script. static bool uncompressfile(RclConfig *conf, const string& ifn, - const list& cmdv, TempDir& tdir, + const vector& cmdv, TempDir& tdir, string& tfile) { // Make sure tmp dir is empty. we guarantee this to filters @@ -141,7 +141,7 @@ static bool uncompressfile(RclConfig *conf, const string& ifn, string cmd = cmdv.front(); // Substitute file name and temp dir in command elements - list::const_iterator it = cmdv.begin(); + vector::const_iterator it = cmdv.begin(); ++it; vector args; map subs; @@ -245,7 +245,7 @@ void FileInterner::init(const string &f, const struct stat *stp, RclConfig *cnf, // Has mime: check for a compressed file. If so, create a // temporary uncompressed file, and rerun the mime type // identification, then do the rest with the temp file. - listucmd; + vectorucmd; if (m_cfg->getUncompressor(l_mime, ucmd)) { // Check for compressed size limit int maxkbs = -1; @@ -541,10 +541,10 @@ bool FileInterner::dataToTempFile(const string& dt, const string& mt, void FileInterner::checkExternalMissing(const string& msg, const string& mt) { if (m_missingdatap && msg.find("RECFILTERROR") == 0) { - list lerr; + vector lerr; stringToStrings(msg, lerr); if (lerr.size() > 2) { - list::iterator it = lerr.begin(); + vector::iterator it = lerr.begin(); lerr.erase(it++); if (*it == "HELPERNOTFOUND") { lerr.erase(it++); @@ -597,8 +597,8 @@ void FileInterner::getMissingFromDescription(FIMissingStore *st, const string& i return; // The "missing" file is text. Each line defines a missing filter - // and the list of mime types actually encountered that needed it (see method - // getMissingDescription()) + // and the list of mime types actually encountered that needed it + // (see method getMissingDescription()) vector lines; stringToTokens(in, lines, "\n"); @@ -1125,7 +1125,7 @@ bool FileInterner::isCompressed(const string& fn, RclConfig *cnf) return false; } - listucmd; + vector ucmd; if (cnf->getUncompressor(l_mime, ucmd)) { return true; } @@ -1149,7 +1149,7 @@ bool FileInterner::maybeUncompressToTemp(TempFile& temp, const string& fn, return false; } - listucmd; + vectorucmd; if (!cnf->getUncompressor(l_mime, ucmd)) { return true; } diff --git a/src/internfile/mh_exec.cpp b/src/internfile/mh_exec.cpp index 2e37166b..7ce52f5d 100644 --- a/src/internfile/mh_exec.cpp +++ b/src/internfile/mh_exec.cpp @@ -86,8 +86,8 @@ bool MimeHandlerExec::next_document() // Command name string cmd = params.front(); - // Build parameter list: delete cmd name and add the file name - list::iterator it = params.begin(); + // Build parameter vector: delete cmd name and add the file name + vector::iterator it = params.begin(); vectormyparams(++it, params.end()); myparams.push_back(m_fn); if (!m_ipath.empty()) diff --git a/src/internfile/mh_exec.h b/src/internfile/mh_exec.h index cb7cb8bd..0b043c71 100644 --- a/src/internfile/mh_exec.h +++ b/src/internfile/mh_exec.h @@ -18,8 +18,8 @@ #define _MH_EXEC_H_INCLUDED_ #include -#include -using std::list; +#include +using std::vector; using std::string; #include "mimehandler.h" @@ -43,9 +43,9 @@ class MimeHandlerExec : public RecollFilter { // (no use to try and execute over and over something that's not // here). - // Parameter list: this has been built by our creator, from config file + // Parameters: this has been built by our creator, from config file // data. We always add the file name at the end before actual execution - list params; + vector params; // Filter output type. The default for ext. filters is to output html, // but some don't, in which case the type is defined in the config. string cfgFilterOutputMtype; diff --git a/src/internfile/mh_execm.cpp b/src/internfile/mh_execm.cpp index c74a1bee..29439e83 100644 --- a/src/internfile/mh_execm.cpp +++ b/src/internfile/mh_execm.cpp @@ -51,7 +51,7 @@ bool MimeHandlerExecMultiple::startCmd() string cmd = params.front(); // Build parameter list: delete cmd name - list::iterator it = params.begin(); + vector::iterator it = params.begin(); vectormyparams(++it, params.end()); // Start filter diff --git a/src/internfile/mh_mail.cpp b/src/internfile/mh_mail.cpp index c6c09a99..5fef997f 100644 --- a/src/internfile/mh_mail.cpp +++ b/src/internfile/mh_mail.cpp @@ -51,11 +51,11 @@ MimeHandlerMail::MimeHandlerMail(RclConfig *cnf, const string &mt) { // Look for additional headers to be processed as per config: - list hdrnames = + vector hdrnames = m_config->getFieldSectNames("mail"); if (hdrnames.empty()) return; - for (list::const_iterator it = hdrnames.begin(); + for (vector::const_iterator it = hdrnames.begin(); it != hdrnames.end(); it++) { (void)m_config->getFieldConfParam(*it, "mail", m_addProcdHdrs[*it]); } diff --git a/src/qtgui/advsearch_w.cpp b/src/qtgui/advsearch_w.cpp index ac899591..959936ae 100644 --- a/src/qtgui/advsearch_w.cpp +++ b/src/qtgui/advsearch_w.cpp @@ -294,17 +294,17 @@ void AdvSearch::fillFileTypes() QStringList ql; if (m_ignByCats == false) { - list types = theconfig->getAllMimeTypes(); - for (list::iterator it = types.begin(); + vector types = theconfig->getAllMimeTypes(); + for (vector::iterator it = types.begin(); it != types.end(); it++) { QString qs = QString::fromUtf8(it->c_str()); if (m_ignTypes.indexOf(qs) < 0) ql.append(qs); } } else { - list cats; + vector cats; theconfig->getMimeCategories(cats); - for (list::const_iterator it = cats.begin(); + for (vector::const_iterator it = cats.begin(); it != cats.end(); it++) { map::const_iterator it1; QString cat; @@ -321,7 +321,7 @@ void AdvSearch::fillFileTypes() yesFiltypsLB->insertItems(0, ql); } -// Save current list of ignored file types to prefs +// Save current set of ignored file types to prefs void AdvSearch::saveFileTypes() { prefs.asearchIgnFilTyps = m_ignTypes; @@ -383,9 +383,9 @@ void AdvSearch::runSearch() } else { cat = (const char *)qcat.toUtf8(); } - list types; + vector types; theconfig->getMimeCatTypes(cat, types); - for (list::const_iterator it = types.begin(); + for (vector::const_iterator it = types.begin(); it != types.end(); it++) { sdata->addFiletype(*it); } @@ -419,7 +419,7 @@ void AdvSearch::runSearch() QString current = subtreeCMB->currentText(); sdata->setTopdir((const char*)subtreeCMB->currentText().toUtf8(), direxclCB->isChecked()); - // Keep history list clean and sorted. Maybe there would be a + // Keep history clean and sorted. Maybe there would be a // simpler way to do this list entries; for (int i = 0; i < subtreeCMB->count(); i++) { @@ -427,7 +427,7 @@ void AdvSearch::runSearch() } entries.push_back(subtreeCMB->currentText()); entries.sort(); - unique(entries.begin(), entries.end()); + entries.unique(); subtreeCMB->clear(); for (list::iterator it = entries.begin(); it != entries.end(); it++) { diff --git a/src/qtgui/confgui/confguiindex.cpp b/src/qtgui/confgui/confguiindex.cpp index 7b3a6c1a..9b33bd53 100644 --- a/src/qtgui/confgui/confguiindex.cpp +++ b/src/qtgui/confgui/confguiindex.cpp @@ -296,10 +296,10 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config) // customized in the system config like .thunderbird or // .purple. This doesn't prevent them to add and customize them // further. - list allkeydirs = config->getSubKeys(true); + vector allkeydirs = config->getSubKeys(true); QStringList qls; - for (list::const_iterator it = allkeydirs.begin(); + for (vector::const_iterator it = allkeydirs.begin(); it != allkeydirs.end(); it++) { qls.push_back(QString::fromUtf8(it->c_str())); } diff --git a/src/qtgui/main.cpp b/src/qtgui/main.cpp index 2f49ac05..aa0fc192 100644 --- a/src/qtgui/main.cpp +++ b/src/qtgui/main.cpp @@ -133,7 +133,7 @@ bool maybeOpenDb(string &reason, bool force, bool *maindberror) return true; } -bool getStemLangs(list& langs) +bool getStemLangs(vector& langs) { string reason; if (!maybeOpenDb(reason)) { diff --git a/src/qtgui/rclmain_w.cpp b/src/qtgui/rclmain_w.cpp index 28332165..6e47f0d4 100644 --- a/src/qtgui/rclmain_w.cpp +++ b/src/qtgui/rclmain_w.cpp @@ -178,12 +178,12 @@ void RclMain::init() bgrp->addButton(allRDB, bgrpid++); connect(bgrp, SIGNAL(buttonClicked(int)), this, SLOT(catgFilter(int))); allRDB->setChecked(true); - list cats; + vector cats; theconfig->getGuiFilterNames(cats); // Text for button 0 is not used. Next statement just avoids unused // variable compiler warning for catg_strings m_catgbutvec.push_back(catg_strings[0]); - for (list::const_iterator it = cats.begin(); + for (vector::const_iterator it = cats.begin(); it != cats.end(); it++) { QRadioButton *but = new QRadioButton(catgBGRP); QString catgnm = QString::fromUtf8(it->c_str(), it->length()); @@ -1089,12 +1089,12 @@ void RclMain::showActiveTypes() } // All types listed in mimeconf: - list mtypesfromconfig = theconfig->getAllMimeTypes(); + vector mtypesfromconfig = theconfig->getAllMimeTypes(); // Intersect file system types with config types (those not in the // config can be indexed by name, not by content) set mtypesfromdbconf; - for (list::const_iterator it = mtypesfromconfig.begin(); + for (vector::const_iterator it = mtypesfromconfig.begin(); it != mtypesfromconfig.end(); it++) { if (mtypesfromdb.find(*it) != mtypesfromdb.end()) mtypesfromdbconf.insert(*it); diff --git a/src/qtgui/recoll.h b/src/qtgui/recoll.h index 77b01a70..175ea3b5 100644 --- a/src/qtgui/recoll.h +++ b/src/qtgui/recoll.h @@ -31,7 +31,7 @@ extern bool maybeOpenDb(std::string &reason, bool force = true, bool *maindberror = 0); /** Retrieve configured stemming languages */ -bool getStemLangs(list& langs); +bool getStemLangs(vector& langs); extern RclConfig *theconfig; extern RclConfig *thestableconfig; diff --git a/src/qtgui/spell_w.cpp b/src/qtgui/spell_w.cpp index dc6a96ef..bca586d1 100644 --- a/src/qtgui/spell_w.cpp +++ b/src/qtgui/spell_w.cpp @@ -66,12 +66,12 @@ void SpellW::init() // Stemming language combobox stemLangCMB->clear(); - list langs; + vector langs; if (!getStemLangs(langs)) { QMessageBox::warning(0, "Recoll", tr("error retrieving stemming languages")); } - for (list::const_iterator it = langs.begin(); + for (vector::const_iterator it = langs.begin(); it != langs.end(); it++) { stemLangCMB-> addItem(QString::fromAscii(it->c_str(), it->length())); diff --git a/src/qtgui/uiprefs_w.cpp b/src/qtgui/uiprefs_w.cpp index 0866a1c5..e97c8dd3 100644 --- a/src/qtgui/uiprefs_w.cpp +++ b/src/qtgui/uiprefs_w.cpp @@ -140,13 +140,13 @@ void UIPrefsDialog::setFromPrefs() stemLangCMB->clear(); stemLangCMB->addItem(g_stringNoStem); stemLangCMB->addItem(g_stringAllStem); - list langs; + vector langs; if (!getStemLangs(langs)) { QMessageBox::warning(0, "Recoll", tr("error retrieving stemming languages")); } int cur = prefs.queryStemLang == "" ? 0 : 1; - for (list::const_iterator it = langs.begin(); + for (vector::const_iterator it = langs.begin(); it != langs.end(); it++) { stemLangCMB-> addItem(QString::fromAscii(it->c_str(), it->length())); diff --git a/src/query/docseqdb.cpp b/src/query/docseqdb.cpp index 95c66a9d..cbf05e5a 100644 --- a/src/query/docseqdb.cpp +++ b/src/query/docseqdb.cpp @@ -98,7 +98,8 @@ bool DocSequenceDb::getEnclosing(Rcl::Doc& doc, Rcl::Doc& pdoc) list DocSequenceDb::expand(Rcl::Doc &doc) { setQuery(); - return m_q->expand(doc); + vector v = m_q->expand(doc); + return list(v.begin(), v.end()); } string DocSequenceDb::title() diff --git a/src/query/docseqhist.cpp b/src/query/docseqhist.cpp index 52e56fc6..e2024a9a 100644 --- a/src/query/docseqhist.cpp +++ b/src/query/docseqhist.cpp @@ -44,10 +44,10 @@ bool RclDHistoryEntry::encode(string& value) // Current entry format is "U time b64udi" bool RclDHistoryEntry::decode(const string &value) { - list vall; + vector vall; stringToStrings(value, vall); - list::const_iterator it = vall.begin(); + vector::const_iterator it = vall.begin(); udi.erase(); string fn, ipath; switch (vall.size()) { diff --git a/src/query/dynconf.cpp b/src/query/dynconf.cpp index 6a731561..31a28100 100644 --- a/src/query/dynconf.cpp +++ b/src/query/dynconf.cpp @@ -43,8 +43,8 @@ bool RclDynConf::insertNew(const string &sk, DynConfEntry &n, DynConfEntry &s, int maxlen) { // Is this doc already in list ? If it is we remove the old entry - list names = m_data.getNames(sk); - list::const_iterator it; + vector names = m_data.getNames(sk); + vector::const_iterator it; bool changed = false; for (it = names.begin(); it != names.end(); it++) { string oval; @@ -61,7 +61,7 @@ bool RclDynConf::insertNew(const string &sk, DynConfEntry &n, DynConfEntry &s, } } - // Maybe reget list + // Maybe reget things if (changed) names = m_data.getNames(sk); @@ -95,8 +95,8 @@ bool RclDynConf::insertNew(const string &sk, DynConfEntry &n, DynConfEntry &s, bool RclDynConf::eraseAll(const string &sk) { - list names = m_data.getNames(sk); - list::const_iterator it; + vector names = m_data.getNames(sk); + vector::const_iterator it; for (it = names.begin(); it != names.end(); it++) { m_data.erase(*it, sk); } diff --git a/src/query/dynconf.h b/src/query/dynconf.h index 37c324b6..4f2fbbac 100644 --- a/src/query/dynconf.h +++ b/src/query/dynconf.h @@ -98,8 +98,8 @@ template list RclDynConf::getList(const string &sk) { list mlist; Tp entry; - list names = m_data.getNames(sk); - for (list::const_iterator it = names.begin(); + vector names = m_data.getNames(sk); + for (vector::const_iterator it = names.begin(); it != names.end(); it++) { string value; if (m_data.get(*it, value, sk)) { diff --git a/src/query/filtseq.cpp b/src/query/filtseq.cpp index 1bf16ee2..93901aab 100644 --- a/src/query/filtseq.cpp +++ b/src/query/filtseq.cpp @@ -70,9 +70,9 @@ bool DocSeqFiltered::setFiltSpec(DocSeqFiltSpec &filtspec) string val = filtspec.values[i]; if (val.find("rclcat:") == 0) { string catg = val.substr(7); - list tps; + vector tps; m_config->getMimeCatTypes(catg, tps); - for (list::const_iterator it = tps.begin(); + for (vector::const_iterator it = tps.begin(); it != tps.end(); it++) { LOGDEB2(("Adding mime: [%s]\n", it->c_str())); m_spec.orCrit(DocSeqFiltSpec::DSFS_MIMETYPE, *it); diff --git a/src/query/wasatorcl.cpp b/src/query/wasatorcl.cpp index f7f51a32..ddc1faea 100644 --- a/src/query/wasatorcl.cpp +++ b/src/query/wasatorcl.cpp @@ -82,10 +82,10 @@ static Rcl::SearchData *wasaQueryToRcl(RclConfig *config, WasaQuery *wasa, "nor excl??"; return 0; } - list mtypes; + vector mtypes; if (config && config->getMimeCatTypes((*it)->m_value, mtypes) && !mtypes.empty()) { - for (list::iterator mit = mtypes.begin(); + for (vector::iterator mit = mtypes.begin(); mit != mtypes.end(); mit++) { if ((*it)->m_op == WasaQuery::OP_LEAF) sdata->addFiletype(*mit); diff --git a/src/rcldb/rcldb.cpp b/src/rcldb/rcldb.cpp index 1f43dddd..592bfaed 100644 --- a/src/rcldb/rcldb.cpp +++ b/src/rcldb/rcldb.cpp @@ -217,8 +217,8 @@ bool Db::Native::dbDataToRclDoc(Xapian::docid docid, std::string &data, doc.xdocid = docid; // Other, not predefined meta fields: - list keys = parms.getNames(string()); - for (list::const_iterator it = keys.begin(); + vector keys = parms.getNames(string()); + for (vector::const_iterator it = keys.begin(); it != keys.end(); it++) { if (doc.meta.find(*it) == doc.meta.end()) parms.get(*it, doc.meta[*it]); @@ -228,9 +228,9 @@ bool Db::Native::dbDataToRclDoc(Xapian::docid docid, std::string &data, } // Remove prefixes (caps) from a list of terms. -static void noPrefixList(const list& in, list& out) +static void noPrefixList(const vector& in, vector& out) { - for (list::const_iterator qit = in.begin(); + for (vector::const_iterator qit = in.begin(); qit != in.end(); qit++) { if ('A' <= qit->at(0) && qit->at(0) <= 'Z') { string term = *qit; @@ -252,10 +252,10 @@ static void noPrefixList(const list& in, list& out) #define LOGABS LOGDEB2 #endif #if 0 -static void listList(const string& what, const list&l) +static void listList(const string& what, const vector&l) { string a; - for (list::const_iterator it = l.begin(); it != l.end(); it++) { + for (vector::const_iterator it = l.begin(); it != l.end(); it++) { a = a + *it + " "; } LOGDEB(("%s: %s\n", what.c_str(), a.c_str())); @@ -273,10 +273,10 @@ vector Db::Native::makeAbstract(Xapian::docid docid, Query *query) LOGDEB2(("makeAbstract:%d: maxlen %d wWidth %d\n", chron.ms(), m_rcldb->m_synthAbsLen, m_rcldb->m_synthAbsWordCtxLen)); - list terms; + vector terms; { - list iterms; + vector iterms; query->getMatchTerms(docid, iterms); noPrefixList(iterms, terms); if (terms.empty()) { @@ -289,13 +289,13 @@ vector Db::Native::makeAbstract(Xapian::docid docid, Query *query) // Retrieve db-wide frequencies for the query terms (we do this once per // query, using all the query terms, not only the document match terms) if (query->m_nq->termfreqs.empty()) { - list iqterms, qterms; + vector iqterms, qterms; query->getQueryTerms(iqterms); noPrefixList(iqterms, qterms); // listList("Query terms: ", qterms); double doccnt = xrdb.get_doccount(); if (doccnt == 0) doccnt = 1; - for (list::const_iterator qit = qterms.begin(); + for (vector::const_iterator qit = qterms.begin(); qit != qterms.end(); qit++) { query->m_nq->termfreqs[*qit] = xrdb.get_termfreq(*qit) / doccnt; LOGABS(("makeAbstract: [%s] db freq %.1e\n", qit->c_str(), @@ -312,7 +312,7 @@ vector Db::Native::makeAbstract(Xapian::docid docid, Query *query) double totalweight = 0; double doclen = xrdb.get_doclength(docid); if (doclen == 0) doclen = 1; - for (list::const_iterator qit = terms.begin(); + for (vector::const_iterator qit = terms.begin(); qit != terms.end(); qit++) { Xapian::TermIterator term = xrdb.termlist_begin(docid); term.skip_to(*qit); @@ -338,7 +338,7 @@ vector Db::Native::makeAbstract(Xapian::docid docid, Query *query) // Build a sorted by quality term list. multimap byQ; - for (list::const_iterator qit = terms.begin(); + for (vector::const_iterator qit = terms.begin(); qit != terms.end(); qit++) { if (termQcoefs.find(*qit) != termQcoefs.end()) byQ.insert(pair(termQcoefs[*qit], *qit)); @@ -1481,10 +1481,10 @@ bool Db::needUpdate(const string &udi, const string& sig) // Return list of existing stem db languages -list Db::getStemLangs() +vector Db::getStemLangs() { LOGDEB(("Db::getStemLang\n")); - list dirs; + vector dirs; if (m_ndb == 0 || m_ndb->m_isopen == false) return dirs; dirs = StemDb::getLangs(m_basedir); @@ -1724,7 +1724,7 @@ bool Db::stemExpand(const string &lang, const string &term, list dirs = m_extraDbs; dirs.push_front(m_basedir); for (list::iterator it = dirs.begin(); it != dirs.end(); it++) { - list more; + vector more; StemDb::stemExpand(*it, lang, term, more); LOGDEB1(("Db::stemExpand: Got %d from %s\n", more.size(), it->c_str())); diff --git a/src/rcldb/rcldb.h b/src/rcldb/rcldb.h index 92e65dc8..1596095e 100644 --- a/src/rcldb/rcldb.h +++ b/src/rcldb/rcldb.h @@ -140,7 +140,7 @@ class Db { } /** List existing stemming databases */ - std::list getStemLangs(); + std::vector getStemLangs(); #ifdef TESTING_XAPIAN_SPELL /** Return spelling suggestion */ diff --git a/src/rcldb/rclquery.cpp b/src/rcldb/rclquery.cpp index 8aa43346..eb2edf0c 100644 --- a/src/rcldb/rclquery.cpp +++ b/src/rcldb/rclquery.cpp @@ -19,7 +19,6 @@ #include #include -#include #include #include "xapian.h" @@ -240,7 +239,7 @@ bool Query::setQuery(RefCntr sdata) } -bool Query::getQueryTerms(list& terms) +bool Query::getQueryTerms(vector& terms) { if (ISNULL(m_nq)) return false; @@ -261,11 +260,11 @@ bool Query::getQueryTerms(list& terms) return true; } -bool Query::getMatchTerms(const Doc& doc, list& terms) +bool Query::getMatchTerms(const Doc& doc, vector& terms) { return getMatchTerms(doc.xdocid, terms); } -bool Query::getMatchTerms(unsigned long xdocid, list& terms) +bool Query::getMatchTerms(unsigned long xdocid, vector& terms) { if (ISNULL(m_nq) || !m_nq->xenquire) { LOGERR(("Query::getMatchTerms: no query opened\n")); @@ -421,10 +420,10 @@ bool Query::getDoc(int xapi, Doc &doc) return m_db->m_ndb->dbDataToRclDoc(docid, data, doc); } -list Query::expand(const Doc &doc) +vector Query::expand(const Doc &doc) { LOGDEB(("Rcl::Query::expand()\n")); - list res; + vector res; if (ISNULL(m_nq) || !m_nq->xenquire) { LOGERR(("Query::expand: no query opened\n")); return res; diff --git a/src/rcldb/rclquery.h b/src/rcldb/rclquery.h index 7691bff0..c44dc8be 100644 --- a/src/rcldb/rclquery.h +++ b/src/rcldb/rclquery.h @@ -17,12 +17,10 @@ #ifndef _rclquery_h_included_ #define _rclquery_h_included_ #include -#include #include #ifndef NO_NAMESPACES using std::string; -using std::list; using std::vector; #endif @@ -72,14 +70,14 @@ class Query { bool getDoc(int i, Doc &doc); /** Get possibly expanded list of query terms */ - bool getQueryTerms(list& terms); + bool getQueryTerms(vector& terms); /** Return a list of terms which matched for a specific result document */ - bool getMatchTerms(const Doc& doc, list& terms); - bool getMatchTerms(unsigned long xdocid, list& terms); + bool getMatchTerms(const Doc& doc, vector& terms); + bool getMatchTerms(unsigned long xdocid, vector& terms); /** Expand query to look for documents like the one passed in */ - list expand(const Doc &doc); + vector expand(const Doc &doc); /** Return the Db we're set for */ Db *whatDb(); diff --git a/src/rcldb/searchdata.cpp b/src/rcldb/searchdata.cpp index 9b366d11..6f6a4a5b 100644 --- a/src/rcldb/searchdata.cpp +++ b/src/rcldb/searchdata.cpp @@ -151,15 +151,15 @@ bool SearchData::expandFileTypes(RclConfig *cfg, vector& tps) return false; } vector exptps; - list alltypes = cfg->getAllMimeTypes(); + vector alltypes = cfg->getAllMimeTypes(); for (vector::iterator it = tps.begin(); it != tps.end(); it++) { if (cfg->isMimeCategory(*it)) { - listtps; + vectortps; cfg->getMimeCatTypes(*it, tps); exptps.insert(exptps.end(), tps.begin(), tps.end()); } else { - for (list::const_iterator ait = alltypes.begin(); + for (vector::const_iterator ait = alltypes.begin(); ait != alltypes.end(); ait++) { if (fnmatch(it->c_str(), ait->c_str(), FNM_CASEFOLD) != FNM_NOMATCH) { diff --git a/src/rcldb/stemdb.cpp b/src/rcldb/stemdb.cpp index 6e80de6b..ccf50f4f 100644 --- a/src/rcldb/stemdb.cpp +++ b/src/rcldb/stemdb.cpp @@ -48,11 +48,11 @@ static string stemdbname(const string& dbdir, const string& lang) return path_cat(dbdir, cstr_stemdirstem + lang); } -list getLangs(const string& dbdir) +vector getLangs(const string& dbdir) { string pattern = cstr_stemdirstem + "*"; - list dirs = path_dirglob(dbdir, pattern); - for (list::iterator it = dirs.begin(); it != dirs.end(); it++) { + vector dirs = path_dirglob(dbdir, pattern); + for (vector::iterator it = dirs.begin(); it != dirs.end(); it++) { *it = path_basename(*it); *it = it->substr(cstr_stemdirstem.length(), string::npos); } @@ -262,10 +262,10 @@ bool createDb(Xapian::Database& xdb, const string& dbdir, const string& lang) return true; } -static string stringlistdisp(const list& sl) +static string stringlistdisp(const vector& sl) { string s; - for (list::const_iterator it = sl.begin(); it!= sl.end(); it++) + for (vector::const_iterator it = sl.begin(); it!= sl.end(); it++) s += "[" + *it + "] "; if (!s.empty()) s.erase(s.length()-1); @@ -279,7 +279,7 @@ static string stringlistdisp(const list& sl) static bool stemExpandOne(const std::string& dbdir, const std::string& lang, const std::string& term, - list& result) + vector& result) { try { Xapian::Stem stemmer(lang); @@ -347,19 +347,19 @@ static bool stemExpandOne(const std::string& dbdir, bool stemExpand(const std::string& dbdir, const std::string& langs, const std::string& term, - list& result) + vector& result) { list llangs; stringToStrings(langs, llangs); for (list::const_iterator it = llangs.begin(); it != llangs.end(); it++) { - list oneexp; + vector oneexp; stemExpandOne(dbdir, *it, term, oneexp); result.insert(result.end(), oneexp.begin(), oneexp.end()); } - result.sort(); - result.unique(); + sort(result.begin(), result.end()); + unique(result.begin(), result.end()); return true; } diff --git a/src/rcldb/stemdb.h b/src/rcldb/stemdb.h index 1836df6b..3f5003e8 100644 --- a/src/rcldb/stemdb.h +++ b/src/rcldb/stemdb.h @@ -24,20 +24,16 @@ /// Stem databases are stored as separate xapian databases (used as an /// Isam method), in subdirectories of the index. -#include +#include #include #include -#ifndef NO_NAMESPACES -using std::string; -using std::list; namespace Rcl { namespace StemDb { -#endif // NO_NAMESPACES /// Get languages of existing stem databases -extern std::list getLangs(const std::string& dbdir); +extern std::vector getLangs(const std::string& dbdir); /// Delete stem database for given language extern bool deleteDb(const std::string& dbdir, const std::string& lang); /// Create stem database for given language @@ -47,10 +43,8 @@ extern bool createDb(Xapian::Database& xdb, extern bool stemExpand(const std::string& dbdir, const std::string& langs, const std::string& term, - list& result); -#ifndef NO_NAMESPACES + std::vector& result); } } -#endif // NO_NAMESPACES #endif /* _STEMDB_H_INCLUDED_ */ diff --git a/src/utils/circache.cpp b/src/utils/circache.cpp index eeefcef0..6963c2cd 100644 --- a/src/utils/circache.cpp +++ b/src/utils/circache.cpp @@ -217,7 +217,7 @@ public: } } - // Return list of candidate offsets for udi (possibly several + // Return vector of candidate offsets for udi (possibly several // because there may be hash collisions, and also multiple // instances). bool khFind(const string& udi, vector& ofss) @@ -262,10 +262,10 @@ public: } return true; } - // Clear entries for list of udi/offs - bool khClear(const list >& udis) + // Clear entries for vector of udi/offs + bool khClear(const vector >& udis) { - for (list >::const_iterator it = udis.begin(); + for (vector >::const_iterator it = udis.begin(); it != udis.end(); it++) khClear(*it); return true; @@ -754,7 +754,7 @@ bool CirCache::get(const string& udi, string& dic, string& data, int instance) if (!fudi.compare(udi)) { // Found one, memorize offset. Done if instance // matches, else go on. If instance is -1 need to - // go to the end of the list anyway + // go to the end anyway d_good = d; o_good = *it; if (finst == instance) { @@ -849,7 +849,7 @@ class CCScanHookSpacer : public CCScanHook { public: UINT sizewanted; UINT sizeseen; - list > squashed_udis; + vector > squashed_udis; CCScanHookSpacer(int sz) : sizewanted(sz), sizeseen(0) {assert(sz > 0);} diff --git a/src/utils/closefrom.cpp b/src/utils/closefrom.cpp index 1464abed..2aba4cb2 100644 --- a/src/utils/closefrom.cpp +++ b/src/utils/closefrom.cpp @@ -28,7 +28,7 @@ * an exec (security, pipe control, the possibility that a bug will trigger * an unwanted write, etc.) * - * A process has currently no POSIX way to determine the list of open file + * A process has currently no POSIX way to determine the set of open file * descriptors or at least the highest value. Closing all files (except a few), * thus implies performing a close() system call on each entry up to the * maximum, which can be both relatively difficult to determine, and quite @@ -46,7 +46,7 @@ * System interfaces: * FreeBSD: * - Has a closefrom() system call as of release 7.x around Sep 2009 - * - Has a /dev/fd, directory which lists the current process' open + * - Has a /dev/fd, directory which shows the current process' open * descriptors. Only descriptors 0, 1, 2 are shown except if * fdescfs is mounted which it is not by default * diff --git a/src/utils/conftree.cpp b/src/utils/conftree.cpp index 7cf0edb3..b339ac4f 100644 --- a/src/utils/conftree.cpp +++ b/src/utils/conftree.cpp @@ -37,7 +37,6 @@ #ifndef NO_NAMESPACES using namespace std; -using std::list; #endif // NO_NAMESPACES #ifndef MIN @@ -346,7 +345,7 @@ int ConfSimple::i_set(const std::string &nm, const std::string &value, // at begin() for a null subkey, or just behind the subkey // entry. End is either the next subkey entry, or the end of // list. We insert the new entry just before end. - list::iterator start, fin; + vector::iterator start, fin; if (sk.empty()) { start = m_order.begin(); LOGDEB((stderr,"ConfSimple::i_set: null sk, start at top of order\n")); @@ -367,7 +366,7 @@ int ConfSimple::i_set(const std::string &nm, const std::string &value, // The null subkey has no entry (maybe it should) if (!sk.empty()) start++; - for (list::iterator it = start; it != m_order.end(); it++) { + for (vector::iterator it = start; it != m_order.end(); it++) { if (it->m_kind == ConfLine::CFL_SK) { fin = it; break; @@ -402,8 +401,8 @@ int ConfSimple::erase(const string &nm, const string &sk) int ConfSimple::eraseKey(const string &sk) { - listnms = getNames(sk); - for (list::iterator it = nms.begin(); it != nms.end(); it++) { + vector nms = getNames(sk); + for (vector::iterator it = nms.begin(); it != nms.end(); it++) { erase(*it, sk); } return write(); @@ -460,13 +459,13 @@ bool ConfSimple::write() // Write out the tree in configuration file format: // This does not check holdWrites, this is done by write(void), which -// lets ie: listall work even when holdWrites is set +// lets ie: showall work even when holdWrites is set bool ConfSimple::write(ostream& out) const { if (!ok()) return false; string sk; - for (list::const_iterator it = m_order.begin(); + for (vector::const_iterator it = m_order.begin(); it != m_order.end(); it++) { switch(it->m_kind) { case ConfLine::CFL_COMMENT: @@ -509,38 +508,38 @@ bool ConfSimple::write(ostream& out) const return true; } -void ConfSimple::listall() +void ConfSimple::showall() { if (!ok()) return; write(std::cout); } -list ConfSimple::getNames(const string &sk, const char *pattern) +vector ConfSimple::getNames(const string &sk, const char *pattern) { - std::list mylist; + vector mylist; if (!ok()) return mylist; map >::iterator ss; if ((ss = m_submaps.find(sk)) == m_submaps.end()) { return mylist; } + mylist.reserve(ss->second.size()); map::const_iterator it; - for (it = ss->second.begin();it != ss->second.end();it++) { + for (it = ss->second.begin(); it != ss->second.end(); it++) { if (pattern && FNM_NOMATCH == fnmatch(pattern, it->first.c_str(), 0)) continue; mylist.push_back(it->first); } - mylist.sort(); - mylist.unique(); return mylist; } -list ConfSimple::getSubKeys() +vector ConfSimple::getSubKeys() { - std::list mylist; + vector mylist; if (!ok()) return mylist; + mylist.reserve(m_submaps.size()); map >::iterator ss; for (ss = m_submaps.begin(); ss != m_submaps.end(); ss++) { mylist.push_back(ss->first); @@ -550,8 +549,8 @@ list ConfSimple::getSubKeys() bool ConfSimple::hasNameAnywhere(const string& nm) { - listkeys = getSubKeys(); - for (list::const_iterator it = keys.begin(); + vectorkeys = getSubKeys(); + for (vector::const_iterator it = keys.begin(); it != keys.end(); it++) { string val; if (get(nm, val, *it)) @@ -603,7 +602,7 @@ int ConfTree::get(const std::string &name, string &value, const string &sk) #include #include #include -#include +#include #include "conftree.h" #include "smallut.h" @@ -700,7 +699,7 @@ const char *longvalue = void memtest(ConfSimple &c) { cout << "Initial:" << endl; - c.listall(); + c.showall(); if (c.set("nom", "avec nl \n 2eme ligne", "")) { fprintf(stderr, "set with embedded nl succeeded !\n"); exit(1); @@ -719,7 +718,7 @@ void memtest(ConfSimple &c) } cout << "Final:" << endl; - c.listall(); + c.showall(); } bool readwrite(ConfNull *conf) @@ -924,7 +923,7 @@ int main(int argc, char **argv) if (op_flags & OPT_U) { exit(!complex_updates(argv[0])); } - list flist; + vector flist; while (argc--) { flist.push_back(*argv++); } @@ -951,8 +950,8 @@ int main(int argc, char **argv) cerr << "conf init error" << endl; exit(1); } - listlst = conf->getSubKeys(); - for (list::const_iterator it = lst.begin(); + vectorlst = conf->getSubKeys(); + for (vector::const_iterator it = lst.begin(); it != lst.end(); it++) { cout << *it << endl; } @@ -975,13 +974,13 @@ int main(int argc, char **argv) exit(1); } cout << "source: [" << source << "]" << endl; - list strings; + vector strings; if (!stringToStrings(source, strings)) { cerr << "parse failed" << endl; exit(1); } - for (list::iterator it = strings.begin(); + for (vector::iterator it = strings.begin(); it != strings.end(); it++) { cout << "[" << *it << "]" << endl; } @@ -992,17 +991,17 @@ int main(int argc, char **argv) exit(1); } printf("LIST\n"); - conf->listall(); + conf->showall(); //printf("WALK\n");conf->sortwalk(mywalker, 0); printf("\nNAMES in global space:\n"); - list names = conf->getNames(""); - for (list::iterator it = names.begin(); + vector names = conf->getNames(""); + for (vector::iterator it = names.begin(); it!=names.end(); it++) cout << *it << " "; cout << endl; printf("\nNAMES in global space matching t* \n"); names = conf->getNames("", "t*"); - for (list::iterator it = names.begin(); + for (vector::iterator it = names.begin(); it!=names.end(); it++) cout << *it << " "; cout << endl; diff --git a/src/utils/conftree.h b/src/utils/conftree.h index 843e3efc..f0335870 100644 --- a/src/utils/conftree.h +++ b/src/utils/conftree.h @@ -51,7 +51,7 @@ #include #include -#include +#include // rh7.3 likes iostream better... #if defined(__GNUC__) && __GNUC__ < 3 @@ -63,7 +63,7 @@ #ifndef NO_NAMESPACES using std::string; -using std::list; +using std::vector; using std::map; using std::istream; using std::ostream; @@ -100,12 +100,12 @@ public: virtual int set(const string &nm, const string &val, const string &sk = string()) = 0; virtual bool ok() const = 0; - virtual list getNames(const string &sk, const char* = 0) = 0; + virtual vector getNames(const string &sk, const char* = 0) = 0; virtual int erase(const string &, const string &) = 0; virtual int eraseKey(const string &) = 0; - virtual void listall() {}; - virtual list getSubKeys() = 0; - virtual list getSubKeys(bool) = 0; + virtual void showall() {}; + virtual vector getSubKeys() = 0; + virtual vector getSubKeys(bool) = 0; virtual bool holdWrites(bool) = 0; virtual bool sourceChanged() = 0; }; @@ -198,11 +198,11 @@ public: const string &val), void *clidata); - /** List all values to stdout */ - virtual void listall(); + /** Print all values to stdout */ + virtual void showall(); /** Return all names in given submap. */ - virtual list getNames(const string &sk, const char *pattern = 0); + virtual vector getNames(const string &sk, const char *pattern = 0); /** Check if name is present in any submap. This is relatively expensive * but useful for saving further processing sometimes */ @@ -211,8 +211,8 @@ public: /** * Return all subkeys */ - virtual list getSubKeys(bool) {return getSubKeys();} - virtual list getSubKeys(); + virtual vector getSubKeys(bool) {return getSubKeys();} + virtual vector getSubKeys(); /** Test for subkey existence */ virtual bool hasSubKey(const string& sk) { @@ -263,7 +263,7 @@ private: // 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) - list m_order; + vector m_order; // Control if we're writing to the backing store bool m_holdWrites; @@ -323,7 +323,7 @@ public: * have a central config, with possible overrides from more specific * (ie personal) ones. * - * Notes: it's ok for some of the files in the list to not exist, but the last + * Notes: it's ok for some of the files not to exist, but the last * one must or we generate an error. We open all trees readonly, except the * topmost one if requested. All writes go to the topmost file. Note that * erase() won't work except for parameters only defined in the topmost @@ -331,18 +331,18 @@ public: */ template class ConfStack : public ConfNull { public: - /// Construct from list of configuration file names. The earler + /// 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 list &fns, bool ro = true) + ConfStack(const vector &fns, bool ro = true) { construct(fns, ro); } - /// Construct out of single file name and list of directories - ConfStack(const string& nm, const list& dirs, bool ro = true) + /// Construct out of single file name and multiple directories + ConfStack(const string& nm, const vector& dirs, bool ro = true) { - list fns; - for (list::const_iterator it = dirs.begin(); + vector fns; + for (vector::const_iterator it = dirs.begin(); it != dirs.end(); it++){ fns.push_back(path_cat(*it, nm)); } @@ -374,7 +374,7 @@ public: virtual bool sourceChanged() { - typename list::const_iterator it; + typename vector::const_iterator it; for (it = m_confs.begin();it != m_confs.end();it++) { if ((*it)->sourceChanged()) return true; @@ -384,7 +384,7 @@ public: virtual int get(const string &name, string &value, const string &sk) const { - typename list::const_iterator it; + typename vector::const_iterator it; for (it = m_confs.begin();it != m_confs.end();it++) { if ((*it)->get(name, value, sk)) return true; @@ -394,7 +394,7 @@ public: virtual bool hasNameAnywhere(const string& nm) { - typename list::iterator it; + typename vector::iterator it; for (it = m_confs.begin();it != m_confs.end();it++) { if ((*it)->hasNameAnywhere(nm)) return true; @@ -411,7 +411,7 @@ 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 list::iterator it = m_confs.begin(); + typename vector::iterator it = m_confs.begin(); it++; while (it != m_confs.end()) { string value; @@ -445,49 +445,49 @@ public: return m_confs.front()->holdWrites(on); } - virtual list getNames(const string &sk, const char *pattern = 0) + virtual vector getNames(const string &sk, const char *pattern = 0) { return getNames1(sk, pattern, false); } - virtual list getNamesShallow(const string &sk, const char *patt = 0) + virtual vector getNamesShallow(const string &sk, const char *patt = 0) { return getNames1(sk, patt, true); } - virtual list getNames1(const string &sk, const char *pattern, + virtual vector getNames1(const string &sk, const char *pattern, bool shallow) { - list nms; - typename list::iterator it; + vector nms; + typename vector::iterator it; bool skfound = false; for (it = m_confs.begin();it != m_confs.end(); it++) { if ((*it)->hasSubKey(sk)) { skfound = true; - list lst = (*it)->getNames(sk, pattern); + vector lst = (*it)->getNames(sk, pattern); nms.insert(nms.end(), lst.begin(), lst.end()); } if (shallow && skfound) break; } - nms.sort(); - nms.unique(); + sort(nms.begin(), nms.end()); + unique(nms.begin(), nms.end()); return nms; } - virtual list getSubKeys(){return getSubKeys(false);} - virtual list getSubKeys(bool shallow) + virtual vector getSubKeys(){return getSubKeys(false);} + virtual vector getSubKeys(bool shallow) { - list sks; - typename list::iterator it; + vector sks; + typename vector::iterator it; for (it = m_confs.begin();it != m_confs.end(); it++) { - list lst; + vector lst; lst = (*it)->getSubKeys(); sks.insert(sks.end(), lst.begin(), lst.end()); if (shallow) break; } - sks.sort(); - sks.unique(); + sort(sks.begin(), sks.end()); + unique(sks.begin(), sks.end()); return sks; } @@ -495,11 +495,11 @@ public: private: bool m_ok; - list m_confs; + vector m_confs; /// Reset to pristine void clear() { - typename list::iterator it; + typename vector::iterator it; for (it = m_confs.begin();it != m_confs.end();it++) { delete (*it); } @@ -509,16 +509,16 @@ private: /// Common code to initialize from existing object void init_from(const ConfStack &rhs) { if ((m_ok = rhs.m_ok)) { - typename list::const_iterator it; + typename vector::const_iterator it; for (it = rhs.m_confs.begin();it != rhs.m_confs.end();it++) { m_confs.push_back(new T(**it)); } } } - /// Common construct from file list code - void construct(const list &fns, bool ro) { - list::const_iterator it; + /// Common construct from file names code + void construct(const vector &fns, bool ro) { + vector::const_iterator it; bool lastok = false; for (it = fns.begin(); it != fns.end(); it++) { T* p = new T(it->c_str(), ro); diff --git a/src/utils/debuglog.cpp b/src/utils/debuglog.cpp index 15f3ff48..5e581dc7 100644 --- a/src/utils/debuglog.cpp +++ b/src/utils/debuglog.cpp @@ -28,10 +28,8 @@ #include #include -#include using std::set; using std::string; -using std::list; #include "debuglog.h" #include "pathut.h" diff --git a/src/utils/fstreewalk.cpp b/src/utils/fstreewalk.cpp index 35a48eaf..2901733d 100644 --- a/src/utils/fstreewalk.cpp +++ b/src/utils/fstreewalk.cpp @@ -28,7 +28,8 @@ #include #include -#include +#include +#include #include #include "cstr.h" @@ -60,11 +61,11 @@ class FsTreeWalker::Internal { int options; int depthswitch; stringstream reason; - list skippedNames; - list skippedPaths; + vector skippedNames; + vector skippedPaths; // When doing Breadth or FilesThenDirs traversal, we keep a list // of directory paths to be processed, and we do not recurse. - list dirs; + deque dirs; int errors; set donedirs; void logsyserr(const char *call, const string ¶m) @@ -119,15 +120,14 @@ bool FsTreeWalker::addSkippedName(const string& pattern) data->skippedNames.push_back(pattern); return true; } -bool FsTreeWalker::setSkippedNames(const list &patterns) +bool FsTreeWalker::setSkippedNames(const vector &patterns) { data->skippedNames = patterns; return true; } bool FsTreeWalker::inSkippedNames(const string& name) { - list::const_iterator it; - for (it = data->skippedNames.begin(); + for (vector::const_iterator it = data->skippedNames.begin(); it != data->skippedNames.end(); it++) { if (fnmatch(it->c_str(), name.c_str(), 0) == 0) { return true; @@ -144,10 +144,10 @@ bool FsTreeWalker::addSkippedPath(const string& ipath) data->skippedPaths.push_back(path); return true; } -bool FsTreeWalker::setSkippedPaths(const list &paths) +bool FsTreeWalker::setSkippedPaths(const vector &paths) { data->skippedPaths = paths; - for (list::iterator it = data->skippedPaths.begin(); + for (vector::iterator it = data->skippedPaths.begin(); it != data->skippedPaths.end(); it++) if (!(data->options & FtwNoCanon)) *it = path_canon(*it); @@ -160,8 +160,8 @@ bool FsTreeWalker::inSkippedPaths(const string& path, bool ckparents) if (ckparents) fnmflags |= FNM_LEADING_DIR; #endif - list::const_iterator it; - for (it = data->skippedPaths.begin(); + + for (vector::const_iterator it = data->skippedPaths.begin(); it != data->skippedPaths.end(); it++) { #ifndef FNM_LEADING_DIR if (ckparents) { @@ -217,8 +217,8 @@ FsTreeWalker::Status FsTreeWalker::walk(const string& _top, } // Breadth first of filesThenDirs semi-depth first order - // Managing lists of directories to be visited later, in breadth or - // depth order. Null marker are inserted in the list to indicate + // Managing queues of directories to be visited later, in breadth or + // depth order. Null marker are inserted in the queue to indicate // father directory changes (avoids computing parents all the time). data->dirs.push_back(top); Status status; @@ -226,7 +226,7 @@ FsTreeWalker::Status FsTreeWalker::walk(const string& _top, string dir, nfather; if (data->options & (FtwTravBreadth|FtwTravBreadthThenDepth)) { // Breadth first, pop and process an older dir at the - // front of the list. This will add any child dirs at the + // front of the queue. This will add any child dirs at the // back dir = data->dirs.front(); data->dirs.pop_front(); @@ -279,7 +279,7 @@ FsTreeWalker::Status FsTreeWalker::walk(const string& _top, return errno == ENOENT ? FtwOk : FtwError; } // iwalk will not recurse in this case, just process file entries - // and append subdir entries to the list. + // and append subdir entries to the queue. status = iwalk(dir, &st, cb); if (status != FtwOk) return status; @@ -497,8 +497,8 @@ Usage(void) int main(int argc, const char **argv) { - list patterns; - list paths; + vector patterns; + vector paths; thisprog = argv[0]; argc--; argv++; diff --git a/src/utils/fstreewalk.h b/src/utils/fstreewalk.h index b6a8baf5..d5405501 100644 --- a/src/utils/fstreewalk.h +++ b/src/utils/fstreewalk.h @@ -18,11 +18,10 @@ #define _FSTREEWALK_H_INCLUDED_ #include -#include - +#include #ifndef NO_NAMESPACES using std::string; -using std::list; +using std::vector; #endif class FsTreeWalkerCB; @@ -92,18 +91,17 @@ class FsTreeWalker { int getErrCnt(); /** - * Add a pattern to the list of things (file or dir) to be ignored - * (ie: #* , *~) + * Add a pattern (file or dir) to be ignored (ie: #* , *~) */ bool addSkippedName(const string &pattern); - /** Set the ignored patterns list */ - bool setSkippedNames(const list &patlist); + /** Set the ignored patterns set */ + bool setSkippedNames(const vector &patterns); /** Same for skipped paths: this are paths, not names, under which we do not descend (ie: /home/me/.recoll) */ bool addSkippedPath(const string &path); /** Set the ignored paths list */ - bool setSkippedPaths(const list &pathlist); + bool setSkippedPaths(const vector &patterns); /** Test if path/name should be skipped. This can be used independantly of * an actual tree walk */ diff --git a/src/utils/idfile.cpp b/src/utils/idfile.cpp index 0859b6e9..5c45c7bb 100644 --- a/src/utils/idfile.cpp +++ b/src/utils/idfile.cpp @@ -37,14 +37,6 @@ using namespace std; * to separate messages, that we don't recognize currently */ -std::list idFileAllTypes() -{ - std::list lst; - lst.push_back("text/x-mail"); - lst.push_back("message/rfc822"); - return lst; -} - // Mail headers we compare to: static const char *mailhs[] = {"From: ", "Received: ", "Message-Id: ", "To: ", "Date: ", "Subject: ", "Status: ", diff --git a/src/utils/idfile.h b/src/utils/idfile.h index d4ceed88..4d8b47ba 100644 --- a/src/utils/idfile.h +++ b/src/utils/idfile.h @@ -18,7 +18,6 @@ #define _IDFILE_H_INCLUDED_ #include -#include // Look at data inside file or string, and return mime type or empty string. // @@ -28,7 +27,4 @@ extern std::string idFile(const char *fn); extern std::string idFileMem(const std::string& data); -// Return all types known to us -extern std::list idFileAllTypes(); - #endif /* _IDFILE_H_INCLUDED_ */ diff --git a/src/utils/pathut.cpp b/src/utils/pathut.cpp index 65f406a0..75e60c4e 100644 --- a/src/utils/pathut.cpp +++ b/src/utils/pathut.cpp @@ -47,11 +47,9 @@ #include #include #include -#include #include #ifndef NO_NAMESPACES using std::string; -using std::list; using std::stack; #endif /* NO_NAMESPACES */ @@ -363,10 +361,10 @@ extern string path_canon(const string &is) #include #include -list path_dirglob(const string &dir, - const string pattern) +vector path_dirglob(const string &dir, + const string pattern) { - list res; + vector res; glob_t mglob; string mypat=path_cat(dir, pattern); if (glob(mypat.c_str(), 0, 0, &mglob)) { @@ -673,7 +671,7 @@ int main(int argc, const char **argv) thisprog = *argv++;argc--; string s; - list::const_iterator it; + vector::const_iterator it; #if 0 for (unsigned int i = 0;i < sizeof(tstvec) / sizeof(char *); i++) { cout << tstvec[i] << " Father " << path_getfather(tstvec[i]) << endl; @@ -713,7 +711,7 @@ int main(int argc, const char **argv) } string dir = *argv++;argc--; string pattern = *argv++;argc--; - list matched = path_dirglob(dir, pattern); + vector matched = path_dirglob(dir, pattern); for (it = matched.begin(); it != matched.end();it++) { cout << *it << endl; } diff --git a/src/utils/pathut.h b/src/utils/pathut.h index b7a5b5ea..1508a0df 100644 --- a/src/utils/pathut.h +++ b/src/utils/pathut.h @@ -19,12 +19,12 @@ #include #include -#include +#include #include "refcntr.h" #ifndef NO_NAMESPACES using std::string; -using std::list; +using std::vector; #endif /// Add a / at the end if none there yet. @@ -46,9 +46,9 @@ extern string path_tildexpand(const string &s); extern string path_absolute(const string &s); /// Clean up path by removing duplicated / and resolving ../ + make it absolute extern string path_canon(const string &s); -/// Use glob(3) to return a list of file names matching pattern inside dir -extern list path_dirglob(const string &dir, - const string pattern); +/// Use glob(3) to return the file names matching pattern inside dir +extern vector path_dirglob(const string &dir, + const string pattern); /// Encode according to rfc 1738 extern string url_encode(const string& url, string::size_type offs = 0); diff --git a/src/utils/smallut.cpp b/src/utils/smallut.cpp index 62482f0b..a13245b9 100644 --- a/src/utils/smallut.cpp +++ b/src/utils/smallut.cpp @@ -32,6 +32,7 @@ #include #include +#include #include "smallut.h" #include "utf8iter.h" diff --git a/src/utils/smallut.h b/src/utils/smallut.h index f397bb40..715f572f 100644 --- a/src/utils/smallut.h +++ b/src/utils/smallut.h @@ -20,14 +20,12 @@ #include #include -#include #include #include #include #ifndef NO_NAMESPACES using std::string; -using std::list; using std::vector; using std::map; using std::set;