Use make_intrusive/make_shared for smart pointer construction.

This commit is contained in:
Twan van Laarhoven
2020-04-23 23:51:34 +02:00
parent 815df01ba5
commit 708b4389a0
67 changed files with 313 additions and 329 deletions
+9 -9
View File
@@ -76,15 +76,15 @@ intrusive_ptr<Field> read_new<Field>(Reader& reader) {
// there must be a type specified
String type;
reader.handle(_("type"), type);
if (type == _("text")) return intrusive(new TextField());
else if (type == _("choice")) return intrusive(new ChoiceField());
else if (type == _("multiple choice")) return intrusive(new MultipleChoiceField());
else if (type == _("boolean")) return intrusive(new BooleanField());
else if (type == _("image")) return intrusive(new ImageField());
else if (type == _("symbol")) return intrusive(new SymbolField());
else if (type == _("color")) return intrusive(new ColorField());
else if (type == _("info")) return intrusive(new InfoField());
else if (type == _("package choice")) return intrusive(new PackageChoiceField());
if (type == _("text")) return make_intrusive<TextField>();
else if (type == _("choice")) return make_intrusive<ChoiceField>();
else if (type == _("multiple choice")) return make_intrusive<MultipleChoiceField>();
else if (type == _("boolean")) return make_intrusive<BooleanField>();
else if (type == _("image")) return make_intrusive<ImageField>();
else if (type == _("symbol")) return make_intrusive<SymbolField>();
else if (type == _("color")) return make_intrusive<ColorField>();
else if (type == _("info")) return make_intrusive<InfoField>();
else if (type == _("package choice")) return make_intrusive<PackageChoiceField>();
else if (type.empty()) {
reader.warning(_ERROR_1_("expected key", _("type")));
throw ParseError(_ERROR_("aborting parsing"));