2020-08-30 15:43:45 +02:00
|
|
|
|
|
|
|
|
// Copyright Catch2 Authors
|
|
|
|
|
// Distributed under the Boost Software License, Version 1.0.
|
|
|
|
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
|
|
|
|
// https://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
|
|
|
|
|
|
// SPDX-License-Identifier: BSL-1.0
|
2020-08-29 20:48:32 +02:00
|
|
|
#ifndef CATCH_WILDCARD_PATTERN_HPP_INCLUDED
|
|
|
|
|
#define CATCH_WILDCARD_PATTERN_HPP_INCLUDED
|
2015-07-13 15:03:04 +01:00
|
|
|
|
2020-08-18 13:11:30 +02:00
|
|
|
#include <catch2/internal/catch_case_sensitive.hpp>
|
2015-07-13 15:03:04 +01:00
|
|
|
|
2020-08-18 13:11:30 +02:00
|
|
|
#include <string>
|
2017-02-12 12:17:07 +01:00
|
|
|
|
2015-07-13 15:03:04 +01:00
|
|
|
namespace Catch
|
|
|
|
|
{
|
|
|
|
|
class WildcardPattern {
|
|
|
|
|
enum WildcardPosition {
|
|
|
|
|
NoWildcard = 0,
|
|
|
|
|
WildcardAtStart = 1,
|
|
|
|
|
WildcardAtEnd = 2,
|
|
|
|
|
WildcardAtBothEnds = WildcardAtStart | WildcardAtEnd
|
|
|
|
|
};
|
2015-11-04 18:01:28 +00:00
|
|
|
|
2015-07-13 15:03:04 +01:00
|
|
|
public:
|
2015-11-04 18:01:28 +00:00
|
|
|
|
2020-08-18 13:44:37 +02:00
|
|
|
WildcardPattern( std::string const& pattern, CaseSensitive caseSensitivity );
|
2020-11-26 18:35:20 +01:00
|
|
|
bool matches( std::string const& str ) const;
|
2017-07-19 10:13:47 +02:00
|
|
|
|
2015-07-13 15:03:04 +01:00
|
|
|
private:
|
2019-09-09 11:30:45 +02:00
|
|
|
std::string normaliseString( std::string const& str ) const;
|
2020-08-18 13:44:37 +02:00
|
|
|
CaseSensitive m_caseSensitivity;
|
2017-04-25 18:56:53 +01:00
|
|
|
WildcardPosition m_wildcard = NoWildcard;
|
2015-07-13 15:03:04 +01:00
|
|
|
std::string m_pattern;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-29 20:48:32 +02:00
|
|
|
#endif // CATCH_WILDCARD_PATTERN_HPP_INCLUDED
|