Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src/catch2/internal
diff options
context:
space:
mode:
authorChris Thrasher2025-09-21 18:05:21 -0600
committerChris Thrasher2025-09-22 11:50:44 -0600
commit8efee9b7632e6dd014b5b041ee326eef7d0b09e6 (patch)
treefbc1657a5d7d414fbe93a412990bcf5cfb2df438 /src/catch2/internal
parenta5735af2f7d956600250541d289c552ace7e87ae (diff)
downloadcatch3-devel-c++17.tar.gz
Use std::string_viewdevel-c++17
Diffstat (limited to 'src/catch2/internal')
-rw-r--r--src/catch2/internal/catch_assertion_handler.cpp4
-rw-r--r--src/catch2/internal/catch_assertion_handler.hpp4
-rw-r--r--src/catch2/internal/catch_case_insensitive_comparisons.cpp8
-rw-r--r--src/catch2/internal/catch_case_insensitive_comparisons.hpp10
-rw-r--r--src/catch2/internal/catch_clara.cpp20
-rw-r--r--src/catch2/internal/catch_clara.hpp45
-rw-r--r--src/catch2/internal/catch_decomposer.cpp2
-rw-r--r--src/catch2/internal/catch_decomposer.hpp27
-rw-r--r--src/catch2/internal/catch_enum_values_registry.cpp15
-rw-r--r--src/catch2/internal/catch_enum_values_registry.hpp7
-rw-r--r--src/catch2/internal/catch_jsonwriter.cpp24
-rw-r--r--src/catch2/internal/catch_jsonwriter.hpp9
-rw-r--r--src/catch2/internal/catch_list.cpp4
-rw-r--r--src/catch2/internal/catch_list.hpp9
-rw-r--r--src/catch2/internal/catch_message_info.cpp2
-rw-r--r--src/catch2/internal/catch_message_info.hpp5
-rw-r--r--src/catch2/internal/catch_preprocessor.hpp8
-rw-r--r--src/catch2/internal/catch_preprocessor_internal_stringify.hpp4
-rw-r--r--src/catch2/internal/catch_reporter_spec_parser.cpp24
-rw-r--r--src/catch2/internal/catch_reporter_spec_parser.hpp7
-rw-r--r--src/catch2/internal/catch_run_context.cpp16
-rw-r--r--src/catch2/internal/catch_run_context.hpp12
-rw-r--r--src/catch2/internal/catch_section.cpp2
-rw-r--r--src/catch2/internal/catch_section.hpp4
-rw-r--r--src/catch2/internal/catch_stream_end_stop.hpp4
-rw-r--r--src/catch2/internal/catch_string_manip.cpp24
-rw-r--r--src/catch2/internal/catch_string_manip.hpp25
-rw-r--r--src/catch2/internal/catch_stringref.cpp65
-rw-r--r--src/catch2/internal/catch_stringref.hpp123
-rw-r--r--src/catch2/internal/catch_template_test_registry.hpp6
-rw-r--r--src/catch2/internal/catch_test_case_tracker.cpp10
-rw-r--r--src/catch2/internal/catch_test_case_tracker.hpp18
-rw-r--r--src/catch2/internal/catch_test_macro_impl.hpp11
-rw-r--r--src/catch2/internal/catch_test_registry.cpp4
-rw-r--r--src/catch2/internal/catch_test_registry.hpp29
-rw-r--r--src/catch2/internal/catch_xmlwriter.cpp34
-rw-r--r--src/catch2/internal/catch_xmlwriter.hpp32
37 files changed, 228 insertions, 429 deletions
diff --git a/src/catch2/internal/catch_assertion_handler.cpp b/src/catch2/internal/catch_assertion_handler.cpp
index 9a28e79c..e812863f 100644
--- a/src/catch2/internal/catch_assertion_handler.cpp
+++ b/src/catch2/internal/catch_assertion_handler.cpp
@@ -15,9 +15,9 @@
namespace Catch {
AssertionHandler::AssertionHandler
- ( StringRef macroName,
+ ( std::string_view macroName,
SourceLineInfo const& lineInfo,
- StringRef capturedExpression,
+ std::string_view capturedExpression,
ResultDisposition::Flags resultDisposition )
: m_assertionInfo{ macroName, lineInfo, capturedExpression, resultDisposition },
m_resultCapture( getResultCapture() )
diff --git a/src/catch2/internal/catch_assertion_handler.hpp b/src/catch2/internal/catch_assertion_handler.hpp
index c71c6898..bc5ac052 100644
--- a/src/catch2/internal/catch_assertion_handler.hpp
+++ b/src/catch2/internal/catch_assertion_handler.hpp
@@ -30,9 +30,9 @@ namespace Catch {
public:
AssertionHandler
- ( StringRef macroName,
+ ( std::string_view macroName,
SourceLineInfo const& lineInfo,
- StringRef capturedExpression,
+ std::string_view capturedExpression,
ResultDisposition::Flags resultDisposition );
~AssertionHandler() {
if ( !m_completed ) {
diff --git a/src/catch2/internal/catch_case_insensitive_comparisons.cpp b/src/catch2/internal/catch_case_insensitive_comparisons.cpp
index b3e7b53a..9920e528 100644
--- a/src/catch2/internal/catch_case_insensitive_comparisons.cpp
+++ b/src/catch2/internal/catch_case_insensitive_comparisons.cpp
@@ -14,8 +14,8 @@
namespace Catch {
namespace Detail {
- bool CaseInsensitiveLess::operator()( StringRef lhs,
- StringRef rhs ) const {
+ bool CaseInsensitiveLess::operator()( std::string_view lhs,
+ std::string_view rhs ) const {
return std::lexicographical_compare(
lhs.begin(), lhs.end(),
rhs.begin(), rhs.end(),
@@ -23,8 +23,8 @@ namespace Catch {
}
bool
- CaseInsensitiveEqualTo::operator()( StringRef lhs,
- StringRef rhs ) const {
+ CaseInsensitiveEqualTo::operator()( std::string_view lhs,
+ std::string_view rhs ) const {
return std::equal(
lhs.begin(), lhs.end(),
rhs.begin(), rhs.end(),
diff --git a/src/catch2/internal/catch_case_insensitive_comparisons.hpp b/src/catch2/internal/catch_case_insensitive_comparisons.hpp
index 33b77826..f8cf6a92 100644
--- a/src/catch2/internal/catch_case_insensitive_comparisons.hpp
+++ b/src/catch2/internal/catch_case_insensitive_comparisons.hpp
@@ -8,20 +8,20 @@
#ifndef CATCH_CASE_INSENSITIVE_COMPARISONS_HPP_INCLUDED
#define CATCH_CASE_INSENSITIVE_COMPARISONS_HPP_INCLUDED
-#include <catch2/internal/catch_stringref.hpp>
+#include <string_view>
namespace Catch {
namespace Detail {
//! Provides case-insensitive `op<` semantics when called
struct CaseInsensitiveLess {
- bool operator()( StringRef lhs,
- StringRef rhs ) const;
+ bool operator()( std::string_view lhs,
+ std::string_view rhs ) const;
};
//! Provides case-insensitive `op==` semantics when called
struct CaseInsensitiveEqualTo {
- bool operator()( StringRef lhs,
- StringRef rhs ) const;
+ bool operator()( std::string_view lhs,
+ std::string_view rhs ) const;
};
} // namespace Detail
diff --git a/src/catch2/internal/catch_clara.cpp b/src/catch2/internal/catch_clara.cpp
index f9dd9138..bbddc903 100644
--- a/src/catch2/internal/catch_clara.cpp
+++ b/src/catch2/internal/catch_clara.cpp
@@ -25,7 +25,7 @@ namespace {
;
}
- Catch::StringRef normaliseOpt( Catch::StringRef optName ) {
+ std::string_view normaliseOpt( std::string_view optName ) {
if ( optName[0] == '-'
#if defined(CATCH_PLATFORM_WINDOWS)
|| optName[0] == '/'
@@ -37,7 +37,7 @@ namespace {
return optName;
}
- static size_t find_first_separator(Catch::StringRef sr) {
+ static size_t find_first_separator(std::string_view sr) {
auto is_separator = []( char c ) {
return c == ' ' || c == ':' || c == '=';
};
@@ -47,7 +47,7 @@ namespace {
++pos;
}
- return Catch::StringRef::npos;
+ return std::string_view::npos;
}
} // namespace
@@ -65,10 +65,10 @@ namespace Catch {
}
if ( it != itEnd ) {
- StringRef next = *it;
+ std::string_view next = *it;
if ( isOptPrefix( next[0] ) ) {
auto delimiterPos = find_first_separator(next);
- if ( delimiterPos != StringRef::npos ) {
+ if ( delimiterPos != std::string_view::npos ) {
m_tokenBuffer.push_back(
{ TokenType::Option,
next.substr( 0, delimiterPos ) } );
@@ -205,7 +205,7 @@ namespace Catch {
return { oss.str(), m_description };
}
- bool Opt::isMatch(StringRef optToken) const {
+ bool Opt::isMatch(std::string_view optToken) const {
auto normalisedToken = normaliseOpt(optToken);
for (auto const& name : m_optNames) {
if (normaliseOpt(name) == normalisedToken)
@@ -243,12 +243,12 @@ namespace Catch {
if (!tokens)
return Detail::InternalParseResult::runtimeError(
"Expected argument following " +
- token.token);
+ std::string(token.token));
auto const& argToken = *tokens;
if (argToken.type != Detail::TokenType::Argument)
return Detail::InternalParseResult::runtimeError(
"Expected argument following " +
- token.token);
+ std::string(token.token));
const auto result = valueRef->setValue(static_cast<std::string>(argToken.token));
if (!result)
return Detail::InternalParseResult(result);
@@ -436,7 +436,7 @@ namespace Catch {
if ( !tokenParsed )
return Detail::InternalParseResult::runtimeError(
"Unrecognised token: " +
- result.value().remainingTokens()->token );
+ std::string(result.value().remainingTokens()->token) );
}
// !TBD Check missing required options
return result;
@@ -445,7 +445,7 @@ namespace Catch {
Args::Args(int argc, char const* const* argv) :
m_exeName(argv[0]), m_args(argv + 1, argv + argc) {}
- Args::Args(std::initializer_list<StringRef> args) :
+ Args::Args(std::initializer_list<std::string_view> args) :
m_exeName(*args.begin()),
m_args(args.begin() + 1, args.end()) {}
diff --git a/src/catch2/internal/catch_clara.hpp b/src/catch2/internal/catch_clara.hpp
index 49983b54..9b91bf33 100644
--- a/src/catch2/internal/catch_clara.hpp
+++ b/src/catch2/internal/catch_clara.hpp
@@ -22,7 +22,6 @@
#include <optional>
-#include <catch2/internal/catch_stringref.hpp>
#include <catch2/internal/catch_move_and_forward.hpp>
#include <catch2/internal/catch_noncopyable.hpp>
#include <catch2/internal/catch_void_type.hpp>
@@ -93,13 +92,13 @@ namespace Catch {
enum class TokenType { Option, Argument };
struct Token {
TokenType type;
- StringRef token;
+ std::string_view token;
};
// Abstracts iterators into args as a stream of tokens, with option
// arguments uniformly handled
class TokenStream {
- using Iterator = std::vector<StringRef>::const_iterator;
+ using Iterator = std::vector<std::string_view>::const_iterator;
Iterator it;
Iterator itEnd;
std::vector<Token> m_tokenBuffer;
@@ -302,7 +301,7 @@ namespace Catch {
struct HelpColumns {
std::string left;
- StringRef descriptions;
+ std::string_view descriptions;
};
template <typename T>
@@ -480,8 +479,8 @@ namespace Catch {
protected:
Optionality m_optionality = Optionality::Optional;
std::shared_ptr<BoundRef> m_ref;
- StringRef m_hint;
- StringRef m_description;
+ std::string_view m_hint;
+ std::string_view m_description;
explicit ParserRefImpl( std::shared_ptr<BoundRef> const& ref ):
m_ref( ref ) {}
@@ -490,29 +489,29 @@ namespace Catch {
template <typename LambdaT>
ParserRefImpl( accept_many_t,
LambdaT const& ref,
- StringRef hint ):
+ std::string_view hint ):
m_ref( std::make_shared<BoundManyLambda<LambdaT>>( ref ) ),
m_hint( hint ) {}
template <typename T,
typename = typename std::enable_if_t<
!Detail::is_unary_function_v<T>>>
- ParserRefImpl( T& ref, StringRef hint ):
+ ParserRefImpl( T& ref, std::string_view hint ):
m_ref( std::make_shared<BoundValueRef<T>>( ref ) ),
m_hint( hint ) {}
template <typename LambdaT,
typename = typename std::enable_if_t<
Detail::is_unary_function_v<LambdaT>>>
- ParserRefImpl( LambdaT const& ref, StringRef hint ):
+ ParserRefImpl( LambdaT const& ref, std::string_view hint ):
m_ref( std::make_shared<BoundLambda<LambdaT>>( ref ) ),
m_hint( hint ) {}
- DerivedT& operator()( StringRef description ) & {
+ DerivedT& operator()( std::string_view description ) & {
m_description = description;
return static_cast<DerivedT&>( *this );
}
- DerivedT&& operator()( StringRef description ) && {
+ DerivedT&& operator()( std::string_view description ) && {
m_description = description;
return static_cast<DerivedT&&>( *this );
}
@@ -538,7 +537,7 @@ namespace Catch {
return 1;
}
- StringRef hint() const { return m_hint; }
+ std::string_view hint() const { return m_hint; }
};
} // namespace detail
@@ -558,7 +557,7 @@ namespace Catch {
// A parser for options
class Opt : public Detail::ParserRefImpl<Opt> {
protected:
- std::vector<StringRef> m_optNames;
+ std::vector<std::string_view> m_optNames;
public:
template <typename LambdaT>
@@ -571,31 +570,31 @@ namespace Catch {
template <typename LambdaT,
typename = typename std::enable_if_t<
Detail::is_unary_function_v<LambdaT>>>
- Opt( LambdaT const& ref, StringRef hint ):
+ Opt( LambdaT const& ref, std::string_view hint ):
ParserRefImpl( ref, hint ) {}
template <typename LambdaT>
- Opt( accept_many_t, LambdaT const& ref, StringRef hint ):
+ Opt( accept_many_t, LambdaT const& ref, std::string_view hint ):
ParserRefImpl( accept_many, ref, hint ) {}
template <typename T,
typename = typename std::enable_if_t<
!Detail::is_unary_function_v<T>>>
- Opt( T& ref, StringRef hint ):
+ Opt( T& ref, std::string_view hint ):
ParserRefImpl( ref, hint ) {}
- Opt& operator[]( StringRef optName ) & {
+ Opt& operator[]( std::string_view optName ) & {
m_optNames.push_back(optName);
return *this;
}
- Opt&& operator[]( StringRef optName ) && {
+ Opt&& operator[]( std::string_view optName ) && {
m_optNames.push_back( optName );
return CATCH_MOVE(*this);
}
Detail::HelpColumns getHelpColumns() const;
- bool isMatch(StringRef optToken) const;
+ bool isMatch(std::string_view optToken) const;
using ParserBase::parse;
@@ -696,15 +695,15 @@ namespace Catch {
*/
class Args {
friend Detail::TokenStream;
- StringRef m_exeName;
- std::vector<StringRef> m_args;
+ std::string_view m_exeName;
+ std::vector<std::string_view> m_args;
public:
Args(int argc, char const* const* argv);
// Helper constructor for testing
- Args(std::initializer_list<StringRef> args);
+ Args(std::initializer_list<std::string_view> args);
- StringRef exeName() const { return m_exeName; }
+ std::string_view exeName() const { return m_exeName; }
};
diff --git a/src/catch2/internal/catch_decomposer.cpp b/src/catch2/internal/catch_decomposer.cpp
index 17a7bc95..4cfca2d3 100644
--- a/src/catch2/internal/catch_decomposer.cpp
+++ b/src/catch2/internal/catch_decomposer.cpp
@@ -17,7 +17,7 @@ namespace Catch {
os << "Some class derived from ITransientExpression without overriding streamReconstructedExpression";
}
- void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ) {
+ void formatReconstructedExpression( std::ostream &os, std::string const& lhs, std::string_view op, std::string const& rhs ) {
if( lhs.size() + rhs.size() < 40 &&
lhs.find('\n') == std::string::npos &&
rhs.find('\n') == std::string::npos )
diff --git a/src/catch2/internal/catch_decomposer.hpp b/src/catch2/internal/catch_decomposer.hpp
index 18398dc4..fd7613aa 100644
--- a/src/catch2/internal/catch_decomposer.hpp
+++ b/src/catch2/internal/catch_decomposer.hpp
@@ -9,7 +9,6 @@
#define CATCH_DECOMPOSER_HPP_INCLUDED
#include <catch2/catch_tostring.hpp>
-#include <catch2/internal/catch_stringref.hpp>
#include <catch2/internal/catch_compare_traits.hpp>
#include <catch2/internal/catch_test_failure_exception.hpp>
#include <catch2/internal/catch_compiler_capabilities.hpp>
@@ -189,12 +188,12 @@ namespace Catch {
}
};
- void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs );
+ void formatReconstructedExpression( std::ostream &os, std::string const& lhs, std::string_view op, std::string const& rhs );
template<typename LhsT, typename RhsT>
class BinaryExpr : public ITransientExpression {
LhsT m_lhs;
- StringRef m_op;
+ std::string_view m_op;
RhsT m_rhs;
void streamReconstructedExpression( std::ostream &os ) const override {
@@ -203,7 +202,7 @@ namespace Catch {
}
public:
- constexpr BinaryExpr( bool comparisonResult, LhsT lhs, StringRef op, RhsT rhs )
+ constexpr BinaryExpr( bool comparisonResult, LhsT lhs, std::string_view op, RhsT rhs )
: ITransientExpression{ true, comparisonResult },
m_lhs( lhs ),
m_op( op ),
@@ -298,7 +297,7 @@ namespace Catch {
Detail::RemoveCVRef_t<RhsT>>>>, \
BinaryExpr<LhsT, RhsT const&>> { \
return { \
- static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \
+ static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op, rhs }; \
} \
template <typename RhsT> \
constexpr friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \
@@ -307,7 +306,7 @@ namespace Catch {
capture_by_value<RhsT>>, \
BinaryExpr<LhsT, RhsT>> { \
return { \
- static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \
+ static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op, rhs }; \
} \
template <typename RhsT> \
constexpr friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \
@@ -321,7 +320,7 @@ namespace Catch {
BinaryExpr<LhsT, RhsT>> { \
if ( rhs != 0 ) { throw_test_failure_exception(); } \
return { \
- static_cast<bool>( lhs.m_lhs op 0 ), lhs.m_lhs, #op##_sr, rhs }; \
+ static_cast<bool>( lhs.m_lhs op 0 ), lhs.m_lhs, #op, rhs }; \
} \
template <typename RhsT> \
constexpr friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \
@@ -334,7 +333,7 @@ namespace Catch {
std::is_same<LhsT, long>>>, \
BinaryExpr<LhsT, RhsT>> { \
if ( lhs.m_lhs != 0 ) { throw_test_failure_exception(); } \
- return { static_cast<bool>( 0 op rhs ), lhs.m_lhs, #op##_sr, rhs }; \
+ return { static_cast<bool>( 0 op rhs ), lhs.m_lhs, #op, rhs }; \
}
CATCH_INTERNAL_DEFINE_EXPRESSION_EQUALITY_OPERATOR( eq, == )
@@ -352,7 +351,7 @@ namespace Catch {
Detail::RemoveCVRef_t<RhsT>>>>, \
BinaryExpr<LhsT, RhsT const&>> { \
return { \
- static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \
+ static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op, rhs }; \
} \
template <typename RhsT> \
constexpr friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \
@@ -361,7 +360,7 @@ namespace Catch {
capture_by_value<RhsT>> , \
BinaryExpr<LhsT, RhsT>> { \
return { \
- static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \
+ static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op, rhs }; \
} \
template <typename RhsT> \
constexpr friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \
@@ -373,7 +372,7 @@ namespace Catch {
BinaryExpr<LhsT, RhsT>> { \
if ( rhs != 0 ) { throw_test_failure_exception(); } \
return { \
- static_cast<bool>( lhs.m_lhs op 0 ), lhs.m_lhs, #op##_sr, rhs }; \
+ static_cast<bool>( lhs.m_lhs op 0 ), lhs.m_lhs, #op, rhs }; \
} \
template <typename RhsT> \
constexpr friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \
@@ -384,7 +383,7 @@ namespace Catch {
std::is_same<LhsT, int>>, \
BinaryExpr<LhsT, RhsT>> { \
if ( lhs.m_lhs != 0 ) { throw_test_failure_exception(); } \
- return { static_cast<bool>( 0 op rhs ), lhs.m_lhs, #op##_sr, rhs }; \
+ return { static_cast<bool>( 0 op rhs ), lhs.m_lhs, #op, rhs }; \
}
CATCH_INTERNAL_DEFINE_EXPRESSION_COMPARISON_OPERATOR( lt, < )
@@ -402,14 +401,14 @@ namespace Catch {
!capture_by_value<Detail::RemoveCVRef_t<RhsT>>::value, \
BinaryExpr<LhsT, RhsT const&>> { \
return { \
- static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \
+ static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op, rhs }; \
} \
template <typename RhsT> \
constexpr friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \
-> std::enable_if_t<capture_by_value<RhsT>::value, \
BinaryExpr<LhsT, RhsT>> { \
return { \
- static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \
+ static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op, rhs }; \
}
CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(|)
diff --git a/src/catch2/internal/catch_enum_values_registry.cpp b/src/catch2/internal/catch_enum_values_registry.cpp
index a94b6088..a0eeee46 100644
--- a/src/catch2/internal/catch_enum_values_registry.cpp
+++ b/src/catch2/internal/catch_enum_values_registry.cpp
@@ -19,7 +19,7 @@ namespace Catch {
namespace {
// Extracts the actual name part of an enum instance
// In other words, it returns the Blue part of Bikeshed::Colour::Blue
- StringRef extractInstanceName(StringRef enumInstance) {
+ std::string_view extractInstanceName(std::string_view enumInstance) {
// Find last occurrence of ":"
size_t name_start = enumInstance.size();
while (name_start > 0 && enumInstance[name_start - 1] != ':') {
@@ -29,9 +29,9 @@ namespace Catch {
}
}
- std::vector<StringRef> parseEnums( StringRef enums ) {
+ std::vector<std::string_view> parseEnums( std::string_view enums ) {
auto enumValues = splitStringRef( enums, ',' );
- std::vector<StringRef> parsed;
+ std::vector<std::string_view> parsed;
parsed.reserve( enumValues.size() );
for( auto const& enumValue : enumValues ) {
parsed.push_back(trim(extractInstanceName(enumValue)));
@@ -41,15 +41,15 @@ namespace Catch {
EnumInfo::~EnumInfo() = default;
- StringRef EnumInfo::lookup( int value ) const {
+ std::string_view EnumInfo::lookup( int value ) const {
for( auto const& valueToName : m_values ) {
if( valueToName.first == value )
return valueToName.second;
}
- return "{** unexpected enum value **}"_sr;
+ return "{** unexpected enum value **}";
}
- Catch::Detail::unique_ptr<EnumInfo> makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector<int> const& values ) {
+ Catch::Detail::unique_ptr<EnumInfo> makeEnumInfo( std::string_view enumName, std::string_view allValueNames, std::vector<int> const& values ) {
auto enumInfo = Catch::Detail::make_unique<EnumInfo>();
enumInfo->m_name = enumName;
enumInfo->m_values.reserve( values.size() );
@@ -63,11 +63,10 @@ namespace Catch {
return enumInfo;
}
- EnumInfo const& EnumValuesRegistry::registerEnum( StringRef enumName, StringRef allValueNames, std::vector<int> const& values ) {
+ EnumInfo const& EnumValuesRegistry::registerEnum( std::string_view enumName, std::string_view allValueNames, std::vector<int> const& values ) {
m_enumInfos.push_back(makeEnumInfo(enumName, allValueNames, values