|
Pretty Diagnostics
Create your own pretty diagnostics
|
Represents a fully constructed diagnostic report to be rendered. More...
#include <report.hpp>
Data Structures | |
| class | Builder |
Fluent builder for constructing Report instances. More... | |
Public Types | |
| using | MappedFileGroups = std::unordered_map< std::shared_ptr< Source >, FileGroup > |
Public Member Functions | |
| Report (std::string message, std::optional< std::string > code, Severity severity, MappedFileGroups file_groups, std::optional< std::string > note, std::optional< std::string > help) | |
| Constructs a report. More... | |
| void | render (IReporterRenderer &renderer, std::ostream &stream=std::cout) const |
| Renders the report using the provided renderer to the output stream. More... | |
| const MappedFileGroups & | file_groups () const |
| Returns the mapping of sources to file groups. More... | |
| MappedFileGroups & | file_groups () |
| Returns the mapping of sources to file groups. More... | |
| Severity | severity () const |
| Returns the severity of this report. More... | |
| const std::string & | message () const |
| Returns the primary diagnostic message. More... | |
| const std::optional< std::string > & | note () const |
| Returns an optional note with additional context. More... | |
| const std::optional< std::string > & | help () const |
| Returns optional help text with suggestions. More... | |
| const std::optional< std::string > & | code () const |
| Returns an optional error code or identifier. More... | |
Represents a fully constructed diagnostic report to be rendered.
| using pretty_diagnostics::Report::MappedFileGroups = std::unordered_map<std::shared_ptr<Source>, FileGroup> |
| pretty_diagnostics::Report::Report | ( | std::string | message, |
| std::optional< std::string > | code, | ||
| Severity | severity, | ||
| MappedFileGroups | file_groups, | ||
| std::optional< std::string > | note, | ||
| std::optional< std::string > | help | ||
| ) |
Constructs a report.
| message | Primary diagnostic message |
| code | Optional error code or identifier |
| severity | Diagnostic severity |
| file_groups | Mapping from sources to their file group |
| note | Optional note for additional context |
| help | Optional help text with suggestions |
|
inline |
Returns an optional error code or identifier.
|
inline |
Returns the mapping of sources to file groups.
|
inline |
Returns the mapping of sources to file groups.
|
inline |
Returns optional help text with suggestions.
|
inline |
Returns the primary diagnostic message.
|
inline |
Returns an optional note with additional context.
| void pretty_diagnostics::Report::render | ( | IReporterRenderer & | renderer, |
| std::ostream & | stream = std::cout |
||
| ) | const |
Renders the report using the provided renderer to the output stream.
| renderer | Renderer implementation |
| stream | Output stream to write to (defaults to std::cout) |
|
inline |
Returns the severity of this report.