diff options
| author | Chris Thrasher | 2025-09-21 18:05:21 -0600 |
|---|---|---|
| committer | Chris Thrasher | 2025-09-22 11:50:44 -0600 |
| commit | 8efee9b7632e6dd014b5b041ee326eef7d0b09e6 (patch) | |
| tree | fbc1657a5d7d414fbe93a412990bcf5cfb2df438 /src/catch2/interfaces | |
| parent | a5735af2f7d956600250541d289c552ace7e87ae (diff) | |
| download | catch3-devel-c++17.tar.gz | |
Use std::string_viewdevel-c++17
Diffstat (limited to 'src/catch2/interfaces')
7 files changed, 21 insertions, 27 deletions
diff --git a/src/catch2/interfaces/catch_interfaces_capture.hpp b/src/catch2/interfaces/catch_interfaces_capture.hpp index b4fee6cd..737b7262 100644 --- a/src/catch2/interfaces/catch_interfaces_capture.hpp +++ b/src/catch2/interfaces/catch_interfaces_capture.hpp @@ -10,7 +10,6 @@ #include <string> -#include <catch2/internal/catch_stringref.hpp> #include <catch2/internal/catch_result_type.hpp> #include <catch2/internal/catch_unique_ptr.hpp> #include <catch2/benchmark/detail/catch_benchmark_stats_fwd.hpp> @@ -43,31 +42,31 @@ namespace Catch { virtual ~IResultCapture(); virtual void notifyAssertionStarted( AssertionInfo const& info ) = 0; - virtual bool sectionStarted( StringRef sectionName, + virtual bool sectionStarted( std::string_view sectionName, SourceLineInfo const& sectionLineInfo, Counts& assertions ) = 0; virtual void sectionEnded( SectionEndInfo&& endInfo ) = 0; virtual void sectionEndedEarly( SectionEndInfo&& endInfo ) = 0; virtual IGeneratorTracker* - acquireGeneratorTracker( StringRef generatorName, + acquireGeneratorTracker( std::string_view generatorName, SourceLineInfo const& lineInfo ) = 0; virtual IGeneratorTracker* - createGeneratorTracker( StringRef generatorName, + createGeneratorTracker( std::string_view generatorName, SourceLineInfo lineInfo, Generators::GeneratorBasePtr&& generator ) = 0; - virtual void benchmarkPreparing( StringRef name ) = 0; + virtual void benchmarkPreparing( std::string_view name ) = 0; virtual void benchmarkStarting( BenchmarkInfo const& info ) = 0; virtual void benchmarkEnded( BenchmarkStats<> const& stats ) = 0; - virtual void benchmarkFailed( StringRef error ) = 0; + virtual void benchmarkFailed( std::string_view error ) = 0; virtual void pushScopedMessage( MessageInfo&& message ) = 0; virtual void popScopedMessage( unsigned int messageId ) = 0; virtual void emplaceUnscopedMessage( MessageBuilder&& builder ) = 0; - virtual void handleFatalErrorCondition( StringRef message ) = 0; + virtual void handleFatalErrorCondition( std::string_view message ) = 0; virtual void handleExpr ( AssertionInfo const& info, diff --git a/src/catch2/interfaces/catch_interfaces_config.hpp b/src/catch2/interfaces/catch_interfaces_config.hpp index 82a298db..8aa43a59 100644 --- a/src/catch2/interfaces/catch_interfaces_config.hpp +++ b/src/catch2/interfaces/catch_interfaces_config.hpp @@ -9,7 +9,6 @@ #define CATCH_INTERFACES_CONFIG_HPP_INCLUDED #include <catch2/internal/catch_noncopyable.hpp> -#include <catch2/internal/catch_stringref.hpp> #include <chrono> #include <string> @@ -66,7 +65,7 @@ namespace Catch { virtual ~IConfig(); virtual bool allowThrows() const = 0; - virtual StringRef name() const = 0; + virtual std::string_view name() const = 0; virtual bool includeSuccessfulResults() const = 0; virtual bool shouldDebugBreak() const = 0; virtual bool warnAboutMissingAssertions() const = 0; diff --git a/src/catch2/interfaces/catch_interfaces_enum_values_registry.hpp b/src/catch2/interfaces/catch_interfaces_enum_values_registry.hpp index 38b052d9..8a601bce 100644 --- a/src/catch2/interfaces/catch_interfaces_enum_values_registry.hpp +++ b/src/catch2/interfaces/catch_interfaces_enum_values_registry.hpp @@ -8,20 +8,19 @@ #ifndef CATCH_INTERFACES_ENUM_VALUES_REGISTRY_HPP_INCLUDED #define CATCH_INTERFACES_ENUM_VALUES_REGISTRY_HPP_INCLUDED -#include <catch2/internal/catch_stringref.hpp> - +#include <string_view> #include <vector> namespace Catch { namespace Detail { struct EnumInfo { - StringRef m_name; - std::vector<std::pair<int, StringRef>> m_values; + std::string_view m_name; + std::vector<std::pair<int, std::string_view>> m_values; ~EnumInfo(); - StringRef lookup( int value ) const; + std::string_view lookup( int value ) const; }; } // namespace Detail @@ -29,10 +28,10 @@ namespace Catch { public: virtual ~IMutableEnumValuesRegistry(); // = default; - virtual Detail::EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::vector<int> const& values ) = 0; + virtual Detail::EnumInfo const& registerEnum( std::string_view enumName, std::string_view allEnums, std::vector<int> const& values ) = 0; template<typename E> - Detail::EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::initializer_list<E> values ) { + Detail::EnumInfo const& registerEnum( std::string_view enumName, std::string_view allEnums, std::initializer_list<E> values ) { static_assert(sizeof(int) >= sizeof(E), "Cannot serialize enum to int"); std::vector<int> intValues; intValues.reserve( values.size() ); diff --git a/src/catch2/interfaces/catch_interfaces_generatortracker.cpp b/src/catch2/interfaces/catch_interfaces_generatortracker.cpp index e9fa5dda..837bf63b 100644 --- a/src/catch2/interfaces/catch_interfaces_generatortracker.cpp +++ b/src/catch2/interfaces/catch_interfaces_generatortracker.cpp @@ -21,7 +21,7 @@ namespace Catch { return ret; } - StringRef GeneratorUntypedBase::currentElementAsString() const { + std::string_view GeneratorUntypedBase::currentElementAsString() const { if ( m_stringReprCache.empty() ) { m_stringReprCache = stringifyImpl(); } diff --git a/src/catch2/interfaces/catch_interfaces_generatortracker.hpp b/src/catch2/interfaces/catch_interfaces_generatortracker.hpp index d70cb593..2e83d39d 100644 --- a/src/catch2/interfaces/catch_interfaces_generatortracker.hpp +++ b/src/catch2/interfaces/catch_interfaces_generatortracker.hpp @@ -9,7 +9,6 @@ #define CATCH_INTERFACES_GENERATORTRACKER_HPP_INCLUDED #include <catch2/internal/catch_unique_ptr.hpp> -#include <catch2/internal/catch_stringref.hpp> #include <string> @@ -71,7 +70,7 @@ namespace Catch { * is destructed, or it moves onto the next element, whichever * comes first. */ - StringRef currentElementAsString() const; + std::string_view currentElementAsString() const; }; using GeneratorBasePtr = Catch::Detail::unique_ptr<GeneratorUntypedBase>; diff --git a/src/catch2/interfaces/catch_interfaces_reporter.hpp b/src/catch2/interfaces/catch_interfaces_reporter.hpp index c7217889..7e9e85e8 100644 --- a/src/catch2/interfaces/catch_interfaces_reporter.hpp +++ b/src/catch2/interfaces/catch_interfaces_reporter.hpp @@ -13,7 +13,6 @@ #include <catch2/catch_totals.hpp> #include <catch2/catch_assertion_result.hpp> #include <catch2/internal/catch_message_info.hpp> -#include <catch2/internal/catch_stringref.hpp> #include <catch2/internal/catch_unique_ptr.hpp> #include <catch2/benchmark/detail/catch_benchmark_stats.hpp> @@ -154,9 +153,9 @@ namespace Catch { } //! Called when no test cases match provided test spec - virtual void noMatchingTestCases( StringRef unmatchedSpec ) = 0; + virtual void noMatchingTestCases( std::string_view unmatchedSpec ) = 0; //! Called for all invalid test specs from the cli - virtual void reportInvalidTestSpec( StringRef invalidArgument ) = 0; + virtual void reportInvalidTestSpec( std::string_view invalidArgument ) = 0; /** * Called once in a testing run before tests are started @@ -173,13 +172,13 @@ namespace Catch { virtual void sectionStarting( SectionInfo const& sectionInfo ) = 0; //! Called when user-code is being probed before the actual benchmark runs - virtual void benchmarkPreparing( StringRef benchmarkName ) = 0; + virtual void benchmarkPreparing( std::string_view benchmarkName ) = 0; //! Called after probe but before the user-code is being benchmarked virtual void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) = 0; //! Called with the benchmark results if benchmark successfully finishes virtual void benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) = 0; //! Called if running the benchmarks fails for any reason - virtual void benchmarkFailed( StringRef benchmarkName ) = 0; + virtual void benchmarkFailed( std::string_view benchmarkName ) = 0; //! Called before assertion success/failure is evaluated virtual void assertionStarting( AssertionInfo const& assertionInfo ) = 0; @@ -209,7 +208,7 @@ namespace Catch { virtual void skipTest( TestCaseInfo const& testInfo ) = 0; //! Called if a fatal error (signal/structured exception) occurred - virtual void fatalErrorEncountered( StringRef error ) = 0; + virtual void fatalErrorEncountered( std::string_view error ) = 0; //! Writes out information about provided reporters using reporter-specific format virtual void listReporters(std::vector<ReporterDescription> const& descriptions) = 0; diff --git a/src/catch2/interfaces/catch_interfaces_reporter_factory.hpp b/src/catch2/interfaces/catch_interfaces_reporter_factory.hpp index 83ddd7bc..100f1dc0 100644 --- a/src/catch2/interfaces/catch_interfaces_reporter_factory.hpp +++ b/src/catch2/interfaces/catch_interfaces_reporter_factory.hpp @@ -9,7 +9,6 @@ #define CATCH_INTERFACES_REPORTER_FACTORY_HPP_INCLUDED #include <catch2/internal/catch_unique_ptr.hpp> -#include <catch2/internal/catch_stringref.hpp> #include <string> @@ -36,7 +35,7 @@ namespace Catch { virtual ~EventListenerFactory(); // = default virtual IEventListenerPtr create( IConfig const* config ) const = 0; //! Return a meaningful name for the listener, e.g. its type name - virtual StringRef getName() const = 0; + virtual std::string_view getName() const = 0; //! Return listener's description if available virtual std::string getDescription() const = 0; }; |