Uni20
Asynchronous tensor and runtime library.
Loading...
Searching...
No Matches
Classes | Namespaces | Typedefs | Enumerations | Functions
display.hpp File Reference
#include "presentation.hpp"
#include <fmt/core.h>
#include <fmt/format.h>
#include <cstddef>
#include <functional>
#include <initializer_list>
#include <optional>
#include <source_location>
#include <string>
#include <string_view>
#include <type_traits>
#include <utility>
#include <variant>
#include <vector>
Include dependency graph for display.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  uni20::display::column_format
 Default formatting and styling for values emitted in a streaming table column. More...
 
struct  uni20::display::column_width
 Schema-level width request for a streaming display table column. More...
 
struct  uni20::display::event
 Human-facing display event routed through the active sink. More...
 
struct  uni20::display::format_string< Args >
 Compile-time checked display format string with call-site metadata. More...
 
struct  uni20::display::formatted_cell
 Already formatted display text with numeric alignment semantics retained by its producer. More...
 
class  uni20::display::scoped_sink
 Temporarily replace the display sink and restore it on destruction. More...
 
class  uni20::display::streaming_table
 Schema-first table for progress output where rows are emitted immediately. More...
 

Namespaces

namespace  uni20
 
namespace  uni20::display
 
namespace  uni20::display::format
 
namespace  uni20::display::width
 

Typedefs

template<typename... Args>
using uni20::display::checked_format_string = std::type_identity_t< format_string< Args... > >
 Non-deduced format-string parameter type used by display helper templates.
 
using uni20::display::event_content = std::variant< presentation::styled_text, presentation::report_builder >
 Presentation payload carried to a display sink before final rendering.
 
using uni20::display::sink = std::function< void(event const &)>
 Callable that receives display events for final routing and rendering.
 

Enumerations

enum class  uni20::display::column_value_kind { uni20::display::automatic , uni20::display::text , uni20::display::number }
 Semantic value type expected by a streaming table column. More...
 
enum class  uni20::display::column_width_mode { uni20::display::fixed , uni20::display::share , uni20::display::fit }
 Width allocation mode for a streaming display table column. More...
 
enum class  uni20::display::stream { uni20::display::out , uni20::display::err }
 Selects the ordinary display stream for a message. More...
 

Functions

sink uni20::display::current_sink ()
 Return a copy of the active display sink.
 
template<typename... Args>
void uni20::display::deferred (checked_format_string< Args... > format, Args &&... args)
 Emit an intentionally deferred display message.
 
void uni20::display::emit (presentation::report_builder report, stream destination=stream::err, bool newline=true, std::source_location where=std::source_location::current())
 Emit a presentation report through the active display sink.
 
void uni20::display::emit (presentation::styled_text text, stream destination=stream::err, bool newline=true, std::source_location where=std::source_location::current())
 Emit styled text through the active display sink.
 
template<typename... Args>
void uni20::display::failure (checked_format_string< Args... > format, Args &&... args)
 Emit a failure display message.
 
template<typename... Args>
void uni20::display::fatal (checked_format_string< Args... > format, Args &&... args)
 Emit a fatal-status display message.
 
column_width uni20::display::width::fit (std::size_t minimum=1)
 Request a non-greedy column that starts at a minimum width and grows when row values need it.
 
column_format uni20::display::format::fixed (int precision, terminal::TerminalStyle style={})
 Format numeric values with fixed-point notation and the requested precision.
 
column_width uni20::display::width::fixed (std::size_t cells)
 Request an exact display-cell width for a streaming table column.
 
column_format uni20::display::format::general (int precision, terminal::TerminalStyle style={})
 Format numeric values with general notation and the requested precision.
 
template<typename... Args>
void uni20::display::info (checked_format_string< Args... > format, Args &&... args)
 Emit an informational display message.
 
column_format uni20::display::format::number (std::string pattern="{}", terminal::TerminalStyle style={})
 Treat column values as numeric and format them with a runtime fmt pattern.
 
template<typename... Args>
void uni20::display::partial (checked_format_string< Args... > format, Args &&... args)
 Emit a partially-completed display message.
 
void uni20::display::reset_sink ()
 Restore the default C++ terminal display sink.
 
column_format uni20::display::format::scientific (int precision, terminal::TerminalStyle style={})
 Format numeric values with scientific notation and the requested precision.
 
void uni20::display::set_sink (sink replacement)
 Replace the process-wide display sink.
 
column_width uni20::display::width::share (std::size_t weight=1, std::size_t minimum=1)
 Request a flexible streaming table column with the given share weight.
 
template<typename... Args>
void uni20::display::skipped (checked_format_string< Args... > format, Args &&... args)
 Emit a skipped/unavailable display message.
 
template<typename... Args>
void uni20::display::status (presentation::semantic_glyph glyph, checked_format_string< Args... > format, Args &&... args)
 Emit a semantic status message through the active display sink.
 
template<typename... Args>
presentation::styled_text uni20::display::status_cell (presentation::semantic_glyph glyph, checked_format_string< Args... > format, Args &&... args)
 Build styled status text without emitting it.
 
template<typename... Args>
void uni20::display::success (checked_format_string< Args... > format, Args &&... args)
 Emit a successful/completed display message.
 
streaming_table uni20::display::table (std::string title={}, stream destination=stream::out)
 Create a schema-first streaming display table.
 
column_format uni20::display::format::text (terminal::TerminalStyle style={})
 Treat column values as text, optionally applying a style.
 
template<typename... Args>
void uni20::display::warning (checked_format_string< Args... > format, Args &&... args)
 Emit a non-fatal warning display message.