Skip to content
This repository was archived by the owner on Oct 28, 2021. It is now read-only.

Commit f0e8fa3

Browse files
committed
Update the embedded textflow
No version because there are no versions upstream...
1 parent b3ec2cf commit f0e8fa3

File tree

2 files changed

+34
-16
lines changed

2 files changed

+34
-16
lines changed

include/clara_textflow.hpp

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
//
33
// A single-header library for wrapping and laying out basic text, by Phil Nash
44
//
5-
// This work is licensed under the BSD 2-Clause license.
6-
// See the accompanying LICENSE file, or the one at https://opensource.org/licenses/BSD-2-Clause
5+
// Distributed under the Boost Software License, Version 1.0. (See accompanying
6+
// file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
77
//
88
// This project is hosted at https://github.com/philsquared/textflowcpp
99

@@ -16,7 +16,7 @@
1616
#include <vector>
1717

1818
#ifndef CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH
19-
#define CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH 80
19+
#define CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH
2020
#endif
2121

2222

@@ -39,7 +39,7 @@ namespace clara { namespace TextFlow {
3939

4040
class Column {
4141
std::vector<std::string> m_strings;
42-
size_t m_width = CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH;
42+
size_t m_width = TEXTFLOW_CONFIG_CONSOLE_WIDTH;
4343
size_t m_indent = 0;
4444
size_t m_initialIndent = std::string::npos;
4545

@@ -110,6 +110,12 @@ namespace clara { namespace TextFlow {
110110
}
111111

112112
public:
113+
using difference_type = std::ptrdiff_t;
114+
using value_type = std::string;
115+
using pointer = value_type*;
116+
using reference = value_type&;
117+
using iterator_category = std::forward_iterator_tag;
118+
113119
explicit iterator( Column const& column ) : m_column( column ) {
114120
assert( m_column.m_width > m_column.m_indent );
115121
assert( m_column.m_initialIndent == std::string::npos || m_column.m_width > m_column.m_initialIndent );
@@ -121,10 +127,7 @@ namespace clara { namespace TextFlow {
121127
auto operator *() const -> std::string {
122128
assert( m_stringIndex < m_column.m_strings.size() );
123129
assert( m_pos <= m_end );
124-
if( m_pos + m_column.m_width < m_end )
125-
return addIndentAndSuffix(line().substr(m_pos, m_len));
126-
else
127-
return addIndentAndSuffix(line().substr(m_pos, m_end - m_pos));
130+
return addIndentAndSuffix(line().substr(m_pos, m_len));
128131
}
129132

130133
auto operator ++() -> iterator& {
@@ -234,6 +237,12 @@ namespace clara { namespace TextFlow {
234237
}
235238

236239
public:
240+
using difference_type = std::ptrdiff_t;
241+
using value_type = std::string;
242+
using pointer = value_type*;
243+
using reference = value_type&;
244+
using iterator_category = std::forward_iterator_tag;
245+
237246
explicit iterator( Columns const& columns )
238247
: m_columns( columns.m_columns ),
239248
m_activeIterators( m_columns.size() )
@@ -323,6 +332,6 @@ namespace clara { namespace TextFlow {
323332
cols += other;
324333
return cols;
325334
}
326-
}} // namespace clara::TextFlow
335+
}
327336

328337
#endif // CLARA_TEXTFLOW_HPP_INCLUDED

third_party/TextFlow.hpp

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
//
33
// A single-header library for wrapping and laying out basic text, by Phil Nash
44
//
5-
// This work is licensed under the BSD 2-Clause license.
6-
// See the accompanying LICENSE file, or the one at https://opensource.org/licenses/BSD-2-Clause
5+
// Distributed under the Boost Software License, Version 1.0. (See accompanying
6+
// file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
77
//
88
// This project is hosted at https://github.com/philsquared/textflowcpp
99

@@ -110,6 +110,12 @@ namespace TextFlow {
110110
}
111111

112112
public:
113+
using difference_type = std::ptrdiff_t;
114+
using value_type = std::string;
115+
using pointer = value_type*;
116+
using reference = value_type&;
117+
using iterator_category = std::forward_iterator_tag;
118+
113119
explicit iterator( Column const& column ) : m_column( column ) {
114120
assert( m_column.m_width > m_column.m_indent );
115121
assert( m_column.m_initialIndent == std::string::npos || m_column.m_width > m_column.m_initialIndent );
@@ -120,11 +126,8 @@ namespace TextFlow {
120126

121127
auto operator *() const -> std::string {
122128
assert( m_stringIndex < m_column.m_strings.size() );
123-
assert( m_pos < m_end );
124-
if( m_pos + m_column.m_width < m_end )
125-
return addIndentAndSuffix(line().substr(m_pos, m_len));
126-
else
127-
return addIndentAndSuffix(line().substr(m_pos, m_end - m_pos));
129+
assert( m_pos <= m_end );
130+
return addIndentAndSuffix(line().substr(m_pos, m_len));
128131
}
129132

130133
auto operator ++() -> iterator& {
@@ -234,6 +237,12 @@ namespace TextFlow {
234237
}
235238

236239
public:
240+
using difference_type = std::ptrdiff_t;
241+
using value_type = std::string;
242+
using pointer = value_type*;
243+
using reference = value_type&;
244+
using iterator_category = std::forward_iterator_tag;
245+
237246
explicit iterator( Columns const& columns )
238247
: m_columns( columns.m_columns ),
239248
m_activeIterators( m_columns.size() )

0 commit comments

Comments
 (0)