Centralizes all TTS runtime output and dispatches it to the current output_sink. More...
Centralizes all TTS runtime output and dispatches it to the current output_sink.
tts::output_handler is the class every piece of non-usage related TTS output goes through. It exposes formatted writing at the granularity actually needed by the engine - a fragment, a full line, raw text or a printf-style message - and forwards the result to whichever output_sink is currently installed (tts::stdout_sink by default).
Public Member Functions | |
| output_handler (output_sink &s=default_sink()) | |
| Constructs an output_handler using s as its initial output_sink. | |
| void | assertion_failed (text const &location, text const &message, bool fatal) |
| Notifies the current output_sink that an assertion failed. | |
| void | finish () |
| Notifies the current output_sink that tts::report() has returned. | |
| void | flush () |
| Flushes the current output_sink, if that means anything for it. | |
| output_sink & | sink () const |
| Retrieves the output_sink currently in use. | |
| void | sink (output_sink &s) |
| Installs s as the output_sink every subsequent write goes to. | |
| void | suite_aborted () |
| Notifies the current output_sink that the suite aborted early on a fatal failure. | |
| void | suite_finished (unsigned long long fail_count, unsigned long long invalid_count) |
| Notifies the current output_sink that the whole suite has finished running. | |
| void | suite_metric (outcome kind, unsigned long long count, unsigned long long total) |
| Notifies the current output_sink that a Results: outcome category is about to print. | |
| void | test_finished (text const &name, bool passed, bool invalid, unsigned long long duration_ns) |
| Notifies the current output_sink that a test has finished running. | |
| void | test_started (text const &name) |
| Notifies the current output_sink that a test is about to run. | |
| template<typename... Args> | |
| void | write (char const *format, Args const &... args) |
| Writes a printf-style formatted message. | |
| void | write (char const *s) |
| Writes a raw C-string as-is. | |
| void | write (text const &t) |
| Writes a pre-built tts::text as-is. | |
| template<typename... Args> | |
| void | writeln (char const *format, Args const &... args) |
| Writes a printf-style formatted message followed by a newline. | |
| void | writeln (char const *s) |
| Writes a raw C-string followed by a newline. | |
| void | writeln (text const &t=text {}) |
| Writes a pre-built tts::text followed by a newline. | |
Static Public Member Functions | |
| static stdout_sink & | default_sink () |
| The output_sink TTS uses unless a power user installs another one. | |