Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
catch_string_manip.h
Go to the documentation of this file.
1/*
2 * Created by Martin on 25/07/2017.
3 *
4 * Distributed under the Boost Software License, Version 1.0. (See accompanying
5 * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 */
7#ifndef TWOBLUECUBES_CATCH_STRING_MANIP_H_INCLUDED
8#define TWOBLUECUBES_CATCH_STRING_MANIP_H_INCLUDED
9
10#include "catch_stringref.h"
11
12#include <string>
13#include <iosfwd>
14#include <vector>
15
16namespace Catch {
17
18 bool startsWith( std::string const& s, std::string const& prefix );
19 bool startsWith( std::string const& s, char prefix );
20 bool endsWith( std::string const& s, std::string const& suffix );
21 bool endsWith( std::string const& s, char suffix );
22 bool contains( std::string const& s, std::string const& infix );
23 void toLowerInPlace( std::string& s );
24 std::string toLower( std::string const& s );
25 std::string trim( std::string const& str );
26
27 // !!! Be aware, returns refs into original string - make sure original string outlives them
28 std::vector<StringRef> splitStringRef( StringRef str, char delimiter );
29 bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis );
30
31 struct pluralise {
32 pluralise( std::size_t count, std::string const& label );
33
34 friend std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser );
35
36 std::size_t m_count;
37 std::string m_label;
38 };
39}
40
41#endif // TWOBLUECUBES_CATCH_STRING_MANIP_H_INCLUDED
42
GenericStringRef< CharType > StringRef(const CharType *str)
Mark a character pointer as constant string.
Definition document.h:364
os_t os
int * count
void toLowerInPlace(std::string &s)
std::string trim(std::string const &str)
std::vector< StringRef > splitStringRef(StringRef str, char delimiter)
bool startsWith(std::string const &s, std::string const &prefix)
bool contains(std::string const &s, std::string const &infix)
std::string toLower(std::string const &s)
bool endsWith(std::string const &s, std::string const &suffix)
bool replaceInPlace(std::string &str, std::string const &replaceThis, std::string const &withThis)
pluralise(std::size_t count, std::string const &label)
friend std::ostream & operator<<(std::ostream &os, pluralise const &pluraliser)
char * label
char * s