Fix IniFile to use string& instead of char*

Also removes .c_str() usages where found.
This commit is contained in:
Matthew Parlane
2014-02-08 18:50:37 +13:00
parent 079b1ba93d
commit 3fe05e0a9f
17 changed files with 205 additions and 218 deletions

View File

@ -101,7 +101,7 @@ namespace ButtonManager
bool hasbind = false;
char modifier = 0;
std::string value;
ini.Get("Android", config.str().c_str(), &value, "None");
ini.Get("Android", config.str(), &value, "None");
if (value == "None")
continue;
if (std::string::npos != value.find("Axis"))

View File

@ -82,7 +82,7 @@ void CCodeWindow::Load()
? Parent->Perspectives[Parent->ActivePerspective].Name : "Perspective 1");
for (int i = 0; i <= IDM_CODEWINDOW - IDM_LOGWINDOW; i++)
ini.Get(_Section.c_str(), SettingName[i], &iNbAffiliation[i], 0);
ini.Get(_Section, SettingName[i], &iNbAffiliation[i], 0);
// Get floating setting
for (int i = 0; i <= IDM_CODEWINDOW - IDM_LOGWINDOW; i++)
@ -121,7 +121,7 @@ void CCodeWindow::Save()
// Save notebook affiliations
std::string _Section = "P - " + Parent->Perspectives[Parent->ActivePerspective].Name;
for (int i = 0; i <= IDM_CODEWINDOW - IDM_LOGWINDOW; i++)
ini.Set(_Section.c_str(), SettingName[i], iNbAffiliation[i]);
ini.Set(_Section, SettingName[i], iNbAffiliation[i]);
// Save floating setting
for (int i = IDM_LOGWINDOW_PARENT; i <= IDM_CODEWINDOW_PARENT; i++)

View File

@ -917,13 +917,13 @@ void CFrame::LoadIniPerspectives()
continue;
_Section = StringFromFormat("P - %s", Tmp.Name.c_str());
ini.Get(_Section.c_str(), "Perspective", &_Perspective,
ini.Get(_Section, "Perspective", &_Perspective,
"layout2|"
"name=Pane 0;caption=Pane 0;state=768;dir=5;prop=100000;|"
"name=Pane 1;caption=Pane 1;state=31458108;dir=4;prop=100000;|"
"dock_size(5,0,0)=22|dock_size(4,0,0)=333|");
ini.Get(_Section.c_str(), "Width", &_Widths, "70,25");
ini.Get(_Section.c_str(), "Height", &_Heights, "80,80");
ini.Get(_Section, "Width", &_Widths, "70,25");
ini.Get(_Section, "Height", &_Heights, "80,80");
Tmp.Perspective = StrToWxStr(_Perspective);
@ -988,14 +988,14 @@ void CFrame::SaveIniPerspectives()
STmp += Perspective.Name + ",";
}
STmp = STmp.substr(0, STmp.length()-1);
ini.Set("Perspectives", "Perspectives", STmp.c_str());
ini.Set("Perspectives", "Perspectives", STmp);
ini.Set("Perspectives", "Active", ActivePerspective);
// Save the perspectives
for (auto& Perspective : Perspectives)
{
std::string _Section = "P - " + Perspective.Name;
ini.Set(_Section.c_str(), "Perspective", WxStrToStr(Perspective.Perspective));
ini.Set(_Section, "Perspective", WxStrToStr(Perspective.Perspective));
std::string SWidth = "", SHeight = "";
for (u32 j = 0; j < Perspective.Width.size(); j++)
@ -1007,8 +1007,8 @@ void CFrame::SaveIniPerspectives()
SWidth = SWidth.substr(0, SWidth.length()-1);
SHeight = SHeight.substr(0, SHeight.length()-1);
ini.Set(_Section.c_str(), "Width", SWidth.c_str());
ini.Set(_Section.c_str(), "Height", SHeight.c_str());
ini.Set(_Section, "Width", SWidth);
ini.Set(_Section, "Height", SHeight);
}
ini.Save(File::GetUserPath(F_DEBUGGERCONFIG_IDX));

View File

@ -252,13 +252,13 @@ void WiimoteConfigDiag::Save(wxCommandEvent& event)
{
std::string secname("Wiimote");
secname += (char)('1' + i);
IniFile::Section& sec = *inifile.GetOrCreateSection(secname.c_str());
IniFile::Section& sec = *inifile.GetOrCreateSection(secname);
sec.Set("Source", (int)g_wiimote_sources[i]);
}
std::string secname("BalanceBoard");
IniFile::Section& sec = *inifile.GetOrCreateSection(secname.c_str());
IniFile::Section& sec = *inifile.GetOrCreateSection(secname);
sec.Set("Source", (int)g_wiimote_sources[WIIMOTE_BALANCE_BOARD]);
inifile.Save(ini_filename);