Porytiles
Loading...
Searching...
No Matches
porytiles::FilteredUserDiagnostics Class Referencefinal

Decorator that applies tag-based filtering to any UserDiagnostics implementation. More...

#include <filtered_user_diagnostics.hpp>

Inheritance diagram for porytiles::FilteredUserDiagnostics:
[legend]
Collaboration diagram for porytiles::FilteredUserDiagnostics:
[legend]

Public Member Functions

 FilteredUserDiagnostics (gsl::not_null< const TextFormatter * > format, gsl::not_null< const UserDiagnostics * > inner, DiagnosticTagFilter warning_filter, DiagnosticTagFilter remark_filter)
 Constructs a FilteredUserDiagnostics decorator.
 
void remark (const std::string &tag, const std::vector< std::string > &lines) const override
 Display a tagged remark message.
 
void remark_note (const std::string &tag, const std::vector< std::string > &lines) const override
 Display a tagged note message associated with a remark.
 
void warning (const std::string &tag, const std::vector< std::string > &lines) const override
 Display a tagged warning message.
 
void warning_note (const std::string &tag, const std::vector< std::string > &lines) const override
 Display a tagged note message associated with a warning.
 
void error (const std::string &tag, const std::vector< std::string > &lines) const override
 Display a tagged error message.
 
void error_note (const std::string &tag, const std::vector< std::string > &lines) const override
 Display a tagged note message associated with an error.
 
void emit_fatal_proximate (const Error &err) const override
 Emit the proximate (immediate) error in a fatal error chain.
 
void emit_fatal_step (const Error &err) const override
 Emit an intermediate step error in a fatal error chain.
 
void emit_fatal_root (const Error &err) const override
 Emit the root cause error in a fatal error chain.
 
- Public Member Functions inherited from porytiles::UserDiagnostics
virtual ~UserDiagnostics ()=default
 
 UserDiagnostics (gsl::not_null< const TextFormatter * > format)
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
template<typename T , typename E >
void fatal (const ChainableResult< T, E > &result) const
 Display a fatal error with complete error chain visualization.
 
const TextFormatterformatter () const
 

Detailed Description

Decorator that applies tag-based filtering to any UserDiagnostics implementation.

FilteredUserDiagnostics wraps an inner UserDiagnostics and applies DiagnosticTagFilter-based filtering to warnings and remarks. Errors and fatal diagnostics always pass through unfiltered, since they represent conditions that require user attention regardless of filter settings.

When a warning or remark is filtered out, its associated notes are also suppressed.

Definition at line 25 of file filtered_user_diagnostics.hpp.

Constructor & Destructor Documentation

◆ FilteredUserDiagnostics()

porytiles::FilteredUserDiagnostics::FilteredUserDiagnostics ( gsl::not_null< const TextFormatter * >  format,
gsl::not_null< const UserDiagnostics * >  inner,
DiagnosticTagFilter  warning_filter,
DiagnosticTagFilter  remark_filter 
)

Constructs a FilteredUserDiagnostics decorator.

Parameters
formatThe text formatter (passed to base class)
innerThe inner UserDiagnostics to delegate to after filtering
warning_filterFilter to apply to warning diagnostics
remark_filterFilter to apply to remark diagnostics
Precondition
inner must outlive the FilteredUserDiagnostics instance.

Definition at line 5 of file filtered_user_diagnostics.cpp.

Member Function Documentation

◆ emit_fatal_proximate()

void porytiles::FilteredUserDiagnostics::emit_fatal_proximate ( const Error err) const
overridevirtual

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.

Parameters
errThe proximate error to display

Implements porytiles::UserDiagnostics.

Definition at line 53 of file filtered_user_diagnostics.cpp.

◆ emit_fatal_root()

void porytiles::FilteredUserDiagnostics::emit_fatal_root ( const Error err) const
overridevirtual

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.

Parameters
errThe root cause error to display

Implements porytiles::UserDiagnostics.

Definition at line 63 of file filtered_user_diagnostics.cpp.

◆ emit_fatal_step()

void porytiles::FilteredUserDiagnostics::emit_fatal_step ( const Error err) const
overridevirtual

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.

Parameters
errThe step error to display

Implements porytiles::UserDiagnostics.

Definition at line 58 of file filtered_user_diagnostics.cpp.

◆ error()

void porytiles::FilteredUserDiagnostics::error ( const std::string &  tag,
const std::vector< std::string > &  lines 
) const
overridevirtual

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.

Parameters
tagCategorization tag for the error
linesVector of strings representing each line of the error

Implements porytiles::UserDiagnostics.

Definition at line 43 of file filtered_user_diagnostics.cpp.

◆ error_note()

void porytiles::FilteredUserDiagnostics::error_note ( const std::string &  tag,
const std::vector< std::string > &  lines 
) const
overridevirtual

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.

Parameters
tagCategorization tag for the note (should match the parent error's tag)
linesVector of strings representing each line of the message

Implements porytiles::UserDiagnostics.

Definition at line 48 of file filtered_user_diagnostics.cpp.

◆ remark()

void porytiles::FilteredUserDiagnostics::remark ( const std::string &  tag,
const std::vector< std::string > &  lines 
) const
overridevirtual

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.

Parameters
tagCategorization tag for the remark
linesVector of strings representing each line of the message

Implements porytiles::UserDiagnostics.

Definition at line 15 of file filtered_user_diagnostics.cpp.

◆ remark_note()

void porytiles::FilteredUserDiagnostics::remark_note ( const std::string &  tag,
const std::vector< std::string > &  lines 
) const
overridevirtual

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.

Parameters
tagCategorization tag for the note (should match the parent remark's tag)
linesVector of strings representing each line of the message

Implements porytiles::UserDiagnostics.

Definition at line 22 of file filtered_user_diagnostics.cpp.

◆ warning()

void porytiles::FilteredUserDiagnostics::warning ( const std::string &  tag,
const std::vector< std::string > &  lines 
) const
overridevirtual

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.

Parameters
tagCategorization tag for the warning
linesVector of strings representing each line of the warning

Implements porytiles::UserDiagnostics.

Definition at line 29 of file filtered_user_diagnostics.cpp.

◆ warning_note()

void porytiles::FilteredUserDiagnostics::warning_note ( const std::string &  tag,
const std::vector< std::string > &  lines 
) const
overridevirtual

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.

Parameters
tagCategorization tag for the note (should match the parent warning's tag)
linesVector of strings representing each line of the message

Implements porytiles::UserDiagnostics.

Definition at line 36 of file filtered_user_diagnostics.cpp.


The documentation for this class was generated from the following files: