|
rapidyaml
0.13.0
parse and emit YAML, and do it fast
|
Utilities to report handle errors, and to build and report error messages. More...
Classes | |
| struct | c4::yml::Location |
| holds a source or yaml file position, for example when an error is detected; See also location_format() and location_format_with_context(). More... | |
| struct | c4::yml::ErrorDataBasic |
| Data for a basic error. More... | |
| struct | c4::yml::ErrorDataParse |
| Data for a parse error. More... | |
| struct | c4::yml::ErrorDataVisit |
| Data for a visit error. More... | |
| struct | c4::yml::ExceptionBasic |
| Exception thrown by the default basic error implementation. More... | |
| struct | c4::yml::ExceptionParse |
| Exception thrown by the default parse error implementation. More... | |
| struct | c4::yml::ExceptionVisit |
| Exception thrown by the default visit error implementation. More... | |
Functions | |
| template<class DumpFn > | |
| size_t | c4::yml::location_format (DumpFn &&dumpfn, Location const &loc) |
| generic formatting of a location More... | |
| template<class DumpFn > | |
| void | c4::yml::location_format_with_context (DumpFn &&dumpfn, Location const &location, csubstr source_buffer, csubstr call="", size_t num_lines_before=3, size_t num_lines_after=0, size_t first_col_highlight=0, size_t last_col_highlight=0, size_t maxlen=80u) |
| Generic formatting of a location, printing the source code buffer region around the location. More... | |
| template<class DumpFn > | |
| void | c4::yml::err_basic_format (DumpFn &&dumpfn, csubstr msg, ErrorDataBasic const &errdata) |
| Given an error message and associated basic error data, format it fully as a basic error message. More... | |
| void | c4::yml::err_basic (Callbacks const &callbacks, ErrorDataBasic const &errdata, const char *msg_) |
| trigger a basic error to its respective handler, with a non-formatted error message. More... | |
| void | c4::yml::err_basic (ErrorDataBasic const &errdata, const char *msg) |
| trigger a basic error to its respective handler, with a non-formatted error message. More... | |
| template<class ... Args> | |
| void | c4::yml::err_basic (Callbacks const &callbacks, ErrorDataBasic const &errdata, const char *fmt, Args const &...args) |
| trigger a basic error to its respective handler, with a formatted error message. More... | |
| template<class ... Args> | |
| void | c4::yml::err_basic (ErrorDataBasic const &errdata, const char *fmt, Args const &...args) |
| trigger a basic error to its respective handler, with a formatted error message. More... | |
| template<class DumpFn > | |
| void | c4::yml::err_parse_format (DumpFn &&dumpfn, csubstr msg, ErrorDataParse const &errdata) |
| Given an error message and associated parse error data, format it fully as a parse error message. More... | |
| void | c4::yml::err_parse (Callbacks const &callbacks, ErrorDataParse const &errdata, const char *msg) |
| trigger a parse error to its respective handler, with a non-formatted error message More... | |
| void | c4::yml::err_parse (ErrorDataParse const &errdata, const char *msg) |
| trigger a parse error to its respective handler, with a non-formatted error message. More... | |
| template<class ... Args> | |
| void | c4::yml::err_parse (Callbacks const &callbacks, ErrorDataParse const &errdata, const char *fmt, Args const &...args) |
| trigger a parse error to its respective handler, with a formatted error message More... | |
| template<class ... Args> | |
| void | c4::yml::err_parse (ErrorDataParse const &errdata, const char *fmt, Args const &...args) |
| trigger a parse error to its respective handler, with a formatted error message. More... | |
| template<class DumpFn > | |
| void | c4::yml::err_visit_format (DumpFn &&dumpfn, csubstr msg, ErrorDataVisit const &errdata) |
| Given an error message and associated visit error data, format it fully as a visit error message. More... | |
| void | c4::yml::err_visit (Callbacks const &callbacks, ErrorDataVisit const &errdata, const char *msg) |
| trigger a visit error to its respective handler, with a non-formatted error message More... | |
| void | c4::yml::err_visit (ErrorDataVisit const &errdata, const char *msg) |
| trigger a visit error to its respective handler, with a non-formatted error message. More... | |
| template<class ... Args> | |
| void | c4::yml::err_visit (Callbacks const &callbacks, ErrorDataVisit const &errdata, const char *fmt, Args const &...args) |
| trigger a visit error to its respective handler, with a formatted error message More... | |
| template<class ... Args> | |
| void | c4::yml::err_visit (ErrorDataVisit const &errdata, const char *fmt, Args const &...args) |
| trigger a visit error to its respective handler, with a formatted error message. More... | |
| template<class CharContainer > | |
| void | c4::yml::format_exc (CharContainer *out, ExceptionBasic const &exc) |
| Format a basic exception to an existing char container. More... | |
| template<class CharContainer > | |
| void | c4::yml::format_exc (CharContainer *out, ExceptionParse const &exc) |
| Format a parse exception to an existing char container. More... | |
| template<class CharContainer > | |
| void | c4::yml::format_exc (CharContainer *out, ExceptionVisit const &exc) |
| Format a visit exception to an existing char container. More... | |
| template<class CharContainer , class ExceptionT > | |
| CharContainer | c4::yml::format_exc (ExceptionT const &exc) |
| Format a parse exception, and return a newly-created char container. More... | |
Utilities to report handle errors, and to build and report error messages.
| size_t c4::yml::location_format | ( | DumpFn && | dumpfn, |
| Location const & | loc | ||
| ) |
generic formatting of a location
| dumpfn | function taking a csubstr and abstracting a string concatenation operation, such as appending to a std::string or printing to terminal. |
| loc | the location to be formatted |
For example:
Definition at line 18 of file error.def.hpp.
| void c4::yml::location_format_with_context | ( | DumpFn && | dumpfn, |
| Location const & | location, | ||
| csubstr | source_buffer, | ||
| csubstr | call = "", |
||
| size_t | num_lines_before = 3, |
||
| size_t | num_lines_after = 0, |
||
| size_t | first_col_highlight = 0, |
||
| size_t | last_col_highlight = 0, |
||
| size_t | maxlen = 80u |
||
| ) |
Generic formatting of a location, printing the source code buffer region around the location.
| dumpfn | function taking a csubstr and abstracting a string concatenation operation, such as appending to a std::string or printing to terminal. |
| location | the location |
| source_buffer | the source buffer |
| call | a string with a call of attention to print in the message (see examples below) |
| num_lines_before | how many source buffer lines to print before the location line |
| num_lines_after | how many source buffer lines to print after the location line |
| first_col_highlight | the first column to highlight around the location line |
| last_col_highlight | the last column to highlight around the location line |
| maxlen | the maximum number of columns to show in the error message; source buffer lines will have at most this number of columns shown; if the line is longer than this, the line will be trimmed as needed at the end and/or beginning, and only the relevant columns around the location are shown |
For example:
will result in this string:
If an empty string is passed for the call of attention,
the returned string becomes:
Definition at line 86 of file error.def.hpp.
| void c4::yml::err_basic_format | ( | DumpFn && | dumpfn, |
| csubstr | msg, | ||
| ErrorDataBasic const & | errdata | ||
| ) |
Given an error message and associated basic error data, format it fully as a basic error message.
| dumpfn | function taking a csubstr and abstracting a string concatenation operation, such as appending to a std::string or printing to terminal. |
| msg | the error message |
| errdata | the error data |
For example:
Definition at line 318 of file error.def.hpp.
| void c4::yml::err_basic | ( | Callbacks const & | callbacks, |
| ErrorDataBasic const & | errdata, | ||
| const char * | msg_ | ||
| ) |
trigger a basic error to its respective handler, with a non-formatted error message.
Definition at line 201 of file common.cpp.
| void c4::yml::err_basic | ( | ErrorDataBasic const & | errdata, |
| const char * | msg | ||
| ) |
trigger a basic error to its respective handler, with a non-formatted error message.
Like (1), but use the current global callbacks.
Definition at line 196 of file common.cpp.
| void c4::yml::err_basic | ( | Callbacks const & | callbacks, |
| ErrorDataBasic const & | errdata, | ||
| const char * | fmt, | ||
| Args const &... | args | ||
| ) |
| void c4::yml::err_basic | ( | ErrorDataBasic const & | errdata, |
| const char * | fmt, | ||
| Args const &... | args | ||
| ) |
trigger a basic error to its respective handler, with a formatted error message.
Like (1), but use the current global callbacks.
Definition at line 338 of file error.hpp.
| void c4::yml::err_parse_format | ( | DumpFn && | dumpfn, |
| csubstr | msg, | ||
| ErrorDataParse const & | errdata | ||
| ) |
Given an error message and associated parse error data, format it fully as a parse error message.
| dumpfn | function taking a csubstr and abstracting a string concatenation operation, such as appending to a std::string or printing to terminal. |
| msg | the error message |
| errdata | the error data |
For example:
Definition at line 331 of file error.def.hpp.
| void c4::yml::err_parse | ( | Callbacks const & | callbacks, |
| ErrorDataParse const & | errdata, | ||
| const char * | msg_ | ||
| ) |
trigger a parse error to its respective handler, with a non-formatted error message
Definition at line 215 of file common.cpp.
| void c4::yml::err_parse | ( | ErrorDataParse const & | errdata, |
| const char * | msg | ||
| ) |
trigger a parse error to its respective handler, with a non-formatted error message.
Like (1), but use the current global callbacks.
Definition at line 210 of file common.cpp.
| void c4::yml::err_parse | ( | Callbacks const & | callbacks, |
| ErrorDataParse const & | errdata, | ||
| const char * | fmt, | ||
| Args const &... | args | ||
| ) |
trigger a parse error to its respective handler, with a formatted error message
| void c4::yml::err_parse | ( | ErrorDataParse const & | errdata, |
| const char * | fmt, | ||
| Args const &... | args | ||
| ) |
trigger a parse error to its respective handler, with a formatted error message.
Like (1), but use the current global callbacks.
Definition at line 397 of file error.hpp.
| void c4::yml::err_visit_format | ( | DumpFn && | dumpfn, |
| csubstr | msg, | ||
| ErrorDataVisit const & | errdata | ||
| ) |
Given an error message and associated visit error data, format it fully as a visit error message.
| dumpfn | function taking a csubstr and abstracting a string concatenation operation, such as appending to a std::string or printing to terminal. |
| msg | the error message |
| errdata | the error data |
For example:
Definition at line 350 of file error.def.hpp.
| void c4::yml::err_visit | ( | Callbacks const & | callbacks, |
| ErrorDataVisit const & | errdata, | ||
| const char * | msg_ | ||
| ) |
trigger a visit error to its respective handler, with a non-formatted error message
Definition at line 233 of file common.cpp.
| void c4::yml::err_visit | ( | ErrorDataVisit const & | errdata, |
| const char * | msg | ||
| ) |
trigger a visit error to its respective handler, with a non-formatted error message.
Like (1), but uses the current global callbacks.
Definition at line 228 of file common.cpp.
| void c4::yml::err_visit | ( | Callbacks const & | callbacks, |
| ErrorDataVisit const & | errdata, | ||
| const char * | fmt, | ||
| Args const &... | args | ||
| ) |
| void c4::yml::err_visit | ( | ErrorDataVisit const & | errdata, |
| const char * | fmt, | ||
| Args const &... | args | ||
| ) |
trigger a visit error to its respective handler, with a formatted error message.
Like (1), but use the current global callbacks.
Definition at line 459 of file error.hpp.
| void c4::yml::format_exc | ( | CharContainer * | out, |
| ExceptionBasic const & | exc | ||
| ) |
Format a basic exception to an existing char container.
Definition at line 526 of file error.hpp.
| void c4::yml::format_exc | ( | CharContainer * | out, |
| ExceptionParse const & | exc | ||
| ) |
Format a parse exception to an existing char container.
Definition at line 539 of file error.hpp.
| void c4::yml::format_exc | ( | CharContainer * | out, |
| ExceptionVisit const & | exc | ||
| ) |
Format a visit exception to an existing char container.
Definition at line 552 of file error.hpp.
| CharContainer c4::yml::format_exc | ( | ExceptionT const & | exc | ) |
Format a parse exception, and return a newly-created char container.
Definition at line 566 of file error.hpp.