55//
66// See https://github.com/philsquared/Clara for more details
77
8- // Clara v1.1.4
8+ // Clara v1.1.5
99
1010#ifndef CLARA_HPP_INCLUDED
1111#define CLARA_HPP_INCLUDED
3434//
3535// A single-header library for wrapping and laying out basic text, by Phil Nash
3636//
37- // This work is licensed under the BSD 2-Clause license.
38- // See the accompanying LICENSE file, or the one at https ://opensource. org/licenses/BSD-2-Clause
37+ // Distributed under the Boost Software License, Version 1.0. (See accompanying
38+ // file LICENSE.txt or copy at http ://www.boost. org/LICENSE_1_0.txt)
3939//
4040// This project is hosted at https://github.com/philsquared/textflowcpp
4141
4848#include < vector>
4949
5050#ifndef CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH
51- #define CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH 80
51+ #define CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH
5252#endif
5353
5454
@@ -71,7 +71,7 @@ namespace clara { namespace TextFlow {
7171
7272 class Column {
7373 std::vector<std::string> m_strings;
74- size_t m_width = CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH ;
74+ size_t m_width = TEXTFLOW_CONFIG_CONSOLE_WIDTH ;
7575 size_t m_indent = 0 ;
7676 size_t m_initialIndent = std::string::npos;
7777
@@ -142,6 +142,12 @@ namespace clara { namespace TextFlow {
142142 }
143143
144144 public:
145+ using difference_type = std::ptrdiff_t ;
146+ using value_type = std::string;
147+ using pointer = value_type*;
148+ using reference = value_type&;
149+ using iterator_category = std::forward_iterator_tag;
150+
145151 explicit iterator ( Column const & column ) : m_column( column ) {
146152 assert ( m_column.m_width > m_column.m_indent );
147153 assert ( m_column.m_initialIndent == std::string::npos || m_column.m_width > m_column.m_initialIndent );
@@ -153,10 +159,7 @@ namespace clara { namespace TextFlow {
153159 auto operator *() const -> std::string {
154160 assert ( m_stringIndex < m_column.m_strings .size () );
155161 assert ( m_pos <= m_end );
156- if ( m_pos + m_column.m_width < m_end )
157- return addIndentAndSuffix (line ().substr (m_pos, m_len));
158- else
159- return addIndentAndSuffix (line ().substr (m_pos, m_end - m_pos));
162+ return addIndentAndSuffix (line ().substr (m_pos, m_len));
160163 }
161164
162165 auto operator ++() -> iterator& {
@@ -266,6 +269,12 @@ namespace clara { namespace TextFlow {
266269 }
267270
268271 public:
272+ using difference_type = std::ptrdiff_t ;
273+ using value_type = std::string;
274+ using pointer = value_type*;
275+ using reference = value_type&;
276+ using iterator_category = std::forward_iterator_tag;
277+
269278 explicit iterator ( Columns const & columns )
270279 : m_columns( columns.m_columns ),
271280 m_activeIterators( m_columns.size() )
@@ -355,7 +364,7 @@ namespace clara { namespace TextFlow {
355364 cols += other;
356365 return cols;
357366 }
358- }} // namespace clara::TextFlow
367+ }
359368
360369#endif // CLARA_TEXTFLOW_HPP_INCLUDED
361370
0 commit comments