|
Pretty Diagnostics
Create your own pretty diagnostics
|
Namespaces | |
| namespace | color |
| namespace | Glyphs |
Data Structures | |
| struct | Config |
| Configuration options for the TextRenderer. More... | |
| class | FileGroup |
Groups LineGroups belonging to the same Source More... | |
| class | FileSource |
A Source implementation that reads from a file on disk. More... | |
| struct | GlyphSet |
| Collection of glyphs used for rendering text-based UI elements. More... | |
| class | IReporterRenderer |
| Interface implemented by renderers that turn reports into output (e.g., text) More... | |
| class | Label |
Represents a short textual annotation attached to a Span in a source. More... | |
| class | LineGroup |
| A set of labels that belong to the same 0-based line number. More... | |
| class | Location |
A position inside a Source, expressed as (row, column, index) More... | |
| class | Report |
| Represents a fully constructed diagnostic report to be rendered. More... | |
| class | Source |
| Abstract interface for reading and mapping source text. More... | |
| class | Span |
Represents a contiguous region within a Source More... | |
| class | StringSource |
A Source implementation that reads from an in-memory string. More... | |
| class | TextRenderer |
A plain-text renderer for diagnostic Reports. More... | |
| struct | VisualChar |
A structure to contian the return values from get_visual_char More... | |
Enumerations | |
| enum class | Severity { Error , Warning , Info , Unknown } |
| Indicates the importance of a diagnostic. More... | |
Functions | |
| std::string | escape_string (std::string_view input) |
| Escapes control characters and quotes in a string for safe display. For example, converts newlines to "\\n" and tabs to "\\t". More... | |
| template<typename T > | |
| T | max (T first) |
| Returns the maximum of a single value. More... | |
| template<typename T , typename... Ts> | |
| T | max (T first, Ts... rest) |
| Returns the maximum of multiple values. More... | |
| template<typename T > | |
| T | min (T first) |
| Returns the minimum of a single value. More... | |
| template<typename T , typename... Ts> | |
| T | min (T first, Ts... rest) |
| Returns the minimum of multiple values. More... | |
| size_t | get_stream_width (const std::ostream &stream) |
| VisualChar | get_visual_char (std::string_view input, size_t index) |
| Returns the visual width and byte count of a given UTF8 character. More... | |
| size_t | visual_width (std::string_view input) |
| Calculates the visual display width of a UTF-8 string (for terminal display) More... | |
| size_t | to_visual_column (std::string_view line, size_t byte_column) |
| Returns the visual column of a specific byte column in a UTF-8 string. More... | |
| size_t | from_visual_column (std::string_view line, size_t visual_column) |
| Maps a visual column to a UTF-8 byte index in a line. More... | |
|
strong |
| std::string pretty_diagnostics::escape_string | ( | std::string_view | input | ) |
Escapes control characters and quotes in a string for safe display. For example, converts newlines to "\\n" and tabs to "\\t".
| input | Input string view to escape |
| size_t pretty_diagnostics::from_visual_column | ( | std::string_view | line, |
| size_t | visual_column | ||
| ) |
Maps a visual column to a UTF-8 byte index in a line.
| line | Input UTF-8 string view (usually a single line) |
| visual_column | 0-based visual column into line |
| size_t pretty_diagnostics::get_stream_width | ( | const std::ostream & | stream | ) |
| VisualChar pretty_diagnostics::get_visual_char | ( | std::string_view | input, |
| size_t | index | ||
| ) |
Returns the visual width and byte count of a given UTF8 character.
| input | The input stringview that contains the UTF8 character |
| index | The index at which the character is located |
| T pretty_diagnostics::max | ( | T | first | ) |
Returns the maximum of a single value.
| T | Type of the value (supports <) |
| first | The value |
| T pretty_diagnostics::max | ( | T | first, |
| Ts... | rest | ||
| ) |
Returns the maximum of multiple values.
| T | Type of the first argument (supports <) |
| Ts | Types of remaining arguments |
| first | First argument |
| rest | Remaining arguments |
| T pretty_diagnostics::min | ( | T | first | ) |
Returns the minimum of a single value.
| T | Type of the value (supports <) |
| first | The value |
| T pretty_diagnostics::min | ( | T | first, |
| Ts... | rest | ||
| ) |
Returns the minimum of multiple values.
| T | Type of the first argument (supports <) |
| Ts | Types of remaining arguments |
| first | First argument |
| rest | Remaining arguments |
| size_t pretty_diagnostics::to_visual_column | ( | std::string_view | line, |
| size_t | byte_column | ||
| ) |
Returns the visual column of a specific byte column in a UTF-8 string.
| line | Input UTF-8 string view (usually a single line) |
| byte_column | 0-based byte column into line |
| size_t pretty_diagnostics::visual_width | ( | std::string_view | input | ) |
Calculates the visual display width of a UTF-8 string (for terminal display)
ASCII characters count as 1, most 3- and 4-byte characters (CJK, emojis) as 2. Invalid UTF-8 bytes are counted as width 1.
| input | Input UTF-8 string view |