Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
Catch::WildcardPattern Class Reference

#include <catch_wildcard_pattern.h>

Public Member Functions

 WildcardPattern (std::string const &pattern, CaseSensitive::Choice caseSensitivity)
 
virtual ~WildcardPattern ()=default
 
virtual bool matches (std::string const &str) const
 

Detailed Description

Definition at line 16 of file catch_wildcard_pattern.h.

Constructor & Destructor Documentation

◆ 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 {
21 if( startsWith( m_pattern, '*' ) ) {
22 m_pattern = m_pattern.substr( 1 );
23 m_wildcard = WildcardAtStart;
24 }
25 if( endsWith( m_pattern, '*' ) ) {
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)
Here is the call graph for this function:

◆ ~WildcardPattern()

virtual Catch::WildcardPattern::~WildcardPattern ( )
virtualdefault

Member Function Documentation

◆ 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:
42 CATCH_INTERNAL_ERROR( "Unknown enum" );
43 }
44 }
#define CATCH_INTERNAL_ERROR(msg)
bool contains(std::string const &s, std::string const &infix)
Here is the call graph for this function:

The documentation for this class was generated from the following files: