rapidyaml  0.12.0
parse and emit YAML, and do it fast
ScopedErrorHandlerExample Struct Reference

Shows how to create a scoped error handler. More...

Inheritance diagram for ScopedErrorHandlerExample:
ErrorHandlerExample

Public Member Functions

 ScopedErrorHandlerExample ()
 
 ~ScopedErrorHandlerExample ()
 
template<class Fn >
bool check_error_occurs (Fn &&fn)
 checking that an error occurs while calling fn More...
 
template<class Fn >
bool check_assertion_occurs (Fn &&fn)
 checking that an assertion occurs while calling fn. More...
 
void check_enabled () const
 test that this handler is currently set More...
 
void check_disabled () const
 test that this handler is currently not set More...
 
ryml::Callbacks callbacks ()
 a helper to create the Callbacks object for the custom error handler More...
 
void on_error_basic (ryml::csubstr msg, ryml::ErrorDataBasic const &errdata)
 this is where the callback implementation goes. More...
 
void on_error_parse (ryml::csubstr msg, ryml::ErrorDataParse const &errdata)
 this is where the callback implementation goes. More...
 
void on_error_visit (ryml::csubstr msg, ryml::ErrorDataVisit const &errdata)
 this is where the callback implementation goes. More...
 

Static Public Member Functions

static void s_error_basic (ryml::csubstr msg, ryml::ErrorDataBasic const &errdata, void *this_)
 trampoline function to call the object's method More...
 
static void s_error_parse (ryml::csubstr msg, ryml::ErrorDataParse const &errdata, void *this_)
 trampoline function to call the object's method More...
 
static void s_error_visit (ryml::csubstr msg, ryml::ErrorDataVisit const &errdata, void *this_)
 trampoline function to call the object's method More...
 

Public Attributes

ryml::Callbacks original_callbacks
 
std::string saved_msg_short
 
std::string saved_msg_full
 
std::string saved_msg_full_with_context
 
ryml::Location saved_basic_loc
 
ryml::Location saved_parse_loc
 
ryml::Tree const * saved_visit_tree
 
ryml::id_type saved_visit_id
 

Detailed Description

Shows how to create a scoped error handler.

Definition at line 262 of file quickstart.cpp.

Constructor & Destructor Documentation

◆ ScopedErrorHandlerExample()

ScopedErrorHandlerExample::ScopedErrorHandlerExample ( )
inline

Definition at line 264 of file quickstart.cpp.

265  {
267  check_enabled();
268  }
void set_callbacks(Callbacks const &c)
set the global callbacks for the library; after a call to this function, these callbacks will be used...
Definition: common.cpp:89
ryml::Callbacks callbacks()
a helper to create the Callbacks object for the custom error handler
void check_enabled() const
test that this handler is currently set

References ErrorHandlerExample::callbacks(), ErrorHandlerExample::check_enabled(), and c4::yml::set_callbacks().

◆ ~ScopedErrorHandlerExample()

ScopedErrorHandlerExample::~ScopedErrorHandlerExample ( )
inline

Definition at line 269 of file quickstart.cpp.

270  {
272  check_disabled();
273  }
void check_disabled() const
test that this handler is currently not set
ryml::Callbacks original_callbacks
Definition: quickstart.cpp:228

References ErrorHandlerExample::check_disabled(), ErrorHandlerExample::original_callbacks, and c4::yml::set_callbacks().

Member Data Documentation

◆ original_callbacks

ryml::Callbacks ErrorHandlerExample::original_callbacks
inherited

Definition at line 228 of file quickstart.cpp.

◆ saved_msg_short

std::string ErrorHandlerExample::saved_msg_short
inherited

Definition at line 250 of file quickstart.cpp.

◆ saved_msg_full

std::string ErrorHandlerExample::saved_msg_full
inherited

Definition at line 251 of file quickstart.cpp.

◆ saved_msg_full_with_context

std::string ErrorHandlerExample::saved_msg_full_with_context
inherited

Definition at line 252 of file quickstart.cpp.

◆ saved_basic_loc

ryml::Location ErrorHandlerExample::saved_basic_loc
inherited

Definition at line 253 of file quickstart.cpp.

◆ saved_parse_loc

ryml::Location ErrorHandlerExample::saved_parse_loc
inherited

Definition at line 254 of file quickstart.cpp.

◆ saved_visit_tree

ryml::Tree const* ErrorHandlerExample::saved_visit_tree
inherited

Definition at line 255 of file quickstart.cpp.

◆ saved_visit_id

ryml::id_type ErrorHandlerExample::saved_visit_id
inherited

Definition at line 256 of file quickstart.cpp.


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