Dijon filters 1st step: mostly working needs check and optim

This commit is contained in:
dockes
2006-12-15 12:40:24 +00:00
parent 1973c06346
commit 33c95ef1ba
22 changed files with 979 additions and 480 deletions
+5 -4
View File
@@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: smallut.cpp,v 1.22 2006-12-14 13:53:43 dockes Exp $ (C) 2004 J.F.Dockes";
static char rcsid[] = "@(#$Id: smallut.cpp,v 1.23 2006-12-15 12:40:02 dockes Exp $ (C) 2004 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@@ -260,13 +260,14 @@ bool stringToStrings(const string &s, std::list<string> &tokens)
}
void stringToTokens(const string& str, list<string>& tokens,
const string& delims)
const string& delims, bool skipinit)
{
string::size_type startPos, pos;
string::size_type startPos = 0, pos;
for (pos = 0;;) {
// Skip initial delims, break if this eats all.
if ((startPos = str.find_first_not_of(delims, pos)) == string::npos)
if (skipinit &&
(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);
+2 -2
View File
@@ -16,7 +16,7 @@
*/
#ifndef _SMALLUT_H_INCLUDED_
#define _SMALLUT_H_INCLUDED_
/* @(#$Id: smallut.h,v 1.22 2006-12-14 13:53:43 dockes Exp $ (C) 2004 J.F.Dockes */
/* @(#$Id: smallut.h,v 1.23 2006-12-15 12:40:02 dockes Exp $ (C) 2004 J.F.Dockes */
#include <string>
#include <list>
#include <map>
@@ -51,7 +51,7 @@ extern bool stringToStrings(const string &s, list<string> &tokens);
* Split input string. No handling of quoting
*/
extern void stringToTokens(const string &s, list<string> &tokens,
const string &delims = " \t");
const string &delims = " \t", bool skipinit=true);
/** Convert string to boolean */
extern bool stringToBool(const string &s);