mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Clean up pointer use:
* Use unique_ptr for Actions instead of manual memory management * Use unique_ptr in KeywordDatabase * Use unique_ptr instead of shared_ptr for file formats * Don't pass shared_ptr to Reader/Writer, use references instead Also * Switch to C++17 so we can use map::try_emplace
This commit is contained in:
@@ -295,14 +295,15 @@ void Settings::read() {
|
||||
String filename = settingsFile();
|
||||
if (wxFileExists(filename)) {
|
||||
// settings file not existing is not an error
|
||||
shared_ptr<wxFileInputStream> file = make_shared<wxFileInputStream>(filename);
|
||||
if (!file->Ok()) return; // failure is not an error
|
||||
wxFileInputStream file(filename);
|
||||
if (!file.Ok()) return; // failure is not an error
|
||||
Reader reader(file, nullptr, filename);
|
||||
reader.handle_greedy(*this);
|
||||
}
|
||||
}
|
||||
|
||||
void Settings::write() {
|
||||
Writer writer(make_shared<wxFileOutputStream>(settingsFile()), app_version);
|
||||
wxFileOutputStream file(settingsFile());
|
||||
Writer writer(file, app_version);
|
||||
writer.handle(*this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user