summaryrefslogtreecommitdiff
path: root/libxsd/xsd/cxx/xml/dom/bits/error-handler-proxy.hxx
blob: 83e9a7e1f405d277f9db4b4976bf4eee4abfbf8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// file      : xsd/cxx/xml/dom/bits/error-handler-proxy.hxx
// author    : Boris Kolpackov <boris@codesynthesis.com>
// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file

#ifndef XSD_CXX_XML_DOM_BITS_ERROR_HANDLER_PROXY_HXX
#define XSD_CXX_XML_DOM_BITS_ERROR_HANDLER_PROXY_HXX

#include <xercesc/dom/DOMError.hpp>
#include <xercesc/dom/DOMLocator.hpp>
#include <xercesc/dom/DOMErrorHandler.hpp>

#include <xsd/cxx/xml/error-handler.hxx>

namespace xsd
{
  namespace cxx
  {
    namespace xml
    {
      namespace dom
      {
        namespace bits
        {
          template <typename C>
          class error_handler_proxy: public xercesc::DOMErrorHandler
          {
          public:
            error_handler_proxy (error_handler<C>& eh)
                : failed_ (false), eh_ (&eh), native_eh_ (0)
            {
            }

            error_handler_proxy (xercesc::DOMErrorHandler& eh)
              : failed_ (false), eh_ (0), native_eh_ (&eh)
            {
            }

            virtual bool
            handleError (const xercesc::DOMError& e);

            bool
            failed () const
            {
              return failed_;
            }

          private:
            bool failed_;
            error_handler<C>* eh_;
            xercesc::DOMErrorHandler* native_eh_;
          };
        }
      }
    }
  }
}

#include <xsd/cxx/xml/dom/bits/error-handler-proxy.txx>

#endif  // XSD_CXX_XML_DOM_BITS_ERROR_HANDLER_PROXY_HXX