Skip to content
Snippets Groups Projects
Commit 39f75928 authored by Carsten Gräser's avatar Carsten Gräser
Browse files

Values in parameter files can now be quoted by 'bla' or "bla".

If you used such values so far just add additional quotes:
'my string needs quotes' -> ''my string needs quotes''
-This line, and those below, will be ignored--

M    configparser.cc

[[Imported from SVN: r4577]]
parent c21e5091
Branches
Tags
Loading
......@@ -44,6 +44,17 @@ void ConfigParser::parseFile(string file)
{
string key = prefix+trim(line.substr(0, mid));
string value = trim(line.substr(mid+1));
// handle quoted strings
if (value.length()>1)
{
if ((value[0] == '\'')and (value[value.length()-1] == '\''))
value = value.substr(1, value.length()-2);
else
if ((value[0] == '"')and (value[value.length()-1] == '"'))
value = value.substr(1, value.length()-2);
}
if (keysInFile.count(key) != 0)
DUNE_THROW(Exception, "Key '" << key << "' appears twice in file '" << file << "' !");
else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment