Split out helper functions on std::string from catch_common.h

This commit is contained in:
Martin Hořeňovský
2017-07-25 21:57:35 +02:00
parent 1e59ccee41
commit 1a96175bb2
17 changed files with 134 additions and 86 deletions

View File

@@ -22,7 +22,6 @@
#define INTERNAL_CATCH_STRINGIFY( expr ) INTERNAL_CATCH_STRINGIFY2( expr )
#include <sstream>
#include <algorithm>
#include <exception>
namespace Catch {
@@ -45,26 +44,6 @@ namespace Catch {
virtual ~NonCopyable();
};
bool startsWith( std::string const& s, std::string const& prefix );
bool startsWith( std::string const& s, char prefix );
bool endsWith( std::string const& s, std::string const& suffix );
bool endsWith( std::string const& s, char suffix );
bool contains( std::string const& s, std::string const& infix );
void toLowerInPlace( std::string& s );
std::string toLower( std::string const& s );
std::string trim( std::string const& str );
bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis );
struct pluralise {
pluralise( std::size_t count, std::string const& label );
friend std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser );
std::size_t m_count;
std::string m_label;
};
struct SourceLineInfo {
SourceLineInfo() noexcept;
@@ -98,9 +77,7 @@ namespace Catch {
// as well as
// >> stuff +StreamEndStop
struct StreamEndStop {
std::string operator+() const {
return std::string();
}
std::string operator+() const;
};
template<typename T>
T const& operator + ( T const& value, StreamEndStop ) {