diff --git a/Framework/API/src/Algorithm.cpp b/Framework/API/src/Algorithm.cpp index 795addd969ac721041278f3aabd435256340af8d..22239ea2e19b5fbc61d4647d2ff60a2e76503683 100644 --- a/Framework/API/src/Algorithm.cpp +++ b/Framework/API/src/Algorithm.cpp @@ -1711,7 +1711,7 @@ void Algorithm::execMasterOnly() { * non-master ranks in master-only execution. */ void Algorithm::execNonMaster() { // If there is no output we can simply do nothing. - if (m_pureOutputWorkspaceProps.size() == 0) + if (m_pureOutputWorkspaceProps.empty()) return; // Does Algorithm have exactly one input and one output workspace property? if (m_inputWorkspaceProps.size() == 1 && diff --git a/Framework/API/src/DetectorSearcher.cpp b/Framework/API/src/DetectorSearcher.cpp index 76d8f93ebde94c6401f725623b7312ce259264d0..6170612c8930c7bb2f62217ece071b2444bc7cfe 100644 --- a/Framework/API/src/DetectorSearcher.cpp +++ b/Framework/API/src/DetectorSearcher.cpp @@ -148,7 +148,7 @@ DetectorSearcher::searchUsingNearestNeighbours(const V3D &q) { // find where this Q vector should intersect with "extended" space const auto neighbours = m_detectorCacheSearch->findNearest(Eigen::Vector3d(q[0], q[1], q[2]), 5); - if (neighbours.size() == 0) + if (neighbours.empty()) return std::make_tuple(false, 0); const auto result = checkInteceptWithNeighbours(detectorDir, neighbours); diff --git a/Framework/API/src/IndexTypeProperty.cpp b/Framework/API/src/IndexTypeProperty.cpp index df454100350d4ab71ce1c45378f118277c757c7d..7a45c4741b78f912e8a8650e3c810070a876abcb 100644 --- a/Framework/API/src/IndexTypeProperty.cpp +++ b/Framework/API/src/IndexTypeProperty.cpp @@ -10,7 +10,7 @@ IndexTypeProperty::IndexTypeProperty(const std::string &name, if (indexType & IndexType::SpectrumNum) m_allowedValues.push_back("SpectrumNumber"); - if (m_allowedValues.size() == 0) + if (m_allowedValues.empty()) throw std::invalid_argument("Argument indexType incorrectly specified"); m_value = m_allowedValues[0]; diff --git a/Framework/API/src/MatrixWorkspace.cpp b/Framework/API/src/MatrixWorkspace.cpp index 2a1794eb532b86a58fcf5e927b5977f18d57a124..c07904a0494dddf5f2d9e7a94e421caa57f69130 100644 --- a/Framework/API/src/MatrixWorkspace.cpp +++ b/Framework/API/src/MatrixWorkspace.cpp @@ -239,7 +239,7 @@ void MatrixWorkspace::initialize(const std::size_t &NVectors, void MatrixWorkspace::initialize(const std::size_t &NVectors, const HistogramData::Histogram &histogram) { // Check validity of arguments - if (NVectors == 0 || histogram.x().size() == 0) { + if (NVectors == 0 || histogram.x().empty()) { throw std::out_of_range( "All arguments to init must be positive and non-zero"); } diff --git a/Framework/Algorithms/src/AddSampleLog.cpp b/Framework/Algorithms/src/AddSampleLog.cpp index 5b7be49cd1ec18313fc9cb234d05186019b4b4dd..7abbf956b7f33aed2183fa248bec3a15b7963bee 100644 --- a/Framework/Algorithms/src/AddSampleLog.cpp +++ b/Framework/Algorithms/src/AddSampleLog.cpp @@ -228,7 +228,7 @@ void AddSampleLog::addTimeSeriesProperty(Run &run_obj, is_int_series = true; } else if (prop_number_type == autoTypeOption) { // auto type. by default - if (prop_value.size() == 0) + if (prop_value.empty()) g_log.warning("For sample log in TimeSeriesProperty and values are given " "by MarixWorkspace, the default data type " "is double."); @@ -248,8 +248,8 @@ void AddSampleLog::addTimeSeriesProperty(Run &run_obj, // check using workspace or some specified start value std::string tsp_ws_name = getPropertyValue("TimeSeriesWorkspace"); - bool use_ws = tsp_ws_name.size() > 0; - bool use_single_value = prop_value.size() > 0; + bool use_ws = !tsp_ws_name.empty(); + bool use_single_value = !prop_value.empty(); if (use_ws && use_single_value) { throw std::runtime_error("Both TimeSeries workspace and sing value are " "specified. It is not allowed."); diff --git a/Framework/Algorithms/src/ChangeTimeZero.cpp b/Framework/Algorithms/src/ChangeTimeZero.cpp index 631e7068f154165958d57d7d2dd56897c1dabdad..5494590af12673237310f09444f63aac815b0dfc 100644 --- a/Framework/Algorithms/src/ChangeTimeZero.cpp +++ b/Framework/Algorithms/src/ChangeTimeZero.cpp @@ -331,7 +331,7 @@ bool ChangeTimeZero::checkForDateTime(const std::string &val) const { // Hedge for bad lexical casts in the DateTimeValidator try { DateTimeValidator validator = DateTimeValidator(); - isDateTime = validator.isValid(val) == ""; + isDateTime = validator.isValid(val).empty(); } catch (...) { isDateTime = false; } diff --git a/Framework/Algorithms/src/ConvertAxisByFormula.cpp b/Framework/Algorithms/src/ConvertAxisByFormula.cpp index ada62fb7d4e67eb951a6db5656442b4f7a2f0481..de1ab2350a84783216df15414e77d9a00103c55e 100644 --- a/Framework/Algorithms/src/ConvertAxisByFormula.cpp +++ b/Framework/Algorithms/src/ConvertAxisByFormula.cpp @@ -105,7 +105,7 @@ void ConvertAxisByFormula::exec() { RefAxis *refAxisPtr = dynamic_cast<RefAxis *>(axisPtr); if (refAxisPtr != nullptr) { CommonBinsValidator sameBins; - if (sameBins.isValid(outputWs) != "") { + if (!sameBins.isValid(outputWs).empty()) { isRaggedBins = true; } isRefAxis = true; @@ -245,14 +245,14 @@ void ConvertAxisByFormula::exec() { } // Set the Unit of the Axis - if ((axisUnits != "") || (axisTitle != "")) { + if ((!axisUnits.empty()) || (!axisTitle.empty())) { try { axisPtr->unit() = UnitFactory::Instance().create(axisUnits); } catch (Exception::NotFoundError &) { - if (axisTitle == "") { + if (axisTitle.empty()) { axisTitle = axisPtr->unit()->caption(); } - if (axisUnits == "") { + if (axisUnits.empty()) { axisUnits = axisPtr->unit()->label(); } axisPtr->unit() = boost::make_shared<Units::Label>(axisTitle, axisUnits); diff --git a/Framework/Algorithms/src/ConvertUnits.cpp b/Framework/Algorithms/src/ConvertUnits.cpp index 33fa5a87287359031c52e4df80af0856e4246cf9..7f58d71c62d25f033a5ca0ac5004ac5dbd73a63a 100644 --- a/Framework/Algorithms/src/ConvertUnits.cpp +++ b/Framework/Algorithms/src/ConvertUnits.cpp @@ -337,7 +337,7 @@ ConvertUnits::convertQuickly(API::MatrixWorkspace_const_sptr inputWS, // First a quick check using the validator CommonBinsValidator sameBins; bool commonBoundaries = false; - if (sameBins.isValid(inputWS) == "") { + if (sameBins.isValid(inputWS).empty()) { commonBoundaries = WorkspaceHelpers::commonBoundaries(*inputWS); // Only do the full check if the quick one passes if (commonBoundaries) { diff --git a/Framework/Algorithms/src/DiffractionEventCalibrateDetectors.cpp b/Framework/Algorithms/src/DiffractionEventCalibrateDetectors.cpp index 5136276a2e8c353b52b37d9a0c0f0579530102c0..24381be1b96d7f0ff0d4f7065ef00ae70228f5ad 100644 --- a/Framework/Algorithms/src/DiffractionEventCalibrateDetectors.cpp +++ b/Framework/Algorithms/src/DiffractionEventCalibrateDetectors.cpp @@ -299,7 +299,7 @@ void DiffractionEventCalibrateDetectors::exec() { std::vector<boost::shared_ptr<RectangularDetector>> detList; // --------- Loading only one bank ---------------------------------- std::string onebank = getProperty("BankName"); - bool doOneBank = (onebank != ""); + bool doOneBank = (!onebank.empty()); for (int i = 0; i < inst->nelements(); i++) { boost::shared_ptr<RectangularDetector> det; boost::shared_ptr<ICompAssembly> assem; diff --git a/Framework/Algorithms/src/DiffractionFocussing2.cpp b/Framework/Algorithms/src/DiffractionFocussing2.cpp index 5465caa11d939c648c23b353671c930ae19ecbca..875954fbee9fa68cd2a12920b9a98e9431644b36 100644 --- a/Framework/Algorithms/src/DiffractionFocussing2.cpp +++ b/Framework/Algorithms/src/DiffractionFocussing2.cpp @@ -109,7 +109,7 @@ void DiffractionFocussing2::exec() { throw std::invalid_argument("Workspace Invalid Spacing/UnitID"); } // --- Do we need to read the grouping workspace? ---- - if (groupingFileName != "") { + if (!groupingFileName.empty()) { progress(0.01, "Reading grouping file"); IAlgorithm_sptr childAlg = createChildAlgorithm("CreateGroupingWorkspace"); childAlg->setProperty( diff --git a/Framework/Algorithms/src/ExportTimeSeriesLog.cpp b/Framework/Algorithms/src/ExportTimeSeriesLog.cpp index bdce22f34a065590d40664d9e3b8f1a82431eeda..35c15bc9fa4cbb290bda06618c27f87ce484d0df 100644 --- a/Framework/Algorithms/src/ExportTimeSeriesLog.cpp +++ b/Framework/Algorithms/src/ExportTimeSeriesLog.cpp @@ -429,7 +429,7 @@ void ExportTimeSeriesLog::calculateFirstDerivative(bool is_event_ws) { // error message std::string errmsg = errmsg_ss.str(); - if (errmsg.size() > 0) + if (!errmsg.empty()) g_log.error(errmsg); return; diff --git a/Framework/Algorithms/src/FilterByTime.cpp b/Framework/Algorithms/src/FilterByTime.cpp index dd08a9f46bd68884002419ff6e3d53e8ce330d44..fe151e505ff1fcfcacbe1372c99766a0c8938212 100644 --- a/Framework/Algorithms/src/FilterByTime.cpp +++ b/Framework/Algorithms/src/FilterByTime.cpp @@ -77,12 +77,12 @@ void FilterByTime::exec() { start_str = getPropertyValue("AbsoluteStartTime"); stop_str = getPropertyValue("AbsoluteStopTime"); - if ((start_str != "") && (stop_str != "") && (start_dbl <= 0.0) && + if ((!start_str.empty()) && (!stop_str.empty()) && (start_dbl <= 0.0) && (stop_dbl <= 0.0)) { // Use the absolute string start = DateAndTime(start_str); stop = DateAndTime(stop_str); - } else if ((start_str == "") && (stop_str == "") && + } else if ((start_str.empty()) && (stop_str.empty()) && ((start_dbl > 0.0) || (stop_dbl > 0.0))) { // Use the relative times in seconds. DateAndTime first = inputWS->getFirstPulseTime(); diff --git a/Framework/Algorithms/src/FilterByTime2.cpp b/Framework/Algorithms/src/FilterByTime2.cpp index 74ab57080842fac8b8418fb0c8327b9b52d0218f..71d70f362807d68d22e2b6c138781d9a8a9e9824 100644 --- a/Framework/Algorithms/src/FilterByTime2.cpp +++ b/Framework/Algorithms/src/FilterByTime2.cpp @@ -73,12 +73,12 @@ void FilterByTime2::exec() { std::string absstoptime = this->getProperty("AbsoluteStopTime"); std::string start, stop; - if ((absstarttime != "") && (absstoptime != "") && (starttime <= 0.0) && + if ((!absstarttime.empty()) && (!absstoptime.empty()) && (starttime <= 0.0) && (stoptime <= 0.0)) { // Use the absolute string start = absstarttime; stop = absstoptime; - } else if ((absstarttime != "" || absstoptime != "") && + } else if ((!absstarttime.empty() || !absstoptime.empty()) && (starttime > 0.0 || stoptime > 0.0)) { throw std::invalid_argument( "It is not allowed to provide both absolute time and relative time."); diff --git a/Framework/Algorithms/src/FilterEvents.cpp b/Framework/Algorithms/src/FilterEvents.cpp index 9f6b05f04ff7d53d837271dba8553b3b3afe4b43..c4a4cf3116eb8a013bd7e65b0c7f5051326923dc 100644 --- a/Framework/Algorithms/src/FilterEvents.cpp +++ b/Framework/Algorithms/src/FilterEvents.cpp @@ -792,7 +792,7 @@ void FilterEvents::convertSplittersWorkspaceToVectors() { Kernel::SplittingInterval splitter = m_splitters[i_splitter]; int64_t start_time_i64 = splitter.start().totalNanoseconds(); int64_t stop_time_i64 = splitter.stop().totalNanoseconds(); - if (m_vecSplitterTime.size() == 0) { + if (m_vecSplitterTime.empty()) { // first entry: add m_vecSplitterTime.push_back(start_time_i64); m_vecSplitterTime.push_back(stop_time_i64); @@ -949,7 +949,7 @@ void FilterEvents::processTableSplittersWorkspace() { int64_t stop_64 = filter_shift_time + static_cast<int64_t>(stop_time * 1.E9); - if (m_vecSplitterTime.size() == 0) { + if (m_vecSplitterTime.empty()) { // first splitter: push the start time to vector m_vecSplitterTime.push_back(start_64); } else if (start_64 - m_vecSplitterTime.back() > TOLERANCE) { @@ -973,7 +973,7 @@ void FilterEvents::processTableSplittersWorkspace() { // convert string-target to integer target bool addnew = false; int int_target(-1); - if (m_targetIndexMap.size() == 0) { + if (m_targetIndexMap.empty()) { addnew = true; } else { std::map<std::string, int>::iterator mapiter = diff --git a/Framework/Algorithms/src/GenerateIPythonNotebook.cpp b/Framework/Algorithms/src/GenerateIPythonNotebook.cpp index 529b33549073a74d25262e8d5c7f7ee6288da4d6..e5e90cd9a25919dd1ca18464b53e17adb9231662 100644 --- a/Framework/Algorithms/src/GenerateIPythonNotebook.cpp +++ b/Framework/Algorithms/src/GenerateIPythonNotebook.cpp @@ -80,8 +80,8 @@ void GenerateIPythonNotebook::exec() { } // Need at least a start time to do time filter - if (startTime != "") { - if (endTime == "") { + if (!startTime.empty()) { + if (endTime.empty()) { // If no end time was given then filter up to now view->filterBetweenExecDate(DateAndTime(startTime)); } else { diff --git a/Framework/Algorithms/src/GeneratePythonScript.cpp b/Framework/Algorithms/src/GeneratePythonScript.cpp index 5ee5894becf7f62babb485492b17bdbe834ab4b9..01ee8704fcf951b7ea6119890d47ff0c0de46658 100644 --- a/Framework/Algorithms/src/GeneratePythonScript.cpp +++ b/Framework/Algorithms/src/GeneratePythonScript.cpp @@ -79,8 +79,8 @@ void GeneratePythonScript::exec() { } // Need at least a start time to do time filter - if (startTime != "") { - if (endTime == "") { + if (!startTime.empty()) { + if (endTime.empty()) { // If no end time was given then filter up to now view->filterBetweenExecDate(DateAndTime(startTime)); } else { diff --git a/Framework/Algorithms/src/ReflectometryReductionOne2.cpp b/Framework/Algorithms/src/ReflectometryReductionOne2.cpp index 181ab0a98afe857255351f6e327cb825fae53810..6bbbd39b7e56a98c06ced6c3582a972543be10b6 100644 --- a/Framework/Algorithms/src/ReflectometryReductionOne2.cpp +++ b/Framework/Algorithms/src/ReflectometryReductionOne2.cpp @@ -856,7 +856,7 @@ void ReflectometryReductionOne2::findDetectorGroups() { return a.front() < b.front(); }); - if (m_detectorGroups.size() == 0) { + if (m_detectorGroups.empty()) { throw std::runtime_error("Invalid processing instructions"); } } diff --git a/Framework/Algorithms/src/RenameWorkspaces.cpp b/Framework/Algorithms/src/RenameWorkspaces.cpp index 9a6855d499bc8585e95af1a14b04ae49ecc1ba51..7af32cd87e4807dc7ad30c1331f03c76c3a6214c 100644 --- a/Framework/Algorithms/src/RenameWorkspaces.cpp +++ b/Framework/Algorithms/src/RenameWorkspaces.cpp @@ -61,15 +61,15 @@ std::map<std::string, std::string> RenameWorkspaces::validateInputs() { std::string suffix = getPropertyValue("Suffix"); // Check properties - if (newWsName.empty() && prefix == "" && suffix == "") { + if (newWsName.empty() && prefix.empty() && suffix.empty()) { errorList["WorkspaceNames"] = "No list of Workspace names, prefix or suffix has been supplied."; } - if (!newWsName.empty() && (prefix != "" || suffix != "")) { + if (!newWsName.empty() && (!prefix.empty() || !suffix.empty())) { errorList["WorkspaceNames"] = "Both a list of workspace names and a prefix " "or suffix has been supplied."; - if (prefix != "") { + if (!prefix.empty()) { errorList["Prefix"] = "Both a list of workspace names and a prefix " "or suffix has been supplied."; } else { diff --git a/Framework/Algorithms/src/Stitch1DMany.cpp b/Framework/Algorithms/src/Stitch1DMany.cpp index afb9e4feefd4a4d3c78f8e8d38006a298f6218a6..77f76abccba7ac53328b35b749bb6657eac50dda 100644 --- a/Framework/Algorithms/src/Stitch1DMany.cpp +++ b/Framework/Algorithms/src/Stitch1DMany.cpp @@ -205,7 +205,7 @@ void Stitch1DMany::validateGroupWorkspacesInputs() { // Log all errors and throw a runtime error if an error is found validateCommonInputs(errors); - if (errors.size() > 0) { + if (!errors.empty()) { auto &warnLog = getLogger().warning(); for (const auto &error : errors) { warnLog << "Invalid value for " << error.first << ": " << error.second @@ -241,7 +241,7 @@ void Stitch1DMany::validateCommonInputs( m_useManualScaleFactors = this->getProperty("UseManualScaleFactors"); m_manualScaleFactors = this->getProperty("ManualScaleFactors"); - if (m_manualScaleFactors.size() > 0) { + if (!m_manualScaleFactors.empty()) { if (m_manualScaleFactors.size() == 1) { // Single value: fill with list of the same scale factor value m_manualScaleFactors = std::vector<double>(numStitchableWS - 1, diff --git a/Framework/Crystal/src/PeakHKLErrors.cpp b/Framework/Crystal/src/PeakHKLErrors.cpp index cccd488248ddfcb56420e10905411ddbcdb0bdee..08e2cac4993df840ad6fa7b85ff76bd66eaf5d8c 100644 --- a/Framework/Crystal/src/PeakHKLErrors.cpp +++ b/Framework/Crystal/src/PeakHKLErrors.cpp @@ -51,7 +51,7 @@ void PeakHKLErrors::init() { declareParameter("GonRotz", 0.0, "1st Rotation of Goniometer about the z axis"); initMode = 1; - if (OptRuns == "") + if (OptRuns.empty()) return; initMode = 2; diff --git a/Framework/Crystal/src/SCDPanelErrors.cpp b/Framework/Crystal/src/SCDPanelErrors.cpp index 07fd84a64f618a8b3b05eee9563c8f9cdc1497eb..d6da4f78916bdb4fe7d7a27fe6d3987c7f521a27 100644 --- a/Framework/Crystal/src/SCDPanelErrors.cpp +++ b/Framework/Crystal/src/SCDPanelErrors.cpp @@ -263,7 +263,7 @@ void SCDPanelErrors::setAttribute(const std::string &attName, } FileValidator fval; std::string error = fval.isValid(fileName); - if (error == "") { + if (error.empty()) { storeAttributeValue(attName, Attribute(fileName, true)); storeAttributeValue("Workspace", Attribute("")); } else { diff --git a/Framework/CurveFitting/src/Algorithms/ConvertToYSpace.cpp b/Framework/CurveFitting/src/Algorithms/ConvertToYSpace.cpp index 390821af3be5437760ca7a6fd877039181b7760f..1db18580faec19def2ff5663f27bf94881c73300 100644 --- a/Framework/CurveFitting/src/Algorithms/ConvertToYSpace.cpp +++ b/Framework/CurveFitting/src/Algorithms/ConvertToYSpace.cpp @@ -289,7 +289,7 @@ void ConvertToYSpace::createOutputWorkspace() { m_outputWS->setYUnitLabel(""); // q-Space output workspace - if (getPropertyValue("QWorkspace") != "") { + if (!getPropertyValue("QWorkspace").empty()) { m_qOutputWS = WorkspaceFactory::Instance().create(m_inputWS); m_qOutputWS->getAxis(0)->unit() = xLabel; diff --git a/Framework/CurveFitting/src/Algorithms/Fit.cpp b/Framework/CurveFitting/src/Algorithms/Fit.cpp index a0d584825b5fc0c7eeeee2d8605d4888f4b7652a..95f0f78800031337e3134444e8b879338c782122 100644 --- a/Framework/CurveFitting/src/Algorithms/Fit.cpp +++ b/Framework/CurveFitting/src/Algorithms/Fit.cpp @@ -138,7 +138,7 @@ void Fit::copyMinimizerOutput(const API::IFuncMinimizer &minimizer) { auto &properties = minimizer.getProperties(); for (auto property : properties) { if ((*property).direction() == Kernel::Direction::Output && - (*property).isValid() == "") { + (*property).isValid().empty()) { auto clonedProperty = std::unique_ptr<Kernel::Property>((*property).clone()); declareProperty(std::move(clonedProperty)); diff --git a/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp b/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp index 97d725beb899d6fe4466f15e30a17dd4bf51e52d..b744e8480cf9bf89d9c9dbd6b8dd10653c4684d3 100644 --- a/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp +++ b/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp @@ -646,7 +646,7 @@ std::string PlotPeakByLogValue::getMinimizerString(const std::string &wsName, dynamic_cast<Mantid::API::WorkspaceProperty<> *>(minimizerProp); if (wsProp) { const std::string &wsPropValue = minimizerProp->value(); - if (wsPropValue != "") { + if (!wsPropValue.empty()) { const std::string &wsPropName = minimizerProp->name(); m_minimizerWorkspaces[wsPropName].push_back(wsPropValue); } diff --git a/Framework/CurveFitting/src/Algorithms/SplineInterpolation.cpp b/Framework/CurveFitting/src/Algorithms/SplineInterpolation.cpp index 9cd6f62a1920daf4dab915a1b389015631baa581..1978323b913878a7139faac8ff1427371338052f 100644 --- a/Framework/CurveFitting/src/Algorithms/SplineInterpolation.cpp +++ b/Framework/CurveFitting/src/Algorithms/SplineInterpolation.cpp @@ -223,7 +223,7 @@ void SplineInterpolation::exec() { } // Store the output workspaces std::string derivWsName = getPropertyValue("OutputWorkspaceDeriv"); - if (order > 0 && derivWsName != "") { + if (order > 0 && !derivWsName.empty()) { // Store derivatives in a grouped workspace WorkspaceGroup_sptr wsg = WorkspaceGroup_sptr(new WorkspaceGroup); for (size_t i = 0; i < histNo; ++i) { diff --git a/Framework/CurveFitting/src/Functions/CrystalFieldMultiSpectrum.cpp b/Framework/CurveFitting/src/Functions/CrystalFieldMultiSpectrum.cpp index 7dec77fd50fe295284bc82eff16b8b33c8432078..a9180754a94ca66c49570cd777d6c7431cab2b73 100644 --- a/Framework/CurveFitting/src/Functions/CrystalFieldMultiSpectrum.cpp +++ b/Framework/CurveFitting/src/Functions/CrystalFieldMultiSpectrum.cpp @@ -266,7 +266,7 @@ void CrystalFieldMultiSpectrum::calcExcitations( // using an index instead of a name for performance reasons auto &source = dynamic_cast<Peaks &>(*m_source); double intensityScaling; - if (source.m_IntensityScalingIdx.size() == 0) { + if (source.m_IntensityScalingIdx.empty()) { intensityScaling = getParameter(m_nOwnParams - nSpec + iSpec); } else { intensityScaling = getParameter(source.m_IntensityScalingIdx[iSpec]); diff --git a/Framework/CurveFitting/src/Functions/TabulatedFunction.cpp b/Framework/CurveFitting/src/Functions/TabulatedFunction.cpp index a10ed3ab8ab1cd167fe5c6b144c5081ca3fe39e7..a9fe5275204464c18984f565e77659b684cba22e 100644 --- a/Framework/CurveFitting/src/Functions/TabulatedFunction.cpp +++ b/Framework/CurveFitting/src/Functions/TabulatedFunction.cpp @@ -174,7 +174,7 @@ void TabulatedFunction::setAttribute(const std::string &attName, } FileValidator fval; std::string error = fval.isValid(fileName); - if (error == "") { + if (error.empty()) { storeAttributeValue(attName, Attribute(fileName, true)); storeAttributeValue("Workspace", Attribute("")); } else { diff --git a/Framework/DataHandling/src/DownloadInstrument.cpp b/Framework/DataHandling/src/DownloadInstrument.cpp index 5bd0af84487f294cd50e03b5147aa47a95407ef7..1b45d90322b641f2f5e3fa1c6cac454bb072bde9 100644 --- a/Framework/DataHandling/src/DownloadInstrument.cpp +++ b/Framework/DataHandling/src/DownloadInstrument.cpp @@ -204,7 +204,7 @@ DownloadInstrument::StringToStringMap DownloadInstrument::processRepository() { if ((sha != installSha) && (sha != localSha)) { fileMap.emplace(htmlUrl, filePath.toString()); // ACTION - DOWNLOAD to localPath - } else if ((localSha != "") && (sha == installSha) && + } else if ((!localSha.empty()) && (sha == installSha) && (sha != localSha)) // matches install, but different local { fileMap.emplace( diff --git a/Framework/DataHandling/src/LoadAscii2.cpp b/Framework/DataHandling/src/LoadAscii2.cpp index e5ccb44c41b46c8b3b262c1f4f4c205941c92a1e..3ffa5ed3b66a2eeec3fbfd0622c02719f9b90e55 100644 --- a/Framework/DataHandling/src/LoadAscii2.cpp +++ b/Framework/DataHandling/src/LoadAscii2.cpp @@ -671,7 +671,7 @@ void LoadAscii2::exec() { std::string sep; // If the custom separator property is not empty, then we use that under any // circumstance. - if (custom != "") { + if (!custom.empty()) { sep = custom; } // Else if the separator drop down choice is not UserDefined then we use that. diff --git a/Framework/DataHandling/src/LoadFITS.cpp b/Framework/DataHandling/src/LoadFITS.cpp index 0754635782a1e2666c4d2080767dc144d87ef623..694bbb047437c4c6b578030dab7f6793a178b0b1 100644 --- a/Framework/DataHandling/src/LoadFITS.cpp +++ b/Framework/DataHandling/src/LoadFITS.cpp @@ -293,7 +293,7 @@ void LoadFITS::loadHeader(const std::string &filePath, FITSInfo &header) { } // scale parameter, header BSCALE in the fits standard - if ("" == header.headerKeys[m_headerScaleKey]) { + if (header.headerKeys[m_headerScaleKey].empty()) { header.scale = 1; } else { try { @@ -308,7 +308,7 @@ void LoadFITS::loadHeader(const std::string &filePath, FITSInfo &header) { } // data offsset parameter, header BZERO in the fits standard - if ("" == header.headerKeys[m_headerOffsetKey]) { + if (header.headerKeys[m_headerOffsetKey].empty()) { header.offset = 0; } else { try { @@ -361,7 +361,7 @@ void LoadFITS::loadHeader(const std::string &filePath, FITSInfo &header) { void LoadFITS::headerSanityCheck(const FITSInfo &hdr, const FITSInfo &hdrFirst) { bool valid = true; - if (hdr.extension != "") { + if (!hdr.extension.empty()) { valid = false; g_log.error() << "File " << hdr.filePath << ": extensions found in the header.\n"; @@ -625,7 +625,7 @@ void LoadFITS::parseHeader(FITSInfo &headerInfo) { if (key == g_END_KEYNAME) endFound = true; - if (key != "") + if (!key.empty()) headerInfo.headerKeys[key] = value; } } @@ -1141,7 +1141,7 @@ void LoadFITS::setupDefaultKeywordNames() { * Maps the header keys to specified values */ void LoadFITS::mapHeaderKeys() { - if ("" == getPropertyValue(g_HEADER_MAP_NAME)) + if (getPropertyValue(g_HEADER_MAP_NAME).empty()) return; // If a map file is selected, use that. @@ -1157,19 +1157,19 @@ void LoadFITS::mapHeaderKeys() { while (getline(fStream, line)) { boost::split(lineSplit, line, boost::is_any_of("=")); - if (lineSplit[0] == g_ROTATION_NAME && lineSplit[1] != "") + if (lineSplit[0] == g_ROTATION_NAME && !lineSplit[1].empty()) m_headerRotationKey = lineSplit[1]; - if (lineSplit[0] == g_BIT_DEPTH_NAME && lineSplit[1] != "") + if (lineSplit[0] == g_BIT_DEPTH_NAME && !lineSplit[1].empty()) m_headerBitDepthKey = lineSplit[1]; - if (lineSplit[0] == g_AXIS_NAMES_NAME && lineSplit[1] != "") { + if (lineSplit[0] == g_AXIS_NAMES_NAME && !lineSplit[1].empty()) { m_headerAxisNameKeys.clear(); boost::split(m_headerAxisNameKeys, lineSplit[1], boost::is_any_of(",")); } - if (lineSplit[0] == g_IMAGE_KEY_NAME && lineSplit[1] != "") { + if (lineSplit[0] == g_IMAGE_KEY_NAME && !lineSplit[1].empty()) { m_headerImageKeyKey = lineSplit[1]; } } diff --git a/Framework/DataHandling/src/LoadFullprofResolution.cpp b/Framework/DataHandling/src/LoadFullprofResolution.cpp index 32c8bc93506f25537b1ce06e6e4902bd4996d301..cb0e15e01287afd33a56ae11450e397fa30c3717 100644 --- a/Framework/DataHandling/src/LoadFullprofResolution.cpp +++ b/Framework/DataHandling/src/LoadFullprofResolution.cpp @@ -189,7 +189,7 @@ void LoadFullprofResolution::exec() { // Generate output table workspace API::ITableWorkspace_sptr outTabWs = genTableWorkspace(bankparammap); - if (getPropertyValue("OutputTableWorkspace") != "") { + if (!getPropertyValue("OutputTableWorkspace").empty()) { // Output the output table workspace setProperty("OutputTableWorkspace", outTabWs); } @@ -225,7 +225,7 @@ void LoadFullprofResolution::exec() { loadParamAlg->execute(); } } - } else if (getPropertyValue("OutputTableWorkspace") == "") { + } else if (getPropertyValue("OutputTableWorkspace").empty()) { // We don't know where to output throw std::runtime_error( "Either the OutputTableWorkspace or Workspace property must be set."); diff --git a/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp b/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp index 239ea187ff49047152f221f36e53d16d585be4f9..ca4e25413be5a612a4dec884a2942202e9543b29 100644 --- a/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp +++ b/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp @@ -151,7 +151,7 @@ void LoadGSASInstrumentFile::exec() { WorkspaceGroup_sptr wsg = getProperty("Workspace"); // Generate output table workspace API::ITableWorkspace_sptr outTabWs = genTableWorkspace(bankparammap); - if (getPropertyValue("OutputTableWorkspace") != "") { + if (!getPropertyValue("OutputTableWorkspace").empty()) { // Output the output table workspace setProperty("OutputTableWorkspace", outTabWs); } diff --git a/Framework/DataHandling/src/LoadIDFFromNexus.cpp b/Framework/DataHandling/src/LoadIDFFromNexus.cpp index f68ae54eb58d351ee064453a00349d043824e8ed..74305f3eedfbe26a71f97511f9b6c905e52a2abd 100644 --- a/Framework/DataHandling/src/LoadIDFFromNexus.cpp +++ b/Framework/DataHandling/src/LoadIDFFromNexus.cpp @@ -88,7 +88,7 @@ void LoadIDFFromNexus::exec() { // Look for parameter correction file std::string parameterCorrectionFile = getPropertyValue("ParameterCorrectionFilePath"); - if (parameterCorrectionFile == "") { + if (parameterCorrectionFile.empty()) { parameterCorrectionFile = getParameterCorrectionFile(localWorkspace->getInstrument()->getName()); } @@ -98,7 +98,7 @@ void LoadIDFFromNexus::exec() { // Read parameter correction file, if found std::string correctionParameterFile; bool append = false; - if (parameterCorrectionFile != "") { + if (!parameterCorrectionFile.empty()) { // Read parameter correction file // to find out which parameter file to use // and whether it is appended to default parameters. @@ -112,7 +112,7 @@ void LoadIDFFromNexus::exec() { // Load default parameters if either there is no correction parameter file or // it is to be appended. - if (correctionParameterFile == "" || append) { + if (correctionParameterFile.empty() || append) { LoadParameters(&nxfile, localWorkspace); } else { // Else clear the parameters g_log.notice() << "Parameters to be replaced are cleared.\n"; @@ -120,7 +120,7 @@ void LoadIDFFromNexus::exec() { } // Load parameters from correction parameter file, if it exists - if (correctionParameterFile != "") { + if (!correctionParameterFile.empty()) { Poco::Path corrFilePath(parameterCorrectionFile); g_log.debug() << "Correction file path: " << corrFilePath.toString() << "\n"; @@ -200,7 +200,7 @@ void LoadIDFFromNexus::readParameterCorrectionFile( append = false; // Check the date. - if (date == "") { + if (date.empty()) { g_log.notice() << "No date is supplied for parameter correction file " << correction_file << ". Correction file is ignored.\n"; return; diff --git a/Framework/DataHandling/src/LoadILLDiffraction.cpp b/Framework/DataHandling/src/LoadILLDiffraction.cpp index 707c1e4661b527c36f25c600b3d8d85ece95de9f..f04af6189a05e10c1f842ad5e917aba0237955e1 100644 --- a/Framework/DataHandling/src/LoadILLDiffraction.cpp +++ b/Framework/DataHandling/src/LoadILLDiffraction.cpp @@ -480,7 +480,7 @@ std::vector<double> LoadILLDiffraction::getScannedVaribleByPropertyName( } } - if (scannedVariable.size() == 0) + if (scannedVariable.empty()) throw std::runtime_error( "Can not load file because scanned variable with property name " + propertyName + " was not found"); diff --git a/Framework/DataHandling/src/LoadILLIndirect2.cpp b/Framework/DataHandling/src/LoadILLIndirect2.cpp index 4a40a4d3eb8c1a6041b6cf02746190d1be245d6d..9360967a296c627d32fd0d4707f02cd177d87ce5 100644 --- a/Framework/DataHandling/src/LoadILLIndirect2.cpp +++ b/Framework/DataHandling/src/LoadILLIndirect2.cpp @@ -130,7 +130,7 @@ void LoadILLIndirect2::exec() { void LoadILLIndirect2::setInstrumentName( const NeXus::NXEntry &firstEntry, const std::string &instrumentNamePath) { - if (instrumentNamePath == "") { + if (instrumentNamePath.empty()) { std::string message("Cannot set the instrument name from the Nexus file!"); g_log.error(message); throw std::runtime_error(message); diff --git a/Framework/DataHandling/src/LoadILLReflectometry.cpp b/Framework/DataHandling/src/LoadILLReflectometry.cpp index 8a5b69d8b49a622c19b667de27f1fe062e352fc3..f5f647ae8293b110d1457b82e47dbcb28641bdf1 100644 --- a/Framework/DataHandling/src/LoadILLReflectometry.cpp +++ b/Framework/DataHandling/src/LoadILLReflectometry.cpp @@ -176,7 +176,7 @@ void LoadILLReflectometry::exec() { void LoadILLReflectometry::setInstrumentName( const NeXus::NXEntry &firstEntry, const std::string &instrumentNamePath) { - if (instrumentNamePath == "") { + if (instrumentNamePath.empty()) { std::string message("Cannot set the instrument name from the Nexus file!"); g_log.error(message); throw std::runtime_error(message); diff --git a/Framework/DataHandling/src/LoadILLSANS.cpp b/Framework/DataHandling/src/LoadILLSANS.cpp index 4e04e099d398ab98adc552eb294f460eb6c5f790..b9c0d3667cb8c838b019b135c8574639b6e48914 100644 --- a/Framework/DataHandling/src/LoadILLSANS.cpp +++ b/Framework/DataHandling/src/LoadILLSANS.cpp @@ -107,7 +107,7 @@ void LoadILLSANS::exec() { void LoadILLSANS::setInstrumentName(const NeXus::NXEntry &firstEntry, const std::string &instrumentNamePath) { - if (instrumentNamePath == "") { + if (instrumentNamePath.empty()) { std::string message("Cannot set the instrument name from the Nexus file!"); g_log.error(message); throw std::runtime_error(message); diff --git a/Framework/DataHandling/src/LoadILLTOF2.cpp b/Framework/DataHandling/src/LoadILLTOF2.cpp index 50f76c1d0245aa0fb47e150412614312bc4f9e88..9cc3f2e0a7070bf0101ccfd29655e4acf10c3899 100644 --- a/Framework/DataHandling/src/LoadILLTOF2.cpp +++ b/Framework/DataHandling/src/LoadILLTOF2.cpp @@ -144,7 +144,7 @@ void LoadILLTOF2::loadInstrumentDetails(NeXus::NXEntry &firstEntry) { m_instrumentPath = m_loader.findInstrumentNexusPath(firstEntry); - if (m_instrumentPath == "") { + if (m_instrumentPath.empty()) { throw std::runtime_error( "Cannot set the instrument name from the Nexus file!"); } diff --git a/Framework/DataHandling/src/LoadIsawDetCal.cpp b/Framework/DataHandling/src/LoadIsawDetCal.cpp index f2a479594d1dc83a2400d48665e0a06a681d3210..54638a6518b1b4a2d2dfae8e931dea9cc74fb345 100644 --- a/Framework/DataHandling/src/LoadIsawDetCal.cpp +++ b/Framework/DataHandling/src/LoadIsawDetCal.cpp @@ -92,7 +92,7 @@ std::map<std::string, std::string> LoadIsawDetCal::validateInputs() { // two detcal files is only valid for snap std::vector<std::string> filenames = getFilenames(); - if (filenames.size() == 0) { + if (filenames.empty()) { result["Filename"] = "Must supply .detcal file"; } else if (filenames.size() == 2) { Workspace_const_sptr wksp = getProperty("InputWorkspace"); diff --git a/Framework/DataHandling/src/LoadLLB.cpp b/Framework/DataHandling/src/LoadLLB.cpp index 83f047c87824f9ae25676b5a12dfb0baa1543b7b..6599483496a88d39b8bb412576b4539f2a9a867b 100644 --- a/Framework/DataHandling/src/LoadLLB.cpp +++ b/Framework/DataHandling/src/LoadLLB.cpp @@ -104,7 +104,7 @@ void LoadLLB::setInstrumentName(NeXus::NXEntry &entry) { m_instrumentName = m_loader.getStringFromNexusPath(entry, m_instrumentPath + "/name"); - if (m_instrumentName == "") { + if (m_instrumentName.empty()) { throw std::runtime_error( "Cannot read the instrument name from the Nexus file!"); } diff --git a/Framework/DataHandling/src/LoadMLZ.cpp b/Framework/DataHandling/src/LoadMLZ.cpp index 1ad5df0508499856145ab39f86435dfc5956a9cf..23159b7e7906fa1d292d109799748df2adcff780 100644 --- a/Framework/DataHandling/src/LoadMLZ.cpp +++ b/Framework/DataHandling/src/LoadMLZ.cpp @@ -149,7 +149,7 @@ void LoadMLZ::loadInstrumentDetails(NeXus::NXEntry &firstEntry) { m_instrumentPath = m_mlzloader.findInstrumentNexusPath(firstEntry); - if (m_instrumentPath == "") { + if (m_instrumentPath.empty()) { throw std::runtime_error( "Cannot set the instrument name from the Nexus file!"); } diff --git a/Framework/DataHandling/src/LoadSINQFocus.cpp b/Framework/DataHandling/src/LoadSINQFocus.cpp index d7a6a56b7bae9efbc38ec8c7c1bf29f8e529b04b..3494437cfa328e6b800cd8cdf2bdc7615a251e3f 100644 --- a/Framework/DataHandling/src/LoadSINQFocus.cpp +++ b/Framework/DataHandling/src/LoadSINQFocus.cpp @@ -112,7 +112,7 @@ void LoadSINQFocus::setInstrumentName(NeXus::NXEntry &entry) { m_instrumentPath = m_loader.findInstrumentNexusPath(entry); - if (m_instrumentPath == "") { + if (m_instrumentPath.empty()) { throw std::runtime_error( "Cannot set the instrument name from the Nexus file!"); } diff --git a/Framework/DataHandling/src/LoadSpiceXML2DDet.cpp b/Framework/DataHandling/src/LoadSpiceXML2DDet.cpp index eb82237827233b88a0bdd756785990ad0460ec80..f8eda027c8d1960e700628c4e700621d8d0eb0f5 100644 --- a/Framework/DataHandling/src/LoadSpiceXML2DDet.cpp +++ b/Framework/DataHandling/src/LoadSpiceXML2DDet.cpp @@ -231,7 +231,7 @@ void LoadSpiceXML2DDet::processInputs() { if (vec_pixelgeom.size() == 2) { m_numPixelX = vec_pixelgeom[0]; m_numPixelY = vec_pixelgeom[1]; - } else if (vec_pixelgeom.size() == 0) { + } else if (vec_pixelgeom.empty()) { m_numPixelX = 0; m_numPixelY = 0; } else { @@ -714,7 +714,7 @@ LoadSpiceXML2DDet::parseDetectorNode(const std::string &detvaluestr, size_t num_empty_line = 0; size_t num_weird_line = 0; for (size_t iline = 0; iline < vecLines.size(); ++iline) { - if (vecLines[iline].size() == 0) + if (vecLines[iline].empty()) ++num_empty_line; else if (vecLines[iline].size() < 100) ++num_weird_line; diff --git a/Framework/DataHandling/src/LoadTBL.cpp b/Framework/DataHandling/src/LoadTBL.cpp index 1eeaff23a342af8e5aa0729defd686fe1bccbe2f..b5ab7f31e6329b39b45803ba8f5642188566c3ec 100644 --- a/Framework/DataHandling/src/LoadTBL.cpp +++ b/Framework/DataHandling/src/LoadTBL.cpp @@ -342,7 +342,7 @@ void LoadTBL::exec() { std::string line; int stitchID = 1; while (Kernel::Strings::extractToEOL(file, line)) { - if (line == "" || line == ",,,,,,,,,,,,,,,,") { + if (line.empty() || line == ",,,,,,,,,,,,,,,,") { continue; } getCells(line, rowVec, 16, isOld); @@ -351,8 +351,8 @@ void LoadTBL::exec() { // check if the first run in the row has any data associated with it // 0 = runs, 1 = theta, 2 = trans, 3 = qmin, 4 = qmax - if (rowVec[0] != "" || rowVec[1] != "" || rowVec[2] != "" || - rowVec[3] != "" || rowVec[4] != "") { + if (!rowVec[0].empty() || !rowVec[1].empty() || !rowVec[2].empty() || + !rowVec[3].empty() || !rowVec[4].empty()) { TableRow row = ws->appendRow(); row << stitchStr; for (int i = 0; i < 5; ++i) { @@ -364,8 +364,8 @@ void LoadTBL::exec() { // check if the second run in the row has any data associated with it // 5 = runs, 6 = theta, 7 = trans, 8 = qmin, 9 = qmax - if (rowVec[5] != "" || rowVec[6] != "" || rowVec[7] != "" || - rowVec[8] != "" || rowVec[9] != "") { + if (!rowVec[5].empty() || !rowVec[6].empty() || !rowVec[7].empty() || + !rowVec[8].empty() || !rowVec[9].empty()) { TableRow row = ws->appendRow(); row << stitchStr; for (int i = 5; i < 10; ++i) { @@ -377,8 +377,8 @@ void LoadTBL::exec() { // check if the third run in the row has any data associated with it // 10 = runs, 11 = theta, 12 = trans, 13 = qmin, 14 = qmax - if (rowVec[10] != "" || rowVec[11] != "" || rowVec[12] != "" || - rowVec[13] != "" || rowVec[14] != "") { + if (!rowVec[10].empty() || !rowVec[11].empty() || !rowVec[12].empty() || + !rowVec[13].empty() || !rowVec[14].empty()) { TableRow row = ws->appendRow(); row << stitchStr; for (int i = 10; i < 17; ++i) { @@ -413,7 +413,7 @@ void LoadTBL::exec() { } size_t expectedCommas = columnHeadings.size() - 1; while (Kernel::Strings::extractToEOL(file, line)) { - if (line == "" || line == ",,,,,,,,,,,,,,,,") { + if (line.empty() || line == ",,,,,,,,,,,,,,,,") { // skip over any empty lines continue; } diff --git a/Framework/DataHandling/src/SaveAscii.cpp b/Framework/DataHandling/src/SaveAscii.cpp index 090452f80897cbb9e72b013c0da017e7add7fc1b..2b10f7211f0e1cf6208c4e26a2e3855ac0451895 100644 --- a/Framework/DataHandling/src/SaveAscii.cpp +++ b/Framework/DataHandling/src/SaveAscii.cpp @@ -111,7 +111,7 @@ void SaveAscii::exec() { std::string sep; // If the custom separator property is not empty, then we use that under any // circumstance. - if (custom != "") { + if (!custom.empty()) { sep = custom; } // Else if the separator drop down choice is not UserDefined then we use that. diff --git a/Framework/DataHandling/src/SaveAscii2.cpp b/Framework/DataHandling/src/SaveAscii2.cpp index e44f640c9e590fbf517dd567532e29532f97a532..55a10b34c34d516607d3aa774885395208c06c75 100644 --- a/Framework/DataHandling/src/SaveAscii2.cpp +++ b/Framework/DataHandling/src/SaveAscii2.cpp @@ -166,7 +166,7 @@ void SaveAscii2::exec() { const std::string custom = getPropertyValue("CustomSeparator"); // If the custom separator property is not empty, then we use that under any // circumstance. - if (custom != "") { + if (!custom.empty()) { m_sep = custom; } // Else if the separator drop down choice is not UserDefined then we use that. diff --git a/Framework/DataHandling/src/SaveReflCustomAscii.cpp b/Framework/DataHandling/src/SaveReflCustomAscii.cpp index 6b9a61892c157d851e748b78045e009ac348ee3d..2630e931e3ea1bbdadd0f79fe1f1970db238a00d 100644 --- a/Framework/DataHandling/src/SaveReflCustomAscii.cpp +++ b/Framework/DataHandling/src/SaveReflCustomAscii.cpp @@ -34,7 +34,7 @@ void SaveReflCustomAscii::extraHeaders(std::ofstream &file) { std::string subtitleEntry; std::string title = getProperty("Title"); - if (title != "") // if is toggled + if (!title.empty()) // if is toggled { file << "#" << title << '\n'; } diff --git a/Framework/DataHandling/src/SaveReflThreeColumnAscii.cpp b/Framework/DataHandling/src/SaveReflThreeColumnAscii.cpp index 29b9218c24ea1de02e57c71e0e2a5321bb4d0467..cf8c9cd7013801a4880ac92aa98f8b7cb27fb5c6 100644 --- a/Framework/DataHandling/src/SaveReflThreeColumnAscii.cpp +++ b/Framework/DataHandling/src/SaveReflThreeColumnAscii.cpp @@ -28,7 +28,7 @@ void SaveReflThreeColumnAscii::extraHeaders(std::ofstream &file) { auto samp = m_ws->run(); std::string title = getProperty("Title"); - if (title != "") // if is toggled + if (!title.empty()) // if is toggled { file << "#" << title << '\n'; } diff --git a/Framework/DataHandling/src/SaveToSNSHistogramNexus.cpp b/Framework/DataHandling/src/SaveToSNSHistogramNexus.cpp index b44854c1b2ffcd7e7b9859d041bca976a5b69bed..38625424c86340cf3b68e44562635a4de5e3b837 100644 --- a/Framework/DataHandling/src/SaveToSNSHistogramNexus.cpp +++ b/Framework/DataHandling/src/SaveToSNSHistogramNexus.cpp @@ -560,13 +560,13 @@ int SaveToSNSHistogramNexus::WriteGroup(int is_definition) { } //--------------------------------------------------------------------------------------- - if (data_label == "data" && (bank != "")) { + if (data_label == "data" && (!bank.empty())) { if (this->WriteDataGroup(bank, is_definition) != NX_OK) return NX_ERROR; ; } //--------------------------------------------------------------------------------------- - else if (data_label == "time_of_flight" && (bank != "")) { + else if (data_label == "time_of_flight" && (!bank.empty())) { // Get the original info if (NXgetinfo(inId, &dataRank, dataDimensions, &dataType) != NX_OK) return NX_ERROR; diff --git a/Framework/DataObjects/src/EventList.cpp b/Framework/DataObjects/src/EventList.cpp index 9471b3bf95b5582ee9268e4a4176cfaad5588f43..64dd418bad5f778f723e338dadd2e63921ec7b79 100644 --- a/Framework/DataObjects/src/EventList.cpp +++ b/Framework/DataObjects/src/EventList.cpp @@ -4403,7 +4403,7 @@ void EventList::splitByPulseTimeWithMatrix( } // Split - if (vec_target.size() == 0) { + if (vec_target.empty()) { // No splitter: copy all events to group workspace = -1 (*outputs[-1]) = (*this); } else { diff --git a/Framework/Geometry/src/Crystal/SymmetryElementFactory.cpp b/Framework/Geometry/src/Crystal/SymmetryElementFactory.cpp index 09c5dfd1b37e2d2265dc3f2f764ddf5ae6629340..471c225be685c17caa1f65a81234382fe53b5d1b 100644 --- a/Framework/Geometry/src/Crystal/SymmetryElementFactory.cpp +++ b/Framework/Geometry/src/Crystal/SymmetryElementFactory.cpp @@ -313,7 +313,7 @@ std::string SymmetryElementMirrorGenerator::determineSymbol( * proper symbol, so the general symbol "g" is used for these cases. * Examples can be found in No. 227 (Fd-3m). */ - if (symbol == "") { + if (symbol.empty()) { return "g"; } diff --git a/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp b/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp index f079aa5fa59343da650e578f8558d9952af781b0..62e0b6d875c8f4330375bd646fbd4ba9a06d0a87 100644 --- a/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp +++ b/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp @@ -1282,7 +1282,7 @@ void InstrumentDefinitionParser::createDetectorOrMonitor( std::stringstream ss1, ss2; ss1 << idList.vec.size(); ss2 << idList.counted; - if (idList.idname == "") { + if (idList.idname.empty()) { g_log.error("No list of detector IDs found for location element " + name); throw Kernel::Exception::InstrumentDefinitionError( "Detector location element " + name + " has no idlist.", filename); diff --git a/Framework/HistogramData/src/CountStandardDeviations.cpp b/Framework/HistogramData/src/CountStandardDeviations.cpp index 40fc5823bcd4ea06f3a2525bf358587c0018fb02..439692a50a0fe4ef7d767735a13a146abc643b13 100644 --- a/Framework/HistogramData/src/CountStandardDeviations.cpp +++ b/Framework/HistogramData/src/CountStandardDeviations.cpp @@ -24,7 +24,7 @@ CountStandardDeviations::CountStandardDeviations( throw std::logic_error("CountStandardDeviations: Cannot construct from " "FrequencyStandardDeviations -- BinEdges are NULL."); if ((frequencies.size() + 1) != edges.size()) - if (frequencies.size() != 0 || edges.size() != 0) + if (!frequencies.empty() || !edges.empty()) throw std::logic_error("CountStandardDeviations: Cannot construct from " "FrequencyStandardDeviations -- BinEdges size " "does not " diff --git a/Framework/HistogramData/src/CountVariances.cpp b/Framework/HistogramData/src/CountVariances.cpp index 3153e6f540e15c08ab1bd0482191ccf8ffb2bfe7..baf7b9c4c558921a25901aec5e1d4c50c63218bf 100644 --- a/Framework/HistogramData/src/CountVariances.cpp +++ b/Framework/HistogramData/src/CountVariances.cpp @@ -23,7 +23,7 @@ CountVariances::CountVariances(FrequencyVariances &&frequencies, throw std::logic_error("CountVariances: Cannot construct from " "FrequencyVariances -- BinEdges are NULL."); if ((frequencies.size() + 1) != edges.size()) - if (frequencies.size() != 0 || edges.size() != 0) + if (!frequencies.empty() || !edges.empty()) throw std::logic_error("CountVariances: Cannot construct from " "FrequencyVariances -- BinEdges size does not " "match."); diff --git a/Framework/HistogramData/src/Counts.cpp b/Framework/HistogramData/src/Counts.cpp index f63e47a0da03f21c57883c07a5ad8f0566e87731..3c5b7e0461fc8daec1982dc5d81b142afa8419bb 100644 --- a/Framework/HistogramData/src/Counts.cpp +++ b/Framework/HistogramData/src/Counts.cpp @@ -17,7 +17,7 @@ Counts::Counts(Frequencies &&frequencies, const BinEdges &edges) { throw std::logic_error( "Counts: Cannot construct from Frequencies -- BinEdges are NULL."); if ((frequencies.size() + 1) != edges.size()) - if (frequencies.size() != 0 || edges.size() != 0) + if (!frequencies.empty() || !edges.empty()) throw std::logic_error("Counts: Cannot construct from Frequencies -- " "BinEdges size does not match."); // Cannot move frequencies private data since it is of different type. diff --git a/Framework/HistogramData/src/Frequencies.cpp b/Framework/HistogramData/src/Frequencies.cpp index 21b8836351a4a392a0cb226589b4316ddee4705f..6623ee0b2f8e62e2ebee81bbd310400088d324bf 100644 --- a/Framework/HistogramData/src/Frequencies.cpp +++ b/Framework/HistogramData/src/Frequencies.cpp @@ -17,7 +17,7 @@ Frequencies::Frequencies(Counts &&counts, const BinEdges &edges) { throw std::logic_error( "Frequencies: Cannot construct from Counts -- BinEdges are NULL."); if ((counts.size() + 1) != edges.size()) - if (counts.size() != 0 || edges.size() != 0) + if (!counts.empty() || !edges.empty()) throw std::logic_error("Frequencies: Cannot construct from Counts -- " "BinEdges size does not match."); // Cannot move counts private data since it is of different type. diff --git a/Framework/HistogramData/src/FrequencyStandardDeviations.cpp b/Framework/HistogramData/src/FrequencyStandardDeviations.cpp index a4b568727b1d96b0f3a6ef51986ee5143ce0b837..99665e08cf84e9a483d07793f88446a83e571904 100644 --- a/Framework/HistogramData/src/FrequencyStandardDeviations.cpp +++ b/Framework/HistogramData/src/FrequencyStandardDeviations.cpp @@ -23,7 +23,7 @@ FrequencyStandardDeviations::FrequencyStandardDeviations( throw std::logic_error("FrequencyStandardDeviations: Cannot construct from " "CountStandardDeviations -- BinEdges are NULL."); if ((counts.size() + 1) != edges.size()) - if (counts.size() != 0 || edges.size() != 0) + if (!counts.empty() || !edges.empty()) throw std::logic_error("FrequencyStandardDeviations: Cannot construct " "from CountStandardDeviations -- BinEdges size " "does not match."); diff --git a/Framework/HistogramData/src/FrequencyVariances.cpp b/Framework/HistogramData/src/FrequencyVariances.cpp index 86c7c47bb61678b0be314e8b1f456c5f0882b02e..a68c1c1ac073dad057b5293b0abe06f031e16d14 100644 --- a/Framework/HistogramData/src/FrequencyVariances.cpp +++ b/Framework/HistogramData/src/FrequencyVariances.cpp @@ -23,7 +23,7 @@ FrequencyVariances::FrequencyVariances(CountVariances &&counts, throw std::logic_error("FrequencyVariances: Cannot construct from " "CountVariances -- BinEdges are NULL."); if ((counts.size() + 1) != edges.size()) - if (counts.size() != 0 || edges.size() != 0) + if (!counts.empty() || !edges.empty()) throw std::logic_error("FrequencyVariances: Cannot construct from " "CountVariances -- BinEdges size does not match."); // Cannot move counts private data since it is of different type. diff --git a/Framework/HistogramData/src/Points.cpp b/Framework/HistogramData/src/Points.cpp index 78edbfac5fb4bd5c442fe3b325b23a0a62fc9849..a375c2c64f944b47d0760fb3281dfb9c521f1779 100644 --- a/Framework/HistogramData/src/Points.cpp +++ b/Framework/HistogramData/src/Points.cpp @@ -10,7 +10,7 @@ Points::Points(const BinEdges &edges) { return; if (edges.size() == 1) throw std::logic_error("Points: Cannot construct from BinEdges of size 1"); - if (edges.size() == 0) { + if (edges.empty()) { m_data = Kernel::make_cow<HistogramX>(0); return; } diff --git a/Framework/Kernel/inc/MantidKernel/PropertyWithValue.tcc b/Framework/Kernel/inc/MantidKernel/PropertyWithValue.tcc index 134f38a8d0c9fc4f11c22beb4fde5d9d4ffa1f55..a4902017dbb7104790d56d09cb1a6fcb93393f37 100644 --- a/Framework/Kernel/inc/MantidKernel/PropertyWithValue.tcc +++ b/Framework/Kernel/inc/MantidKernel/PropertyWithValue.tcc @@ -271,7 +271,7 @@ TYPE &PropertyWithValue<TYPE>::operator=(const TYPE &value) { m_value = value; } std::string problem = this->isValid(); - if (problem == "") { + if (problem.empty()) { return m_value; } else if (problem == "_alias") { m_value = getValueForAlias(value); diff --git a/Framework/Kernel/src/CompositeValidator.cpp b/Framework/Kernel/src/CompositeValidator.cpp index b87ecc4f290104bb1ed23eca042d291e5ac90418..55fd549ab0d6c74c636de5df72cf20184198bb90 100644 --- a/Framework/Kernel/src/CompositeValidator.cpp +++ b/Framework/Kernel/src/CompositeValidator.cpp @@ -74,7 +74,7 @@ std::string CompositeValidator::check(const boost::any &value) const { std::string error = (*itr)->check(value); // exit on the first error, to avoid passing doing more tests on invalid // objects that could fail - if (error != "") + if (!error.empty()) return error; } // there were no errors diff --git a/Framework/Kernel/src/ConfigService.cpp b/Framework/Kernel/src/ConfigService.cpp index 92f5b6b5d4ccb139e745f1f21ee6875600f62774..59ca2639dfb3f5ecfb7605f28ae18f7c238ddf6a 100644 --- a/Framework/Kernel/src/ConfigService.cpp +++ b/Framework/Kernel/src/ConfigService.cpp @@ -372,7 +372,7 @@ void ConfigServiceImpl::loadConfig(const std::string &filename, bool good = readFile(filename, temp); // check if we have failed to open the file - if ((!good) || (temp == "")) { + if ((!good) || (temp.empty())) { if (filename == getUserPropertiesDir() + m_user_properties_file_name) { // write out a fresh file createUserPropertiesFile(); @@ -382,7 +382,7 @@ void ConfigServiceImpl::loadConfig(const std::string &filename, } // store the property string - if ((append) && (m_PropertyString != "")) { + if ((append) && (!m_PropertyString.empty())) { m_PropertyString = m_PropertyString + "\n" + temp; } else { m_PropertyString = temp; diff --git a/Framework/Kernel/src/UsageService.cpp b/Framework/Kernel/src/UsageService.cpp index 5b77d1be8fa7c5f5b337f7777abcfdfe6d687b6b..54ab2d4a49e74e64a2919b2cc2e6fd49f236f7e6 100644 --- a/Framework/Kernel/src/UsageService.cpp +++ b/Framework/Kernel/src/UsageService.cpp @@ -263,7 +263,7 @@ std::string UsageServiceImpl::generateFeatureUsageMessage() { thisFeature["count"] = featureItem.second; features.append(thisFeature); } - if (features.size() > 0) { + if (!features.empty()) { message["features"] = features; return writer.write(message); } diff --git a/Framework/MDAlgorithms/src/CompareMDWorkspaces.cpp b/Framework/MDAlgorithms/src/CompareMDWorkspaces.cpp index e11d0a2a9c98131cf29363fb787b4066361e7c5d..943900034c059d7d2c7a6042ced52845479c1b8a 100644 --- a/Framework/MDAlgorithms/src/CompareMDWorkspaces.cpp +++ b/Framework/MDAlgorithms/src/CompareMDWorkspaces.cpp @@ -341,7 +341,7 @@ void CompareMDWorkspaces::exec() { this->doComparison(); - if (m_result != "") { + if (!m_result.empty()) { g_log.notice() << "The workspaces did not match: " << m_result << '\n'; this->setProperty("Equals", false); } else { diff --git a/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace3.cpp b/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace3.cpp index 3eb926cae75671c33b69422a520973ab76117c8d..639462ab74555749e74240d3b1a2b3383a94f12f 100644 --- a/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace3.cpp +++ b/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace3.cpp @@ -70,7 +70,7 @@ void ConvertToDiffractionMDWorkspace3::convertExtents( minVal[d] = Extents[2 * d + 0]; maxVal[d] = Extents[2 * d + 1]; } - } else if (Extents.size() == 0) { + } else if (Extents.empty()) { calculateExtentsFromData(minVal, maxVal); } else throw std::invalid_argument( diff --git a/Framework/Nexus/src/NexusFileIO.cpp b/Framework/Nexus/src/NexusFileIO.cpp index 502ab8330ec4a90527813dfe3382817c877bc0ea..e373e252dbb4b65913fe202969850358a9c6a311 100644 --- a/Framework/Nexus/src/NexusFileIO.cpp +++ b/Framework/Nexus/src/NexusFileIO.cpp @@ -264,7 +264,7 @@ bool NexusFileIO::writeNxNote(const std::string ¬eName, m_filehandle->makeGroup(noteName, "NXnote", true); std::vector<std::string> attributes, avalues; - if (date != "") { + if (!date.empty()) { attributes.emplace_back("date"); avalues.push_back(date); } diff --git a/Framework/PythonInterface/mantid/api/src/Exports/IAlgorithm.cpp b/Framework/PythonInterface/mantid/api/src/Exports/IAlgorithm.cpp index 889e326b37407529948cd91e19f6da1a88b608af..6115a7a2561c14ec7e23ea0d510e92633f980f0f 100644 --- a/Framework/PythonInterface/mantid/api/src/Exports/IAlgorithm.cpp +++ b/Framework/PythonInterface/mantid/api/src/Exports/IAlgorithm.cpp @@ -93,7 +93,7 @@ struct MandatoryFirst { /// in the list bool operator()(const Property *p1, const Property *p2) const { // this is false, unless p1 is not valid and p2 is valid - return (p1->isValid() != "") && (p2->isValid() == ""); + return (!p1->isValid().empty()) && (p2->isValid().empty()); } }; diff --git a/Framework/SINQ/src/PoldiPeakSearch.cpp b/Framework/SINQ/src/PoldiPeakSearch.cpp index f6091db34bbda36f2cffc36a54bbcce16d7fb2ca..2b502b516b603112695686036ad0ccf2fc074b6f 100644 --- a/Framework/SINQ/src/PoldiPeakSearch.cpp +++ b/Framework/SINQ/src/PoldiPeakSearch.cpp @@ -564,7 +564,7 @@ void PoldiPeakSearch::exec() { Unit_sptr xUnit = correlationWorkspace->getAxis(0)->unit(); - if (xUnit->caption() == "") { + if (xUnit->caption().empty()) { g_log.information() << " Workspace does not have unit, defaulting to MomentumTransfer.\n"; diff --git a/Framework/TestHelpers/src/FileComparisonHelper.cpp b/Framework/TestHelpers/src/FileComparisonHelper.cpp index 5da64ccbeec582d9a8877421d18e9b54c03481c2..ccf783e80f24838877556223c3d75f81d45e8f30 100644 --- a/Framework/TestHelpers/src/FileComparisonHelper.cpp +++ b/Framework/TestHelpers/src/FileComparisonHelper.cpp @@ -112,7 +112,7 @@ bool areIteratorsEqual(streamCharIter refStream, streamCharIter testStream, Mantid::Kernel::Logger g_log("FileComparisonHelper"); g_log.error("Length of both files were not identical"); areStreamsEqual = false; - } else if (numNewLines == 0 && seenChars.size() == 0) { + } else if (numNewLines == 0 && seenChars.empty()) { Mantid::Kernel::Logger g_log("FileComparisonHelper"); g_log.error("No characters checked in FileComparisonHelper"); areStreamsEqual = false; @@ -190,7 +190,7 @@ bool isEqualToReferenceFile(const std::string &referenceFileName, const std::string referenceFilePath = Mantid::API::FileFinder::Instance().getFullPath(referenceFileName); - if (referenceFilePath == "") { + if (referenceFilePath.empty()) { throw std::invalid_argument("No reference file with the name: " + referenceFileName + " could be found by FileComparisonHelper");