34 inline const std::string & keyGarbage()
36 static const std::string & _val(
":/?|,\\" );
61 void IniParser::consume(
const std::string §ion,
const std::string &key,
const std::string &value )
72 std::string msg =
str::form(
"%s: Section [%s]: Line %d contains garbage (no '=' or '%s' in key)",
84 MIL <<
"Start parsing " << input_r << endl;
93 for ( ; line; line.
next() )
97 if (trimmed.empty() || trimmed[0] ==
';' || trimmed[0] ==
'#')
100 if (trimmed[0] ==
'[')
103 if ( pos != std::string::npos )
105 std::string section = trimmed.substr(1, pos-1);
118 if ( pos == std::string::npos || trimmed.find_first_of( keyGarbage() ) < pos )
125 std::string key =
str::rtrim(trimmed.substr(0, pos));
126 std::string value =
str::ltrim(trimmed.substr(pos+1));
131 if ( ! ticks.
set( input_r.
stream().tellg() ) )
138 MIL <<
"Done parsing " << input_r << endl;