- Give code a round of indentation. Thank astyle, not me.

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@837 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-08-09 14:38:45 +00:00
parent aaf8e068d3
commit d3c7b46853
108 changed files with 3196 additions and 3180 deletions

View file

@ -32,22 +32,22 @@ namespace sgpem
KeyFile::KeyFile()
{}
KeyFile::elements_iterator
KeyFile::elements_begin() const
{
return _elements.begin();
}
KeyFile::elements_iterator
KeyFile::elements_end() const
{
return _elements.end();
}
void
KeyFile::insert_key_value(const Glib::ustring& key, const Glib::ustring& value)
{
@ -55,62 +55,62 @@ namespace sgpem
_elements.insert(val_pair);
}
const Glib::ustring*
KeyFile::search_value(const Glib::ustring& key)
{
const Glib::ustring* ret = 0;
elements_iterator cur = _elements.find(key);
if(cur != elements_end())
if (cur != elements_end())
{
ret = &((*cur).second);
}
return ret;
}
void
KeyFile::file_read(const Glib::ustring& filename)
{
std::ifstream ifs(filename.c_str());
if(ifs)
if (ifs)
{
file_read(ifs);
} // end - if(ifs)
}
void
KeyFile::file_read(std::istream& is)
KeyFile::file_read(std::istream& is)
{
if(is)
if (is)
{
_elements.clear(); // erase all elements
char buff[KEY_FILE_BUF_LEN]; //
while(is)
while (is)
{
is.getline(buff, (KEY_FILE_BUF_LEN), '\n');
// if not a comment line...
if(*buff!='\0' && *buff!='#')
if (*buff != '\0' && *buff != '#')
{
char* pos = strchr(buff, '=');
if(pos!=0)
if (pos != 0)
{
*pos = '\0';
const Glib::ustring key(buff);
const Glib::ustring value(pos+1);
const Glib::ustring value(pos + 1);
insert_key_value(key, value);
}
} // end - if not a comment line...
} // end - while(ifs))
} // end - if(ifs)
}
void
KeyFile::file_write(const Glib::ustring& filename)
{
std::ofstream ofs(filename.c_str());
if(ofs)
if (ofs)
{
file_write(ofs);
} // end - if(ofs)
@ -119,10 +119,11 @@ namespace sgpem
void
KeyFile::file_write(std::ostream& os)
{
if(os)
if (os)
{
elements_iterator iter;
for(iter = elements_begin(); iter != elements_end(); iter++){
for (iter = elements_begin(); iter != elements_end(); iter++)
{
os << (*iter).first << "=" << (*iter).second << std::endl;
}
} // end - if(ofs)