libzypp: ztui::OutNormal Class Reference

libzypp 17.38.6

ztui::OutNormal Class Reference

`#include <zypp-tui/output/OutNormal.h>`

Inheritance diagram for ztui::OutNormal:

## Public Member Functions
| OutNormal (Verbosity verbosity=NORMAL)
| ~OutNormal () override
void | info (const std::string &msg, Verbosity verbosity, Type mask) override
| Show an info message.
void | infoLine (const TermLine &msg, Verbosity verbosity, Type mask) override
| info taking a TermLine
void | warning (const std::string &msg, Verbosity verbosity, Type mask) override
| Show a warning.
void | error (const std::string &problem_desc, const std::string &hint) override
| Show an error message and an optional hint.
void | error (const zypp::Exception &e, const std::string &problem_desc, const std::string &hint) override
| Prints the problem description caused by an exception, its cause and, optionally, a hint for the user.
void | progressStart (const std::string &id, const std::string &label, bool is_tick) override
| Start of an operation with reported progress.
void | progress (const std::string &id, const std::string &label, int value) override
| Progress report for an on-going operation.
void | progressEnd (const std::string &id, const std::string &label, const std::string &donetag, bool error) override
| End of an operation with reported progress.
void | dwnldProgressStart (const zypp::Url &uri) override
| Reoprt start of a download.
void | dwnldProgress (const zypp::Url &uri, int value, long rate) override
| Reports download progress.
void | dwnldProgressEnd (const zypp::Url &uri, long rate, zypp::TriBool error) override
| Reports end of a download.
void | prompt (PromptId id, const std::string &prompt, const PromptOptions &poptions, const std::string &startdesc) override
| Prompt the user for a decision.
void | promptHelp (const PromptOptions &poptions) override
| Print help for prompt, if available.
void | setUseColors (bool value) override
| Hint for a handler whether config would allow to use colors.
Public Member Functions inherited from ztui::Out
| ZYPP_DECLARE_FLAGS (Type, TypeBit)
virtual | ~Out ()
void | xmlNode (const std::string &name_r, const std::initializer_list< XmlNode::Attr > &attrs_r={})
| XML only: Write a leaf node without PCDATA.
void | xmlNode (const std::string &name_r, XmlNode::Attr attr_r)
template<class TContainer, class TFormater = out::ListFormater>
void | list (const std::string &nodeName_r, const std::string &title_r, const TContainer &container_r, const TFormater &formater_r=TFormater())
| Write list from container creating a TitleNode with `size="nnn"` attribute and replacing optional `%1%` in title_r with size.
template<class TContainer, class TFormater = out::TableFormater>
void | table (const std::string &nodeName_r, const std::string &title_r, const TContainer &container_r, const TFormater &formater_r=TFormater())
| Write table from container creating a TitleNode with `size="nnn"` attribute and replacing optional `%1%` in title_r with size.
void | gap ()
| NORMAL: An empty line.
void | printRichText (std::string text, unsigned indent_r=0U)
template<class Text>
void | par (size_t indent_r, const Text &text_r, ParFormat format_r=ParFormat())
| Paragraph of text, optionally indented, or without leading gap.
template<class Text>
void | par (const Text &text_r, ParFormat format_r=ParFormat())
template<class TText, class Text>
void | taggedPar (size_t indent_r, const TText &tag_r, const Text &text_r, ParFormat format_r=ParFormat())
| Paragraph of text preceded by 'tag_r' and a ' '.
template<class TText, class Text>
void | taggedPar (const TText &tag_r, const Text &text_r, ParFormat format_r=ParFormat())
template<class Text>
void | notePar (size_t indent_r, const Text &text_r, ParFormat format_r=ParFormat())
| Paragraph tagged with 'Note: '.
template<class Text>
void | notePar (const Text &text_r, ParFormat format_r=ParFormat())
template<class Text>
void | warningPar (size_t indent_r, const Text &text_r, ParFormat format_r=ParFormat())
| Paragraph tagged with 'Warning: '.
template<class Text>
void | warningPar (const Text &text_r, ParFormat format_r=ParFormat())
template<class Text>
void | errorPar (size_t indent_r, const Text &text_r, ParFormat format_r=ParFormat())
| Paragraph tagged with 'Error: '.
template<class Text>
void | errorPar (const Text &text_r, ParFormat format_r=ParFormat())
void | info (std::string msg, const std::string &msg2, Verbosity verbosity=NORMAL, Type mask=TYPE_ALL)
Info | info ()
void | infoLR (const std::string &lmsg, const std::string &rmsg, Verbosity verbosity=NORMAL, Type mask=TYPE_ALL)
| Info message, 2 strings L/R-adjusted.
void | infoLRHint (const std::string &lmsg, const std::string &hint, Verbosity verbosity=NORMAL, Type mask=TYPE_ALL)
| Info message with R-adjusted "(hint)".
void | progressEnd (const std::string &id, const std::string &label, ProgressEnd donetag)
void | progressEnd (const std::string &id, const std::string &label, bool error=false)
virtual void | searchResult (const Table &table_r)
| Print out a search result.
Verbosity | verbosity () const
| Get current verbosity.
void | setVerbosity (Verbosity verbosity)
| Set current verbosity.
zypp::DtorReset | scopedVerbosity (Verbosity verbosity_r)
| Return RAII class for exception safe scoped verbosity change.
TypeBit | type () const
| Return the type of the instance.
bool | type (TypeBit type_r) const
| Test for a specific type.
bool | typeNORMAL () const
bool | typeXML () const
unsigned | defaultFormatWidth (unsigned desired_r=0) const
| Terminal width or 150 if unlimited.

## Protected Member Functions
bool | mine (Type type) override
| Determine whether the output is intended for the particular type.
unsigned | termwidth () const override
| Width for formatted output [0==unlimited].
Protected Member Functions inherited from ztui::Out
| Out (TypeBit type, Verbosity verbosity=NORMAL)
virtual bool | progressFilter ()
| Determine whether to show progress.
virtual std::string | zyppExceptionReport (const zypp::Exception &e)
| Return a Exception as a string suitable for output.

## Private Member Functions
bool | infoWarningFilter (Verbosity verbosity, Type mask)
void | fixupProgressNL ()
void | displayProgress (const std::string &s, int percent)
void | displayTick (const std::string &s)

## Private Attributes
bool | _use_colors
bool | _isatty
bool | _newline
bool | _oneup

## Additional Inherited Members
Public Types inherited from ztui::Out
enum | Verbosity { QUIET = 0 , NORMAL = 1 , HIGH = 2 , DEBUG = 3 }
| Verbosity levels. More...
enum | TypeBit { TYPE_NORMAL = 0x01<<0 , TYPE_XML = 0x01<<1 }
| Known output types implemented by derived classes. More...
using | PromptId = unsigned
Static Public Attributes inherited from ztui::Out
static constexpr Type | TYPE_NONE = Type(0x00)
static constexpr Type | TYPE_ALL = Type(0xff)

## Detailed Description

Definition at line 23 of file OutNormal.h.

## Constructor & Destructor Documentation

## ◆ OutNormal()

ztui::OutNormal::OutNormal | ( | Verbosity | verbosity = NORMAL | ) |

Definition at line 33 of file OutNormal.cc.

## ◆ ~OutNormal()

ztui::OutNormal::~OutNormal | ( |  | ) |
| override

Definition at line 41 of file OutNormal.cc.

## Member Function Documentation

## ◆ info()

void ztui::OutNormal::info | ( | const std::string & | msg,
|  | Verbosity | verbosity,
|  | Type | mask )
| overridevirtual

Show an info message.

Parameters

  msg | The message to be displayed.
  verbosity | Minimal level o verbosity in which the message will be shown. Out::QUIET means the message will be always be displayed. Out::HIGH means the message will be displayed only if the current verbosity level is HIGH (-v) or DEBUG (-vv).
  mask | Determines the types of output for which is this message intended. By default, the message will be shown in all types of output.

Implements ztui::Out.

Definition at line 63 of file OutNormal.cc.

## ◆ infoLine()

void ztui::OutNormal::infoLine | ( | const TermLine & | msg_r,
|  | Verbosity | verbosity_r,
|  | Type | mask_r )
| overridevirtual

info taking a TermLine

Reimplemented from ztui::Out.

Definition at line 80 of file OutNormal.cc.

## ◆ warning()

void ztui::OutNormal::warning | ( | const std::string & | msg,
|  | Verbosity | verbosity,
|  | Type | mask )
| overridevirtual

Show a warning.

Parameters

  msg | The warning message to be displayed.
  verbosity | Minimal level o verbosity in which the message will be shown. Out::QUIET means the message will be always be displayed. Out::HIGH means the message will be displayed only if the current verbosity level is HIGH (-v) or DEBUG (-vv).
  mask | Determines the types of output for which is this message intended. By default, the message will be shown in all types of output.

Implements ztui::Out.

Definition at line 83 of file OutNormal.cc.

## ◆ error() [1/2]

void ztui::OutNormal::error | ( | const std::string & | problem_desc,
|  | const std::string & | hint )
| overridevirtual

Show an error message and an optional hint.

An error message should be shown regardless of the verbosity level.

Parameters

  problem_desc | Problem description (what happened)
  hint | Hint for the user (what to do, or explanation)

Implements ztui::Out.

Definition at line 94 of file OutNormal.cc.

## ◆ error() [2/2]

void ztui::OutNormal::error | ( | const zypp::Exception & | e,
|  | const std::string & | problem_desc,
|  | const std::string & | hint )
| overridevirtual

Prints the problem description caused by an exception, its cause and, optionally, a hint for the user.

Parameters

  e | Exception which caused the problem.
  Problem | description for the user.
  Hint | for the user how to cope with the problem.

Implements ztui::Out.

Definition at line 107 of file OutNormal.cc.

## ◆ progressStart()

void ztui::OutNormal::progressStart | ( | const std::string & | id,
|  | const std::string & | label,
|  | bool | is_tick )
| overridevirtual

Start of an operation with reported progress.

Parameters

  id | Identifier. Any string used to match multiple overlapping progress reports (doesn't happen now, but probably will in the future).
  label | Progress description.
  is_tick | false for known progress percentage, true for 'still alive' notifications

Implements ztui::Out.

Definition at line 182 of file OutNormal.cc.

## ◆ progress()

void ztui::OutNormal::progress | ( | const std::string & | id,
|  | const std::string & | label,
|  | int | value )
| overridevirtual

Progress report for an on-going operation.

Parameters

  id | Identifier. Any string used to match multiple overlapping progress reports.
  label | Progress description.
  value | Percentage value or -1 if unknown ('still alive' notification)

Implements ztui::Out.

Definition at line 198 of file OutNormal.cc.

## ◆ progressEnd()

void ztui::OutNormal::progressEnd | ( | const std::string & | id,
|  | const std::string & | label,
|  | const std::string & | donetag,
|  | bool | error )
| overridevirtual

End of an operation with reported progress.

Parameters

  id | Identifier. Any string used to match multiple overlapping progress reports.
  label | Progress description.
  donetag | Optional string overwriting the default [done]/[error] tags.
  error | false if the operation finished with success, true otherwise.

Implements ztui::Out.

Definition at line 211 of file OutNormal.cc.

## ◆ dwnldProgressStart()

void ztui::OutNormal::dwnldProgressStart | ( | const zypp::Url & | uri | ) |
| overridevirtual

Reoprt start of a download.

Parameters

  uri | Uri of the file to download.

Implements ztui::Out.

Definition at line 245 of file OutNormal.cc.

## ◆ dwnldProgress()

void ztui::OutNormal::dwnldProgress | ( | const zypp::Url & | uri,
|  | int | value,
|  | long | rate )
| overridevirtual

Reports download progress.

Parameters

  uri | Uri of the file being downloaded.
  value | Value of the progress in percents. -1 if unknown.
  rate | Current download rate in B/s. -1 if unknown.

Implements ztui::Out.

Definition at line 272 of file OutNormal.cc.

## ◆ dwnldProgressEnd()

void ztui::OutNormal::dwnldProgressEnd | ( | const zypp::Url & | uri,
|  | long | rate,
|  | zypp::TriBool | error )
| overridevirtual

Reports end of a download.

Parameters

  uri | Uri of the file to download.
  rate | Average download rate at the end. -1 if unknown.
  error | Error flag - did the download finish with error? `indeterminate` == 'not found'

Implements ztui::Out.

Definition at line 312 of file OutNormal.cc.

## ◆ prompt()

void ztui::OutNormal::prompt | ( | PromptId | id,
|  | const std::string & | prompt,
|  | const PromptOptions & | poptions,
|  | const std::string & | startdesc )
| overridevirtual

Prompt the user for a decision.

Parameters

  id | Unique prompt identifier for use by machines.
  prompt | Prompt text.
  options | A PromptOptions object
  startdesc | Initial detailed description of the prompt to be prepended to the prompt text. Should be used only whe prompting for the first time and left empty when retrying after an invalid answer has been given.

See also
  prompt.h
  ../zypper-prompt.h

Implements ztui::Out.

Definition at line 358 of file OutNormal.cc.

## ◆ promptHelp()

void ztui::OutNormal::promptHelp | ( | const PromptOptions & | poptions | ) |
| overridevirtual

Print help for prompt, if available.

This method should be called after '?' prompt option has been entered.

Implements ztui::Out.

Definition at line 416 of file OutNormal.cc.

## ◆ setUseColors()

void ztui::OutNormal::setUseColors | ( | bool | yesno | ) |
| inlineoverridevirtual

Hint for a handler whether config would allow to use colors.

Reimplemented from ztui::Out.

Definition at line 50 of file OutNormal.h.

## ◆ mine()

bool ztui::OutNormal::mine | ( | Type | type | ) |
| overrideprotectedvirtual

Determine whether the output is intended for the particular type.

Implements ztui::Out.

Definition at line 44 of file OutNormal.cc.

## ◆ termwidth()

unsigned ztui::OutNormal::termwidth | ( |  | ) | const
| overrideprotectedvirtual

Width for formatted output [0==unlimited].

Reimplemented from ztui::Out.

Definition at line 451 of file OutNormal.cc.

## ◆ infoWarningFilter()

bool ztui::OutNormal::infoWarningFilter | ( | Verbosity | verbosity,
|  | Type | mask )
| private

Definition at line 47 of file OutNormal.cc.

## ◆ fixupProgressNL()

void ztui::OutNormal::fixupProgressNL | ( |  | ) |
| private

Definition at line 56 of file OutNormal.cc.

## ◆ displayProgress()

void ztui::OutNormal::displayProgress | ( | const std::string & | s,
|  | int | percent )
| private

Definition at line 127 of file OutNormal.cc.

## ◆ displayTick()

void ztui::OutNormal::displayTick | ( | const std::string & | s | ) |
| private

Definition at line 158 of file OutNormal.cc.

## Member Data Documentation

## ◆ _use_colors

bool ztui::OutNormal::_use_colors
| private

Definition at line 65 of file OutNormal.h.

## ◆ _isatty

bool ztui::OutNormal::_isatty
| private

Definition at line 66 of file OutNormal.h.

## ◆ _newline

bool ztui::OutNormal::_newline
| private

Definition at line 69 of file OutNormal.h.

## ◆ _oneup

bool ztui::OutNormal::_oneup
| private

Definition at line 71 of file OutNormal.h.

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

- zypp-tui/output/OutNormal.h
- zypp-tui/output/OutNormal.cc