libzypp 17.37.17
|
#include <zypp-tui/output/OutNormal.h>
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) |
Definition at line 23 of file OutNormal.h.
Definition at line 33 of file OutNormal.cc.
|
override |
Definition at line 41 of file OutNormal.cc.
|
overridevirtual |
Show an info message.
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.
|
overridevirtual |
Show a warning.
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.
|
overridevirtual |
Show an error message and an optional hint.
An error message should be shown regardless of the verbosity level.
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.
|
overridevirtual |
Prints the problem description caused by an exception, its cause and, optionally, a hint for the user.
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.
|
overridevirtual |
Start of an operation with reported progress.
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.
|
overridevirtual |
Progress report for an on-going operation.
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.
|
overridevirtual |
End of an operation with reported progress.
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.
|
overridevirtual |
Reoprt start of a download.
uri | Uri of the file to download. |
Implements ztui::Out.
Definition at line 245 of file OutNormal.cc.
|
overridevirtual |
Reports download progress.
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.
|
overridevirtual |
Reports end of a download.
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.
|
overridevirtual |
Prompt the user for a decision.
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. |
Implements ztui::Out.
Definition at line 358 of file OutNormal.cc.
|
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.
|
inlineoverridevirtual |
Hint for a handler whether config would allow to use colors.
Reimplemented from ztui::Out.
Definition at line 50 of file OutNormal.h.
|
overrideprotectedvirtual |
Determine whether the output is intended for the particular type.
Implements ztui::Out.
Definition at line 44 of file OutNormal.cc.
|
overrideprotectedvirtual |
Width for formatted output [0==unlimited].
Reimplemented from ztui::Out.
Definition at line 451 of file OutNormal.cc.
Definition at line 47 of file OutNormal.cc.
|
private |
Definition at line 56 of file OutNormal.cc.
|
private |
Definition at line 127 of file OutNormal.cc.
|
private |
Definition at line 158 of file OutNormal.cc.
|
private |
Definition at line 65 of file OutNormal.h.
|
private |
Definition at line 66 of file OutNormal.h.
|
private |
Definition at line 69 of file OutNormal.h.
|
private |
Definition at line 71 of file OutNormal.h.