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:
Twan van Laarhoven
2020-04-25 21:30:05 +02:00
parent 708b4389a0
commit 64ea1d7322
57 changed files with 363 additions and 385 deletions
+4 -3
View File
@@ -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);
}