Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into cppcheck_bump
Browse files Browse the repository at this point in the history
  • Loading branch information
jmarrec committed Nov 22, 2022
2 parents 402bb6b + a2feef7 commit 468a62b
Show file tree
Hide file tree
Showing 73 changed files with 307 additions and 299 deletions.
2 changes: 1 addition & 1 deletion src/model_editor/IGLineEdit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ using namespace openstudio;
IGLineEdit::IGLineEdit(const QString& val, InspectorGadget* ig, QWidget* parent)
: QLineEdit(val, parent), m_ig(ig), m_min(-std::numeric_limits<double>::max()), m_max(std::numeric_limits<double>::max()), m_default(0.0) {}

IGLineEdit::~IGLineEdit() {}
IGLineEdit::~IGLineEdit() = default;

void IGLineEdit::setMin(double min) {
m_min = min;
Expand Down
2 changes: 1 addition & 1 deletion src/model_editor/ListWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ QString modeleditor::ListWidget::mMimeType = "ListWidget data";

ListWidget::ListWidget(QWidget* parent) : QListWidget(parent) {}

ListWidget::~ListWidget() {}
ListWidget::~ListWidget() = default;

QMimeData* ListWidget::mimeData(const QList<QListWidgetItem*>& items) const {
QMimeData* mimeData = QListWidget::mimeData(items);
Expand Down
4 changes: 1 addition & 3 deletions src/model_editor/ModalDialogs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,7 @@ void ModelObjectSelectorDialog::connectSignalsAndSlots() {
m_model.getImpl<model::detail::Model_Impl>()
->addWorkspaceObjectPtr.connect<ModelObjectSelectorDialog, &ModelObjectSelectorDialog::onAddWorkspaceObject>(this);

m_model
.getImpl<model::detail::Model_Impl>()

m_model.getImpl<model::detail::Model_Impl>()
->removeWorkspaceObjectPtr.connect<ModelObjectSelectorDialog, &ModelObjectSelectorDialog::onRemoveWorkspaceObject>(this);
}

Expand Down
2 changes: 1 addition & 1 deletion src/model_editor/PathWatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ PathWatcher::PathWatcher(const openstudio::path& p, int msec)
}
}

PathWatcher::~PathWatcher() {}
PathWatcher::~PathWatcher() = default;

bool PathWatcher::enabled() const {
return m_enabled;
Expand Down
2 changes: 1 addition & 1 deletion src/model_editor/TableView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace modeleditor {

TableView::TableView(QWidget* parent) : QTableView(parent) {}

TableView::~TableView() {}
TableView::~TableView() = default;

void TableView::enterEvent(QEnterEvent* event) {
emit eventEnter();
Expand Down
2 changes: 1 addition & 1 deletion src/model_editor/TableWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace modeleditor {

TableWidget::TableWidget(QWidget* parent) : QTableWidget(parent) {}

TableWidget::~TableWidget() {}
TableWidget::~TableWidget() = default;

void TableWidget::populateTable(const openstudio::WorkspaceObject& obj) {
clear();
Expand Down
4 changes: 2 additions & 2 deletions src/openstudio_app/LibraryDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ LibraryDialog::LibraryDialog(const std::vector<openstudio::path>& paths, const s
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);

for (auto path : paths) {
for (const auto& path : paths) {
m_list->addItem(QString::fromStdString(toString(path)));
}
}
Expand All @@ -105,7 +105,7 @@ void LibraryDialog::onRemove() {
void LibraryDialog::onRestore() {
m_list->clear();

for (const auto path : m_defaultPaths) {
for (const auto& path : m_defaultPaths) {
m_list->addItem(QString::fromStdString(toString(path)));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/openstudio_lib/ConstructionsController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace openstudio {
ConstructionsController::ConstructionsController(bool isIP, const model::Model& model)
: ModelSubTabController(new ConstructionsView(isIP, model), model) {}

ConstructionsController::~ConstructionsController() {}
ConstructionsController::~ConstructionsController() = default;

void ConstructionsController::onAddObject(const openstudio::IddObjectType& iddObjectType) {
switch (iddObjectType.value()) {
Expand Down
2 changes: 1 addition & 1 deletion src/openstudio_lib/DefaultConstructionSetsController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace openstudio {
DefaultConstructionSetsController::DefaultConstructionSetsController(const model::Model& model)
: ModelSubTabController(new DefaultConstructionSetsView(model, "Default Constructions", false), model) {}

DefaultConstructionSetsController::~DefaultConstructionSetsController() {}
DefaultConstructionSetsController::~DefaultConstructionSetsController() = default;

void DefaultConstructionSetsController::onAddObject(const openstudio::IddObjectType& iddObjectType) {
switch (iddObjectType.value()) {
Expand Down
4 changes: 2 additions & 2 deletions src/openstudio_lib/EMSInspectorView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ void EMSInspectorView::layoutModelObject(const model::ModelObject& modelObject)

const auto actuatorNames = objecti.emsActuatorNames();

for (const auto actuator : actuatorNames) {
for (const auto& actuator : actuatorNames) {
auto* actuatorWidget = new EMSInspectorActuator(actuator, objecti);
m_layout->addWidget(actuatorWidget);
}
Expand All @@ -253,7 +253,7 @@ void EMSInspectorView::layoutModelObject(const model::ModelObject& modelObject)

const auto sensorNames = objecti.outputVariableNames();

for (const auto sensor : sensorNames) {
for (const auto& sensor : sensorNames) {
auto* sensorWidget = new EMSInspectorSensor(sensor, objecti);
m_layout->addWidget(sensorWidget);
}
Expand Down
4 changes: 3 additions & 1 deletion src/openstudio_lib/FacilityExteriorEquipmentGridView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,9 @@ QString FacilityExteriorEquipmentGridController::getColor(const model::ModelObje
}

void FacilityExteriorEquipmentGridController::checkSelectedFields() {
if (!this->hasHorizontalHeader()) return;
if (!this->hasHorizontalHeader()) {
return;
}

OSGridController::checkSelectedFields();
}
Expand Down
22 changes: 11 additions & 11 deletions src/openstudio_lib/FacilityShadingGridView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ void FacilityShadingGridView::nameFilterChanged() {
if (m_nameFilter->text().isEmpty()) {
// nothing to filter
} else {
for (auto obj : this->m_gridController->selectableObjects()) {
for (const auto& obj : this->m_gridController->selectableObjects()) {
QString objName(obj.name().get().c_str());
if (!objName.contains(m_nameFilter->text(), Qt::CaseInsensitive)) {
m_objectsFilteredByName.insert(obj);
Expand All @@ -276,7 +276,7 @@ void FacilityShadingGridView::typeFilterChanged(const QString& text) {
if (m_typeFilter->currentText() == "All") {
// Nothing to filter
} else {
for (auto obj : this->m_gridController->selectableObjects()) {
for (const auto& obj : this->m_gridController->selectableObjects()) {
auto parent = obj.parent();
if (parent && parent->iddObjectType() == IddObjectType::OS_ShadingSurfaceGroup) {
if (m_typeFilter->currentText() != parent->cast<model::ShadingSurfaceGroup>().shadingSurfaceType().c_str()) {
Expand Down Expand Up @@ -311,9 +311,9 @@ void FacilityShadingGridView::orientationFilterChanged() {
OS_ASSERT(convertedValue);
lowerLimit = *convertedValue;

for (auto obj : this->m_gridController->selectableObjects()) {
for (const auto& obj : this->m_gridController->selectableObjects()) {
if (obj.iddObjectType() == IddObjectType::OS_ShadingSurfaceGroup) {
for (auto shadingSurface : obj.cast<model::ShadingSurfaceGroup>().shadingSurfaces()) {
for (const auto& shadingSurface : obj.cast<model::ShadingSurfaceGroup>().shadingSurfaces()) {
auto orientation = shadingSurface.azimuth();
if (orientation >= upperLimit || orientation <= lowerLimit) {
m_objectsFilteredByOrientation.insert(obj);
Expand Down Expand Up @@ -347,9 +347,9 @@ void FacilityShadingGridView::tiltFilterChanged() {
OS_ASSERT(convertedValue);
lowerLimit = *convertedValue;

for (auto obj : this->m_gridController->selectableObjects()) {
for (const auto& obj : this->m_gridController->selectableObjects()) {
if (obj.iddObjectType() == IddObjectType::OS_ShadingSurfaceGroup) {
for (auto shadingSurface : obj.cast<model::ShadingSurfaceGroup>().shadingSurfaces()) {
for (const auto& shadingSurface : obj.cast<model::ShadingSurfaceGroup>().shadingSurfaces()) {
auto tilt = shadingSurface.tilt();
if (tilt >= upperLimit || tilt <= lowerLimit) {
m_objectsFilteredByOrientation.insert(obj);
Expand All @@ -364,15 +364,15 @@ void FacilityShadingGridView::tiltFilterChanged() {
void FacilityShadingGridView::filterChanged() {
std::set<openstudio::model::ModelObject> allFilteredObjects = m_objectsFilteredByName;

for (auto obj : m_objectsFilteredByTilt) {
for (const auto& obj : m_objectsFilteredByTilt) {
allFilteredObjects.insert(obj);
}

for (auto obj : m_objectsFilteredByType) {
for (const auto& obj : m_objectsFilteredByType) {
allFilteredObjects.insert(obj);
}

for (auto obj : m_objectsFilteredByOrientation) {
for (const auto& obj : m_objectsFilteredByOrientation) {
allFilteredObjects.insert(obj);
}

Expand All @@ -390,14 +390,14 @@ void FacilityShadingGridView::addObject(const IddObjectType& iddObjectType) {

void FacilityShadingGridView::purgeObjects(const IddObjectType& iddObjectType) {
// If no shading surfaces in the Shading Surface Group -> remove
for (auto mo : this->m_model.getConcreteModelObjects<model::ShadingSurfaceGroup>()) {
for (auto& mo : this->m_model.getConcreteModelObjects<model::ShadingSurfaceGroup>()) {
if (mo.shadingSurfaces().empty()) {
mo.remove();
}
}

// If a shading surface isn't part of a Shading Surface Group, it won't be translated to IDF anyways and should be considered orphaned
for (auto mo : this->m_model.getConcreteModelObjects<model::ShadingSurface>()) {
for (auto& mo : this->m_model.getConcreteModelObjects<model::ShadingSurface>()) {
if (!mo.shadingSurfaceGroup().has_value()) {
mo.remove();
}
Expand Down
4 changes: 3 additions & 1 deletion src/openstudio_lib/FacilityStoriesGridView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,9 @@ QString FacilityStoriesGridController::getColor(const model::ModelObject& modelO
}

void FacilityStoriesGridController::checkSelectedFields() {
if (!this->hasHorizontalHeader()) return;
if (!this->hasHorizontalHeader()) {
return;
}

OSGridController::checkSelectedFields();
}
Expand Down
4 changes: 2 additions & 2 deletions src/openstudio_lib/GeometryPreviewView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ GeometryPreviewView::GeometryPreviewView(bool isIP, const openstudio::model::Mod
setLayout(layout);
}

GeometryPreviewView::~GeometryPreviewView() {}
GeometryPreviewView::~GeometryPreviewView() = default;

PreviewWebView::PreviewWebView(bool isIP, const model::Model& model, QWidget* t_parent)
: QWidget(t_parent), m_isIP(isIP), m_model(model), m_progressBar(new QProgressBar()), m_refreshBtn(new QPushButton("Refresh")) {
Expand Down Expand Up @@ -127,7 +127,7 @@ PreviewWebView::PreviewWebView(bool isIP, const model::Model& model, QWidget* t_
m_view->load(previewURL);
}

PreviewWebView::~PreviewWebView() {}
PreviewWebView::~PreviewWebView() = default;

void PreviewWebView::refreshClicked() {
m_progressBar->setStyleSheet("");
Expand Down
2 changes: 1 addition & 1 deletion src/openstudio_lib/LifeCycleCostsTabView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ LifeCycleCostsView::LifeCycleCostsView(const model::Model& model) : QWidget(), m
attach(m_lifeCycleCostParameters.get());
}

LifeCycleCostsView::~LifeCycleCostsView() {}
LifeCycleCostsView::~LifeCycleCostsView() = default;

void LifeCycleCostsView::createWidgets() {

Expand Down
2 changes: 1 addition & 1 deletion src/openstudio_lib/LoadsController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ LoadsController::LoadsController(bool isIP, const model::Model& model) : ModelSu
connect(this, &LoadsController::toggleUnitsClicked, static_cast<ModelSubTabView*>(subTabView()), &ModelSubTabView::toggleUnitsClicked);
}

LoadsController::~LoadsController() {}
LoadsController::~LoadsController() = default;

void LoadsController::onAddObject(const openstudio::IddObjectType& iddObjectType) {
switch (iddObjectType.value()) {
Expand Down
2 changes: 1 addition & 1 deletion src/openstudio_lib/LoadsTabController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ LoadsTabController::LoadsTabController(bool isIP, const model::Model& model) : M
connect(m_LoadsController.get(), &LoadsController::openLibDlgClicked, this, &LoadsTabController::openLibDlgClicked);
}

LoadsTabController::~LoadsTabController() {}
LoadsTabController::~LoadsTabController() = default;

void LoadsTabController::toggleUnits(bool displayIP) {}

Expand Down
2 changes: 1 addition & 1 deletion src/openstudio_lib/LoopScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ LoopScene::LoopScene(model::Loop loop, QObject* parent) : GridScene(parent), m_l
// loop.model().getImpl<model::detail::Model_Impl>().get()->addWorkspaceObjectPtr.connect<LoopScene, &LoopScene::addedWorkspaceObject>(this);
connect(OSAppBase::instance(), &OSAppBase::workspaceObjectAddedPtr, this, &LoopScene::addedWorkspaceObject, Qt::QueuedConnection);

loop.model().getImpl<model::detail::Model_Impl>().get()->removeWorkspaceObjectPtr.connect<LoopScene, &LoopScene::removedWorkspaceObject>(this);
loop.model().getImpl<model::detail::Model_Impl>()->removeWorkspaceObjectPtr.connect<LoopScene, &LoopScene::removedWorkspaceObject>(this);

layout();
}
Expand Down
2 changes: 1 addition & 1 deletion src/openstudio_lib/MainTabController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ MainTabController::MainTabController(MainTabView* mainContentWidget) : OSQObject
addQObject(mainContentWidget);
}

MainTabController::~MainTabController() {}
MainTabController::~MainTabController() = default;

MainTabView* MainTabController::mainContentWidget() const {
return m_mainContentWidget;
Expand Down
8 changes: 6 additions & 2 deletions src/openstudio_lib/MainTabView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ void MainTabView::setTabType(MainTabView::TabType tabType) {
bool MainTabView::addTabWidget(QWidget* widget) {
// This method should only be called in cases where the tab will not have sub tabs
OS_ASSERT(m_tabType == MAIN_TAB);
if (m_tabType != MAIN_TAB) return false;
if (m_tabType != MAIN_TAB) {
return false;
}

m_editView->setView(widget);

Expand All @@ -132,7 +134,9 @@ bool MainTabView::addTabWidget(QWidget* widget) {
bool MainTabView::addSubTab(const QString& subTabLabel, int id) {
// This method should only be called in cases where the tab will have sub tabs
OS_ASSERT(m_tabType != MAIN_TAB);
if (m_tabType == MAIN_TAB) return false;
if (m_tabType == MAIN_TAB) {
return false;
}

auto* button = new QPushButton(this);
button->setText(subTabLabel);
Expand Down
2 changes: 1 addition & 1 deletion src/openstudio_lib/MaterialsController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace openstudio {
MaterialsController::MaterialsController(bool isIP, const model::Model& model)
: ModelSubTabController(new MaterialsView(isIP, model, "Materials", false), model) {}

MaterialsController::~MaterialsController() {}
MaterialsController::~MaterialsController() = default;

void MaterialsController::onAddObject(const openstudio::IddObjectType& iddObjectType) {
model::Model model = this->model();
Expand Down
7 changes: 2 additions & 5 deletions src/openstudio_lib/ModelObjectInspectorView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,19 @@ void ModelObjectInspectorView::update() {
void ModelObjectInspectorView::selectModelObject(const openstudio::model::ModelObject& modelObject) {
if (m_modelObject) {
m_modelObject->getImpl<openstudio::model::detail::ModelObject_Impl>()
.get()
->onChange.disconnect<ModelObjectInspectorView, &ModelObjectInspectorView::update>(this);
}

m_modelObject = modelObject;

m_modelObject->getImpl<model::detail::ModelObject_Impl>().get()->onChange.connect<ModelObjectInspectorView, &ModelObjectInspectorView::update>(
this);
m_modelObject->getImpl<model::detail::ModelObject_Impl>()->onChange.connect<ModelObjectInspectorView, &ModelObjectInspectorView::update>(this);

onSelectModelObject(*m_modelObject);
}

void ModelObjectInspectorView::onClearSelection() {
if (m_modelObject) {
m_modelObject->getImpl<model::detail::ModelObject_Impl>().get()->onChange.disconnect<ModelObjectInspectorView, &ModelObjectInspectorView::update>(
this);
m_modelObject->getImpl<model::detail::ModelObject_Impl>()->onChange.disconnect<ModelObjectInspectorView, &ModelObjectInspectorView::update>(this);
}

m_modelObject.reset();
Expand Down
2 changes: 1 addition & 1 deletion src/openstudio_lib/ModelObjectItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ ModelObjectItem::ModelObjectItem(const openstudio::model::ModelObject& modelObje
: OSItem(modelObjectToItemId(modelObject, isDefaulted), type, parent), m_handle(modelObject.handle()), m_modelObject(modelObject) {
this->setText(QString::fromStdString(m_modelObject.name().get()));

m_modelObject.getImpl<model::detail::ModelObject_Impl>().get()->onChange.connect<ModelObjectItem, &ModelObjectItem::onObjectChanged>(this);
m_modelObject.getImpl<model::detail::ModelObject_Impl>()->onChange.connect<ModelObjectItem, &ModelObjectItem::onObjectChanged>(this);

if (!modelObject.getModelObjectSources<model::ComponentData>().empty()) {
m_measureBadge->setMeasureBadgeType(MeasureBadgeType::BCLMeasure);
Expand Down
2 changes: 1 addition & 1 deletion src/openstudio_lib/ModelObjectListView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ std::vector<OSItemId> ModelObjectListController::makeVector() {
// sort by name
std::sort(workspaceObjects.begin(), workspaceObjects.end(), WorkspaceObjectNameGreater());

for (WorkspaceObject workspaceObject : workspaceObjects) {
for (const WorkspaceObject& workspaceObject : workspaceObjects) {
if (!workspaceObject.handle().isNull()) {
auto modelObject = workspaceObject.cast<openstudio::model::ModelObject>();
if (boost::optional<model::HVACComponent> hvacComponent = modelObject.optionalCast<model::HVACComponent>()) {
Expand Down
16 changes: 4 additions & 12 deletions src/openstudio_lib/ModelObjectVectorController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,13 @@ void ModelObjectVectorController::attach(const model::ModelObject& modelObject)
//connect(OSAppBase::instance(), &OSAppBase::workspaceObjectRemovedPtr, this, &ModelObjectVectorController::objectRemoved, Qt::QueuedConnection);

m_modelObject->getImpl<model::detail::ModelObject_Impl>()
.get()
->onRelationshipChange.connect<ModelObjectVectorController, &ModelObjectVectorController::changeRelationship>(this);

m_modelObject->getImpl<model::detail::ModelObject_Impl>()
.get()
->onDataChange.connect<ModelObjectVectorController, &ModelObjectVectorController::dataChange>(this);

m_modelObject->getImpl<model::detail::ModelObject_Impl>()
.get()
->onChange.connect<ModelObjectVectorController, &ModelObjectVectorController::change>(this);
m_modelObject->getImpl<model::detail::ModelObject_Impl>()->onChange.connect<ModelObjectVectorController, &ModelObjectVectorController::change>(
this);
}

void ModelObjectVectorController::attachModel(const model::Model& model) {
Expand Down Expand Up @@ -97,23 +94,19 @@ void ModelObjectVectorController::attachOtherModelObject(const model::ModelObjec
m_otherModelObjects.push_back(modelObject);

modelObject.getImpl<model::detail::ModelObject_Impl>()
.get()
->onRelationshipChange.connect<ModelObjectVectorController, &ModelObjectVectorController::changeRelationship>(this);
}

void ModelObjectVectorController::detach() {
if (m_modelObject) {
m_modelObject->getImpl<model::detail::ModelObject_Impl>()
.get()
->onRelationshipChange.disconnect<ModelObjectVectorController, &ModelObjectVectorController::changeRelationship>(this);

m_modelObject->getImpl<model::detail::ModelObject_Impl>()
.get()
->onDataChange.disconnect<ModelObjectVectorController, &ModelObjectVectorController::dataChange>(this);

m_modelObject->getImpl<model::detail::ModelObject_Impl>()
.get()
->onChange.disconnect<ModelObjectVectorController, &ModelObjectVectorController::change>(this);
m_modelObject->getImpl<model::detail::ModelObject_Impl>()->onChange.disconnect<ModelObjectVectorController, &ModelObjectVectorController::change>(
this);

m_modelObject.reset();
}
Expand All @@ -138,7 +131,6 @@ void ModelObjectVectorController::detachOtherModelObject(const model::ModelObjec
for (; it != itend; ++it) {
if (it->handle() == modelObject.handle()) {
m_modelObject->getImpl<model::detail::ModelObject_Impl>()
.get()
->onRelationshipChange.disconnect<ModelObjectVectorController, &ModelObjectVectorController::changeRelationship>(this);

//m_modelObject->getImpl<model::detail::ModelObject_Impl>().get()->onDataChange.disconnect<ModelObjectVectorController, &ModelObjectVectorController::dataChange>(this);
Expand Down
Loading

0 comments on commit 468a62b

Please sign in to comment.