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

Commit

Permalink
v1.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
horenmar committed Oct 26, 2018
1 parent f0e8fa3 commit a469a43
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Clara v1.1.4
# Clara v1.1.5
[![Build Status](https://travis-ci.org/catchorg/Clara.svg?branch=master)](https://travis-ci.org/catchorg/Clara)
[![Build status](https://ci.appveyor.com/api/projects/status/github/catchorg/Clara?brach=master&svg=true)](https://ci.appveyor.com/project/catchorg/clara)
[![codecov](https://codecov.io/gh/catchorg/Clara/branch/master/graph/badge.svg)](https://codecov.io/gh/catchorg/Clara)
Expand Down
2 changes: 1 addition & 1 deletion include/clara.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//
// See https://github.com/philsquared/Clara for more details

// Clara v1.1.4
// Clara v1.1.5

#ifndef CLARA_HPP_INCLUDED
#define CLARA_HPP_INCLUDED
Expand Down
29 changes: 19 additions & 10 deletions single_include/clara.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//
// See https://github.com/philsquared/Clara for more details

// Clara v1.1.4
// Clara v1.1.5

#ifndef CLARA_HPP_INCLUDED
#define CLARA_HPP_INCLUDED
Expand Down Expand Up @@ -34,8 +34,8 @@
//
// A single-header library for wrapping and laying out basic text, by Phil Nash
//
// This work is licensed under the BSD 2-Clause license.
// See the accompanying LICENSE file, or the one at https://opensource.org/licenses/BSD-2-Clause
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// This project is hosted at https://github.com/philsquared/textflowcpp

Expand All @@ -48,7 +48,7 @@
#include <vector>

#ifndef CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH
#define CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH 80
#define CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH
#endif


Expand All @@ -71,7 +71,7 @@ namespace clara { namespace TextFlow {

class Column {
std::vector<std::string> m_strings;
size_t m_width = CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH;
size_t m_width = TEXTFLOW_CONFIG_CONSOLE_WIDTH;
size_t m_indent = 0;
size_t m_initialIndent = std::string::npos;

Expand Down Expand Up @@ -142,6 +142,12 @@ namespace clara { namespace TextFlow {
}

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 ) {
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 );
Expand All @@ -153,10 +159,7 @@ namespace clara { namespace TextFlow {
auto operator *() const -> std::string {
assert( m_stringIndex < m_column.m_strings.size() );
assert( m_pos <= m_end );
if( m_pos + m_column.m_width < m_end )
return addIndentAndSuffix(line().substr(m_pos, m_len));
else
return addIndentAndSuffix(line().substr(m_pos, m_end - m_pos));
return addIndentAndSuffix(line().substr(m_pos, m_len));
}

auto operator ++() -> iterator& {
Expand Down Expand Up @@ -266,6 +269,12 @@ namespace clara { namespace TextFlow {
}

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 )
: m_columns( columns.m_columns ),
m_activeIterators( m_columns.size() )
Expand Down Expand Up @@ -355,7 +364,7 @@ namespace clara { namespace TextFlow {
cols += other;
return cols;
}
}} // namespace clara::TextFlow
}

#endif // CLARA_TEXTFLOW_HPP_INCLUDED

Expand Down

0 comments on commit a469a43

Please sign in to comment.