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
+4 -6
View File
@@ -12,8 +12,8 @@
// ----------------------------------------------------------------------------- : BooleanField
BooleanField::BooleanField() {
choices->choices.push_back(intrusive(new Choice(_("yes"))));
choices->choices.push_back(intrusive(new Choice(_("no"))));
choices->choices.push_back(make_intrusive<Choice>(_("yes")));
choices->choices.push_back(make_intrusive<Choice>(_("no")));
choices->initIds();
}
@@ -32,10 +32,8 @@ BooleanStyle::BooleanStyle(const ChoiceFieldP& field)
: ChoiceStyle(field)
{
render_style = RENDER_BOTH;
//choice_images[_("yes")] = ScriptableImage(_("buildin_image(\"bool_yes\")"));
//choice_images[_("no")] = ScriptableImage(_("buildin_image(\"bool_no\")"));
choice_images[_("yes")] = ScriptableImage(intrusive(new BuiltInImage(_("bool_yes"))));
choice_images[_("no")] = ScriptableImage(intrusive(new BuiltInImage(_("bool_no"))));
choice_images[_("yes")] = ScriptableImage(make_intrusive<BuiltInImage>(_("bool_yes")));
choice_images[_("no")] = ScriptableImage(make_intrusive<BuiltInImage>(_("bool_no")));
}
IMPLEMENT_REFLECTION(BooleanStyle) {
+1 -1
View File
@@ -48,5 +48,5 @@ void ImageValue::reflect(Writer& tag) {
void ImageValue::reflect(GetMember& tag) {}
void ImageValue::reflect(GetDefaultMember& tag) {
// convert to ScriptImageP for scripting
tag.handle( (ScriptValueP)intrusive(new ImageValueToImage(filename, last_update)) );
tag.handle( (ScriptValueP)make_intrusive<ImageValueToImage>(filename, last_update) );
}