2015-07-13 16:03:04 +02:00
|
|
|
/*
|
|
|
|
* Created by Phil on 13/7/2015.
|
|
|
|
* Copyright 2015 Two Blue Cubes Ltd. All rights reserved.
|
|
|
|
*
|
|
|
|
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
*/
|
|
|
|
#ifndef TWOBLUECUBES_CATCH_WILDCARD_PATTERN_HPP_INCLUDED
|
|
|
|
#define TWOBLUECUBES_CATCH_WILDCARD_PATTERN_HPP_INCLUDED
|
|
|
|
|
|
|
|
#include "catch_common.h"
|
|
|
|
|
2017-02-12 12:17:07 +01:00
|
|
|
#include <stdexcept>
|
|
|
|
|
|
|
|
|
2015-07-13 16:03:04 +02:00
|
|
|
namespace Catch
|
|
|
|
{
|
|
|
|
class WildcardPattern {
|
|
|
|
enum WildcardPosition {
|
|
|
|
NoWildcard = 0,
|
|
|
|
WildcardAtStart = 1,
|
|
|
|
WildcardAtEnd = 2,
|
|
|
|
WildcardAtBothEnds = WildcardAtStart | WildcardAtEnd
|
|
|
|
};
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-07-13 16:03:04 +02:00
|
|
|
public:
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2017-07-19 10:13:47 +02:00
|
|
|
WildcardPattern( std::string const& pattern, CaseSensitive::Choice caseSensitivity );
|
|
|
|
virtual ~WildcardPattern() = default;
|
|
|
|
virtual bool matches( std::string const& str ) const;
|
|
|
|
|
2015-07-13 16:03:04 +02:00
|
|
|
private:
|
2017-07-19 10:13:47 +02:00
|
|
|
std::string adjustCase( std::string const& str ) const;
|
2015-07-16 00:02:25 +02:00
|
|
|
CaseSensitive::Choice m_caseSensitivity;
|
2017-04-25 19:56:53 +02:00
|
|
|
WildcardPosition m_wildcard = NoWildcard;
|
2015-07-13 16:03:04 +02:00
|
|
|
std::string m_pattern;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // TWOBLUECUBES_CATCH_WILDCARD_PATTERN_HPP_INCLUDED
|