// file      : xsd/cxx/xml/dom/error-handler.hxx
// author    : Boris Kolpackov <boris@codesynthesis.com>
// copyright : Copyright (c) 2005 Code Synthesis Tools CC
// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file

#ifndef XSD_CXX_XML_DOM_ERROR_HANDLER_HXX
#define XSD_CXX_XML_DOM_ERROR_HANDLER_HXX

#include <string>

namespace xsd
{
  namespace cxx
  {
    namespace xml
    {
      namespace dom
      {
        template <typename C>
        class error_handler
        {
        public:
          virtual
          ~error_handler ()
          {
          }

        public:

          // The fatal severity level results in termination
          // of the parsing process no matter what is returned
          // from handle.
          //
          struct severity
          {
            enum value
            {
              warning,
              error,
              fatal
            };

            severity (value v) : v_ (v) {}
            operator value () const { return v_; }

          private:
            value v_;
          };

          virtual bool
          handle (std::basic_string<C> const& id,
                  unsigned long line,
                  unsigned long column,
                  severity,
                  std::basic_string<C> const& message) = 0;
        };
      }
    }
  }
}

#endif  // XSD_CXX_XML_DOM_ERROR_HANDLER_HXX

