|
Pretty Diagnostics
Create your own pretty diagnostics
|
Abstract interface for reading and mapping source text. More...
#include <source.hpp>
Public Member Functions | |
| virtual | ~Source ()=default |
| virtual Location | from_coords (size_t row, size_t column) const =0 |
| Returns a location corresponding to the given row and column. More... | |
| virtual Location | from_index (size_t index) const =0 |
| Returns a location for the given absolute character index. More... | |
| virtual std::string | substr (const Location &start, const Location &end) const =0 |
| Returns the substring between two locations. More... | |
| virtual std::string | line (const Location &location) const =0 |
| Returns the full line at the given location. More... | |
| virtual std::string | line (size_t line_number) const =0 |
| Returns the contents of the specified line number. More... | |
| virtual size_t | line_count () const =0 |
| Returns the total number of lines in the source. More... | |
| virtual std::string | contents () const =0 |
| Returns the entire contents of the source. More... | |
| virtual std::string | path () const =0 |
| Returns a displayable path or identifier of the source. More... | |
| virtual size_t | size () const =0 |
| Returns the total size (in characters) of the source. More... | |
Abstract interface for reading and mapping source text.
|
virtualdefault |
|
pure virtual |
Returns the entire contents of the source.
Implemented in pretty_diagnostics::FileSource.
|
pure virtual |
Returns a location corresponding to the given row and column.
| row | 0-based line number |
| column | 0-based column number |
Implemented in pretty_diagnostics::FileSource.
|
pure virtual |
Returns a location for the given absolute character index.
| index | 0-based absolute character index |
Implemented in pretty_diagnostics::FileSource.
|
pure virtual |
Returns the full line at the given location.
| location | A location within the desired line |
Implemented in pretty_diagnostics::FileSource.
|
pure virtual |
Returns the contents of the specified line number.
| line_number | 1-based line number |
Implemented in pretty_diagnostics::FileSource.
|
pure virtual |
Returns the total number of lines in the source.
Implemented in pretty_diagnostics::FileSource.
|
pure virtual |
Returns a displayable path or identifier of the source.
Implemented in pretty_diagnostics::FileSource.
|
pure virtual |
Returns the total size (in characters) of the source.
Implemented in pretty_diagnostics::FileSource.
|
pure virtual |
Returns the substring between two locations.
| start | Inclusive start location |
| end | Exclusive end location |
start and end Implemented in pretty_diagnostics::FileSource.