mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +01:00
parent
e13d9cab02
commit
8f3fc15b73
10
include/external/clara.hpp
vendored
10
include/external/clara.hpp
vendored
@ -5,7 +5,7 @@
|
|||||||
//
|
//
|
||||||
// See https://github.com/philsquared/Clara for more details
|
// See https://github.com/philsquared/Clara for more details
|
||||||
|
|
||||||
// Clara v1.1.1
|
// Clara v1.1.2
|
||||||
|
|
||||||
#ifndef CATCH_CLARA_HPP_INCLUDED
|
#ifndef CATCH_CLARA_HPP_INCLUDED
|
||||||
#define CATCH_CLARA_HPP_INCLUDED
|
#define CATCH_CLARA_HPP_INCLUDED
|
||||||
@ -670,12 +670,14 @@ namespace detail {
|
|||||||
struct BoundRef : NonCopyable {
|
struct BoundRef : NonCopyable {
|
||||||
virtual ~BoundRef() = default;
|
virtual ~BoundRef() = default;
|
||||||
virtual auto isContainer() const -> bool { return false; }
|
virtual auto isContainer() const -> bool { return false; }
|
||||||
|
virtual auto isFlag() const -> bool { return false; }
|
||||||
};
|
};
|
||||||
struct BoundValueRefBase : BoundRef {
|
struct BoundValueRefBase : BoundRef {
|
||||||
virtual auto setValue( std::string const &arg ) -> ParserResult = 0;
|
virtual auto setValue( std::string const &arg ) -> ParserResult = 0;
|
||||||
};
|
};
|
||||||
struct BoundFlagRefBase : BoundRef {
|
struct BoundFlagRefBase : BoundRef {
|
||||||
virtual auto setFlag( bool flag ) -> ParserResult = 0;
|
virtual auto setFlag( bool flag ) -> ParserResult = 0;
|
||||||
|
virtual auto isFlag() const -> bool { return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@ -907,7 +909,7 @@ namespace detail {
|
|||||||
if( token.type != TokenType::Argument )
|
if( token.type != TokenType::Argument )
|
||||||
return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) );
|
return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) );
|
||||||
|
|
||||||
assert( dynamic_cast<detail::BoundValueRefBase*>( m_ref.get() ) );
|
assert( !m_ref->isFlag() );
|
||||||
auto valueRef = static_cast<detail::BoundValueRefBase*>( m_ref.get() );
|
auto valueRef = static_cast<detail::BoundValueRefBase*>( m_ref.get() );
|
||||||
|
|
||||||
auto result = valueRef->setValue( remainingTokens->token );
|
auto result = valueRef->setValue( remainingTokens->token );
|
||||||
@ -983,14 +985,14 @@ namespace detail {
|
|||||||
if( remainingTokens && remainingTokens->type == TokenType::Option ) {
|
if( remainingTokens && remainingTokens->type == TokenType::Option ) {
|
||||||
auto const &token = *remainingTokens;
|
auto const &token = *remainingTokens;
|
||||||
if( isMatch(token.token ) ) {
|
if( isMatch(token.token ) ) {
|
||||||
if( auto flagRef = dynamic_cast<detail::BoundFlagRefBase*>( m_ref.get() ) ) {
|
if( m_ref->isFlag() ) {
|
||||||
|
auto flagRef = static_cast<detail::BoundFlagRefBase*>( m_ref.get() );
|
||||||
auto result = flagRef->setFlag( true );
|
auto result = flagRef->setFlag( true );
|
||||||
if( !result )
|
if( !result )
|
||||||
return InternalParseResult( result );
|
return InternalParseResult( result );
|
||||||
if( result.value() == ParseResultType::ShortCircuitAll )
|
if( result.value() == ParseResultType::ShortCircuitAll )
|
||||||
return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) );
|
return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) );
|
||||||
} else {
|
} else {
|
||||||
assert( dynamic_cast<detail::BoundValueRefBase*>( m_ref.get() ) );
|
|
||||||
auto valueRef = static_cast<detail::BoundValueRefBase*>( m_ref.get() );
|
auto valueRef = static_cast<detail::BoundValueRefBase*>( m_ref.get() );
|
||||||
++remainingTokens;
|
++remainingTokens;
|
||||||
if( !remainingTokens )
|
if( !remainingTokens )
|
||||||
|
10
third_party/clara.hpp
vendored
10
third_party/clara.hpp
vendored
@ -5,7 +5,7 @@
|
|||||||
//
|
//
|
||||||
// See https://github.com/philsquared/Clara for more details
|
// See https://github.com/philsquared/Clara for more details
|
||||||
|
|
||||||
// Clara v1.1.1
|
// Clara v1.1.2
|
||||||
|
|
||||||
#ifndef CLARA_HPP_INCLUDED
|
#ifndef CLARA_HPP_INCLUDED
|
||||||
#define CLARA_HPP_INCLUDED
|
#define CLARA_HPP_INCLUDED
|
||||||
@ -670,12 +670,14 @@ namespace detail {
|
|||||||
struct BoundRef : NonCopyable {
|
struct BoundRef : NonCopyable {
|
||||||
virtual ~BoundRef() = default;
|
virtual ~BoundRef() = default;
|
||||||
virtual auto isContainer() const -> bool { return false; }
|
virtual auto isContainer() const -> bool { return false; }
|
||||||
|
virtual auto isFlag() const -> bool { return false; }
|
||||||
};
|
};
|
||||||
struct BoundValueRefBase : BoundRef {
|
struct BoundValueRefBase : BoundRef {
|
||||||
virtual auto setValue( std::string const &arg ) -> ParserResult = 0;
|
virtual auto setValue( std::string const &arg ) -> ParserResult = 0;
|
||||||
};
|
};
|
||||||
struct BoundFlagRefBase : BoundRef {
|
struct BoundFlagRefBase : BoundRef {
|
||||||
virtual auto setFlag( bool flag ) -> ParserResult = 0;
|
virtual auto setFlag( bool flag ) -> ParserResult = 0;
|
||||||
|
virtual auto isFlag() const -> bool { return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@ -907,7 +909,7 @@ namespace detail {
|
|||||||
if( token.type != TokenType::Argument )
|
if( token.type != TokenType::Argument )
|
||||||
return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) );
|
return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) );
|
||||||
|
|
||||||
assert( dynamic_cast<detail::BoundValueRefBase*>( m_ref.get() ) );
|
assert( !m_ref->isFlag() );
|
||||||
auto valueRef = static_cast<detail::BoundValueRefBase*>( m_ref.get() );
|
auto valueRef = static_cast<detail::BoundValueRefBase*>( m_ref.get() );
|
||||||
|
|
||||||
auto result = valueRef->setValue( remainingTokens->token );
|
auto result = valueRef->setValue( remainingTokens->token );
|
||||||
@ -983,14 +985,14 @@ namespace detail {
|
|||||||
if( remainingTokens && remainingTokens->type == TokenType::Option ) {
|
if( remainingTokens && remainingTokens->type == TokenType::Option ) {
|
||||||
auto const &token = *remainingTokens;
|
auto const &token = *remainingTokens;
|
||||||
if( isMatch(token.token ) ) {
|
if( isMatch(token.token ) ) {
|
||||||
if( auto flagRef = dynamic_cast<detail::BoundFlagRefBase*>( m_ref.get() ) ) {
|
if( m_ref->isFlag() ) {
|
||||||
|
auto flagRef = static_cast<detail::BoundFlagRefBase*>( m_ref.get() );
|
||||||
auto result = flagRef->setFlag( true );
|
auto result = flagRef->setFlag( true );
|
||||||
if( !result )
|
if( !result )
|
||||||
return InternalParseResult( result );
|
return InternalParseResult( result );
|
||||||
if( result.value() == ParseResultType::ShortCircuitAll )
|
if( result.value() == ParseResultType::ShortCircuitAll )
|
||||||
return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) );
|
return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) );
|
||||||
} else {
|
} else {
|
||||||
assert( dynamic_cast<detail::BoundValueRefBase*>( m_ref.get() ) );
|
|
||||||
auto valueRef = static_cast<detail::BoundValueRefBase*>( m_ref.get() );
|
auto valueRef = static_cast<detail::BoundValueRefBase*>( m_ref.get() );
|
||||||
++remainingTokens;
|
++remainingTokens;
|
||||||
if( !remainingTokens )
|
if( !remainingTokens )
|
||||||
|
Loading…
Reference in New Issue
Block a user