From 3e5c07f600a3ac048b7dc6923234a1586a157063 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Sat, 3 Oct 2020 12:00:20 +0200 Subject: [PATCH] rm redundant boolean constants --- Core/Fitting/FitObserver.h | 2 +- GUI/coregui/Models/ComponentProxyStrategy.cpp | 2 +- GUI/coregui/Models/JobItem.cpp | 2 +- GUI/coregui/Models/ModelMapper.h | 2 +- GUI/coregui/Models/ParticleLayoutItem.cpp | 2 +- GUI/coregui/Views/PropertyEditor/MultiComboPropertyEditor.cpp | 2 +- GUI/coregui/Views/RealSpaceWidgets/RealSpaceBuilder.cpp | 2 +- GUI/coregui/Views/SampleDesigner/NodeEditorPort.cpp | 2 +- GUI/coregui/mainwindow/SaveService.cpp | 2 +- GUI/main/appoptions.cpp | 2 +- Tests/Functional/GUI/Other/SaveLoadProject.cpp | 2 +- Tests/Functional/GUI/Translate/GUITranslationTest.cpp | 4 ++-- Tests/Performance/Core/CoreIO.cpp | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Core/Fitting/FitObserver.h b/Core/Fitting/FitObserver.h index 7c56ec59c5e..82c15e89d70 100644 --- a/Core/Fitting/FitObserver.h +++ b/Core/Fitting/FitObserver.h @@ -86,7 +86,7 @@ template <class T> void FitObserver<T>::notify_all(const T& data) template <class T> bool FitObserver<T>::need_notify(int every_nth) { - return m_notify_count == 0 || m_notify_count % every_nth == 0 ? true : false; + return m_notify_count == 0 || m_notify_count % every_nth == 0; } #endif // BORNAGAIN_CORE_FITTING_FITOBSERVER_H diff --git a/GUI/coregui/Models/ComponentProxyStrategy.cpp b/GUI/coregui/Models/ComponentProxyStrategy.cpp index b5c3c4436b4..26419c78b64 100644 --- a/GUI/coregui/Models/ComponentProxyStrategy.cpp +++ b/GUI/coregui/Models/ComponentProxyStrategy.cpp @@ -65,7 +65,7 @@ bool ComponentProxyStrategy::isPropertyRelated(SessionItem* item) if (m_sourceRootIndex.isValid() && item->parent()->index() == m_sourceRootIndex && item->parent()->modelType() != "GroupProperty") - return propertyRelated.contains(item->modelType()) ? true : false; + return propertyRelated.contains(item->modelType()); return true; } diff --git a/GUI/coregui/Models/JobItem.cpp b/GUI/coregui/Models/JobItem.cpp index 6d624d30df6..854750eedae 100644 --- a/GUI/coregui/Models/JobItem.cpp +++ b/GUI/coregui/Models/JobItem.cpp @@ -165,7 +165,7 @@ bool JobItem::isFailed() const bool JobItem::isValidForFitting() { - return isTag(T_REALDATA) && getItem(T_REALDATA) ? true : false; + return isTag(T_REALDATA) && getItem(T_REALDATA); } void JobItem::setBeginTime(const QString& begin_time) diff --git a/GUI/coregui/Models/ModelMapper.h b/GUI/coregui/Models/ModelMapper.h index 84d62ddcc1f..5af3c798f92 100644 --- a/GUI/coregui/Models/ModelMapper.h +++ b/GUI/coregui/Models/ModelMapper.h @@ -109,7 +109,7 @@ template <class U> inline void ModelMapper::clean_container(U& v, const void* ca { v.erase(std::remove_if(v.begin(), v.end(), [caller](typename U::value_type const& x) -> bool { - return (x.second == caller ? true : false); + return (x.second == caller); }), v.end()); } diff --git a/GUI/coregui/Models/ParticleLayoutItem.cpp b/GUI/coregui/Models/ParticleLayoutItem.cpp index 6a895b7c5d9..c31ebeadb99 100644 --- a/GUI/coregui/Models/ParticleLayoutItem.cpp +++ b/GUI/coregui/Models/ParticleLayoutItem.cpp @@ -33,7 +33,7 @@ bool isInterference2D(const QString& name) //! Returns true if name is related to 2D interference functions. bool isLattice2D(SessionItem* item) { - return dynamic_cast<Lattice2DItem*>(item) ? true : false; + return dynamic_cast<Lattice2DItem*>(item); } const QString density_tooltip = diff --git a/GUI/coregui/Views/PropertyEditor/MultiComboPropertyEditor.cpp b/GUI/coregui/Views/PropertyEditor/MultiComboPropertyEditor.cpp index 675567f7fd3..9f4248ee7fd 100644 --- a/GUI/coregui/Views/PropertyEditor/MultiComboPropertyEditor.cpp +++ b/GUI/coregui/Views/PropertyEditor/MultiComboPropertyEditor.cpp @@ -96,7 +96,7 @@ void MultiComboPropertyEditor::onModelDataChanged(const QModelIndex& topLeft, co return; ComboProperty comboProperty = m_data.value<ComboProperty>(); - auto state = item->checkState() == Qt::Checked ? true : false; + auto state = item->checkState() == Qt::Checked; comboProperty.setSelected(topLeft.row(), state); updateBoxLabel(); diff --git a/GUI/coregui/Views/RealSpaceWidgets/RealSpaceBuilder.cpp b/GUI/coregui/Views/RealSpaceWidgets/RealSpaceBuilder.cpp index 568ef7b95ab..2b5867480a0 100644 --- a/GUI/coregui/Views/RealSpaceWidgets/RealSpaceBuilder.cpp +++ b/GUI/coregui/Views/RealSpaceWidgets/RealSpaceBuilder.cpp @@ -88,7 +88,7 @@ void RealSpaceBuilder::populateMultiLayer(RealSpaceModel* model, const SessionIt int index(0); for (auto layer : item.getItems(MultiLayerItem::T_LAYERS)) { - bool isTopLayer = index == 0 ? true : false; + bool isTopLayer = index == 0; populateLayer(model, *layer, sceneGeometry, QVector3D(0, 0, static_cast<float>(-total_height)), isTopLayer); diff --git a/GUI/coregui/Views/SampleDesigner/NodeEditorPort.cpp b/GUI/coregui/Views/SampleDesigner/NodeEditorPort.cpp index 8134b849aa3..6c13f9572e0 100644 --- a/GUI/coregui/Views/SampleDesigner/NodeEditorPort.cpp +++ b/GUI/coregui/Views/SampleDesigner/NodeEditorPort.cpp @@ -55,7 +55,7 @@ NodeEditorPort::~NodeEditorPort() bool NodeEditorPort::isOutput() { - return (m_direction == OUTPUT ? true : false); + return (m_direction == OUTPUT); } bool NodeEditorPort::isInput() diff --git a/GUI/coregui/mainwindow/SaveService.cpp b/GUI/coregui/mainwindow/SaveService.cpp index 5b7b63f9160..d9274daa179 100644 --- a/GUI/coregui/mainwindow/SaveService.cpp +++ b/GUI/coregui/mainwindow/SaveService.cpp @@ -63,7 +63,7 @@ void SaveService::setAutosaveEnabled(bool value) bool SaveService::isAutosaveEnabled() const { - return m_autosave ? true : false; + return m_autosave; } void SaveService::setAutosaveTime(int timerInterval) diff --git a/GUI/main/appoptions.cpp b/GUI/main/appoptions.cpp index 7cb7c7b18dd..b4310b20b89 100644 --- a/GUI/main/appoptions.cpp +++ b/GUI/main/appoptions.cpp @@ -70,7 +70,7 @@ const bpo::variable_value& ApplicationOptions::operator[](const std::string& s) bool ApplicationOptions::find(std::string name) const { - return (m_variables_map.count(name.c_str()) ? true : false); + return (m_variables_map.count(name.c_str())); } bool ApplicationOptions::isConsistent() const diff --git a/Tests/Functional/GUI/Other/SaveLoadProject.cpp b/Tests/Functional/GUI/Other/SaveLoadProject.cpp index f785d40b6a7..d03b7a86e91 100644 --- a/Tests/Functional/GUI/Other/SaveLoadProject.cpp +++ b/Tests/Functional/GUI/Other/SaveLoadProject.cpp @@ -75,7 +75,7 @@ bool GUISaveLoadProject::runTest() // analyze difference nerr += check_difference(projectName1, projectName2); - return nerr == 0 ? true : false; + return nerr == 0; } int GUISaveLoadProject::run_job() diff --git a/Tests/Functional/GUI/Translate/GUITranslationTest.cpp b/Tests/Functional/GUI/Translate/GUITranslationTest.cpp index d8fbeb3828b..c249bab5948 100644 --- a/Tests/Functional/GUI/Translate/GUITranslationTest.cpp +++ b/Tests/Functional/GUI/Translate/GUITranslationTest.cpp @@ -258,7 +258,7 @@ bool GUITranslationTest::checkExistingTranslations() } std::cout << ostr.str(); - bool isSuccess = (wrong_translations.empty() ? true : false); + bool isSuccess = (wrong_translations.empty()); return isSuccess; } @@ -296,6 +296,6 @@ bool GUITranslationTest::checkMissedTranslations() std::cout << "domain : " << name << std::endl; } - bool isSuccess = (missedNames.empty() ? true : false); + bool isSuccess = (missedNames.empty()); return isSuccess; } diff --git a/Tests/Performance/Core/CoreIO.cpp b/Tests/Performance/Core/CoreIO.cpp index 1971c84bc83..52eabeb56d0 100644 --- a/Tests/Performance/Core/CoreIO.cpp +++ b/Tests/Performance/Core/CoreIO.cpp @@ -118,7 +118,7 @@ bool test_io(int nx, int ny, bool random_data, const std::string& ext) results.push_back(result); - bool success = result.m_biggest_diff < 1e-10 ? true : false; + bool success = result.m_biggest_diff < 1e-10; return success; } -- GitLab