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
+2 -2
View File
@@ -21,7 +21,7 @@ DECLARE_TYPEOF_COLLECTION(KeywordModeP);
AddKeywordAction::AddKeywordAction(Set& set)
: KeywordListAction(set)
, action(ADD, intrusive(new Keyword()), set.keywords)
, action(ADD, make_intrusive<Keyword>(), set.keywords)
{
Keyword& keyword = *action.steps.front().item;
// find default mode
@@ -185,7 +185,7 @@ bool KeywordReminderTextValue::checkScript(const ScriptP& script) {
const KeywordParam& kwp = *keyword.parameters[i];
String param_name = String(_("param")) << (int)(i+1);
String param_value = _("<atom-kwpph>") + (kwp.placeholder.empty() ? kwp.name : kwp.placeholder) + _("</atom-kwpph>");
ctx.setVariable(param_name, intrusive(new KeywordParamValue(kwp.name, _(""), _(""), param_value)));
ctx.setVariable(param_name, make_intrusive<KeywordParamValue>(kwp.name, _(""), _(""), param_value));
}
script->eval(ctx);
errors.clear();
+1 -1
View File
@@ -23,7 +23,7 @@ DECLARE_TYPEOF_COLLECTION(int);
AddCardAction::AddCardAction(Set& set)
: CardListAction(set)
, action(ADD, intrusive(new Card(*set.game)), set.cards)
, action(ADD, make_intrusive<Card>(*set.game), set.cards)
{}
AddCardAction::AddCardAction(AddingOrRemoving ar, Set& set, const CardP& card)
+2 -2
View File
@@ -398,7 +398,7 @@ ControlPointRemoveAction::ControlPointRemoveAction(const SymbolShapeP& shape, co
FOR_EACH(point, shape->points) {
if (to_delete.find(point) != to_delete.end()) {
// remove this point
removals.push_back(intrusive(new SinglePointRemoveAction(shape, index)));
removals.push_back(make_intrusive<SinglePointRemoveAction>(shape, index));
}
++index;
}
@@ -422,7 +422,7 @@ void ControlPointRemoveAction::perform(bool to_undo) {
Action* control_point_remove_action(const SymbolShapeP& shape, const set<ControlPointP>& to_delete) {
if (shape->points.size() - to_delete.size() < 2) {
// TODO : remove part?
//intrusive(new ControlPointRemoveAllAction(part));
//make_intrusive<ControlPointRemoveAllAction>(part);
return 0; // no action
} else {
return new ControlPointRemoveAction(shape, to_delete);