From 1312e4e85e31920dbb298b63c25ce98fa5ff9cb8 Mon Sep 17 00:00:00 2001 From: Pete Peterson Date: Fri, 3 Jan 2025 16:50:44 -0500 Subject: [PATCH] Migrate to std::optional for boost::regexp --- .../GUI/Experiment/LookupTableValidator.cpp | 4 ++-- .../ISISReflectometry/Reduction/Experiment.cpp | 2 +- .../ISISReflectometry/Reduction/LookupRow.cpp | 6 +++--- .../ISISReflectometry/Reduction/LookupRow.h | 6 +++--- .../ISISReflectometry/Reduction/LookupTable.cpp | 2 +- .../Reduction/ParseReflectometryStrings.cpp | 6 +++--- .../Reduction/ParseReflectometryStrings.h | 2 +- .../Reduction/ValidateLookupRow.cpp | 6 +++--- .../Reduction/ValidateLookupRow.h | 4 ++-- .../TestHelpers/ModelCreationHelper.cpp | 12 ++++++------ .../TestHelpers/ModelCreationHelper.h | 2 +- .../test/Experiment/ExperimentOptionDefaultsTest.h | 4 ++-- .../test/Experiment/ExperimentPresenterTest.h | 10 +++++----- .../test/Experiment/LookupTableValidatorTest.h | 4 ++-- .../test/Reduction/LookupTableTest.h | 14 +++++++------- .../test/Reduction/ParseReflectometryStringsTest.h | 6 +++--- .../test/Reduction/ValidateLookupRowTest.h | 14 +++++++------- 17 files changed, 52 insertions(+), 52 deletions(-) diff --git a/qt/scientific_interfaces/ISISReflectometry/GUI/Experiment/LookupTableValidator.cpp b/qt/scientific_interfaces/ISISReflectometry/GUI/Experiment/LookupTableValidator.cpp index 3c9b2d131a25..b751d25e9294 100644 --- a/qt/scientific_interfaces/ISISReflectometry/GUI/Experiment/LookupTableValidator.cpp +++ b/qt/scientific_interfaces/ISISReflectometry/GUI/Experiment/LookupTableValidator.cpp @@ -118,8 +118,8 @@ void LookupTableValidator::sortInPlaceByThetaThenTitleMatcher(LookupTableRows &l if (*lhs.thetaOrWildcard() != *rhs.thetaOrWildcard()) { return *lhs.thetaOrWildcard() < *rhs.thetaOrWildcard(); } - auto const lhsTitle = lhs.titleMatcher().get_value_or(boost::regex()); - auto const rhsTitle = rhs.titleMatcher().get_value_or(boost::regex()); + auto const lhsTitle = lhs.titleMatcher().value_or(boost::regex()); + auto const rhsTitle = rhs.titleMatcher().value_or(boost::regex()); return lhsTitle < rhsTitle; }; diff --git a/qt/scientific_interfaces/ISISReflectometry/Reduction/Experiment.cpp b/qt/scientific_interfaces/ISISReflectometry/Reduction/Experiment.cpp index fb4601eb82c4..0e4c58b10bc2 100644 --- a/qt/scientific_interfaces/ISISReflectometry/Reduction/Experiment.cpp +++ b/qt/scientific_interfaces/ISISReflectometry/Reduction/Experiment.cpp @@ -19,7 +19,7 @@ Experiment::Experiment() m_polarizationCorrections(PolarizationCorrections(PolarizationCorrectionType::None)), m_floodCorrections(FloodCorrections(FloodCorrectionType::Workspace)), m_transmissionStitchOptions(), m_stitchParameters(std::map()), - m_lookupTable(LookupTable({LookupRow(boost::none, boost::none, TransmissionRunPair(), boost::none, RangeInQ(), + m_lookupTable(LookupTable({LookupRow(boost::none, std::nullopt, TransmissionRunPair(), boost::none, RangeInQ(), boost::none, ProcessingInstructions(), boost::none, boost::none)})) {} Experiment::Experiment(AnalysisMode analysisMode, ReductionType reductionType, SummationType summationType, diff --git a/qt/scientific_interfaces/ISISReflectometry/Reduction/LookupRow.cpp b/qt/scientific_interfaces/ISISReflectometry/Reduction/LookupRow.cpp index 250deda9b2d7..a3bef79f8331 100644 --- a/qt/scientific_interfaces/ISISReflectometry/Reduction/LookupRow.cpp +++ b/qt/scientific_interfaces/ISISReflectometry/Reduction/LookupRow.cpp @@ -13,7 +13,7 @@ constexpr double EPSILON = std::numeric_limits::epsilon(); namespace MantidQt::CustomInterfaces::ISISReflectometry { -LookupRow::LookupRow(boost::optional theta, boost::optional titleMatcher, +LookupRow::LookupRow(boost::optional theta, std::optional titleMatcher, TransmissionRunPair transmissionRuns, boost::optional transmissionProcessingInstructions, RangeInQ qRange, boost::optional scaleFactor, @@ -30,11 +30,11 @@ LookupRow::LookupRow(boost::optional theta, boost::optional LookupRow::thetaOrWildcard() const { return m_theta; } -boost::optional LookupRow::titleMatcher() const { return m_titleMatcher; } +std::optional LookupRow::titleMatcher() const { return m_titleMatcher; } RangeInQ const &LookupRow::qRange() const { return m_qRange; } diff --git a/qt/scientific_interfaces/ISISReflectometry/Reduction/LookupRow.h b/qt/scientific_interfaces/ISISReflectometry/Reduction/LookupRow.h index fd1b676078ec..f63df4d8331f 100644 --- a/qt/scientific_interfaces/ISISReflectometry/Reduction/LookupRow.h +++ b/qt/scientific_interfaces/ISISReflectometry/Reduction/LookupRow.h @@ -47,7 +47,7 @@ class MANTIDQT_ISISREFLECTOMETRY_DLL LookupRow { ROI_DETECTOR_IDS = 11 }; - LookupRow(boost::optional theta, boost::optional titleMatcher, + LookupRow(boost::optional theta, std::optional titleMatcher, TransmissionRunPair tranmissionRuns, boost::optional transmissionProcessingInstructions, RangeInQ qRange, boost::optional scaleFactor, boost::optional processingInstructions, @@ -57,7 +57,7 @@ class MANTIDQT_ISISREFLECTOMETRY_DLL LookupRow { TransmissionRunPair const &transmissionWorkspaceNames() const; bool isWildcard() const; boost::optional thetaOrWildcard() const; - boost::optional titleMatcher() const; + std::optional titleMatcher() const; RangeInQ const &qRange() const; boost::optional scaleFactor() const; boost::optional transmissionProcessingInstructions() const; @@ -73,7 +73,7 @@ class MANTIDQT_ISISREFLECTOMETRY_DLL LookupRow { private: boost::optional m_theta; - boost::optional m_titleMatcher; + std::optional m_titleMatcher; TransmissionRunPair m_transmissionRuns; RangeInQ m_qRange; boost::optional m_scaleFactor; diff --git a/qt/scientific_interfaces/ISISReflectometry/Reduction/LookupTable.cpp b/qt/scientific_interfaces/ISISReflectometry/Reduction/LookupTable.cpp index 0ddfac9e4b1c..1d54a70df166 100644 --- a/qt/scientific_interfaces/ISISReflectometry/Reduction/LookupTable.cpp +++ b/qt/scientific_interfaces/ISISReflectometry/Reduction/LookupTable.cpp @@ -96,7 +96,7 @@ std::vector LookupTable::findMatchingRegexes(std::string const &title auto results = std::vector(); std::copy_if(m_lookupRows.cbegin(), m_lookupRows.cend(), std::back_inserter(results), [&title](auto const &candidate) { - return candidate.titleMatcher() && boost::regex_search(title, candidate.titleMatcher().get()); + return candidate.titleMatcher() && boost::regex_search(title, candidate.titleMatcher().value()); }); return results; } diff --git a/qt/scientific_interfaces/ISISReflectometry/Reduction/ParseReflectometryStrings.cpp b/qt/scientific_interfaces/ISISReflectometry/Reduction/ParseReflectometryStrings.cpp index 09d1be894ab5..764408239594 100644 --- a/qt/scientific_interfaces/ISISReflectometry/Reduction/ParseReflectometryStrings.cpp +++ b/qt/scientific_interfaces/ISISReflectometry/Reduction/ParseReflectometryStrings.cpp @@ -64,14 +64,14 @@ boost::optional parseTheta(std::string const &theta) { return boost::none; } -boost::optional parseTitleMatcher(std::string const &titleMatcher) { +std::optional parseTitleMatcher(std::string const &titleMatcher) { if (isEntirelyWhitespace(titleMatcher)) { - return boost::none; + return std::nullopt; } try { return boost::regex(titleMatcher); } catch (boost::regex_error const &) { - return boost::none; + return std::nullopt; } } diff --git a/qt/scientific_interfaces/ISISReflectometry/Reduction/ParseReflectometryStrings.h b/qt/scientific_interfaces/ISISReflectometry/Reduction/ParseReflectometryStrings.h index bd9440acecb4..7da843389fa5 100644 --- a/qt/scientific_interfaces/ISISReflectometry/Reduction/ParseReflectometryStrings.h +++ b/qt/scientific_interfaces/ISISReflectometry/Reduction/ParseReflectometryStrings.h @@ -28,7 +28,7 @@ parseRunNumberOrWhitespace(std::string const &runNumberString); MANTIDQT_ISISREFLECTOMETRY_DLL boost::optional parseTheta(std::string const &theta); -MANTIDQT_ISISREFLECTOMETRY_DLL boost::optional parseTitleMatcher(std::string const &titleMatcher); +MANTIDQT_ISISREFLECTOMETRY_DLL std::optional parseTitleMatcher(std::string const &titleMatcher); MANTIDQT_ISISREFLECTOMETRY_DLL boost::variant> parseTransmissionRuns(std::string const &firstTransmissionRun, diff --git a/qt/scientific_interfaces/ISISReflectometry/Reduction/ValidateLookupRow.cpp b/qt/scientific_interfaces/ISISReflectometry/Reduction/ValidateLookupRow.cpp index 53fbd14982a0..974d29e47825 100644 --- a/qt/scientific_interfaces/ISISReflectometry/Reduction/ValidateLookupRow.cpp +++ b/qt/scientific_interfaces/ISISReflectometry/Reduction/ValidateLookupRow.cpp @@ -54,11 +54,11 @@ ValidatorT> LookupRowValidator::parseThetaOrWhitespace(C return boost::none; } -ValidatorT> LookupRowValidator::parseTitleMatcherOrWhitespace(CellText const &cellText) { +ValidatorT> LookupRowValidator::parseTitleMatcherOrWhitespace(CellText const &cellText) { auto const &text = cellText[LookupRow::Column::TITLE]; if (isEntirelyWhitespace(text)) { // Mark validator as passed, but the enclosed value empty - return boost::optional(boost::none); + return boost::make_optional>(std::nullopt); } // This check relies on us checking for whitespace chars before calling parseTitleMatcher @@ -131,7 +131,7 @@ void LookupRowValidator::validateThetaAndRegex() { return; // Check we have a theta value, when we have a titleMatcher - if (m_titleMatcherOrInvalid.get().is_initialized() && !m_thetaOrInvalid.get().is_initialized()) { + if (m_titleMatcherOrInvalid.get().has_value() && !m_thetaOrInvalid.get().is_initialized()) { m_invalidColumns.insert(LookupRow::Column::THETA); m_invalidColumns.insert(LookupRow::Column::TITLE); m_thetaOrInvalid = boost::none; diff --git a/qt/scientific_interfaces/ISISReflectometry/Reduction/ValidateLookupRow.h b/qt/scientific_interfaces/ISISReflectometry/Reduction/ValidateLookupRow.h index e1de0684246b..a3d4e8662dce 100644 --- a/qt/scientific_interfaces/ISISReflectometry/Reduction/ValidateLookupRow.h +++ b/qt/scientific_interfaces/ISISReflectometry/Reduction/ValidateLookupRow.h @@ -31,7 +31,7 @@ class MANTIDQT_ISISREFLECTOMETRY_DLL LookupRowValidator { private: ValidatorT> parseThetaOrWhitespace(LookupRow::ValueArray const &cellText); - ValidatorT> parseTitleMatcherOrWhitespace(LookupRow::ValueArray const &cellText); + ValidatorT> parseTitleMatcherOrWhitespace(LookupRow::ValueArray const &cellText); ValidatorT parseTransmissionRuns(LookupRow::ValueArray const &cellText); ValidatorT> parseTransmissionProcessingInstructions(LookupRow::ValueArray const &cellText); @@ -46,7 +46,7 @@ class MANTIDQT_ISISREFLECTOMETRY_DLL LookupRowValidator { std::unordered_set m_invalidColumns; ValidatorT> m_thetaOrInvalid; - ValidatorT> m_titleMatcherOrInvalid; + ValidatorT> m_titleMatcherOrInvalid; }; ValidationResult> validateLookupRow(LookupRow::ValueArray const &cellText); diff --git a/qt/scientific_interfaces/ISISReflectometry/TestHelpers/ModelCreationHelper.cpp b/qt/scientific_interfaces/ISISReflectometry/TestHelpers/ModelCreationHelper.cpp index d9cd61dbd57a..d4bb96014716 100644 --- a/qt/scientific_interfaces/ISISReflectometry/TestHelpers/ModelCreationHelper.cpp +++ b/qt/scientific_interfaces/ISISReflectometry/TestHelpers/ModelCreationHelper.cpp @@ -345,7 +345,7 @@ ReductionJobs oneGroupWithTwoRowsWithOutputNamesModel() { /* Experiment */ -LookupRow makeLookupRow(boost::optional angle, boost::optional titleMatcher) { +LookupRow makeLookupRow(boost::optional angle, std::optional titleMatcher) { return LookupRow( std::move(angle), std::move(titleMatcher), TransmissionRunPair(std::vector{"22348", "22349"}, std::vector{"22358", "22359"}), @@ -353,19 +353,19 @@ LookupRow makeLookupRow(boost::optional angle, boost::optional angle, - boost::optional titleMatcher = boost::none); + std::optional titleMatcher = std::nullopt); MANTIDQT_ISISREFLECTOMETRY_DLL LookupTable makeEmptyLookupTable(); MANTIDQT_ISISREFLECTOMETRY_DLL LookupTable makeLookupTable(); MANTIDQT_ISISREFLECTOMETRY_DLL LookupTable makeLookupTableWithTwoAngles(); diff --git a/qt/scientific_interfaces/ISISReflectometry/test/Experiment/ExperimentOptionDefaultsTest.h b/qt/scientific_interfaces/ISISReflectometry/test/Experiment/ExperimentOptionDefaultsTest.h index e82ffb8062ae..cba821192be0 100644 --- a/qt/scientific_interfaces/ISISReflectometry/test/Experiment/ExperimentOptionDefaultsTest.h +++ b/qt/scientific_interfaces/ISISReflectometry/test/Experiment/ExperimentOptionDefaultsTest.h @@ -72,7 +72,7 @@ class ExperimentOptionDefaultsTest : public CxxTest::TestSuite { void testDefaultLookupRowOptions() { auto result = getDefaults(); - auto expected = LookupRow(boost::none, boost::none, TransmissionRunPair(), boost::none, + auto expected = LookupRow(boost::none, std::nullopt, TransmissionRunPair(), boost::none, RangeInQ(std::nullopt, std::nullopt, std::nullopt), boost::none, boost::none, boost::none, boost::none); auto foundLookupRows = result.lookupTableRows(); @@ -83,7 +83,7 @@ class ExperimentOptionDefaultsTest : public CxxTest::TestSuite { void testValidLookupRowOptionsFromParamsFile() { auto result = getDefaultsFromParamsFile("Experiment"); - auto expected = LookupRow(boost::none, boost::none, TransmissionRunPair(), boost::none, RangeInQ(0.01, 0.03, 0.2), + auto expected = LookupRow(boost::none, std::nullopt, TransmissionRunPair(), boost::none, RangeInQ(0.01, 0.03, 0.2), 0.7, std::string("390-415"), std::string("370-389,416-430"), boost::none); auto foundLookupRows = result.lookupTableRows(); TS_ASSERT_EQUALS(foundLookupRows.size(), 1); diff --git a/qt/scientific_interfaces/ISISReflectometry/test/Experiment/ExperimentPresenterTest.h b/qt/scientific_interfaces/ISISReflectometry/test/Experiment/ExperimentPresenterTest.h index c64ab921119d..b82661dcaec9 100644 --- a/qt/scientific_interfaces/ISISReflectometry/test/Experiment/ExperimentPresenterTest.h +++ b/qt/scientific_interfaces/ISISReflectometry/test/Experiment/ExperimentPresenterTest.h @@ -658,7 +658,7 @@ class ExperimentPresenterTest : public CxxTest::TestSuite { } void testInstrumentChangedUpdatesLookupRowInView() { - auto lookupRow = LookupRow(boost::none, boost::none, TransmissionRunPair(), boost::none, RangeInQ(0.01, 0.03, 0.2), + auto lookupRow = LookupRow(boost::none, std::nullopt, TransmissionRunPair(), boost::none, RangeInQ(0.01, 0.03, 0.2), 0.7, std::string("390-415"), std::string("370-389,416-430"), boost::none); auto model = makeModelWithLookupRow(std::move(lookupRow)); auto defaultOptions = expectDefaults(model); @@ -670,13 +670,13 @@ class ExperimentPresenterTest : public CxxTest::TestSuite { } void testInstrumentChangedUpdatesLookupRowInModel() { - auto model = makeModelWithLookupRow(LookupRow(boost::none, boost::none, TransmissionRunPair(), boost::none, + auto model = makeModelWithLookupRow(LookupRow(boost::none, std::nullopt, TransmissionRunPair(), boost::none, RangeInQ(0.01, 0.03, 0.2), 0.7, std::string("390-415"), std::string("370-389,416-430"), boost::none)); auto defaultOptions = expectDefaults(model); auto presenter = makePresenter(std::move(defaultOptions)); presenter.notifyInstrumentChanged("POLREF"); - auto expected = LookupRow(boost::none, boost::none, TransmissionRunPair(), boost::none, RangeInQ(0.01, 0.03, 0.2), + auto expected = LookupRow(boost::none, std::nullopt, TransmissionRunPair(), boost::none, RangeInQ(0.01, 0.03, 0.2), 0.7, std::string("390-415"), std::string("370-389,416-430"), boost::none); auto lookupRows = presenter.experiment().lookupTableRows(); TS_ASSERT_EQUALS(lookupRows.size(), 1); @@ -1140,13 +1140,13 @@ class ExperimentPresenterTest : public CxxTest::TestSuite { // either as an input array of strings or an output model OptionsRow optionsRowWithFirstAngle() { return {"0.5", "", "13463", ""}; } LookupRow defaultsWithFirstAngle() { - return LookupRow(0.5, boost::none, TransmissionRunPair("13463", ""), boost::none, RangeInQ(), boost::none, + return LookupRow(0.5, std::nullopt, TransmissionRunPair("13463", ""), boost::none, RangeInQ(), boost::none, boost::none, boost::none, boost::none); } OptionsRow optionsRowWithSecondAngle() { return {"2.3", "", "13463", "13464"}; } LookupRow defaultsWithSecondAngle() { - return LookupRow(2.3, boost::none, TransmissionRunPair("13463", "13464"), boost::none, RangeInQ(), boost::none, + return LookupRow(2.3, std::nullopt, TransmissionRunPair("13463", "13464"), boost::none, RangeInQ(), boost::none, boost::none, boost::none, boost::none); } OptionsRow optionsRowWithWildcard() { return {"", "", "13463", "13464"}; } diff --git a/qt/scientific_interfaces/ISISReflectometry/test/Experiment/LookupTableValidatorTest.h b/qt/scientific_interfaces/ISISReflectometry/test/Experiment/LookupTableValidatorTest.h index dd7003bfe713..1c140a99bc42 100644 --- a/qt/scientific_interfaces/ISISReflectometry/test/Experiment/LookupTableValidatorTest.h +++ b/qt/scientific_interfaces/ISISReflectometry/test/Experiment/LookupTableValidatorTest.h @@ -74,8 +74,8 @@ class LookupTableValidatorTest : public CxxTest::TestSuite { TS_ASSERT(results[0].thetaOrWildcard().is_initialized()); TS_ASSERT(results[1].thetaOrWildcard().is_initialized()); TS_ASSERT_EQUALS(results[0].thetaOrWildcard().get(), results[1].thetaOrWildcard().get()); - TS_ASSERT_EQUALS(results[0].titleMatcher().get().expression(), title1); - TS_ASSERT_EQUALS(results[1].titleMatcher().get().expression(), title2); + TS_ASSERT_EQUALS(results[0].titleMatcher().value().expression(), title1); + TS_ASSERT_EQUALS(results[1].titleMatcher().value().expression(), title2); } void testDuplicateAnglesAndTitleMatchersAreInvalid() { diff --git a/qt/scientific_interfaces/ISISReflectometry/test/Reduction/LookupTableTest.h b/qt/scientific_interfaces/ISISReflectometry/test/Reduction/LookupTableTest.h index 4178652604b3..1308b1b550b3 100644 --- a/qt/scientific_interfaces/ISISReflectometry/test/Reduction/LookupTableTest.h +++ b/qt/scientific_interfaces/ISISReflectometry/test/Reduction/LookupTableTest.h @@ -291,7 +291,7 @@ class LookupTableTest : public CxxTest::TestSuite { void test_searching_by_title_matches_empty_regex() { auto constexpr angle = 2.3; - auto emptyRegexRow = ModelCreationHelper::makeLookupRow(angle, boost::none); + auto emptyRegexRow = ModelCreationHelper::makeLookupRow(angle, std::nullopt); auto table = LookupTable{emptyRegexRow}; auto group = Group("En Oh", {ModelCreationHelper::makeRow(angle)}); @@ -302,7 +302,7 @@ class LookupTableTest : public CxxTest::TestSuite { void test_searching_by_title_matches_empty_regex_for_preview_row() { auto constexpr angle = 2.3; - auto emptyRegexRow = ModelCreationHelper::makeLookupRow(angle, boost::none); + auto emptyRegexRow = ModelCreationHelper::makeLookupRow(angle, std::nullopt); auto table = LookupTable{emptyRegexRow}; auto row = ModelCreationHelper::makePreviewRow(angle, "En Oh"s); @@ -313,7 +313,7 @@ class LookupTableTest : public CxxTest::TestSuite { void test_empty_title_matches_only_empty_regex() { auto constexpr angle = 2.3; - auto emptyRegexRow = ModelCreationHelper::makeLookupRow(angle, boost::none); + auto emptyRegexRow = ModelCreationHelper::makeLookupRow(angle, std::nullopt); auto regexRow = ModelCreationHelper::makeLookupRow(angle, boost::regex("Ay")); auto table = LookupTable{emptyRegexRow, regexRow}; @@ -325,7 +325,7 @@ class LookupTableTest : public CxxTest::TestSuite { void test_empty_title_matches_only_empty_regex_for_preview_row() { auto constexpr angle = 2.3; - auto emptyRegexRow = ModelCreationHelper::makeLookupRow(angle, boost::none); + auto emptyRegexRow = ModelCreationHelper::makeLookupRow(angle, std::nullopt); auto regexRow = ModelCreationHelper::makeLookupRow(angle, boost::regex("Ay")); auto table = LookupTable{emptyRegexRow, regexRow}; @@ -337,7 +337,7 @@ class LookupTableTest : public CxxTest::TestSuite { void test_no_loaded_ws_matches_only_empty_regex_for_preview_row() { auto constexpr angle = 2.3; - auto emptyRegexRow = ModelCreationHelper::makeLookupRow(angle, boost::none); + auto emptyRegexRow = ModelCreationHelper::makeLookupRow(angle, std::nullopt); auto regexRow = ModelCreationHelper::makeLookupRow(angle, boost::regex("Ay")); auto table = LookupTable{emptyRegexRow, regexRow}; @@ -370,7 +370,7 @@ class LookupTableTest : public CxxTest::TestSuite { void test_searching_with_no_matching_title_but_matching_theta_with_matching_title_present() { auto angle = 0.7; auto regexRow = ModelCreationHelper::makeLookupRow(2.3, boost::regex("Ay")); - auto nonRegexRow = ModelCreationHelper::makeLookupRow(angle, boost::none); + auto nonRegexRow = ModelCreationHelper::makeLookupRow(angle, std::nullopt); auto table = LookupTable{regexRow, nonRegexRow}; auto group = Group("Ay Bee", {ModelCreationHelper::makeRow(angle)}); @@ -382,7 +382,7 @@ class LookupTableTest : public CxxTest::TestSuite { void test_searching_with_no_matching_title_but_matching_theta_with_matching_title_present_for_preview_row() { auto angle = 0.7; auto regexRow = ModelCreationHelper::makeLookupRow(2.3, boost::regex("Ay")); - auto nonRegexRow = ModelCreationHelper::makeLookupRow(angle, boost::none); + auto nonRegexRow = ModelCreationHelper::makeLookupRow(angle, std::nullopt); auto table = LookupTable{regexRow, nonRegexRow}; auto row = ModelCreationHelper::makePreviewRow(angle, "Ay Bee"s); diff --git a/qt/scientific_interfaces/ISISReflectometry/test/Reduction/ParseReflectometryStringsTest.h b/qt/scientific_interfaces/ISISReflectometry/test/Reduction/ParseReflectometryStringsTest.h index c1ba220152ec..19a257d1ef0a 100644 --- a/qt/scientific_interfaces/ISISReflectometry/test/Reduction/ParseReflectometryStringsTest.h +++ b/qt/scientific_interfaces/ISISReflectometry/test/Reduction/ParseReflectometryStringsTest.h @@ -81,17 +81,17 @@ class ParseReflectometryStringsTest : public CxxTest::TestSuite { void testParseTitleMatcherEmpty() { auto result = parseTitleMatcher(" \t "); - TS_ASSERT(!result.is_initialized()); + TS_ASSERT(!result.has_value()); } void testParseTitleMatcher() { auto result = parseTitleMatcher(".*"); - TS_ASSERT(result.is_initialized()); + TS_ASSERT(result.has_value()); } void testParseTitleMatcherHandlesInvalidRegex() { auto result = parseTitleMatcher("["); - TS_ASSERT(!result.is_initialized()); + TS_ASSERT(!result.has_value()); } void testParseOptions() { diff --git a/qt/scientific_interfaces/ISISReflectometry/test/Reduction/ValidateLookupRowTest.h b/qt/scientific_interfaces/ISISReflectometry/test/Reduction/ValidateLookupRowTest.h index 385ef2fc057e..ae294d43249d 100644 --- a/qt/scientific_interfaces/ISISReflectometry/test/Reduction/ValidateLookupRowTest.h +++ b/qt/scientific_interfaces/ISISReflectometry/test/Reduction/ValidateLookupRowTest.h @@ -44,8 +44,8 @@ class ValidateLookupRowTest : public CxxTest::TestSuite { void testParseTitleMatcherEmpty() { LookupRowValidator validator; auto result = validator({"0.5", ""}); - TS_ASSERT(result.isValid()); // Outer initialized (not invalid) - TS_ASSERT(!result.assertValid().titleMatcher().is_initialized()) // Inner not initialized (empty) + TS_ASSERT(result.isValid()); // Outer initialized (not invalid) + TS_ASSERT(!result.assertValid().titleMatcher().has_value()) // Inner not initialized (empty) } void testParseTitleMatcherWhitespace() { @@ -53,7 +53,7 @@ class ValidateLookupRowTest : public CxxTest::TestSuite { auto result = validator({"0.5", " \t"}); TS_ASSERT(result.isValid()); // All whitespace is the equivalent of an empty string - TS_ASSERT(!result.assertValid().titleMatcher().is_initialized()) + TS_ASSERT(!result.assertValid().titleMatcher().has_value()) } void testParseTitleMatcherSimpleValid() { @@ -63,8 +63,8 @@ class ValidateLookupRowTest : public CxxTest::TestSuite { TS_ASSERT(result.isValid()); auto const &titleMatcher = result.assertValid().titleMatcher(); - TS_ASSERT(titleMatcher.is_initialized()) - TS_ASSERT_EQUALS(expected, titleMatcher.get().expression()) + TS_ASSERT(titleMatcher.has_value()) + TS_ASSERT_EQUALS(expected, titleMatcher.value().expression()) } void testParseTitleMatcherRegexCharsValid() { @@ -74,8 +74,8 @@ class ValidateLookupRowTest : public CxxTest::TestSuite { TS_ASSERT(result.isValid()); auto const &titleMatcher = result.assertValid().titleMatcher(); - TS_ASSERT(titleMatcher.is_initialized()) - TS_ASSERT_EQUALS(expected, titleMatcher.get().expression()) + TS_ASSERT(titleMatcher.has_value()) + TS_ASSERT_EQUALS(expected, titleMatcher.value().expression()) } void testParseTitleMatcherInvalid() {