Updated Clara with VS ICE workaround

This commit is contained in:
Phil Nash 2017-06-22 16:07:05 +01:00
parent 0470b300a8
commit 2462dff088
2 changed files with 16 additions and 13 deletions

View File

@ -31,8 +31,7 @@
#include <vector>
#ifndef CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH
#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH
#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH 80
#endif
@ -785,9 +784,7 @@ namespace detail {
public:
virtual ~ParserBase() = default;
virtual auto validate() const -> Result { return Result::ok(); }
virtual auto parse( std::string const& exeName, TokenStream const &tokens) const -> InternalParseResult = 0;
virtual auto cardinality() const -> size_t { return 1; }
auto parse(Args const &args) const -> InternalParseResult {
@ -926,13 +923,17 @@ namespace detail {
std::vector<std::string> m_optNames;
public:
using ParserRefImpl::ParserRefImpl;
template<typename LambdaT>
explicit Opt( LambdaT const &ref ) : ParserRefImpl(std::make_shared<BoundFlagLambda<LambdaT>>(ref)) {}
explicit Opt( bool &ref ) : ParserRefImpl(std::make_shared<BoundFlagRef>(ref)) {}
template<typename LambdaT>
Opt( LambdaT const &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {}
template<typename T>
Opt( T &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {}
auto operator[](std::string const &optName) -> Opt & {
m_optNames.push_back(optName);
return *this;
@ -1096,7 +1097,7 @@ namespace detail {
}
auto rows = getHelpColumns();
size_t consoleWidth = CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH;
size_t consoleWidth = CATCH_CLARA_CONFIG_CONSOLE_WIDTH;
size_t optWidth = 0;
for (auto const &cols : rows)
optWidth = std::max(optWidth, cols.left.size() + 2);

14
third_party/clara.hpp vendored
View File

@ -29,7 +29,7 @@
#include <vector>
#ifndef CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH
#define CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH
#define CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH 80
#endif
@ -53,7 +53,7 @@ namespace clara { namespace TextFlow
class Column {
std::vector<std::string> m_strings;
size_t m_width = TEXTFLOW_CONFIG_CONSOLE_WIDTH;
size_t m_width = CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH;
size_t m_indent = 0;
size_t m_initialIndent = std::string::npos;
@ -782,9 +782,7 @@ namespace detail {
public:
virtual ~ParserBase() = default;
virtual auto validate() const -> Result { return Result::ok(); }
virtual auto parse( std::string const& exeName, TokenStream const &tokens) const -> InternalParseResult = 0;
virtual auto cardinality() const -> size_t { return 1; }
auto parse(Args const &args) const -> InternalParseResult {
@ -923,13 +921,17 @@ namespace detail {
std::vector<std::string> m_optNames;
public:
using ParserRefImpl::ParserRefImpl;
template<typename LambdaT>
explicit Opt( LambdaT const &ref ) : ParserRefImpl(std::make_shared<BoundFlagLambda<LambdaT>>(ref)) {}
explicit Opt( bool &ref ) : ParserRefImpl(std::make_shared<BoundFlagRef>(ref)) {}
template<typename LambdaT>
Opt( LambdaT const &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {}
template<typename T>
Opt( T &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {}
auto operator[](std::string const &optName) -> Opt & {
m_optNames.push_back(optName);
return *this;