| Home | Libraries | People | FAQ | More

## Struct callback_error_handler

boost::parser::callback_error_handler

## Synopsis

    // In header: <boost/parser/error_handling.hpp>

    struct callback_error_handler {
      // types
      typedef std::function< void(std::string const &)> callback_type;

      // public member functions
      callback_error_handler();
      callback_error_handler(callback_type, callback_type = callback_type());
      callback_error_handler(std::string_view, callback_type,
                             callback_type = callback_type());
      callback_error_handler(std::wstring_view, callback_type,
                             callback_type = callback_type());
      template<typename Iter, typename Sentinel>
        error_handler_result
        operator()(Iter, Sentinel, parse_error< Iter > const &) const;
      template<typename Context, typename Iter>
        void diagnose(diagnostic_kind, std::string_view, Context const &, Iter) const;
      template<typename Context>
        void diagnose(diagnostic_kind, std::string_view, Context const &) const;

      // public data members
      callback_type error_;
      callback_type warning_;
      std::string filename_;
    };

## Description

An error handler that allows users to supply callbacks to handle the reporting of warnings and errors. The reporting of errors and/or warnings can be suppressed by supplying one or both default-constructed callbacks.

### `callback_error_handler` public member functions

1.     callback_error_handler();

2.     callback_error_handler(callback_type error,
                              callback_type warning = callback_type());

3.     callback_error_handler(std::string_view filename, callback_type error,
                              callback_type warning = callback_type());

4.     callback_error_handler(std::wstring_view filename, callback_type error,
                              callback_type warning = callback_type());

   This overload is Windows-only.

5.     template<typename Iter, typename Sentinel>
         error_handler_result
         operator()(Iter first, Sentinel last, parse_error< Iter > const & e) const;

6.     template<typename Context, typename Iter>
         void diagnose(diagnostic_kind kind, std::string_view message,
                       Context const & context, Iter it) const;

7.     template<typename Context>
         void diagnose(diagnostic_kind kind, std::string_view message,
                       Context const & context) const;