|
Porytiles
|
Abstract class for structured error reporting and diagnostic output. More...
#include <user_diagnostics.hpp>
Public Member Functions | |
| virtual | ~UserDiagnostics ()=default |
| UserDiagnostics (gsl::not_null< const TextFormatter * > format) | |
| virtual void | remark (const std::string &tag, const std::vector< std::string > &lines) const =0 |
| Display a tagged remark message. | |
| void | remark (const std::string &tag, const std::string &msg) const |
| Convenience overload for single line messages. | |
| template<typename FirstParam , typename... RestParams> requires ( !std::is_same_v<std::decay_t<FirstParam>, std::vector<FormatParam>> && std::is_constructible_v<FormatParam, FirstParam> && (std::is_constructible_v<FormatParam, RestParams> && ...)) | |
| void | remark (const std::string &tag, const std::string &format_str, FirstParam &&first, RestParams &&...rest) const |
| Variadic template overload for formatted remark messages. | |
| virtual void | warning (const std::string &tag, const std::vector< std::string > &lines) const =0 |
| Display a tagged warning message. | |
| void | warning (const std::string &tag, const std::string &msg) const |
| Convenience overload for single line messages. | |
| template<typename FirstParam , typename... RestParams> requires ( !std::is_same_v<std::decay_t<FirstParam>, std::vector<FormatParam>> && std::is_constructible_v<FormatParam, FirstParam> && (std::is_constructible_v<FormatParam, RestParams> && ...)) | |
| void | warning (const std::string &tag, const std::string &format_str, FirstParam &&first, RestParams &&...rest) const |
| Variadic template overload for formatted warning messages. | |
| virtual void | error (const std::string &tag, const std::vector< std::string > &lines) const =0 |
| Display a tagged error message. | |
| void | error (const std::string &tag, const std::string &msg) const |
| Convenience overload for single line messages. | |
| template<typename FirstParam , typename... RestParams> requires ( !std::is_same_v<std::decay_t<FirstParam>, std::vector<FormatParam>> && std::is_constructible_v<FormatParam, FirstParam> && (std::is_constructible_v<FormatParam, RestParams> && ...)) | |
| void | error (const std::string &tag, const std::string &format_str, FirstParam &&first, RestParams &&...rest) const |
| Variadic template overload for formatted error messages. | |
| virtual void | remark_note (const std::string &tag, const std::vector< std::string > &lines) const =0 |
| Display a tagged note message associated with a remark. | |
| void | remark_note (const std::string &tag, const std::string &msg) const |
| Convenience overload for single line messages. | |
| template<typename FirstParam , typename... RestParams> requires ( !std::is_same_v<std::decay_t<FirstParam>, std::vector<FormatParam>> && std::is_constructible_v<FormatParam, FirstParam> && (std::is_constructible_v<FormatParam, RestParams> && ...)) | |
| void | remark_note (const std::string &tag, const std::string &format_str, FirstParam &&first, RestParams &&...rest) const |
| Variadic template overload for formatted remark note messages. | |
| virtual void | warning_note (const std::string &tag, const std::vector< std::string > &lines) const =0 |
| Display a tagged note message associated with a warning. | |
| void | warning_note (const std::string &tag, const std::string &msg) const |
| Convenience overload for single line messages. | |
| template<typename FirstParam , typename... RestParams> requires ( !std::is_same_v<std::decay_t<FirstParam>, std::vector<FormatParam>> && std::is_constructible_v<FormatParam, FirstParam> && (std::is_constructible_v<FormatParam, RestParams> && ...)) | |
| void | warning_note (const std::string &tag, const std::string &format_str, FirstParam &&first, RestParams &&...rest) const |
| Variadic template overload for formatted warning note messages. | |
| virtual void | error_note (const std::string &tag, const std::vector< std::string > &lines) const =0 |
| Display a tagged note message associated with an error. | |
| void | error_note (const std::string &tag, const std::string &msg) const |
| Convenience overload for single line messages. | |
| template<typename FirstParam , typename... RestParams> requires ( !std::is_same_v<std::decay_t<FirstParam>, std::vector<FormatParam>> && std::is_constructible_v<FormatParam, FirstParam> && (std::is_constructible_v<FormatParam, RestParams> && ...)) | |
| void | error_note (const std::string &tag, const std::string &format_str, FirstParam &&first, RestParams &&...rest) const |
| Variadic template overload for formatted error note messages. | |
| virtual void | emit_fatal_proximate (const Error &err) const =0 |
| Emit the proximate (immediate) error in a fatal error chain. | |
| virtual void | emit_fatal_step (const Error &err) const =0 |
| Emit an intermediate step error in a fatal error chain. | |
| virtual void | emit_fatal_root (const Error &err) const =0 |
| Emit the root cause error in a fatal error chain. | |
| template<typename T , typename E > | |
| void | fatal (const ChainableResult< T, E > &result) const |
| Display a fatal error with complete error chain visualization. | |
| const TextFormatter & | formatter () const |
Abstract class for structured error reporting and diagnostic output.
UserDiagnostics provides a polymorphic interface for communicating diagnostics, warnings, errors, and fatal conditions to users. The class supports multiple severity levels and integrates with the ChainableResult error system to provide hierarchical error chain visualization.
The diagnostic system categorizes output into:
All methods support both single-line messages (std::string) and multi-line messages (std::vector<std::string>) for flexible diagnostic formatting.
Definition at line 35 of file user_diagnostics.hpp.
|
virtualdefault |
|
inlineexplicit |
Definition at line 39 of file user_diagnostics.hpp.
|
pure virtual |
Emit the proximate (immediate) error in a fatal error chain.
Virtual method for displaying the most immediate error in a fatal error chain. This is typically the first error encountered and is displayed with the highest visual prominence.
| err | The proximate error to display |
Implemented in porytiles::NullUserDiagnostics, porytiles::BufferedUserDiagnostics, porytiles::FilteredUserDiagnostics, and porytiles::StderrStyledUserDiagnostics.
|
pure virtual |
Emit the root cause error in a fatal error chain.
Virtual method for displaying the root cause error in a fatal error chain. This represents the original underlying cause of the failure and is typically displayed as the final item in the error hierarchy.
| err | The root cause error to display |
Implemented in porytiles::NullUserDiagnostics, porytiles::BufferedUserDiagnostics, porytiles::FilteredUserDiagnostics, and porytiles::StderrStyledUserDiagnostics.
|
pure virtual |
Emit an intermediate step error in a fatal error chain.
Virtual method for displaying intermediate errors in a fatal error chain. These are errors that occurred between the proximate and root causes, typically displayed with tree-like formatting to show the error hierarchy.
| err | The step error to display |
Implemented in porytiles::NullUserDiagnostics, porytiles::BufferedUserDiagnostics, porytiles::FilteredUserDiagnostics, and porytiles::StderrStyledUserDiagnostics.
|
inline |
Variadic template overload for formatted error messages.
Enables inline formatting of error messages by accepting a format string and variadic FormatParam arguments. The format string uses fmtlib-style {} placeholders.
Example:
| FirstParam | Type of the first format parameter |
| RestParams | Types of remaining format parameters |
| tag | Categorization tag for the error |
| format_str | Format string with {} placeholders |
| first | First parameter to substitute |
| rest | Remaining parameters to substitute |
Definition at line 196 of file user_diagnostics.hpp.
|
inline |
Convenience overload for single line messages.
Definition at line 167 of file user_diagnostics.hpp.
|
pure virtual |
Display a tagged error message.
Errors indicate serious issues that require attention but don't necessarily cause immediate failure of the current operation. They include a categorization tag to help users understand and/or filter the type of error being reported.
Implementations typically format the first line with an "error:" prefix and subsequent lines with appropriate indentation.
| tag | Categorization tag for the error |
| lines | Vector of strings representing each line of the error |
Implemented in porytiles::NullUserDiagnostics, porytiles::BufferedUserDiagnostics, porytiles::FilteredUserDiagnostics, and porytiles::StderrStyledUserDiagnostics.
|
inline |
Variadic template overload for formatted error note messages.
Enables inline formatting of error note messages by accepting a format string and variadic FormatParam arguments. The format string uses fmtlib-style {} placeholders.
Example:
| FirstParam | Type of the first format parameter |
| RestParams | Types of remaining format parameters |
| tag | Categorization tag for the note (should match the parent error's tag) |
| format_str | Format string with {} placeholders |
| first | First parameter to substitute |
| rest | Remaining parameters to substitute |
Definition at line 360 of file user_diagnostics.hpp.
|
inline |
Convenience overload for single line messages.
Definition at line 330 of file user_diagnostics.hpp.
|
pure virtual |
Display a tagged note message associated with an error.
Notes are informational messages that further clarify a parent diagnostic. This method is specifically for notes that follow an error diagnostic, enabling proper filtering - when an error is filtered out, its associated notes can also be suppressed.
Implementations typically format the first line with a "note:" prefix and subsequent lines with appropriate indentation. All note types use identical styling regardless of parent diagnostic type.
| tag | Categorization tag for the note (should match the parent error's tag) |
| lines | Vector of strings representing each line of the message |
Implemented in porytiles::NullUserDiagnostics, porytiles::BufferedUserDiagnostics, porytiles::FilteredUserDiagnostics, and porytiles::StderrStyledUserDiagnostics.
|
inline |
Display a fatal error with complete error chain visualization.
Processes a ChainableResult error chain to display a hierarchical view of all errors that led to the fatal condition. The error chain is displayed in order from proximate (immediate) cause to root cause, creating a tree-like structure that helps users understand the failure path.
The method handles three types of errors in the chain:
| T | The success value type of the ChainableResult |
| E | The error type of the ChainableResult |
| result | The failed ChainableResult containing the error chain |
Definition at line 421 of file user_diagnostics.hpp.
|
inline |
Definition at line 460 of file user_diagnostics.hpp.
|
inline |
Variadic template overload for formatted remark messages.
Enables inline formatting of remark messages by accepting a format string and variadic FormatParam arguments. The format string uses fmtlib-style {} placeholders.
Example:
| FirstParam | Type of the first format parameter |
| RestParams | Types of remaining format parameters |
| tag | Categorization tag for the remark |
| format_str | Format string with {} placeholders |
| first | First parameter to substitute |
| rest | Remaining parameters to substitute |
Definition at line 90 of file user_diagnostics.hpp.
|
inline |
Convenience overload for single line messages.
Definition at line 61 of file user_diagnostics.hpp.
|
pure virtual |
Display a tagged remark message.
Remarks are the lowest severity diagnostic level, used for communicating internal compiler mechanisms or decisions that may be of interest to users. Unlike notes (which clarify other remarks/warnings/errors), remarks are standalone informational messages about compiler behavior such as optimization decisions, tile assignment choices, or palette allocation strategies.
Implementations typically format the first line with a "remark:" prefix and the tag, with subsequent lines appropriately indented.
| tag | Categorization tag for the remark |
| lines | Vector of strings representing each line of the message |
Implemented in porytiles::NullUserDiagnostics, porytiles::BufferedUserDiagnostics, porytiles::FilteredUserDiagnostics, and porytiles::StderrStyledUserDiagnostics.
|
inline |
Variadic template overload for formatted remark note messages.
Enables inline formatting of remark note messages by accepting a format string and variadic FormatParam arguments. The format string uses fmtlib-style {} placeholders.
Example:
| FirstParam | Type of the first format parameter |
| RestParams | Types of remaining format parameters |
| tag | Categorization tag for the note (should match the parent remark's tag) |
| format_str | Format string with {} placeholders |
| first | First parameter to substitute |
| rest | Remaining parameters to substitute |
Definition at line 250 of file user_diagnostics.hpp.
|
inline |
Convenience overload for single line messages.
Definition at line 220 of file user_diagnostics.hpp.
|
pure virtual |
Display a tagged note message associated with a remark.
Notes are informational messages that further clarify a parent diagnostic. This method is specifically for notes that follow a remark diagnostic, enabling proper filtering - when a remark is filtered out, its associated notes can also be suppressed.
Implementations typically format the first line with a "note:" prefix and subsequent lines with appropriate indentation. All note types use identical styling regardless of parent diagnostic type.
| tag | Categorization tag for the note (should match the parent remark's tag) |
| lines | Vector of strings representing each line of the message |
Implemented in porytiles::NullUserDiagnostics, porytiles::BufferedUserDiagnostics, porytiles::FilteredUserDiagnostics, and porytiles::StderrStyledUserDiagnostics.
|
inline |
Variadic template overload for formatted warning messages.
Enables inline formatting of warning messages by accepting a format string and variadic FormatParam arguments. The format string uses fmtlib-style {} placeholders.
Example:
| FirstParam | Type of the first format parameter |
| RestParams | Types of remaining format parameters |
| tag | Categorization tag for the warning |
| format_str | Format string with {} placeholders |
| first | First parameter to substitute |
| rest | Remaining parameters to substitute |
Definition at line 142 of file user_diagnostics.hpp.
|
inline |
Convenience overload for single line messages.
Definition at line 113 of file user_diagnostics.hpp.
|
pure virtual |
Display a tagged warning message.
Warnings indicate non-fatal issues that users should be aware of. They include a categorization tag to help users understand and/or filter the type of warning being reported.
Implementations typically format the first line with a "warning:" prefix and the tag, with subsequent lines appropriately indented.
| tag | Categorization tag for the warning |
| lines | Vector of strings representing each line of the warning |
Implemented in porytiles::NullUserDiagnostics, porytiles::BufferedUserDiagnostics, porytiles::FilteredUserDiagnostics, and porytiles::StderrStyledUserDiagnostics.
|
inline |
Variadic template overload for formatted warning note messages.
Enables inline formatting of warning note messages by accepting a format string and variadic FormatParam arguments. The format string uses fmtlib-style {} placeholders.
Example:
| FirstParam | Type of the first format parameter |
| RestParams | Types of remaining format parameters |
| tag | Categorization tag for the note (should match the parent warning's tag) |
| format_str | Format string with {} placeholders |
| first | First parameter to substitute |
| rest | Remaining parameters to substitute |
Definition at line 305 of file user_diagnostics.hpp.
|
inline |
Convenience overload for single line messages.
Definition at line 275 of file user_diagnostics.hpp.
|
pure virtual |
Display a tagged note message associated with a warning.
Notes are informational messages that further clarify a parent diagnostic. This method is specifically for notes that follow a warning diagnostic, enabling proper filtering - when a warning is filtered out, its associated notes can also be suppressed.
Implementations typically format the first line with a "note:" prefix and subsequent lines with appropriate indentation. All note types use identical styling regardless of parent diagnostic type.
| tag | Categorization tag for the note (should match the parent warning's tag) |
| lines | Vector of strings representing each line of the message |
Implemented in porytiles::NullUserDiagnostics, porytiles::BufferedUserDiagnostics, porytiles::FilteredUserDiagnostics, and porytiles::StderrStyledUserDiagnostics.