libzypp: ztui::mbs::MbsWriteWrapped Class Reference

libzypp 17.36.6

Classes | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Related Symbols | List of all members
ztui::mbs::MbsWriteWrapped Class Reference

Write MBString optionally wrapped and indented. More...

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

## Classes
struct | ScopedIndentIncrement
| Temporarily increase indent. More...

## Public Member Functions
| MbsWriteWrapped (std::ostream &out)
| MbsWriteWrapped (std::ostream &out, size_t wrap_r)
| MbsWriteWrapped (std::ostream &out, size_t indent_r, size_t wrap_r, int indentFix_r=0)
size_t | defaultWrap () const
size_t | defaultIndent () const
int | defaultIndentFix () const
size_t | indent () const
size_t | lpos () const
bool | atLineBegin () const
bool | atParBegin () const
void | resetToParBegin ()
| Reset housekeeping data to the beginning of a paragraph (does not write anything)
void | gotoNextPar ()
| Write out any pending word and start a new par (NL unconditionally)
void | gotoParBegin ()
| Open a new paragraph if not atParBegin.
void | gotoNextLine (size_t count_r=1)
| Add count_r (1) new lines in this par (BR unconditionally)
void | gotoLineBegin ()
| Open a new line in this paragraph if not atLineBegin.
void | startPar (boost::string_ref text_r)
| Write text_r; starting a new paragraph.
void | startPar (boost::string_ref text_r, size_t increment_r)
void | addString (boost::string_ref text_r)
| Continue writing text at the current position.
void | addString (boost::string_ref text_r, size_t increment_r)
void | writeText (boost::string_ref text_r)
| Continue writing text (separated by WS if not atLineBegin).
void | writeText (boost::string_ref text_r, size_t increment_r)
void | writePar (boost::string_ref text_r)
| Write text_r; starting a new paragraph and ending it after the text was written.
void | writePar (boost::string_ref text_r, size_t increment_r)
void | writeDefinition (boost::string_ref tag_r, boost::string_ref text_r, size_t tagincr_r, size_t textincr_r)
| Write a tag_r with indented definition text_r.
void | writeDefinition (boost::string_ref tag_r, boost::string_ref text_r)
void | writeDefinition (boost::string_ref tag_r, boost::string_ref text_r, size_t tagincr_r, size_t textincr_r, size_t increment_r)
void | writeDefinition (boost::string_ref tag_r, boost::string_ref text_r, size_t increment_r)

## Private Member Functions
void | write (boost::string_ref text_r, bool leadingWSindents_r=true)
| Append text_r indented and wrapped at the current position.
void | writeout (bool force_r=false)
| Write any pending "indent/gap+word" and reset for next word.
void | _writeoutPending ()
size_t | fixIndent (size_t indent_r)
| Return fixed indent_r (unsets _indentFix)
size_t | saneIncrementIndent (size_t increment_r)
| Return incremented `_indent`, but not more than 50% of the remaining line size if wrapped.
void | clearIndent ()
| Set default indent at par start (reloads `_indentFix`)
void | clearGap ()
| Set no gaps.
void | clearWord ()
| Set no word pending.

## Static Private Member Functions
static size_t | fixIndent (size_t indent_r, int indentFix_r)
| Return fixed indent_r.
static size_t | saneIncrementIndent (size_t current_r, size_t increment_r, size_t wrap_r)
| Return incremented indent, but not to more than 50% of the remaining line size if wrapped.

## Private Attributes
std::ostream & | _out
const size_t | _defaultWrap
const size_t | _defaultIndent
const int | _defaultIndentFix
size_t | _indent
int | _indentFix
size_t | _indentGap
size_t | _lpos
size_t | _gap
size_t | _gapForced
size_t | _gapLines
const char * | _word
size_t | _wSize
size_t | _wColumns

## Related Symbols
(Note that these are not member symbols.)
ScopedIndentIncrement | scopedIndentIncrement (size_t increment_r)
| Temporarily increase indent.

## Detailed Description

Write MBString optionally wrapped and indented.

The class assumes the output starts at the beginning of a new term line. Every '
' in text starts a new paragraph (on an new line with default indent).

WS at par begin increments indent for this par.

Use gotoNextLine to open a new indented line without stating a new par.

If MbsWriteWrapped is used in conjunction with plain screen output, you can use resetToParBegin to reset housekeeping data after plain screen output.

Definition at line 260 of file text.h.

## Constructor & Destructor Documentation

## ◆ MbsWriteWrapped() [1/3]

ztui::mbs::MbsWriteWrapped::MbsWriteWrapped | ( | std::ostream & | out | ) |
| inline

Definition at line 262 of file text.h.

## ◆ MbsWriteWrapped() [2/3]

ztui::mbs::MbsWriteWrapped::MbsWriteWrapped | ( | std::ostream & | out,
|  | size_t | wrap_r )
| inline

Definition at line 266 of file text.h.

## ◆ MbsWriteWrapped() [3/3]

ztui::mbs::MbsWriteWrapped::MbsWriteWrapped | ( | std::ostream & | out,
|  | size_t | indent_r,
|  | size_t | wrap_r,
|  | int | indentFix_r = 0 )
| inline

Definition at line 270 of file text.h.

## Member Function Documentation

## ◆ defaultWrap()

size_t ztui::mbs::MbsWriteWrapped::defaultWrap | ( |  | ) | const
| inline

Definition at line 287 of file text.h.

## ◆ defaultIndent()

size_t ztui::mbs::MbsWriteWrapped::defaultIndent | ( |  | ) | const
| inline

Definition at line 288 of file text.h.

## ◆ defaultIndentFix()

int ztui::mbs::MbsWriteWrapped::defaultIndentFix | ( |  | ) | const
| inline

Definition at line 289 of file text.h.

## ◆ indent()

size_t ztui::mbs::MbsWriteWrapped::indent | ( |  | ) | const
| inline

Definition at line 291 of file text.h.

## ◆ lpos()

size_t ztui::mbs::MbsWriteWrapped::lpos | ( |  | ) | const
| inline

Definition at line 292 of file text.h.

## ◆ atLineBegin()

bool ztui::mbs::MbsWriteWrapped::atLineBegin | ( |  | ) | const
| inline

Definition at line 294 of file text.h.

## ◆ atParBegin()

bool ztui::mbs::MbsWriteWrapped::atParBegin | ( |  | ) | const
| inline

Definition at line 295 of file text.h.

## ◆ resetToParBegin()

void ztui::mbs::MbsWriteWrapped::resetToParBegin | ( |  | ) |
| inline

Reset housekeeping data to the beginning of a paragraph (does not write anything)

Definition at line 298 of file text.h.

## ◆ gotoNextPar()

void ztui::mbs::MbsWriteWrapped::gotoNextPar | ( |  | ) |
| inline

Write out any pending word and start a new par (NL unconditionally)

Definition at line 308 of file text.h.

## ◆ gotoParBegin()

void ztui::mbs::MbsWriteWrapped::gotoParBegin | ( |  | ) |
| inline

Open a new paragraph if not atParBegin.

Definition at line 321 of file text.h.

## ◆ gotoNextLine()

void ztui::mbs::MbsWriteWrapped::gotoNextLine | ( | size_t | count_r = 1 | ) |
| inline

Add count_r (1) new lines in this par (BR unconditionally)

Definition at line 326 of file text.h.

## ◆ gotoLineBegin()

void ztui::mbs::MbsWriteWrapped::gotoLineBegin | ( |  | ) |
| inline

Open a new line in this paragraph if not atLineBegin.

Definition at line 343 of file text.h.

## ◆ startPar() [1/2]

void ztui::mbs::MbsWriteWrapped::startPar | ( | boost::string_ref | text_r | ) |
| inline

Write text_r; starting a new paragraph.

Definition at line 360 of file text.h.

## ◆ startPar() [2/2]

void ztui::mbs::MbsWriteWrapped::startPar | ( | boost::string_ref | text_r,
|  | size_t | increment_r )
| inline

Definition at line 366 of file text.h.

## ◆ addString() [1/2]

void ztui::mbs::MbsWriteWrapped::addString | ( | boost::string_ref | text_r | ) |
| inline

Continue writing text at the current position.

Definition at line 371 of file text.h.

## ◆ addString() [2/2]

void ztui::mbs::MbsWriteWrapped::addString | ( | boost::string_ref | text_r,
|  | size_t | increment_r )
| inline

Definition at line 376 of file text.h.

## ◆ writeText() [1/2]

void ztui::mbs::MbsWriteWrapped::writeText | ( | boost::string_ref | text_r | ) |
| inline

Continue writing text (separated by WS if not atLineBegin).

Definition at line 381 of file text.h.

## ◆ writeText() [2/2]

void ztui::mbs::MbsWriteWrapped::writeText | ( | boost::string_ref | text_r,
|  | size_t | increment_r )
| inline

Definition at line 387 of file text.h.

## ◆ writePar() [1/2]

void ztui::mbs::MbsWriteWrapped::writePar | ( | boost::string_ref | text_r | ) |
| inline

Write text_r; starting a new paragraph and ending it after the text was written.

Definition at line 392 of file text.h.

## ◆ writePar() [2/2]

void ztui::mbs::MbsWriteWrapped::writePar | ( | boost::string_ref | text_r,
|  | size_t | increment_r )
| inline

Definition at line 399 of file text.h.

## ◆ writeDefinition() [1/4]

void ztui::mbs::MbsWriteWrapped::writeDefinition | ( | boost::string_ref | tag_r,
|  | boost::string_ref | text_r,
|  | size_t | tagincr_r,
|  | size_t | textincr_r )
| inline

Write a tag_r with indented definition text_r.

Optional tagincr_r (0) and textincr_r (28) are counted on top of the base increment.

Definition at line 407 of file text.h.

## ◆ writeDefinition() [2/4]

void ztui::mbs::MbsWriteWrapped::writeDefinition | ( | boost::string_ref | tag_r,
|  | boost::string_ref | text_r )
| inline

Definition at line 425 of file text.h.

## ◆ writeDefinition() [3/4]

void ztui::mbs::MbsWriteWrapped::writeDefinition | ( | boost::string_ref | tag_r,
|  | boost::string_ref | text_r,
|  | size_t | tagincr_r,
|  | size_t | textincr_r,
|  | size_t | increment_r )
| inline

Definition at line 428 of file text.h.

## ◆ writeDefinition() [4/4]

void ztui::mbs::MbsWriteWrapped::writeDefinition | ( | boost::string_ref | tag_r,
|  | boost::string_ref | text_r,
|  | size_t | increment_r )
| inline

Definition at line 431 of file text.h.

## ◆ write()

void ztui::mbs::MbsWriteWrapped::write | ( | boost::string_ref | text_r,
|  | bool | leadingWSindents_r = true )
| inlineprivate

Append text_r indented and wrapped at the current position.

All words and NL are written, only trailing WS is remembered.

Definition at line 439 of file text.h.

## ◆ writeout()

void ztui::mbs::MbsWriteWrapped::writeout | ( | bool | force_r = false | ) |
| inlineprivate

Write any pending "indent/gap+word" and reset for next word.

If force_r, gap is cleared even if no word is pending. This is used before writing a '
'.

Definition at line 477 of file text.h.

## ◆ _writeoutPending()

void ztui::mbs::MbsWriteWrapped::_writeoutPending | ( |  | ) |
| inlineprivate

Definition at line 490 of file text.h.

## ◆ fixIndent() [1/2]

static size_t ztui::mbs::MbsWriteWrapped::fixIndent | ( | size_t | indent_r,
|  | int | indentFix_r )
| inlinestaticprivate

Return fixed indent_r.

Definition at line 543 of file text.h.

## ◆ fixIndent() [2/2]

size_t ztui::mbs::MbsWriteWrapped::fixIndent | ( | size_t | indent_r | ) |
| inlineprivate

Return fixed indent_r (unsets _indentFix)

Definition at line 556 of file text.h.

## ◆ saneIncrementIndent() [1/2]

static size_t ztui::mbs::MbsWriteWrapped::saneIncrementIndent | ( | size_t | current_r,
|  | size_t | increment_r,
|  | size_t | wrap_r )
| inlinestaticprivate

Return incremented indent, but not to more than 50% of the remaining line size if wrapped.

Definition at line 564 of file text.h.

## ◆ saneIncrementIndent() [2/2]

size_t ztui::mbs::MbsWriteWrapped::saneIncrementIndent | ( | size_t | increment_r | ) |
| inlineprivate

Return incremented `_indent`, but not more than 50% of the remaining line size if wrapped.

Definition at line 580 of file text.h.

## ◆ clearIndent()

void ztui::mbs::MbsWriteWrapped::clearIndent | ( |  | ) |
| inlineprivate

Set default indent at par start (reloads `_indentFix`)

Definition at line 584 of file text.h.

## ◆ clearGap()

void ztui::mbs::MbsWriteWrapped::clearGap | ( |  | ) |
| inlineprivate

Set no gaps.

Definition at line 588 of file text.h.

## ◆ clearWord()

void ztui::mbs::MbsWriteWrapped::clearWord | ( |  | ) |
| inlineprivate

Set no word pending.

Definition at line 592 of file text.h.

## Friends And Related Symbol Documentation

## ◆ scopedIndentIncrement()

ScopedIndentIncrement scopedIndentIncrement | ( | size_t | increment_r | ) |
| related

Temporarily increase indent.

Definition at line 355 of file text.h.

## Member Data Documentation

## ◆ _out

std::ostream& ztui::mbs::MbsWriteWrapped::_out
| private

Definition at line 595 of file text.h.

## ◆ _defaultWrap

const size_t ztui::mbs::MbsWriteWrapped::_defaultWrap
| private

Definition at line 596 of file text.h.

## ◆ _defaultIndent

const size_t ztui::mbs::MbsWriteWrapped::_defaultIndent
| private

Definition at line 597 of file text.h.

## ◆ _defaultIndentFix

const int ztui::mbs::MbsWriteWrapped::_defaultIndentFix
| private

Definition at line 598 of file text.h.

## ◆ _indent

size_t ztui::mbs::MbsWriteWrapped::_indent
| private

Definition at line 600 of file text.h.

## ◆ _indentFix

int ztui::mbs::MbsWriteWrapped::_indentFix
| private

Definition at line 601 of file text.h.

## ◆ _indentGap

size_t ztui::mbs::MbsWriteWrapped::_indentGap
| private

Definition at line 602 of file text.h.

## ◆ _lpos

size_t ztui::mbs::MbsWriteWrapped::_lpos
| private

Definition at line 604 of file text.h.

## ◆ _gap

size_t ztui::mbs::MbsWriteWrapped::_gap
| private

Definition at line 606 of file text.h.

## ◆ _gapForced

size_t ztui::mbs::MbsWriteWrapped::_gapForced
| private

Definition at line 607 of file text.h.

## ◆ _gapLines

size_t ztui::mbs::MbsWriteWrapped::_gapLines
| private

Definition at line 608 of file text.h.

## ◆ _word

const char* ztui::mbs::MbsWriteWrapped::_word
| private

Definition at line 610 of file text.h.

## ◆ _wSize

size_t ztui::mbs::MbsWriteWrapped::_wSize
| private

Definition at line 611 of file text.h.

## ◆ _wColumns

size_t ztui::mbs::MbsWriteWrapped::_wColumns
| private

Definition at line 612 of file text.h.

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

- zypp-tui/utils/text.h