#include <catch_wildcard_pattern.h>
Definition at line 16 of file catch_wildcard_pattern.h.
◆ WildcardPattern()
Catch::WildcardPattern::WildcardPattern |
( |
std::string const & | pattern, |
|
|
CaseSensitive::Choice | caseSensitivity ) |
Definition at line 16 of file catch_wildcard_pattern.cpp.
18 : m_caseSensitivity( caseSensitivity ),
19 m_pattern( adjustCase( pattern ) )
20 {
22 m_pattern = m_pattern.substr( 1 );
23 m_wildcard = WildcardAtStart;
24 }
26 m_pattern = m_pattern.substr( 0, m_pattern.size()-1 );
27 m_wildcard = static_cast<WildcardPosition>( m_wildcard | WildcardAtEnd );
28 }
29 }
bool startsWith(std::string const &s, std::string const &prefix)
bool endsWith(std::string const &s, std::string const &suffix)
◆ ~WildcardPattern()
virtual Catch::WildcardPattern::~WildcardPattern |
( |
| ) |
|
|
virtualdefault |
◆ matches()
bool Catch::WildcardPattern::matches |
( |
std::string const & | str | ) |
const |
|
virtual |
Definition at line 31 of file catch_wildcard_pattern.cpp.
31 {
32 switch( m_wildcard ) {
33 case NoWildcard:
34 return m_pattern == adjustCase( str );
35 case WildcardAtStart:
36 return endsWith( adjustCase( str ), m_pattern );
37 case WildcardAtEnd:
38 return startsWith( adjustCase( str ), m_pattern );
39 case WildcardAtBothEnds:
40 return contains( adjustCase( str ), m_pattern );
41 default:
43 }
44 }
#define CATCH_INTERNAL_ERROR(msg)
bool contains(std::string const &s, std::string const &infix)
The documentation for this class was generated from the following files: