make stringtotokens use vector
This commit is contained in:
parent
c4a818fc64
commit
e327ea0b4e
@ -752,7 +752,7 @@ FileInterner::Status FileInterner::internfile(Rcl::Doc& doc, string& ipath)
|
||||
vector<string> vipath(MAXHANDLERS);
|
||||
int vipathidx = 0;
|
||||
if (!ipath.empty()) {
|
||||
list<string> lipath;
|
||||
vector<string> lipath;
|
||||
stringToTokens(ipath, lipath, isep, true);
|
||||
vipath.insert(vipath.begin(), lipath.begin(), lipath.end());
|
||||
if (!m_handlers.back()->skip_to_document(vipath[m_handlers.size()-1])){
|
||||
|
||||
@ -102,14 +102,14 @@ bool MimeHandlerExecMultiple::readDataElement(string& name, string &data)
|
||||
}
|
||||
|
||||
// We're expecting something like Name: len\n
|
||||
list<string> tokens;
|
||||
vector<string> tokens;
|
||||
stringToTokens(ibuf, tokens);
|
||||
if (tokens.size() != 2) {
|
||||
LOGERR(("MHExecMultiple: bad line in filter output: [%s]\n",
|
||||
ibuf.c_str()));
|
||||
return false;
|
||||
}
|
||||
list<string>::iterator it = tokens.begin();
|
||||
vector<string>::iterator it = tokens.begin();
|
||||
name = *it++;
|
||||
string& slen = *it;
|
||||
int len;
|
||||
|
||||
@ -208,9 +208,9 @@ void rwSettings(bool writing)
|
||||
prefs.allExtraDbs = g_dynconf->getStringList(allEdbsSk);
|
||||
const char *cp;
|
||||
if ((cp = getenv("RECOLL_EXTRA_DBS")) != 0) {
|
||||
list<string> dbl;
|
||||
vector<string> dbl;
|
||||
stringToTokens(cp, dbl, ":");
|
||||
for (list<string>::iterator dit = dbl.begin(); dit != dbl.end();
|
||||
for (vector<string>::iterator dit = dbl.begin(); dit != dbl.end();
|
||||
dit++) {
|
||||
string dbdir = path_canon(*dit);
|
||||
path_catslash(dbdir);
|
||||
|
||||
@ -946,7 +946,7 @@ static bool lookForHtmlBrowser(string &exefile)
|
||||
{
|
||||
static const char *htmlbrowserlist =
|
||||
"opera konqueror firefox mozilla netscape epiphany";
|
||||
list<string> blist;
|
||||
vector<string> blist;
|
||||
stringToTokens(htmlbrowserlist, blist, " ");
|
||||
|
||||
const char *path = getenv("PATH");
|
||||
@ -954,7 +954,7 @@ static bool lookForHtmlBrowser(string &exefile)
|
||||
path = "/bin:/usr/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/local/bin";
|
||||
|
||||
// Look for each browser
|
||||
for (list<string>::const_iterator bit = blist.begin();
|
||||
for (vector<string>::const_iterator bit = blist.begin();
|
||||
bit != blist.end(); bit++) {
|
||||
if (ExecCmd::which(*bit, exefile, path))
|
||||
return true;
|
||||
|
||||
@ -165,7 +165,7 @@ static void initfiles()
|
||||
const char *cp = getenv("DEBUGLOG_FILES");
|
||||
if (!cp)
|
||||
return;
|
||||
list<string> files;
|
||||
vector<string> files;
|
||||
stringToTokens(cp, files, ",");
|
||||
yesfiles.insert(files.begin(), files.end());
|
||||
}
|
||||
|
||||
@ -98,9 +98,9 @@ bool ExecCmd::which(const string& cmd, string& exepath, const char* path)
|
||||
if (pp == 0)
|
||||
return false;
|
||||
|
||||
list<string> pels;
|
||||
vector<string> pels;
|
||||
stringToTokens(pp, pels, ":");
|
||||
for (list<string>::iterator it = pels.begin(); it != pels.end(); it++) {
|
||||
for (vector<string>::iterator it = pels.begin(); it != pels.end(); it++) {
|
||||
if (it->empty())
|
||||
*it = ".";
|
||||
string candidate = (it->empty() ? string(".") : *it) + "/" + cmd;
|
||||
|
||||
@ -606,7 +606,7 @@ time_t rfc2822DateToUxTime(const string& dt)
|
||||
{
|
||||
// Strip everything up to first comma if any, we don't need weekday,
|
||||
// then break into tokens
|
||||
list<string> toks;
|
||||
vector<string> toks;
|
||||
string::size_type idx;
|
||||
if ((idx = dt.find_first_of(",")) != string::npos) {
|
||||
if (idx == dt.length() - 1) {
|
||||
@ -623,16 +623,11 @@ time_t rfc2822DateToUxTime(const string& dt)
|
||||
// 0 1 2 3 4 5 6
|
||||
// and change to: 19 Nov 2006 06:18:41
|
||||
if (toks.size() == 7) {
|
||||
list<string>::iterator it0 = toks.begin();
|
||||
if (it0->length() == 3 &&
|
||||
it0->find_first_of("0123456789") == string::npos) {
|
||||
list<string>::iterator it2 = it0;
|
||||
for (int i = 0; i < 2; i++) it2++;
|
||||
list<string>::iterator it6 = it2;
|
||||
for (int i = 0; i < 4; i++) it6++;
|
||||
iter_swap(it0, it2);
|
||||
iter_swap(it6, it2);
|
||||
toks.erase(it6);
|
||||
if (toks[0].length() == 3 &&
|
||||
toks[0].find_first_of("0123456789") == string::npos) {
|
||||
swap(toks[0], toks[2]);
|
||||
swap(toks[6], toks[2]);
|
||||
toks.pop_back();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -661,7 +656,7 @@ time_t rfc2822DateToUxTime(const string& dt)
|
||||
// Load struct tm with appropriate tokens, possibly converting
|
||||
// when needed
|
||||
|
||||
list<string>::iterator it = toks.begin();
|
||||
vector<string>::iterator it = toks.begin();
|
||||
|
||||
// Day of month: no conversion needed
|
||||
tm.tm_mday = atoi(it->c_str());
|
||||
|
||||
@ -331,10 +331,10 @@ extern string path_canon(const string &is)
|
||||
}
|
||||
s = path_cat(string(buf), s);
|
||||
}
|
||||
list<string>elems;
|
||||
vector<string> elems;
|
||||
stringToTokens(s, elems, "/");
|
||||
list<string> cleaned;
|
||||
for (list<string>::const_iterator it = elems.begin();
|
||||
vector<string> cleaned;
|
||||
for (vector<string>::const_iterator it = elems.begin();
|
||||
it != elems.end(); it++){
|
||||
if (*it == "..") {
|
||||
if (!cleaned.empty())
|
||||
@ -346,7 +346,7 @@ extern string path_canon(const string &is)
|
||||
}
|
||||
string ret;
|
||||
if (!cleaned.empty()) {
|
||||
for (list<string>::const_iterator it = cleaned.begin();
|
||||
for (vector<string>::const_iterator it = cleaned.begin();
|
||||
it != cleaned.end(); it++) {
|
||||
ret += "/";
|
||||
ret += *it;
|
||||
|
||||
@ -336,7 +336,7 @@ void stringsToString(const set<string> &tokens, string &s)
|
||||
stringsToString<set<string> >(tokens, s);
|
||||
}
|
||||
|
||||
void stringToTokens(const string& str, list<string>& tokens,
|
||||
void stringToTokens(const string& str, vector<string>& tokens,
|
||||
const string& delims, bool skipinit)
|
||||
{
|
||||
string::size_type startPos = 0, pos;
|
||||
|
||||
@ -100,7 +100,7 @@ extern void stringsToString(const set<string> &tokens, string &s);
|
||||
/**
|
||||
* Split input string. No handling of quoting
|
||||
*/
|
||||
extern void stringToTokens(const string &s, list<string> &tokens,
|
||||
extern void stringToTokens(const string &s, vector<string> &tokens,
|
||||
const string &delims = " \t", bool skipinit=true);
|
||||
|
||||
/** Convert string to boolean */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user