18 : m_caseSensitivity( caseSensitivity ),
19 m_pattern( adjustCase( pattern ) )
22 m_pattern = m_pattern.substr( 1 );
23 m_wildcard = WildcardAtStart;
26 m_pattern = m_pattern.substr( 0, m_pattern.size()-1 );
27 m_wildcard =
static_cast<WildcardPosition
>( m_wildcard | WildcardAtEnd );
32 switch( m_wildcard ) {
34 return m_pattern == adjustCase( str );
36 return endsWith( adjustCase( str ), m_pattern );
38 return startsWith( adjustCase( str ), m_pattern );
39 case WildcardAtBothEnds:
40 return contains( adjustCase( str ), m_pattern );
46 std::string WildcardPattern::adjustCase( std::string
const& str )
const {
#define CATCH_INTERNAL_ERROR(msg)
WildcardPattern(std::string const &pattern, CaseSensitive::Choice caseSensitivity)
virtual bool matches(std::string const &str) const
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)