mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 05:16:10 +01:00
Update Clara to v1.1.5 to fix TextFlow bugs
This commit is contained in:
parent
544c7d7cbf
commit
779e83bc20
533
include/external/clara.hpp
vendored
533
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.4
|
// Clara v1.1.5
|
||||||
|
|
||||||
#ifndef CATCH_CLARA_HPP_INCLUDED
|
#ifndef CATCH_CLARA_HPP_INCLUDED
|
||||||
#define CATCH_CLARA_HPP_INCLUDED
|
#define CATCH_CLARA_HPP_INCLUDED
|
||||||
@ -34,8 +34,8 @@
|
|||||||
//
|
//
|
||||||
// A single-header library for wrapping and laying out basic text, by Phil Nash
|
// A single-header library for wrapping and laying out basic text, by Phil Nash
|
||||||
//
|
//
|
||||||
// This work is licensed under the BSD 2-Clause license.
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
// See the accompanying LICENSE file, or the one at https://opensource.org/licenses/BSD-2-Clause
|
// file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
//
|
//
|
||||||
// This project is hosted at https://github.com/philsquared/textflowcpp
|
// This project is hosted at https://github.com/philsquared/textflowcpp
|
||||||
|
|
||||||
@ -52,317 +52,326 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
namespace Catch { namespace clara { namespace TextFlow {
|
namespace Catch {
|
||||||
|
namespace clara {
|
||||||
|
namespace TextFlow {
|
||||||
|
|
||||||
inline auto isWhitespace( char c ) -> bool {
|
inline auto isWhitespace(char c) -> bool {
|
||||||
static std::string chars = " \t\n\r";
|
static std::string chars = " \t\n\r";
|
||||||
return chars.find( c ) != std::string::npos;
|
return chars.find(c) != std::string::npos;
|
||||||
}
|
}
|
||||||
inline auto isBreakableBefore( char c ) -> bool {
|
inline auto isBreakableBefore(char c) -> bool {
|
||||||
static std::string chars = "[({<|";
|
static std::string chars = "[({<|";
|
||||||
return chars.find( c ) != std::string::npos;
|
return chars.find(c) != std::string::npos;
|
||||||
}
|
}
|
||||||
inline auto isBreakableAfter( char c ) -> bool {
|
inline auto isBreakableAfter(char c) -> bool {
|
||||||
static std::string chars = "])}>.,:;*+-=&/\\";
|
static std::string chars = "])}>.,:;*+-=&/\\";
|
||||||
return chars.find( c ) != std::string::npos;
|
return chars.find(c) != std::string::npos;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Columns;
|
class Columns;
|
||||||
|
|
||||||
class Column {
|
class Column {
|
||||||
std::vector<std::string> m_strings;
|
std::vector<std::string> m_strings;
|
||||||
size_t m_width = CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH;
|
size_t m_width = CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH;
|
||||||
size_t m_indent = 0;
|
size_t m_indent = 0;
|
||||||
size_t m_initialIndent = std::string::npos;
|
size_t m_initialIndent = std::string::npos;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class iterator {
|
class iterator {
|
||||||
friend Column;
|
friend Column;
|
||||||
|
|
||||||
Column const& m_column;
|
Column const& m_column;
|
||||||
size_t m_stringIndex = 0;
|
size_t m_stringIndex = 0;
|
||||||
size_t m_pos = 0;
|
size_t m_pos = 0;
|
||||||
|
|
||||||
size_t m_len = 0;
|
size_t m_len = 0;
|
||||||
size_t m_end = 0;
|
size_t m_end = 0;
|
||||||
bool m_suffix = false;
|
bool m_suffix = false;
|
||||||
|
|
||||||
iterator( Column const& column, size_t stringIndex )
|
iterator(Column const& column, size_t stringIndex)
|
||||||
: m_column( column ),
|
: m_column(column),
|
||||||
m_stringIndex( stringIndex )
|
m_stringIndex(stringIndex) {}
|
||||||
{}
|
|
||||||
|
|
||||||
auto line() const -> std::string const& { return m_column.m_strings[m_stringIndex]; }
|
auto line() const -> std::string const& { return m_column.m_strings[m_stringIndex]; }
|
||||||
|
|
||||||
auto isBoundary( size_t at ) const -> bool {
|
auto isBoundary(size_t at) const -> bool {
|
||||||
assert( at > 0 );
|
assert(at > 0);
|
||||||
assert( at <= line().size() );
|
assert(at <= line().size());
|
||||||
|
|
||||||
return at == line().size() ||
|
return at == line().size() ||
|
||||||
( isWhitespace( line()[at] ) && !isWhitespace( line()[at-1] ) ) ||
|
(isWhitespace(line()[at]) && !isWhitespace(line()[at - 1])) ||
|
||||||
isBreakableBefore( line()[at] ) ||
|
isBreakableBefore(line()[at]) ||
|
||||||
isBreakableAfter( line()[at-1] );
|
isBreakableAfter(line()[at - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void calcLength() {
|
void calcLength() {
|
||||||
assert( m_stringIndex < m_column.m_strings.size() );
|
assert(m_stringIndex < m_column.m_strings.size());
|
||||||
|
|
||||||
m_suffix = false;
|
m_suffix = false;
|
||||||
auto width = m_column.m_width-indent();
|
auto width = m_column.m_width - indent();
|
||||||
m_end = m_pos;
|
m_end = m_pos;
|
||||||
while( m_end < line().size() && line()[m_end] != '\n' )
|
while (m_end < line().size() && line()[m_end] != '\n')
|
||||||
++m_end;
|
++m_end;
|
||||||
|
|
||||||
if( m_end < m_pos + width ) {
|
if (m_end < m_pos + width) {
|
||||||
m_len = m_end - m_pos;
|
m_len = m_end - m_pos;
|
||||||
}
|
} else {
|
||||||
else {
|
size_t len = width;
|
||||||
size_t len = width;
|
while (len > 0 && !isBoundary(m_pos + len))
|
||||||
while (len > 0 && !isBoundary(m_pos + len))
|
--len;
|
||||||
--len;
|
while (len > 0 && isWhitespace(line()[m_pos + len - 1]))
|
||||||
while (len > 0 && isWhitespace( line()[m_pos + len - 1] ))
|
--len;
|
||||||
--len;
|
|
||||||
|
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
m_len = len;
|
m_len = len;
|
||||||
} else {
|
} else {
|
||||||
m_suffix = true;
|
m_suffix = true;
|
||||||
m_len = width - 1;
|
m_len = width - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto indent() const -> size_t {
|
auto indent() const -> size_t {
|
||||||
auto initial = m_pos == 0 && m_stringIndex == 0 ? m_column.m_initialIndent : std::string::npos;
|
auto initial = m_pos == 0 && m_stringIndex == 0 ? m_column.m_initialIndent : std::string::npos;
|
||||||
return initial == std::string::npos ? m_column.m_indent : initial;
|
return initial == std::string::npos ? m_column.m_indent : initial;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto addIndentAndSuffix(std::string const &plain) const -> std::string {
|
auto addIndentAndSuffix(std::string const &plain) const -> std::string {
|
||||||
return std::string( indent(), ' ' ) + (m_suffix ? plain + "-" : plain);
|
return std::string(indent(), ' ') + (m_suffix ? plain + "-" : plain);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit iterator( Column const& column ) : m_column( column ) {
|
using difference_type = std::ptrdiff_t;
|
||||||
assert( m_column.m_width > m_column.m_indent );
|
using value_type = std::string;
|
||||||
assert( m_column.m_initialIndent == std::string::npos || m_column.m_width > m_column.m_initialIndent );
|
using pointer = value_type * ;
|
||||||
calcLength();
|
using reference = value_type & ;
|
||||||
if( m_len == 0 )
|
using iterator_category = std::forward_iterator_tag;
|
||||||
m_stringIndex++; // Empty string
|
|
||||||
}
|
|
||||||
|
|
||||||
auto operator *() const -> std::string {
|
explicit iterator(Column const& column) : m_column(column) {
|
||||||
assert( m_stringIndex < m_column.m_strings.size() );
|
assert(m_column.m_width > m_column.m_indent);
|
||||||
assert( m_pos <= m_end );
|
assert(m_column.m_initialIndent == std::string::npos || m_column.m_width > m_column.m_initialIndent);
|
||||||
if( m_pos + m_column.m_width < m_end )
|
calcLength();
|
||||||
return addIndentAndSuffix(line().substr(m_pos, m_len));
|
if (m_len == 0)
|
||||||
else
|
m_stringIndex++; // Empty string
|
||||||
return addIndentAndSuffix(line().substr(m_pos, m_end - m_pos));
|
}
|
||||||
}
|
|
||||||
|
|
||||||
auto operator ++() -> iterator& {
|
auto operator *() const -> std::string {
|
||||||
m_pos += m_len;
|
assert(m_stringIndex < m_column.m_strings.size());
|
||||||
if( m_pos < line().size() && line()[m_pos] == '\n' )
|
assert(m_pos <= m_end);
|
||||||
m_pos += 1;
|
return addIndentAndSuffix(line().substr(m_pos, m_len));
|
||||||
else
|
}
|
||||||
while( m_pos < line().size() && isWhitespace( line()[m_pos] ) )
|
|
||||||
++m_pos;
|
|
||||||
|
|
||||||
if( m_pos == line().size() ) {
|
auto operator ++() -> iterator& {
|
||||||
m_pos = 0;
|
m_pos += m_len;
|
||||||
++m_stringIndex;
|
if (m_pos < line().size() && line()[m_pos] == '\n')
|
||||||
}
|
m_pos += 1;
|
||||||
if( m_stringIndex < m_column.m_strings.size() )
|
else
|
||||||
calcLength();
|
while (m_pos < line().size() && isWhitespace(line()[m_pos]))
|
||||||
return *this;
|
++m_pos;
|
||||||
}
|
|
||||||
auto operator ++(int) -> iterator {
|
|
||||||
iterator prev( *this );
|
|
||||||
operator++();
|
|
||||||
return prev;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto operator ==( iterator const& other ) const -> bool {
|
if (m_pos == line().size()) {
|
||||||
return
|
m_pos = 0;
|
||||||
m_pos == other.m_pos &&
|
++m_stringIndex;
|
||||||
m_stringIndex == other.m_stringIndex &&
|
}
|
||||||
&m_column == &other.m_column;
|
if (m_stringIndex < m_column.m_strings.size())
|
||||||
}
|
calcLength();
|
||||||
auto operator !=( iterator const& other ) const -> bool {
|
return *this;
|
||||||
return !operator==( other );
|
}
|
||||||
}
|
auto operator ++(int) -> iterator {
|
||||||
};
|
iterator prev(*this);
|
||||||
using const_iterator = iterator;
|
operator++();
|
||||||
|
return prev;
|
||||||
|
}
|
||||||
|
|
||||||
explicit Column( std::string const& text ) { m_strings.push_back( text ); }
|
auto operator ==(iterator const& other) const -> bool {
|
||||||
|
return
|
||||||
|
m_pos == other.m_pos &&
|
||||||
|
m_stringIndex == other.m_stringIndex &&
|
||||||
|
&m_column == &other.m_column;
|
||||||
|
}
|
||||||
|
auto operator !=(iterator const& other) const -> bool {
|
||||||
|
return !operator==(other);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
using const_iterator = iterator;
|
||||||
|
|
||||||
auto width( size_t newWidth ) -> Column& {
|
explicit Column(std::string const& text) { m_strings.push_back(text); }
|
||||||
assert( newWidth > 0 );
|
|
||||||
m_width = newWidth;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
auto indent( size_t newIndent ) -> Column& {
|
|
||||||
m_indent = newIndent;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
auto initialIndent( size_t newIndent ) -> Column& {
|
|
||||||
m_initialIndent = newIndent;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto width() const -> size_t { return m_width; }
|
auto width(size_t newWidth) -> Column& {
|
||||||
auto begin() const -> iterator { return iterator( *this ); }
|
assert(newWidth > 0);
|
||||||
auto end() const -> iterator { return { *this, m_strings.size() }; }
|
m_width = newWidth;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
auto indent(size_t newIndent) -> Column& {
|
||||||
|
m_indent = newIndent;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
auto initialIndent(size_t newIndent) -> Column& {
|
||||||
|
m_initialIndent = newIndent;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
inline friend std::ostream& operator << ( std::ostream& os, Column const& col ) {
|
auto width() const -> size_t { return m_width; }
|
||||||
bool first = true;
|
auto begin() const -> iterator { return iterator(*this); }
|
||||||
for( auto line : col ) {
|
auto end() const -> iterator { return { *this, m_strings.size() }; }
|
||||||
if( first )
|
|
||||||
first = false;
|
|
||||||
else
|
|
||||||
os << "\n";
|
|
||||||
os << line;
|
|
||||||
}
|
|
||||||
return os;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto operator + ( Column const& other ) -> Columns;
|
inline friend std::ostream& operator << (std::ostream& os, Column const& col) {
|
||||||
|
bool first = true;
|
||||||
|
for (auto line : col) {
|
||||||
|
if (first)
|
||||||
|
first = false;
|
||||||
|
else
|
||||||
|
os << "\n";
|
||||||
|
os << line;
|
||||||
|
}
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
auto toString() const -> std::string {
|
auto operator + (Column const& other)->Columns;
|
||||||
std::ostringstream oss;
|
|
||||||
oss << *this;
|
|
||||||
return oss.str();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class Spacer : public Column {
|
auto toString() const -> std::string {
|
||||||
|
std::ostringstream oss;
|
||||||
|
oss << *this;
|
||||||
|
return oss.str();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
class Spacer : public Column {
|
||||||
explicit Spacer( size_t spaceWidth ) : Column( "" ) {
|
|
||||||
width( spaceWidth );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class Columns {
|
public:
|
||||||
std::vector<Column> m_columns;
|
explicit Spacer(size_t spaceWidth) : Column("") {
|
||||||
|
width(spaceWidth);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
class Columns {
|
||||||
|
std::vector<Column> m_columns;
|
||||||
|
|
||||||
class iterator {
|
public:
|
||||||
friend Columns;
|
|
||||||
struct EndTag {};
|
|
||||||
|
|
||||||
std::vector<Column> const& m_columns;
|
class iterator {
|
||||||
std::vector<Column::iterator> m_iterators;
|
friend Columns;
|
||||||
size_t m_activeIterators;
|
struct EndTag {};
|
||||||
|
|
||||||
iterator( Columns const& columns, EndTag )
|
std::vector<Column> const& m_columns;
|
||||||
: m_columns( columns.m_columns ),
|
std::vector<Column::iterator> m_iterators;
|
||||||
m_activeIterators( 0 )
|
size_t m_activeIterators;
|
||||||
{
|
|
||||||
m_iterators.reserve( m_columns.size() );
|
|
||||||
|
|
||||||
for( auto const& col : m_columns )
|
iterator(Columns const& columns, EndTag)
|
||||||
m_iterators.push_back( col.end() );
|
: m_columns(columns.m_columns),
|
||||||
}
|
m_activeIterators(0) {
|
||||||
|
m_iterators.reserve(m_columns.size());
|
||||||
|
|
||||||
public:
|
for (auto const& col : m_columns)
|
||||||
explicit iterator( Columns const& columns )
|
m_iterators.push_back(col.end());
|
||||||
: m_columns( columns.m_columns ),
|
}
|
||||||
m_activeIterators( m_columns.size() )
|
|
||||||
{
|
|
||||||
m_iterators.reserve( m_columns.size() );
|
|
||||||
|
|
||||||
for( auto const& col : m_columns )
|
public:
|
||||||
m_iterators.push_back( col.begin() );
|
using difference_type = std::ptrdiff_t;
|
||||||
}
|
using value_type = std::string;
|
||||||
|
using pointer = value_type * ;
|
||||||
|
using reference = value_type & ;
|
||||||
|
using iterator_category = std::forward_iterator_tag;
|
||||||
|
|
||||||
auto operator ==( iterator const& other ) const -> bool {
|
explicit iterator(Columns const& columns)
|
||||||
return m_iterators == other.m_iterators;
|
: m_columns(columns.m_columns),
|
||||||
}
|
m_activeIterators(m_columns.size()) {
|
||||||
auto operator !=( iterator const& other ) const -> bool {
|
m_iterators.reserve(m_columns.size());
|
||||||
return m_iterators != other.m_iterators;
|
|
||||||
}
|
|
||||||
auto operator *() const -> std::string {
|
|
||||||
std::string row, padding;
|
|
||||||
|
|
||||||
for( size_t i = 0; i < m_columns.size(); ++i ) {
|
for (auto const& col : m_columns)
|
||||||
auto width = m_columns[i].width();
|
m_iterators.push_back(col.begin());
|
||||||
if( m_iterators[i] != m_columns[i].end() ) {
|
}
|
||||||
std::string col = *m_iterators[i];
|
|
||||||
row += padding + col;
|
|
||||||
if( col.size() < width )
|
|
||||||
padding = std::string( width - col.size(), ' ' );
|
|
||||||
else
|
|
||||||
padding = "";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
padding += std::string( width, ' ' );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return row;
|
|
||||||
}
|
|
||||||
auto operator ++() -> iterator& {
|
|
||||||
for( size_t i = 0; i < m_columns.size(); ++i ) {
|
|
||||||
if (m_iterators[i] != m_columns[i].end())
|
|
||||||
++m_iterators[i];
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
auto operator ++(int) -> iterator {
|
|
||||||
iterator prev( *this );
|
|
||||||
operator++();
|
|
||||||
return prev;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
using const_iterator = iterator;
|
|
||||||
|
|
||||||
auto begin() const -> iterator { return iterator( *this ); }
|
auto operator ==(iterator const& other) const -> bool {
|
||||||
auto end() const -> iterator { return { *this, iterator::EndTag() }; }
|
return m_iterators == other.m_iterators;
|
||||||
|
}
|
||||||
|
auto operator !=(iterator const& other) const -> bool {
|
||||||
|
return m_iterators != other.m_iterators;
|
||||||
|
}
|
||||||
|
auto operator *() const -> std::string {
|
||||||
|
std::string row, padding;
|
||||||
|
|
||||||
auto operator += ( Column const& col ) -> Columns& {
|
for (size_t i = 0; i < m_columns.size(); ++i) {
|
||||||
m_columns.push_back( col );
|
auto width = m_columns[i].width();
|
||||||
return *this;
|
if (m_iterators[i] != m_columns[i].end()) {
|
||||||
}
|
std::string col = *m_iterators[i];
|
||||||
auto operator + ( Column const& col ) -> Columns {
|
row += padding + col;
|
||||||
Columns combined = *this;
|
if (col.size() < width)
|
||||||
combined += col;
|
padding = std::string(width - col.size(), ' ');
|
||||||
return combined;
|
else
|
||||||
}
|
padding = "";
|
||||||
|
} else {
|
||||||
|
padding += std::string(width, ' ');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
auto operator ++() -> iterator& {
|
||||||
|
for (size_t i = 0; i < m_columns.size(); ++i) {
|
||||||
|
if (m_iterators[i] != m_columns[i].end())
|
||||||
|
++m_iterators[i];
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
auto operator ++(int) -> iterator {
|
||||||
|
iterator prev(*this);
|
||||||
|
operator++();
|
||||||
|
return prev;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
using const_iterator = iterator;
|
||||||
|
|
||||||
inline friend std::ostream& operator << ( std::ostream& os, Columns const& cols ) {
|
auto begin() const -> iterator { return iterator(*this); }
|
||||||
|
auto end() const -> iterator { return { *this, iterator::EndTag() }; }
|
||||||
|
|
||||||
bool first = true;
|
auto operator += (Column const& col) -> Columns& {
|
||||||
for( auto line : cols ) {
|
m_columns.push_back(col);
|
||||||
if( first )
|
return *this;
|
||||||
first = false;
|
}
|
||||||
else
|
auto operator + (Column const& col) -> Columns {
|
||||||
os << "\n";
|
Columns combined = *this;
|
||||||
os << line;
|
combined += col;
|
||||||
}
|
return combined;
|
||||||
return os;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
auto toString() const -> std::string {
|
inline friend std::ostream& operator << (std::ostream& os, Columns const& cols) {
|
||||||
std::ostringstream oss;
|
|
||||||
oss << *this;
|
|
||||||
return oss.str();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
inline auto Column::operator + ( Column const& other ) -> Columns {
|
bool first = true;
|
||||||
Columns cols;
|
for (auto line : cols) {
|
||||||
cols += *this;
|
if (first)
|
||||||
cols += other;
|
first = false;
|
||||||
return cols;
|
else
|
||||||
}
|
os << "\n";
|
||||||
}}} // namespace Catch::clara::TextFlow
|
os << line;
|
||||||
|
}
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto toString() const -> std::string {
|
||||||
|
std::ostringstream oss;
|
||||||
|
oss << *this;
|
||||||
|
return oss.str();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
inline auto Column::operator + (Column const& other) -> Columns {
|
||||||
|
Columns cols;
|
||||||
|
cols += *this;
|
||||||
|
cols += other;
|
||||||
|
return cols;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif // CATCH_CLARA_TEXTFLOW_HPP_INCLUDED
|
#endif // CATCH_CLARA_TEXTFLOW_HPP_INCLUDED
|
||||||
|
|
||||||
// ----------- end of #include from clara_textflow.hpp -----------
|
// ----------- end of #include from clara_textflow.hpp -----------
|
||||||
// ........... back in clara.hpp
|
// ........... back in clara.hpp
|
||||||
|
|
||||||
|
|
||||||
|
#include <string>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -6732,7 +6732,7 @@ Matchers.tests.cpp:<line number>:
|
|||||||
PASSED:
|
PASSED:
|
||||||
CHECK_THAT( testStringForMatching(), Contains("aBC", Catch::CaseSensitive::No) )
|
CHECK_THAT( testStringForMatching(), Contains("aBC", Catch::CaseSensitive::No) )
|
||||||
with expansion:
|
with expansion:
|
||||||
"this string contains 'abc' as a substring" contains: "abc" (case insensitive)
|
"this string contains 'abc' as a substring" contains: "abc" (case
|
||||||
insensitive)
|
insensitive)
|
||||||
|
|
||||||
Matchers.tests.cpp:<line number>:
|
Matchers.tests.cpp:<line number>:
|
||||||
@ -10865,7 +10865,7 @@ with expansion:
|
|||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
xmlentitycheck
|
xmlentitycheck
|
||||||
embedded xml: <test>it should be possible to embed xml characters, such as <,
|
embedded xml: <test>it should be possible to embed xml characters, such as <,
|
||||||
" or &, or even whole <xml>documents</xml> within an attribute</test>
|
" or &, or even whole <xml>documents</xml> within an attribute
|
||||||
</test>
|
</test>
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Misc.tests.cpp:<line number>
|
Misc.tests.cpp:<line number>
|
||||||
|
25
third_party/clara.hpp
vendored
25
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.4
|
// Clara v1.1.5
|
||||||
|
|
||||||
#ifndef CLARA_HPP_INCLUDED
|
#ifndef CLARA_HPP_INCLUDED
|
||||||
#define CLARA_HPP_INCLUDED
|
#define CLARA_HPP_INCLUDED
|
||||||
@ -34,8 +34,8 @@
|
|||||||
//
|
//
|
||||||
// A single-header library for wrapping and laying out basic text, by Phil Nash
|
// A single-header library for wrapping and laying out basic text, by Phil Nash
|
||||||
//
|
//
|
||||||
// This work is licensed under the BSD 2-Clause license.
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
// See the accompanying LICENSE file, or the one at https://opensource.org/licenses/BSD-2-Clause
|
// file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
//
|
//
|
||||||
// This project is hosted at https://github.com/philsquared/textflowcpp
|
// This project is hosted at https://github.com/philsquared/textflowcpp
|
||||||
|
|
||||||
@ -142,6 +142,12 @@ namespace clara { namespace TextFlow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
using difference_type = std::ptrdiff_t;
|
||||||
|
using value_type = std::string;
|
||||||
|
using pointer = value_type*;
|
||||||
|
using reference = value_type&;
|
||||||
|
using iterator_category = std::forward_iterator_tag;
|
||||||
|
|
||||||
explicit iterator( Column const& column ) : m_column( column ) {
|
explicit iterator( Column const& column ) : m_column( column ) {
|
||||||
assert( m_column.m_width > m_column.m_indent );
|
assert( m_column.m_width > m_column.m_indent );
|
||||||
assert( m_column.m_initialIndent == std::string::npos || m_column.m_width > m_column.m_initialIndent );
|
assert( m_column.m_initialIndent == std::string::npos || m_column.m_width > m_column.m_initialIndent );
|
||||||
@ -153,10 +159,7 @@ namespace clara { namespace TextFlow {
|
|||||||
auto operator *() const -> std::string {
|
auto operator *() const -> std::string {
|
||||||
assert( m_stringIndex < m_column.m_strings.size() );
|
assert( m_stringIndex < m_column.m_strings.size() );
|
||||||
assert( m_pos <= m_end );
|
assert( m_pos <= m_end );
|
||||||
if( m_pos + m_column.m_width < m_end )
|
return addIndentAndSuffix(line().substr(m_pos, m_len));
|
||||||
return addIndentAndSuffix(line().substr(m_pos, m_len));
|
|
||||||
else
|
|
||||||
return addIndentAndSuffix(line().substr(m_pos, m_end - m_pos));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto operator ++() -> iterator& {
|
auto operator ++() -> iterator& {
|
||||||
@ -266,6 +269,12 @@ namespace clara { namespace TextFlow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
using difference_type = std::ptrdiff_t;
|
||||||
|
using value_type = std::string;
|
||||||
|
using pointer = value_type*;
|
||||||
|
using reference = value_type&;
|
||||||
|
using iterator_category = std::forward_iterator_tag;
|
||||||
|
|
||||||
explicit iterator( Columns const& columns )
|
explicit iterator( Columns const& columns )
|
||||||
: m_columns( columns.m_columns ),
|
: m_columns( columns.m_columns ),
|
||||||
m_activeIterators( m_columns.size() )
|
m_activeIterators( m_columns.size() )
|
||||||
@ -355,7 +364,7 @@ namespace clara { namespace TextFlow {
|
|||||||
cols += other;
|
cols += other;
|
||||||
return cols;
|
return cols;
|
||||||
}
|
}
|
||||||
}} // namespace clara::TextFlow
|
}}
|
||||||
|
|
||||||
#endif // CLARA_TEXTFLOW_HPP_INCLUDED
|
#endif // CLARA_TEXTFLOW_HPP_INCLUDED
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user