Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:02:51

0001 
0002 //              Copyright Catch2 Authors
0003 // Distributed under the Boost Software License, Version 1.0.
0004 //   (See accompanying file LICENSE.txt or copy at
0005 //        https://www.boost.org/LICENSE_1_0.txt)
0006 
0007 // SPDX-License-Identifier: BSL-1.0
0008 #ifndef CATCH_WILDCARD_PATTERN_HPP_INCLUDED
0009 #define CATCH_WILDCARD_PATTERN_HPP_INCLUDED
0010 
0011 #include <catch2/internal/catch_case_sensitive.hpp>
0012 
0013 #include <string>
0014 
0015 namespace Catch
0016 {
0017     class WildcardPattern {
0018         enum WildcardPosition {
0019             NoWildcard = 0,
0020             WildcardAtStart = 1,
0021             WildcardAtEnd = 2,
0022             WildcardAtBothEnds = WildcardAtStart | WildcardAtEnd
0023         };
0024 
0025     public:
0026 
0027         WildcardPattern( std::string const& pattern, CaseSensitive caseSensitivity );
0028         bool matches( std::string const& str ) const;
0029 
0030     private:
0031         std::string normaliseString( std::string const& str ) const;
0032         CaseSensitive m_caseSensitivity;
0033         WildcardPosition m_wildcard = NoWildcard;
0034         std::string m_pattern;
0035     };
0036 }
0037 
0038 #endif // CATCH_WILDCARD_PATTERN_HPP_INCLUDED