First commit of STRINGIFY_ENUM

This commit is contained in:
Phil nash
2019-04-04 15:55:46 +01:00
parent 08147a23f9
commit 43428c6093
16 changed files with 587 additions and 8 deletions

View File

@@ -6,11 +6,13 @@
*/
#include "catch_string_manip.h"
#include "catch_stringref.h"
#include <algorithm>
#include <ostream>
#include <cstring>
#include <cctype>
#include <vector>
namespace Catch {
@@ -65,6 +67,21 @@ namespace Catch {
return replaced;
}
std::vector<std::string> splitString( StringRef str, char delimiter ) {
std::vector<std::string> subStrings;
std::size_t start = 0;
for(std::size_t pos = 0; pos < str.size(); ++pos ) {
if( str[pos] == delimiter ) {
if( pos - start > 1 )
subStrings.push_back( str.substr( start, pos-start ) );
start = pos+1;
}
}
if( start < str.size() )
subStrings.push_back( str.substr( start, str.size()-start ) );
return subStrings;
}
pluralise::pluralise( std::size_t count, std::string const& label )
: m_count( count ),
m_label( label )