26 m_section_pttrn (
"\\[[a-zA-Z0-9]+.*] *$"),
27 m_tuple_pttrn (
"^[ \t]*[a-zA-Z0-9]+.* *= *.*"),
28 m_comment_pttrn (
"^#.*$")
46 const int size = 1024;
60 m_stream.getline (inbuf, size,
'\n');
101 DL((
INIFILE,
"Parse error: illegal syntax!\n"));
114 ::unlink (fname_.c_str ());
115 m_stream.open (fname_.c_str (), std::ios::app | std::ios::out);
117 EL((
INIFILE,
"Failed to open(\"%s\", app|out)\n", fname_.c_str ()));
124 m_stream <<
"[" << (*i).first <<
"]\n";
125 j = (*i).second.begin ();
127 while (j != (*i).second.end ()) {
128 m_stream << (*j).first <<
"=" << (*j).second <<
"\n";
148 DL((
INIFILE,
"============= Start =================\n"));
151 DL((
INIFILE,
"[%s]\n", (*i).first.c_str ()));
152 j = (*i).second.begin ();
153 while (j != (*i).second.end ()) {
155 (*j).first.c_str (), (*j).second.c_str ()));
160 DL((
INIFILE,
"============== End =================\n"));
165 get_value (
const string& section_,
const string& name_)
const
172 if ((*i).first == section_) {
173 j = (*i).second.begin ();
174 while (j != (*i).second.end ()) {
175 if ((*j).first == name_) {
204 if ((*i).first == section_) {
219 if ((*i).first == section_) {
235 DL((
INIFILE,
"Section [%s] is not found!\n", section_.c_str ()));
239 while (j != (*i).second.end ()) {
240 if ((*j).first == newkey_.first) {
241 (*j).second = newkey_.second;
246 (*i).second.push_back (newkey_);
258 DL((
INIFILE,
"Section [%s] is not found!\n", section_.c_str ()));
273 DL((
INIFILE,
"Section [%s] is not found!\n", section_.c_str ()));
278 while (j != (*i).second.end ()) {
279 if ((*j).first == name_) {
280 (*i).second.erase (j);