Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
clara::TextFlow::Column::iterator Class Reference

#include <clara.hpp>

Public Types

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
 

Public Member Functions

 iterator (Column const &column)
 
auto operator* () const -> std::string
 
auto operator++ () -> iterator &
 
auto operator++ (int) -> iterator
 
auto operator== (iterator const &other) const -> bool
 
auto operator!= (iterator const &other) const -> bool
 

Detailed Description

Definition at line 79 of file clara.hpp.

Member Typedef Documentation

◆ difference_type

Definition at line 148 of file clara.hpp.

◆ iterator_category

using clara::TextFlow::Column::iterator::iterator_category = std::forward_iterator_tag

Definition at line 152 of file clara.hpp.

◆ pointer

◆ reference

◆ value_type

Definition at line 149 of file clara.hpp.

Constructor & Destructor Documentation

◆ iterator()

clara::TextFlow::Column::iterator::iterator ( Column const & column)
inlineexplicit

Definition at line 154 of file clara.hpp.

154 : m_column( column ) {
155 assert( m_column.m_width > m_column.m_indent );
156 assert( m_column.m_initialIndent == std::string::npos || m_column.m_width > m_column.m_initialIndent );
157 calcLength();
158 if( m_len == 0 )
159 m_stringIndex++; // Empty string
160 }

Member Function Documentation

◆ operator!=()

auto clara::TextFlow::Column::iterator::operator!= ( iterator const & other) const -> bool
inline

Definition at line 196 of file clara.hpp.

196 {
197 return !operator==( other );
198 }
auto operator==(iterator const &other) const -> bool
Definition clara.hpp:190
Here is the call graph for this function:

◆ operator*()

auto clara::TextFlow::Column::iterator::operator* ( ) const -> std::string
inline

Definition at line 162 of file clara.hpp.

162 {
163 assert( m_stringIndex < m_column.m_strings.size() );
164 assert( m_pos <= m_end );
165 return addIndentAndSuffix(line().substr(m_pos, m_len));
166 }

◆ operator++() [1/2]

auto clara::TextFlow::Column::iterator::operator++ ( ) -> iterator&
inline

Definition at line 168 of file clara.hpp.

168 {
169 m_pos += m_len;
170 if( m_pos < line().size() && line()[m_pos] == '\n' )
171 m_pos += 1;
172 else
173 while( m_pos < line().size() && isWhitespace( line()[m_pos] ) )
174 ++m_pos;
175
176 if( m_pos == line().size() ) {
177 m_pos = 0;
178 ++m_stringIndex;
179 }
180 if( m_stringIndex < m_column.m_strings.size() )
181 calcLength();
182 return *this;
183 }
auto isWhitespace(char c) -> bool
Definition clara.hpp:57
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator++() [2/2]

auto clara::TextFlow::Column::iterator::operator++ ( int ) -> iterator
inline

Definition at line 184 of file clara.hpp.

184 {
185 iterator prev( *this );
186 operator++();
187 return prev;
188 }
auto operator++() -> iterator &
Definition clara.hpp:168
Here is the call graph for this function:

◆ operator==()

auto clara::TextFlow::Column::iterator::operator== ( iterator const & other) const -> bool
inline

Definition at line 190 of file clara.hpp.

190 {
191 return
192 m_pos == other.m_pos &&
193 m_stringIndex == other.m_stringIndex &&
194 &m_column == &other.m_column;
195 }
Here is the caller graph for this function:

The documentation for this class was generated from the following file: