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
+2 -2
View File
@@ -21,7 +21,7 @@ DECLARE_TYPEOF_COLLECTION(KeywordModeP);
AddKeywordAction::AddKeywordAction(Set& set)
: KeywordListAction(set)
, action(ADD, new_intrusive<Keyword>(), set.keywords)
, action(ADD, intrusive(new Keyword()), set.keywords)
{
Keyword& keyword = *action.steps.front().item;
// find default mode
@@ -184,7 +184,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, new_intrusive4<KeywordParamValue>(kwp.name, _(""), _(""), param_value));
ctx.setVariable(param_name, intrusive(new 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, new_intrusive1<Card>(*set.game), set.cards)
, action(ADD, intrusive(new 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(new_intrusive2<SinglePointRemoveAction>(shape, index));
removals.push_back(intrusive(new 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?
//new_intrusive<ControlPointRemoveAllAction>(part);
//intrusive(new ControlPointRemoveAllAction(part));
return 0; // no action
} else {
return new ControlPointRemoveAction(shape, to_delete);