add menu entry to start browser on html doc
This commit is contained in:
+20
-1
@@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: smallut.cpp,v 1.11 2005-12-13 12:43:00 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: smallut.cpp,v 1.12 2006-01-04 11:33:44 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
#endif
|
||||
#ifndef TEST_SMALLUT
|
||||
#include <string>
|
||||
@@ -265,6 +265,25 @@ bool stringToStrings(const string &s, std::list<string> &tokens)
|
||||
return true;
|
||||
}
|
||||
|
||||
void stringToTokens(const string& str, list<string>& tokens,
|
||||
const string& delims)
|
||||
{
|
||||
string::size_type startPos, pos;
|
||||
|
||||
for (pos = 0;;) {
|
||||
// Skip initial delims, break if this eats all.
|
||||
if ((startPos = str.find_first_not_of(delims, pos)) == string::npos)
|
||||
break;
|
||||
// Find next delimiter or end of string (end of token)
|
||||
pos = str.find_first_of(delims, startPos);
|
||||
// Add token to the vector. Note: token cant be empty here
|
||||
if (pos == string::npos)
|
||||
tokens.push_back(str.substr(startPos));
|
||||
else
|
||||
tokens.push_back(str.substr(startPos, pos - startPos));
|
||||
}
|
||||
}
|
||||
|
||||
bool stringToBool(const string &s)
|
||||
{
|
||||
if (s.empty())
|
||||
|
||||
+9
-2
@@ -1,6 +1,6 @@
|
||||
#ifndef _SMALLUT_H_INCLUDED_
|
||||
#define _SMALLUT_H_INCLUDED_
|
||||
/* @(#$Id: smallut.h,v 1.10 2005-11-25 14:36:46 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||
/* @(#$Id: smallut.h,v 1.11 2006-01-04 11:33:44 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
@@ -20,13 +20,20 @@ extern bool maketmpdir(string& tdir);
|
||||
extern string stringlistdisp(const list<string>& strs);
|
||||
|
||||
/**
|
||||
* Parse input stream into list of strings.
|
||||
* Parse input string into list of strings.
|
||||
*
|
||||
* Token delimiter is " \t" except inside dquotes. dquote inside
|
||||
* dquotes can be escaped with \ etc...
|
||||
*/
|
||||
extern bool stringToStrings(const string &s, std::list<string> &tokens);
|
||||
|
||||
/**
|
||||
* Split input string. No handling of quoting
|
||||
*/
|
||||
extern void stringToTokens(const string &s, std::list<string> &tokens,
|
||||
const string &delims = " \t");
|
||||
|
||||
/** Convert string to boolean */
|
||||
extern bool stringToBool(const string &s);
|
||||
|
||||
/** Remove instances of characters belonging to set (default {space,
|
||||
|
||||
Reference in New Issue
Block a user