35 string comment,
string sentry )
36 : myDelimiter(delimiter), myComment(comment), mySentry(sentry)
40 std::ifstream in( filename.c_str() );
49 : myDelimiter( string(1,
'=') ), myComment( string(1,
'#') )
75 static const char whitespace[] =
" \n\t\v\r\f";
76 s.erase( 0, s.find_first_not_of(whitespace) );
77 s.erase( s.find_last_not_of(whitespace) + 1U );
89 os << p->second << std::endl;
99 typedef string::size_type pos;
103 const pos skip = delim.length();
105 string nextline =
"";
107 while( is || nextline.length() > 0 )
111 if( nextline.length() > 0 )
118 std::getline( is, line );
122 line = line.substr( 0, line.find(comm) );
125 if( sentry !=
"" && line.find(sentry) != string::npos )
return is;
128 pos delimPos = line.find( delim );
129 if( delimPos < string::npos )
132 string key = line.substr( 0, delimPos );
133 line.replace( 0, delimPos+skip,
"" );
138 bool terminate =
false;
139 while( !terminate && is )
141 std::getline( is, nextline );
144 string nlcopy = nextline;
146 if( nlcopy ==
"" )
continue;
148 nextline = nextline.substr( 0, nextline.find(comm) );
149 if( nextline.find(delim) != string::npos )
151 if( sentry !=
"" && nextline.find(sentry) != string::npos )
156 if( nlcopy !=
"" ) line +=
"\n";