Quiet-aware, indentation-aware output context.
More...
#include <Output.hpp>
|
| | Output (bool quiet) |
| |
| void | dedent () |
| |
| template<typename... Args> |
| void | errorln (fmt::format_string< Args... > fmt_str, Args &&... args) const |
| | Print formatted content + newline to stderr. Always prints.
|
| |
| void | flush () const |
| | Flush stdout. For interactive output like progress bars.
|
| |
| void | indent () |
| |
| void | newline () const |
| | Print a blank line. For visual separation between sections.
|
| |
| template<typename... Args> |
| void | print (fmt::format_string< Args... > fmt_str, Args &&... args) const |
| | Print indent + formatted content, no newline.
|
| |
| template<typename... Args> |
| void | println (fmt::format_string< Args... > fmt_str, Args &&... args) const |
| | Print indent + formatted content + newline. The workhorse.
|
| |
| void | progress (int current, int total, int bar_width=50) const |
| | Display a carriage-return progress bar.
|
| |
| void | saved (std::string const &label, std::string const &path) const |
| | Print a file-save confirmation: "label saved to path".
|
| |
| int | try_or_fail (std::function< void()> const &f, std::string const &context="") const |
| | Run a callable, catch std::exception, print error, return 1.
|
| |
Quiet-aware, indentation-aware output context.
Construct once per subcommand from CLIOptions::quiet and thread through all printing functions. Stdout methods respect quiet mode and prepend the current indentation. Stderr methods always print.
◆ Output()
| ppforest2::io::Output::Output |
( |
bool | quiet | ) |
|
|
inlineexplicit |
◆ dedent()
| void ppforest2::io::Output::dedent |
( |
| ) |
|
|
inline |
◆ errorln()
template<typename... Args>
| void ppforest2::io::Output::errorln |
( |
fmt::format_string< Args... > | fmt_str, |
|
|
Args &&... | args ) const |
|
inline |
Print formatted content + newline to stderr. Always prints.
◆ flush()
| void ppforest2::io::Output::flush |
( |
| ) |
const |
|
inline |
Flush stdout. For interactive output like progress bars.
◆ indent()
| void ppforest2::io::Output::indent |
( |
| ) |
|
|
inline |
◆ newline()
| void ppforest2::io::Output::newline |
( |
| ) |
const |
|
inline |
Print a blank line. For visual separation between sections.
◆ print()
template<typename... Args>
| void ppforest2::io::Output::print |
( |
fmt::format_string< Args... > | fmt_str, |
|
|
Args &&... | args ) const |
|
inline |
Print indent + formatted content, no newline.
Use for starting a partial line that will be continued.
◆ println()
template<typename... Args>
| void ppforest2::io::Output::println |
( |
fmt::format_string< Args... > | fmt_str, |
|
|
Args &&... | args ) const |
|
inline |
Print indent + formatted content + newline. The workhorse.
◆ progress()
| void ppforest2::io::Output::progress |
( |
int | current, |
|
|
int | total, |
|
|
int | bar_width = 50 ) const |
|
inline |
Display a carriage-return progress bar.
Overwrites the current line with a bar showing current/total. Prints a final newline when current == total.
◆ saved()
| void ppforest2::io::Output::saved |
( |
std::string const & | label, |
|
|
std::string const & | path ) const |
|
inline |
Print a file-save confirmation: "label saved to path".
◆ try_or_fail()
| int ppforest2::io::Output::try_or_fail |
( |
std::function< void()> const & | f, |
|
|
std::string const & | context = "" ) const |
|
inline |
Run a callable, catch std::exception, print error, return 1.
If the callable succeeds, returns 0. If it throws, prints the error message to stderr with red "Error:" prefix and returns 1.
◆ indent_level
| int ppforest2::io::Output::indent_level = 0 |
◆ quiet
| bool ppforest2::io::Output::quiet |
The documentation for this struct was generated from the following file: