125 void render(
const Label& label, std::ostream& stream,
const std::vector<std::string>& text_lines,
size_t text_index,
bool active_render,
126 size_t column_start = 0)
const;
146 [[nodiscard]]
static std::vector<std::string>
wrap_text(
const std::string& text,
size_t max_width);
157 static void print_wrapped_text(
const std::string& text,
const std::string& wrapped_prefix,
size_t max_width, std::ostream& stream);
160 size_t _line_number_width, _snippet_width;
161 std::string _whitespaces;
Groups LineGroups belonging to the same Source
Definition: report.hpp:67
Interface implemented by renderers that turn reports into output (e.g., text)
Definition: report.hpp:195
Represents a short textual annotation attached to a Span in a source.
Definition: label.hpp:12
A set of labels that belong to the same 0-based line number.
Definition: report.hpp:28
Represents a fully constructed diagnostic report to be rendered.
Definition: report.hpp:109
std::unordered_map< std::shared_ptr< Source >, FileGroup > MappedFileGroups
Definition: report.hpp:111
A plain-text renderer for diagnostic Reports.
Definition: renderer.hpp:70
TextRenderer(const Report &report, Config config={})
Initializes the renderer with a reference layout taken from a Report
static void print_wrapped_text(const std::string &text, const std::string &wrapped_prefix, size_t max_width, std::ostream &stream)
Prints the wrapped text into lines no longer than max_width characters and adds a prefix to wrapped l...
void render(const Report &report, std::ostream &stream) override
Renders an entire report to the stream.
void render(const LineGroup &line_group, std::ostream &stream) override
Renders a single line group to the stream.
static size_t widest_line_number(const Report::MappedFileGroups &groups, size_t padding)
Computes the width of the widest line number across groups, plus padding.
void render(const FileGroup &file_group, std::ostream &stream) override
Renders a single file group to the stream.
static std::vector< std::string > wrap_text(const std::string &text, size_t max_width)
Wraps the given text to lines no longer than max_width characters.
void render(const Severity &severity, std::ostream &stream) override
Renders just the severity label to the stream.
void render(const Label &label, std::ostream &stream, const std::vector< std::string > &text_lines, size_t text_index, bool active_render, size_t column_start=0) const
Renders an individual label, optionally in active mode to draw the actual span arrows.
GlyphSet Unicode()
Returns a Unicode glyph set for rich terminal rendering.
GlyphSet Ascii()
Returns an ASCII-only glyph set for maximum compatibility.
Severity
Indicates the importance of a diagnostic.
Definition: report.hpp:18
Configuration options for the TextRenderer.
Definition: renderer.hpp:56
GlyphSet glyphs
Glyph set used for rendering.
Definition: renderer.hpp:62
Collection of glyphs used for rendering text-based UI elements.
Definition: renderer.hpp:18
std::string line_vertical
Definition: renderer.hpp:24
std::string arrow_right
Definition: renderer.hpp:29
std::string corner_bottom_right
Definition: renderer.hpp:20
std::string filler
Definition: renderer.hpp:28
std::string label_end
Definition: renderer.hpp:27
std::string corner_top_left
Definition: renderer.hpp:19
std::string cap_left
Definition: renderer.hpp:22
std::string line_horizontal
Definition: renderer.hpp:25
std::string label_start
Definition: renderer.hpp:26
std::string cap_right
Definition: renderer.hpp:23
std::string tee_right
Definition: renderer.hpp:21