libzypp 17.37.17
ztui::mbs::MbsIterator Class Reference

Iterate chars and ANSI SGR in a multi-byte character string. More...

#include <zypp-tui/utils/text.h>

Inheritance diagram for ztui::mbs::MbsIterator:

Public Member Functions

 MbsIterator (boost::string_ref text_r)
wchar_t & operator* ()
 Use with care; all WS are faked to either '
' or ' '.
const wchar_t & operator* () const
const char * pos () const
size_t size () const
size_t columns () const
boost::string_ref ref () const
bool atEnd () const
bool isNL () const
bool isWS () const
bool isCH () const
bool isSGR () const
MbsIteratoroperator++ ()

Private Member Functions

unsigned ansiSize (const char *pos_r)
void setToEnd ()

Private Attributes

boost::string_ref _text
const char * _tpos
size_t _trest
size_t _tread
size_t _cols
wchar_t _wc
mbstate_t _mbstate

Detailed Description

Iterate chars and ANSI SGR in a multi-byte character string.

The iterator offers (pos, size) of the current wchar within the original text_r. Also the number of columns the current wchar occupies on the screen.

Note
: The iterator contents fakes all WS to either '
' or ' '.
: isCH includes SGR sequences

Definition at line 86 of file text.h.

Constructor & Destructor Documentation

◆ MbsIterator()

ztui::mbs::MbsIterator::MbsIterator ( boost::string_ref text_r)
inline

Definition at line 88 of file text.h.

Member Function Documentation

◆ operator*() [1/2]

wchar_t & ztui::mbs::MbsIterator::operator* ( )
inline

Use with care; all WS are faked to either '
' or ' '.

Definition at line 98 of file text.h.

◆ operator*() [2/2]

const wchar_t & ztui::mbs::MbsIterator::operator* ( ) const
inline

Definition at line 99 of file text.h.

◆ pos()

const char * ztui::mbs::MbsIterator::pos ( ) const
inline

Definition at line 101 of file text.h.

◆ size()

size_t ztui::mbs::MbsIterator::size ( ) const
inline

Definition at line 102 of file text.h.

◆ columns()

size_t ztui::mbs::MbsIterator::columns ( ) const
inline

Definition at line 103 of file text.h.

◆ ref()

boost::string_ref ztui::mbs::MbsIterator::ref ( ) const
inline

Definition at line 119 of file text.h.

◆ atEnd()

bool ztui::mbs::MbsIterator::atEnd ( ) const
inline

Definition at line 121 of file text.h.

◆ isNL()

bool ztui::mbs::MbsIterator::isNL ( ) const
inline

Definition at line 122 of file text.h.

◆ isWS()

bool ztui::mbs::MbsIterator::isWS ( ) const
inline

Definition at line 123 of file text.h.

◆ isCH()

bool ztui::mbs::MbsIterator::isCH ( ) const
inline

Definition at line 124 of file text.h.

◆ isSGR()

bool ztui::mbs::MbsIterator::isSGR ( ) const
inline

Definition at line 125 of file text.h.

◆ operator++()

MbsIterator & ztui::mbs::MbsIterator::operator++ ( )
inline

Definition at line 127 of file text.h.

◆ ansiSize()

unsigned ztui::mbs::MbsIterator::ansiSize ( const char * pos_r)
inlineprivate

Definition at line 191 of file text.h.

◆ setToEnd()

void ztui::mbs::MbsIterator::setToEnd ( )
inlineprivate

Definition at line 205 of file text.h.

Member Data Documentation

◆ _text

boost::string_ref ztui::mbs::MbsIterator::_text
private

Definition at line 211 of file text.h.

◆ _tpos

const char* ztui::mbs::MbsIterator::_tpos
private

Definition at line 212 of file text.h.

◆ _trest

size_t ztui::mbs::MbsIterator::_trest
private

Definition at line 213 of file text.h.

◆ _tread

size_t ztui::mbs::MbsIterator::_tread
private

Definition at line 214 of file text.h.

◆ _cols

size_t ztui::mbs::MbsIterator::_cols
mutableprivate

Definition at line 215 of file text.h.

◆ _wc

wchar_t ztui::mbs::MbsIterator::_wc
private

Definition at line 217 of file text.h.

◆ _mbstate

mbstate_t ztui::mbs::MbsIterator::_mbstate
private

Definition at line 218 of file text.h.


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