FindVariableOperation.cpp
75 lines
| 1.9 KiB
| text/x-c
|
CppLexer
Alexandre Leroux
|
r735 | #include "Visualization/operations/FindVariableOperation.h" | ||
#include "Visualization/VisualizationGraphWidget.h" | ||||
#include "Visualization/VisualizationTabWidget.h" | ||||
#include "Visualization/VisualizationWidget.h" | ||||
#include "Visualization/VisualizationZoneWidget.h" | ||||
r1420 | #include <Variable/Variable2.h> | |||
Alexandre Leroux
|
r735 | |||
r1420 | struct FindVariableOperation::FindVariableOperationPrivate | |||
{ | ||||
explicit FindVariableOperationPrivate(std::shared_ptr<Variable2> variable) | ||||
: m_Variable { variable } | ||||
Alexandre Leroux
|
r735 | { | ||
} | ||||
r1420 | void visit(IVisualizationWidget* widget) | |||
Alexandre Leroux
|
r735 | { | ||
r1420 | if (m_Variable && widget && widget->contains(*m_Variable)) | |||
{ | ||||
Alexandre Leroux
|
r735 | m_Containers.insert(widget); | ||
} | ||||
} | ||||
r1420 | std::shared_ptr<Variable2> m_Variable; ///< Variable to find | |||
std::set<IVisualizationWidget*> m_Containers; ///< Containers found for the variable | ||||
Alexandre Leroux
|
r735 | }; | ||
r1420 | FindVariableOperation::FindVariableOperation(std::shared_ptr<Variable2> variable) | |||
: impl { spimpl::make_unique_impl<FindVariableOperationPrivate>(variable) } | ||||
Alexandre Leroux
|
r735 | { | ||
} | ||||
r1420 | void FindVariableOperation::visitEnter(VisualizationWidget* widget) | |||
Alexandre Leroux
|
r735 | { | ||
impl->visit(widget); | ||||
} | ||||
r1420 | void FindVariableOperation::visitLeave(VisualizationWidget* widget) | |||
Alexandre Leroux
|
r735 | { | ||
// Does nothing | ||||
Q_UNUSED(widget); | ||||
} | ||||
r1420 | void FindVariableOperation::visitEnter(VisualizationTabWidget* tabWidget) | |||
Alexandre Leroux
|
r735 | { | ||
impl->visit(tabWidget); | ||||
} | ||||
r1420 | void FindVariableOperation::visitLeave(VisualizationTabWidget* tabWidget) | |||
Alexandre Leroux
|
r735 | { | ||
// Does nothing | ||||
Q_UNUSED(tabWidget); | ||||
} | ||||
r1420 | void FindVariableOperation::visitEnter(VisualizationZoneWidget* zoneWidget) | |||
Alexandre Leroux
|
r735 | { | ||
impl->visit(zoneWidget); | ||||
} | ||||
r1420 | void FindVariableOperation::visitLeave(VisualizationZoneWidget* zoneWidget) | |||
Alexandre Leroux
|
r735 | { | ||
// Does nothing | ||||
Q_UNUSED(zoneWidget); | ||||
} | ||||
r1420 | void FindVariableOperation::visit(VisualizationGraphWidget* graphWidget) | |||
Alexandre Leroux
|
r735 | { | ||
impl->visit(graphWidget); | ||||
} | ||||
r1420 | std::set<IVisualizationWidget*> FindVariableOperation::result() const noexcept | |||
Alexandre Leroux
|
r735 | { | ||
return impl->m_Containers; | ||||
} | ||||