arg_router  1.4.0
C++ command line argument parsing and routing
arg_router::utility::utf8::line_iterator Class Reference

#include <arg_router/utility/utf8.hpp>

Public Types

using difference_type = std::string_view::difference_type
 
using value_type = std::string_view
 
using pointer = const value_type *
 
using reference = const value_type &
 
using iterator_category = std::forward_iterator_tag
 

Public Member Functions

constexpr line_iterator () noexcept
 
constexpr line_iterator (std::string_view str, std::size_t max_columns) noexcept
 
constexpr std::size_t max_columns () const noexcept
 
constexpr bool operator== (line_iterator other) const noexcept
 
constexpr bool operator!= (line_iterator other) const noexcept
 
constexpr value_type operator* () const noexcept
 
constexpr line_iterator operator++ (int) noexcept
 

Detailed Description

Iterates over a string view, dereferencing to a substring that is equal or less than the max terminal column count, breaking on whitespace.

Definition at line 343 of file utf8.hpp.

Member Typedef Documentation

◆ difference_type

using arg_router::utility::utf8::line_iterator::difference_type = std::string_view::difference_type

Difference in bytes between two iterator positions.

Definition at line 347 of file utf8.hpp.

◆ iterator_category

Iterator category.

Definition at line 355 of file utf8.hpp.

◆ pointer

Pointer type.

Definition at line 351 of file utf8.hpp.

◆ reference

Reference type/

Definition at line 353 of file utf8.hpp.

◆ value_type

Dereferenced type.

Definition at line 349 of file utf8.hpp.

Constructor & Destructor Documentation

◆ line_iterator() [1/2]

constexpr arg_router::utility::utf8::line_iterator::line_iterator ( )
inlineconstexprnoexcept

Default constructor.

Represents the end iterator.

Definition at line 361 of file utf8.hpp.

◆ line_iterator() [2/2]

constexpr arg_router::utility::utf8::line_iterator::line_iterator ( std::string_view  str,
std::size_t  max_columns 
)
inlineexplicitconstexprnoexcept

Constructor.

Note
If max_columns is zero then str is emptied making this iterator equivalent to the end iterator - this is to prevent infinite loops
Parameters
strInput string
max_columnsMaximum width of each iteration in terminal columns

Definition at line 370 of file utf8.hpp.

Member Function Documentation

◆ max_columns()

constexpr std::size_t arg_router::utility::utf8::line_iterator::max_columns ( ) const
inlineconstexprnoexcept

Returns the maximum terminal column count passed to the constructor.

Returns
Max column count

Definition at line 385 of file utf8.hpp.

◆ operator!=()

constexpr bool arg_router::utility::utf8::line_iterator::operator!= ( line_iterator  other) const
inlineconstexprnoexcept

Inequality operator.

Parameters
otherInstance to compare against
Returns
False if equal

Definition at line 407 of file utf8.hpp.

◆ operator*()

constexpr value_type arg_router::utility::utf8::line_iterator::operator* ( ) const
inlineconstexprnoexcept

Dereference operator.

Returns
Whole line

Definition at line 416 of file utf8.hpp.

◆ operator++()

constexpr line_iterator arg_router::utility::utf8::line_iterator::operator++ ( int  )
inlineconstexprnoexcept

Post-increment the iterator by line.

Returns
Copy of this before moving the iterator

Definition at line 431 of file utf8.hpp.

◆ operator==()

constexpr bool arg_router::utility::utf8::line_iterator::operator== ( line_iterator  other) const
inlineconstexprnoexcept

Equality operator.

Parameters
otherInstance to compare against
Returns
True if equal

Definition at line 392 of file utf8.hpp.


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