File indexing completed on 2025-01-30 10:02:50
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef CATCH_STRING_MANIP_HPP_INCLUDED
0009 #define CATCH_STRING_MANIP_HPP_INCLUDED
0010
0011 #include <cstdint>
0012 #include <catch2/internal/catch_stringref.hpp>
0013
0014 #include <cstdint>
0015 #include <string>
0016 #include <iosfwd>
0017 #include <vector>
0018
0019 namespace Catch {
0020
0021 bool startsWith( std::string const& s, std::string const& prefix );
0022 bool startsWith( StringRef s, char prefix );
0023 bool endsWith( std::string const& s, std::string const& suffix );
0024 bool endsWith( std::string const& s, char suffix );
0025 bool contains( std::string const& s, std::string const& infix );
0026 void toLowerInPlace( std::string& s );
0027 std::string toLower( std::string const& s );
0028 char toLower( char c );
0029
0030 std::string trim( std::string const& str );
0031
0032 StringRef trim(StringRef ref);
0033
0034
0035 std::vector<StringRef> splitStringRef( StringRef str, char delimiter );
0036 bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis );
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048 class pluralise {
0049 std::uint64_t m_count;
0050 StringRef m_label;
0051
0052 public:
0053 constexpr pluralise(std::uint64_t count, StringRef label):
0054 m_count(count),
0055 m_label(label)
0056 {}
0057
0058 friend std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser );
0059 };
0060 }
0061
0062 #endif