67 static size_t render(
const Label& label, std::ostream& stream,
68 const std::vector<std::string>& text_lines,
size_t text_index,
69 bool active_render,
size_t column_start = 0);
89 [[nodiscard]]
static std::vector<std::string>
wrap_text(
const std::string& text,
size_t max_width);
92 size_t _padding, _snippet_width;
93 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 1-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:13
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.
TextRenderer(const Report &report)
Initializes the renderer with a reference layout taken from a Report
void render(const FileGroup &file_group, std::ostream &stream) override
Renders a single file group to the stream.
static size_t 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)
Renders an individual label, optionally in active mode to draw the actual span arrows.
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.
Severity
Indicates the importance of a diagnostic.
Definition: report.hpp:18