Skip to content

Commit 3686d87

Browse files
committed
Replacing boost::bind (#1383)
1 parent 0bb34f7 commit 3686d87

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

src/Interface/Application/GuiCommands.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ namespace
166166

167167
QPointF SCIRun::Gui::findCenterOfNetwork(const ModulePositions& positions)
168168
{
169-
auto pointRange = positions.modulePositions | boost::adaptors::map_values;
169+
const auto pointRange = positions.modulePositions | boost::adaptors::map_values;
170170
return centroidOfPointRange(pointRange.begin(), pointRange.end());
171171
}
172172

@@ -181,8 +181,8 @@ namespace std
181181

182182
bool NetworkFileProcessCommand::execute()
183183
{
184-
auto filename = get(Variables::Filename).toFilename().string();
185-
auto tempFile = get(Name("temporaryFile")).toBool();
184+
const auto filename = get(Variables::Filename).toFilename().string();
185+
const auto tempFile = get(Name("temporaryFile")).toBool();
186186
GuiLogger::logInfoQ("Attempting load of " + QString::fromStdString(filename));
187187

188188
try
@@ -191,14 +191,14 @@ bool NetworkFileProcessCommand::execute()
191191

192192
if (file)
193193
{
194-
auto load = [this, file] { guiProcess(file); };
194+
auto load = [this, file] { return guiProcess(file); };
195195
if (Application::Instance().parameters()->isRegressionMode())
196196
{
197197
load();
198198
}
199199
else
200200
{
201-
int numModules = static_cast<int>(file->network.modules.size());
201+
const int numModules = static_cast<int>(file->network.modules.size());
202202
QProgressDialog progress("Loading network " + (tempFile ? "" : QString::fromStdString(filename)), QString(), 0, numModules + 1, SCIRunMainWindow::Instance());
203203
progress.connect(networkEditor_->getNetworkEditorController().get(), SIGNAL(networkDoneLoading(int)), SLOT(setValue(int)));
204204
progress.setWindowModality(Qt::WindowModal);
@@ -215,7 +215,7 @@ bool NetworkFileProcessCommand::execute()
215215
}
216216
file_ = file;
217217

218-
auto center = findCenterOfNetworkFile(*file);
218+
const auto center = findCenterOfNetworkFile(*file);
219219
networkEditor_->centerOn(center);
220220

221221
if (!tempFile)
@@ -229,7 +229,7 @@ bool NetworkFileProcessCommand::execute()
229229
}
230230
catch (ExceptionBase& e)
231231
{
232-
std::string message(e.what());
232+
const std::string message(e.what());
233233
GuiLogger::logErrorStd("File load failed (" + filename + "): SCIRun exception in load_xml, " + message);
234234

235235
auto quiet = get(Core::Algorithms::AlgorithmParameterName("QuietMode")).toBool();

src/Interface/Application/NetworkEditor.cc

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ ModuleProxyWidget* NetworkEditor::setupModuleWidget(ModuleWidget* module)
465465
}
466466

467467
LOG_TRACE("NetworkEditor connecting to state.");
468-
module->getModule()->get_state()->connectStateChanged(boost::bind(&NetworkEditor::modified, this));
468+
module->getModule()->get_state()->connectStateChanged([this]() { modified(); });
469469

470470
connect(this, SIGNAL(networkExecuted()), module, SLOT(resetLogButtonColor()));
471471
connect(this, SIGNAL(networkExecuted()), module, SLOT(resetProgressBar()));
@@ -609,13 +609,13 @@ void NetworkEditor::logViewerDims(const QString& msg)
609609
void NetworkEditor::setMouseAsDragMode()
610610
{
611611
setDragMode(ScrollHandDrag);
612-
tailRecurse(boost::bind(&NetworkEditor::setMouseAsDragMode, _1));
612+
tailRecurse(&NetworkEditor::setMouseAsDragMode);
613613
}
614614

615615
void NetworkEditor::setMouseAsSelectMode()
616616
{
617617
setDragMode(RubberBandDrag);
618-
tailRecurse(boost::bind(&NetworkEditor::setMouseAsSelectMode, _1));
618+
tailRecurse(&NetworkEditor::setMouseAsSelectMode);
619619
}
620620

621621
void NetworkEditor::bringToFront()
@@ -1281,7 +1281,7 @@ void NetworkEditor::centerView()
12811281
{
12821282
if (!isActiveWindow())
12831283
{
1284-
tailRecurse(boost::bind(&NetworkEditor::centerView, _1));
1284+
tailRecurse(&NetworkEditor::centerView);
12851285
return;
12861286
}
12871287

@@ -1782,7 +1782,7 @@ void NetworkEditor::selectAll()
17821782
{
17831783
if (!isActiveWindow())
17841784
{
1785-
tailRecurse(boost::bind(&NetworkEditor::selectAll, _1));
1785+
tailRecurse(&NetworkEditor::selectAll);
17861786
return;
17871787
}
17881788

@@ -1796,7 +1796,7 @@ void NetworkEditor::pinAllModuleUIs()
17961796
{
17971797
if (!isActiveWindow())
17981798
{
1799-
tailRecurse(boost::bind(&NetworkEditor::pinAllModuleUIs, _1));
1799+
tailRecurse(&NetworkEditor::pinAllModuleUIs);
18001800
return;
18011801
}
18021802

@@ -1812,7 +1812,7 @@ void NetworkEditor::hideAllModuleUIs()
18121812
{
18131813
if (!isActiveWindow())
18141814
{
1815-
tailRecurse(boost::bind(&NetworkEditor::hideAllModuleUIs, _1));
1815+
tailRecurse(&NetworkEditor::hideAllModuleUIs);
18161816
return;
18171817
}
18181818

@@ -1848,7 +1848,7 @@ void NetworkEditor::restoreAllModuleUIs()
18481848
{
18491849
if (!isActiveWindow())
18501850
{
1851-
tailRecurse(boost::bind(&NetworkEditor::restoreAllModuleUIs, _1));
1851+
tailRecurse(&NetworkEditor::restoreAllModuleUIs);
18521852
return;
18531853
}
18541854

@@ -1913,7 +1913,7 @@ void NetworkEditor::zoomIn()
19131913
{
19141914
if (!isActiveWindow())
19151915
{
1916-
tailRecurse(boost::bind(&NetworkEditor::zoomIn, _1));
1916+
tailRecurse(&NetworkEditor::zoomIn);
19171917
return;
19181918
}
19191919

@@ -1933,7 +1933,7 @@ void NetworkEditor::zoomOut()
19331933
{
19341934
if (!isActiveWindow())
19351935
{
1936-
tailRecurse(boost::bind(&NetworkEditor::zoomOut, _1));
1936+
tailRecurse(&NetworkEditor::zoomOut);
19371937
return;
19381938
}
19391939

@@ -1952,7 +1952,7 @@ void NetworkEditor::zoomReset()
19521952
{
19531953
if (!isActiveWindow())
19541954
{
1955-
tailRecurse(boost::bind(&NetworkEditor::zoomReset, _1));
1955+
tailRecurse(&NetworkEditor::zoomReset);
19561956
return;
19571957
}
19581958

@@ -2044,7 +2044,7 @@ void NetworkEditor::metadataLayer(bool active)
20442044
if (module)
20452045
module->updateMetadata(active);
20462046
}
2047-
tailRecurse(boost::bind(&NetworkEditor::metadataLayer, _1, active));
2047+
// TODO: tailRecurse(&NetworkEditor::metadataLayer, active);
20482048
}
20492049

20502050
void NetworkEditor::adjustExecuteButtonsToDownstream(bool downOnly)
@@ -2058,7 +2058,7 @@ void NetworkEditor::adjustExecuteButtonsToDownstream(bool downOnly)
20582058
}
20592059
}
20602060

2061-
tailRecurse(boost::bind(&NetworkEditor::adjustExecuteButtonsToDownstream, _1, downOnly));
2061+
//TODO: tailRecurse(&NetworkEditor::adjustExecuteButtonsToDownstream, downOnly);
20622062
}
20632063

20642064
void NetworkEditor::updateExecuteButtons(bool downstream)
@@ -2186,7 +2186,7 @@ void NetworkEditor::tagLayer(bool active, int tag)
21862186
removeTagGroups();
21872187
}
21882188

2189-
tailRecurse(boost::bind(&NetworkEditor::tagLayer, _1, active, tag));
2189+
//TODO: tailRecurse(&NetworkEditor::tagLayer, active, tag);
21902190
}
21912191

21922192
namespace

src/Interface/Application/NetworkEditor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,11 +483,11 @@ namespace Gui {
483483
std::map<std::string, QString> subnetNameMap_;
484484

485485
template <typename Func>
486-
void tailRecurse(Func func)
486+
void tailRecurse(Func p)
487487
{
488488
for (auto& child : childrenNetworks_)
489489
{
490-
func(child.second->get());
490+
std::invoke(p, child.second->get());
491491
}
492492
}
493493

0 commit comments

Comments
 (0)