add key renaming

fix a possible glitch
This commit is contained in:
Glenn Maynard
2003-01-03 22:37:44 +00:00
parent 0c9b9c8b28
commit 6341356c9e
4 changed files with 29 additions and 11 deletions
+15 -2
View File
@@ -246,7 +246,20 @@ bool IniFile::DeleteKey(const CString &keyname)
return true;
}
IniFile::const_iterator IniFile::GetKey(const CString &keyname) const
const IniFile::key *IniFile::GetKey(const CString &keyname) const
{
return keys.find(keyname);
keymap::const_iterator i = keys.find(keyname);
if(i == keys.end()) return NULL;
return &i->second;
}
void IniFile::RenameKey(const CString &from, const CString &to)
{
if(keys.find(from) == keys.end())
return;
if(keys.find(to) != keys.end())
return;
keys[to] = keys[from];
keys.erase(from);
}