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
+1 -1
View File
@@ -31,7 +31,7 @@ class FilterCtrl : public wxControl {
template <typename T>
intrusive_ptr<Filter<T> > getFilter() const {
if (hasFilter()) {
return intrusive(new QuickFilter<T>(getFilterString()));
return make_intrusive<QuickFilter<T>>(getFilterString());
} else {
return intrusive_ptr<Filter<T> >();
}
+22 -22
View File
@@ -1039,39 +1039,39 @@ void GraphControl::setLayout(GraphType type, bool force) {
switch (type) {
case GRAPH_TYPE_BAR: {
intrusive_ptr<GraphContainer> combined(new GraphContainer());
combined->add(intrusive(new GraphValueAxis(0, true)));
combined->add(intrusive(new GraphLabelAxis(0, HORIZONTAL)));
combined->add(intrusive(new BarGraph(0)));
combined->add(intrusive(new GraphStats(0, ALIGN_TOP_RIGHT)));
graph = intrusive(new GraphWithMargins(combined, 23,8,7,20));
combined->add(make_intrusive<GraphValueAxis>(0, true));
combined->add(make_intrusive<GraphLabelAxis>(0, HORIZONTAL));
combined->add(make_intrusive<BarGraph>(0));
combined->add(make_intrusive<GraphStats>(0, ALIGN_TOP_RIGHT));
graph = make_intrusive<GraphWithMargins>(combined, 23,8,7,20);
break;
} case GRAPH_TYPE_PIE: {
intrusive_ptr<GraphContainer> combined(new GraphContainer());
combined->add(intrusive(new GraphWithMargins(intrusive(new PieGraph(0)), 0,0,120,0)));
combined->add(intrusive(new GraphLegend(0, ALIGN_TOP_RIGHT, false)));
graph = intrusive(new GraphWithMargins(combined, 20,20,20,20));
combined->add(make_intrusive<GraphWithMargins>(make_intrusive<PieGraph>(0), 0,0,120,0));
combined->add(make_intrusive<GraphLegend>(0, ALIGN_TOP_RIGHT, false));
graph = make_intrusive<GraphWithMargins>(combined, 20,20,20,20);
break;
} case GRAPH_TYPE_STACK: {
intrusive_ptr<GraphContainer> combined(new GraphContainer());
combined->add(intrusive(new GraphValueAxis(0, false)));
combined->add(intrusive(new GraphLabelAxis(0, HORIZONTAL)));
combined->add(intrusive(new BarGraph2D(0,1)));
combined->add(intrusive(new GraphLegend(1, ALIGN_TOP_RIGHT, true)));
graph = intrusive(new GraphWithMargins(combined, 23,8,7,20));
combined->add(make_intrusive<GraphValueAxis>(0, false));
combined->add(make_intrusive<GraphLabelAxis>(0, HORIZONTAL));
combined->add(make_intrusive<BarGraph2D>(0,1));
combined->add(make_intrusive<GraphLegend>(1, ALIGN_TOP_RIGHT, true));
graph = make_intrusive<GraphWithMargins>(combined, 23,8,7,20);
break;
} case GRAPH_TYPE_SCATTER: {
intrusive_ptr<GraphContainer> combined(new GraphContainer());
combined->add(intrusive(new GraphLabelAxis(0, HORIZONTAL, false, DRAW_LINES_MID)));
combined->add(intrusive(new GraphLabelAxis(1, VERTICAL, false, DRAW_LINES_MID)));
combined->add(intrusive(new ScatterGraph(0,1)));
graph = intrusive(new GraphWithMargins(combined, 80,8,7,20));
combined->add(make_intrusive<GraphLabelAxis>(0, HORIZONTAL, false, DRAW_LINES_MID));
combined->add(make_intrusive<GraphLabelAxis>(1, VERTICAL, false, DRAW_LINES_MID));
combined->add(make_intrusive<ScatterGraph>(0,1));
graph = make_intrusive<GraphWithMargins>(combined, 80,8,7,20);
break;
} case GRAPH_TYPE_SCATTER_PIE: {
intrusive_ptr<GraphContainer> combined(new GraphContainer());
combined->add(intrusive(new GraphLabelAxis(0, HORIZONTAL, false, DRAW_LINES_MID)));
combined->add(intrusive(new GraphLabelAxis(1, VERTICAL, false, DRAW_LINES_MID)));
combined->add(intrusive(new ScatterPieGraph(0,1,2)));
graph = intrusive(new GraphWithMargins(combined, 80,8,7,20));
combined->add(make_intrusive<GraphLabelAxis>(0, HORIZONTAL, false, DRAW_LINES_MID));
combined->add(make_intrusive<GraphLabelAxis>(1, VERTICAL, false, DRAW_LINES_MID));
combined->add(make_intrusive<ScatterPieGraph>(0,1,2));
graph = make_intrusive<GraphWithMargins>(combined, 80,8,7,20);
break;
} default:
graph = GraphP();
@@ -1085,7 +1085,7 @@ GraphType GraphControl::getLayout() const {
}
void GraphControl::setData(const GraphDataPre& data) {
setData(intrusive(new GraphData(data)));
setData(make_intrusive<GraphData>(data));
}
void GraphControl::setData(const GraphDataP& data) {
if (graph) {
+1 -1
View File
@@ -101,7 +101,7 @@ int ImageCardList::OnGetItemImage(long pos) const {
return it->second;
} else {
// request a thumbnail
thumbnail_thread.request(intrusive(new CardThumbnailRequest(const_cast<ImageCardList*>(this), val.filename)));
thumbnail_thread.request(make_intrusive<CardThumbnailRequest>(const_cast<ImageCardList*>(this), val.filename));
}
}
return -1;
+1 -1
View File
@@ -64,7 +64,7 @@ void TextCtrl::updateSize() {
}
void TextCtrl::setValue(String* value, bool untagged) {
setValue(intrusive(new FakeTextValue(getFieldP(), value, true, untagged)));
setValue(make_intrusive<FakeTextValue>(getFieldP(), value, true, untagged));
}
void TextCtrl::setValue(const FakeTextValueP& value) {
value->retrieve();