Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
Public Member Functions | Friends
TOML_PARSE_ERROR_BASE Class Reference

An error generated when parsing fails. More...

#include <parse_error.hpp>

Public Member Functions

TOML_NODISCARD_CTOR parse_error (std::string &&desc, source_region &&src) noexcept
 
TOML_NODISCARD_CTOR parse_error (std::string &&desc, const source_region &src) noexcept
 
TOML_NODISCARD_CTOR parse_error (std::string &&desc, const source_position &position, const source_path_ptr &path={}) noexcept
 
TOML_NODISCARD std::string_view description () const noexcept
 Returns a textual description of the error.
 
TOML_NODISCARD const source_region & source () const noexcept
 Returns the region of the source document responsible for the error.
 

Friends

std::ostream & operator<< (std::ostream &lhs, const parse_error &rhs)
 Prints a parse_error to a stream.
 

Detailed Description

An error generated when parsing fails.

Remarks
This class inherits from std::runtime_error when exceptions are enabled. The public interface is the same regardless of exception mode.

Definition at line 28 of file parse_error.hpp.

Member Function Documentation

◆ description()

TOML_NODISCARD std::string_view TOML_PARSE_ERROR_BASE::description ( ) const
inlinenoexcept

Returns a textual description of the error.

Remarks
The backing string is guaranteed to be null-terminated.

Definition at line 74 of file parse_error.hpp.

◆ parse_error() [1/3]

TOML_NODISCARD_CTOR TOML_PARSE_ERROR_BASE::parse_error ( std::string &&  desc,
const source_position &  position,
const source_path_ptr &  path = {} 
)
inlinenoexcept

Definition at line 65 of file parse_error.hpp.

◆ parse_error() [2/3]

TOML_NODISCARD_CTOR TOML_PARSE_ERROR_BASE::parse_error ( std::string &&  desc,
const source_region &  src 
)
inlinenoexcept

Definition at line 61 of file parse_error.hpp.

◆ parse_error() [3/3]

TOML_NODISCARD_CTOR TOML_PARSE_ERROR_BASE::parse_error ( std::string &&  desc,
source_region &&  src 
)
inlinenoexcept

Definition at line 57 of file parse_error.hpp.

◆ source()

TOML_NODISCARD const source_region & TOML_PARSE_ERROR_BASE::source ( ) const
inlinenoexcept

Returns the region of the source document responsible for the error.

Definition at line 84 of file parse_error.hpp.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  lhs,
const parse_error &  rhs 
)
friend

Prints a parse_error to a stream.

\detail \cpp try { auto tbl = toml::parse("enabled = trUe"sv); } catch (const toml::parse_error & err) { std::cerr << "Parsing failed:\n"sv << err << "\n"; } \ecpp

\out Parsing failed: Encountered unexpected character while parsing boolean; expected 'true', saw 'trU' (error occurred at line 1, column 13) \eout

Template Parameters
CharThe output stream's underlying character type. Must be 1 byte in size.
Parameters
lhsThe stream.
rhsThe parse_error.
Returns
The input stream.

Definition at line 110 of file parse_error.hpp.


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