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

#include <arg_router/utility/utf8.hpp>

Classes

class  range_t
 

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 iterator () noexcept
 
constexpr iterator (std::string_view str) noexcept
 
constexpr bool operator== (iterator other) const noexcept
 
constexpr bool operator!= (iterator other) const noexcept
 
constexpr value_type operator* () const noexcept
 
constexpr iteratoroperator++ () noexcept
 
constexpr iterator operator++ (int) noexcept
 

Static Public Member Functions

constexpr static range_t range (std::string_view str) noexcept
 

Detailed Description

Forward iterator for a string's grapheme clusters a.k.a. user-perceived characters.

Definition at line 48 of file utf8.hpp.

Member Typedef Documentation

◆ difference_type

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

Difference in bytes between two iterator positions.

Definition at line 52 of file utf8.hpp.

◆ iterator_category

using arg_router::utility::utf8::iterator::iterator_category = std::forward_iterator_tag

Iterator category.

Definition at line 60 of file utf8.hpp.

◆ pointer

Pointer type.

Definition at line 56 of file utf8.hpp.

◆ reference

Reference type/

Definition at line 58 of file utf8.hpp.

◆ value_type

Dereferenced type.

Definition at line 54 of file utf8.hpp.

Constructor & Destructor Documentation

◆ iterator() [1/2]

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

Default constructor.

Represents the end iterator.

Definition at line 107 of file utf8.hpp.

◆ iterator() [2/2]

constexpr arg_router::utility::utf8::iterator::iterator ( std::string_view  str)
inlineexplicitconstexprnoexcept

Constructor.

If str is empty, then this will create an end iterator.

Parameters
strString to iterator over.

Definition at line 114 of file utf8.hpp.

Member Function Documentation

◆ operator!=()

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

Inequality operator.

Parameters
otherInstance to compare against
Returns
False if the start and end positions are the same

Definition at line 140 of file utf8.hpp.

◆ operator*()

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

Dereference operator.

Returns
Grapheme cluster

Definition at line 149 of file utf8.hpp.

◆ operator++() [1/2]

constexpr iterator& arg_router::utility::utf8::iterator::operator++ ( )
inlineconstexprnoexcept

Pre-increment the iterator by one code point.

Returns
Reference to this after moving the iterator

Definition at line 158 of file utf8.hpp.

◆ operator++() [2/2]

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

Post-increment the iterator by one code point.

Returns
Copy of this before moving the iterator

Definition at line 173 of file utf8.hpp.

◆ operator==()

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

Equality operator.

Parameters
otherInstance to compare against
Returns
True if the start and end positions are the same

Definition at line 126 of file utf8.hpp.

◆ range()

constexpr static range_t arg_router::utility::utf8::iterator::range ( std::string_view  str)
inlinestaticconstexprnoexcept

Returns an object that can be used in range-for loops.

Parameters
strInput string
Returns
Range object

Definition at line 98 of file utf8.hpp.


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