Pretty Diagnostics
Create your own pretty diagnostics
Loading...
Searching...
No Matches
pretty_diagnostics::Report::Builder Class Reference

Fluent builder for constructing Report instances. More...

#include <report.hpp>

Public Member Functions

Builderseverity (Severity severity)
 Sets report severity. More...
 
Buildermessage (std::string message)
 Sets the main diagnostic message. More...
 
Buildercode (std::string code)
 Sets an optional error code or identifier. More...
 
Builderlabel (std::string text, Span span)
 Adds a label to the report. More...
 
Buildernote (std::string note)
 Sets an optional note. More...
 
Builderhelp (std::string help)
 Sets optional help text. More...
 
Report build () const
 Builds a complete Report More...
 

Detailed Description

Fluent builder for constructing Report instances.

Member Function Documentation

◆ build()

Report pretty_diagnostics::Report::Builder::build ( ) const

Builds a complete Report

Returns
The constructed report
Exceptions
std::exceptionIf required fields are missing

◆ code()

Builder & pretty_diagnostics::Report::Builder::code ( std::string  code)

Sets an optional error code or identifier.

Parameters
codeError code or identifier
Returns
Reference to this builder

◆ help()

Builder & pretty_diagnostics::Report::Builder::help ( std::string  help)

Sets optional help text.

Parameters
helpHelp text
Returns
Reference to this builder

◆ label()

Builder & pretty_diagnostics::Report::Builder::label ( std::string  text,
Span  span 
)

Adds a label to the report.

Parameters
textLabel message
spanSource span the label refers to
Returns
Reference to this builder

◆ message()

Builder & pretty_diagnostics::Report::Builder::message ( std::string  message)

Sets the main diagnostic message.

Parameters
messageDiagnostic message text
Returns
Reference to this builder

◆ note()

Builder & pretty_diagnostics::Report::Builder::note ( std::string  note)

Sets an optional note.

Parameters
noteNote text
Returns
Reference to this builder

◆ severity()

Builder & pretty_diagnostics::Report::Builder::severity ( Severity  severity)

Sets report severity.

Parameters
severitySeverity to set
Returns
Reference to this builder

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