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
+10 -10
View File
@@ -139,9 +139,9 @@ SymbolPartP read_new<SymbolPart>(Reader& reader) {
// there must be a type specified
String type;
reader.handle(_("type"), type);
if (type == _("shape") || type.empty()) return new_intrusive<SymbolShape>();
else if (type == _("symmetry")) return new_intrusive<SymbolSymmetry>();
else if (type == _("group")) return new_intrusive<SymbolGroup>();
if (type == _("shape") || type.empty()) return intrusive(new SymbolShape);
else if (type == _("symmetry")) return intrusive(new SymbolSymmetry);
else if (type == _("group")) return intrusive(new SymbolGroup);
else {
throw ParseError(_("Unsupported symbol part type: '") + type + _("'"));
}
@@ -200,7 +200,7 @@ SymbolPartP SymbolShape::clone() const {
SymbolShapeP part(new SymbolShape(*this));
// also clone the control points
FOR_EACH(p, part->points) {
p = new_intrusive1<ControlPoint>(*p);
p = intrusive(new ControlPoint(*p));
}
return part;
}
@@ -357,18 +357,18 @@ double Symbol::aspectRatio() const {
// A default symbol part, a square, moved by d
SymbolShapeP default_symbol_part(double d) {
SymbolShapeP part = new_intrusive<SymbolShape>();
part->points.push_back(new_intrusive2<ControlPoint>(d + .2, d + .2));
part->points.push_back(new_intrusive2<ControlPoint>(d + .2, d + .8));
part->points.push_back(new_intrusive2<ControlPoint>(d + .8, d + .8));
part->points.push_back(new_intrusive2<ControlPoint>(d + .8, d + .2));
SymbolShapeP part = intrusive(new SymbolShape);
part->points.push_back(intrusive(new ControlPoint(d + .2, d + .2)));
part->points.push_back(intrusive(new ControlPoint(d + .2, d + .8)));
part->points.push_back(intrusive(new ControlPoint(d + .8, d + .8)));
part->points.push_back(intrusive(new ControlPoint(d + .8, d + .2)));
part->name = _("Square");
return part;
}
// A default symbol, a square
SymbolP default_symbol() {
SymbolP symbol = new_intrusive<Symbol>();
SymbolP symbol = intrusive(new Symbol);
symbol->parts.push_back(default_symbol_part(0));
return symbol;
}