Split out CaseInsensitiveCmp into its own file

This commit is contained in:
Martin Hořeňovský committed 2021-12-26 00:35:46 +01:00
1 parent cde26de803
commit 187bf6db2b
6 files changed
+55 -17

No files matched your search

@@ -76,21 +76,9 @@ namespace Catch {
#include <catch2/interfaces/catch_interfaces_reporter_registry.hpp>
#include <catch2/internal/catch_string_manip.hpp>
#include <algorithm>
namespace Catch {
IReporterRegistry::~IReporterRegistry() = default;
bool IReporterRegistry::CaseInsensitiveCmp::operator()(std::string const& lhs, std::string const& rhs) const {
return std::lexicographical_compare(lhs.begin(), lhs.end(),
rhs.begin(), rhs.end(),
[](char l, char r) {
return toLower(l) < toLower(r);
});
}
}
@@ -8,6 +8,7 @@
#ifndef CATCH_INTERFACES_REPORTER_REGISTRY_HPP_INCLUDED
#define CATCH_INTERFACES_REPORTER_REGISTRY_HPP_INCLUDED
#include <catch2/internal/catch_case_insensitive_comparisons.hpp>
#include <catch2/internal/catch_unique_ptr.hpp>
#include <string>
@@ -24,11 +25,7 @@ namespace Catch {
using IReporterFactoryPtr = Detail::unique_ptr<IReporterFactory>;
struct IReporterRegistry {
struct CaseInsensitiveCmp {
bool operator()(std::string const& lhs, std::string const& rhs) const;
};
using FactoryMap = std::map<std::string, IReporterFactoryPtr, CaseInsensitiveCmp>;
using FactoryMap = std::map<std::string, IReporterFactoryPtr, Detail::CaseInsensitiveLess>;
using Listeners = std::vector<IReporterFactoryPtr>;
virtual ~IReporterRegistry(); // = default