Instead of the new_intrusive<T>() functions, use intrusive(new T)

This means we no longer need 8 different functions for different numbers of arguments, and non-const references can now also be passed to constructors without problems.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1443 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2010-07-21 14:32:28 +00:00
parent 8800500d86
commit 51dfed69b4
66 changed files with 304 additions and 353 deletions
+4 -4
View File
@@ -195,7 +195,7 @@ void Settings::addRecentFile(const String& filename) {
GameSettings& Settings::gameSettingsFor(const Game& game) {
GameSettingsP& gs = game_settings[game.name()];
if (!gs) gs = new_intrusive<GameSettings>();
if (!gs) gs = intrusive(new GameSettings);
gs->initDefaults(game);
return *gs;
}
@@ -214,7 +214,7 @@ ColumnSettings& Settings::columnSettingsFor(const Game& game, const Field& field
}
StyleSheetSettings& Settings::stylesheetSettingsFor(const StyleSheet& stylesheet) {
StyleSheetSettingsP& ss = stylesheet_settings[stylesheet.name()];
if (!ss) ss = new_intrusive<StyleSheetSettings>();
if (!ss) ss = intrusive(new StyleSheetSettings);
ss->useDefault(default_stylesheet_settings); // update default settings
return *ss;
}
@@ -286,7 +286,7 @@ void Settings::read() {
String filename = settingsFile();
if (wxFileExists(filename)) {
// settings file not existing is not an error
shared_ptr<wxFileInputStream> file = new_shared1<wxFileInputStream>(filename);
shared_ptr<wxFileInputStream> file = shared(new wxFileInputStream(filename));
if (!file->Ok()) return; // failure is not an error
Reader reader(file, nullptr, filename);
reader.handle_greedy(*this);
@@ -294,6 +294,6 @@ void Settings::read() {
}
void Settings::write() {
Writer writer(new_shared1<wxFileOutputStream>(settingsFile()), app_version);
Writer writer(shared(new wxFileOutputStream(settingsFile())), app_version);
writer.handle(*this);
}