1 /* 2 * Created by Phil on 13/7/2015. 3 * Copyright 2015 Two Blue Cubes Ltd. All rights reserved. 4 * 5 * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 */ 8 #ifndef TWOBLUECUBES_CATCH_WILDCARD_PATTERN_HPP_INCLUDED 9 #define TWOBLUECUBES_CATCH_WILDCARD_PATTERN_HPP_INCLUDED 10 11 #include "catch_common.h" 12 13 14 namespace Catch 15 { 16 class WildcardPattern { 17 enum WildcardPosition { 18 NoWildcard = 0, 19 WildcardAtStart = 1, 20 WildcardAtEnd = 2, 21 WildcardAtBothEnds = WildcardAtStart | WildcardAtEnd 22 }; 23 24 public: 25 26 WildcardPattern( std::string const& pattern, CaseSensitive::Choice caseSensitivity ); 27 virtual ~WildcardPattern() = default; 28 virtual bool matches( std::string const& str ) const; 29 30 private: 31 std::string adjustCase( std::string const& str ) const; 32 CaseSensitive::Choice m_caseSensitivity; 33 WildcardPosition m_wildcard = NoWildcard; 34 std::string m_pattern; 35 }; 36 } 37 38 #endif // TWOBLUECUBES_CATCH_WILDCARD_PATTERN_HPP_INCLUDED 39