aboutsummaryrefslogtreecommitdiff
path: root/libxsde/xsde/cxx/parser/exceptions.hxx
blob: f78f2233659d7df85f2558809f3432f76a9c37ae (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// file      : xsde/cxx/parser/exceptions.hxx
// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file

#ifndef XSDE_CXX_PARSER_EXCEPTIONS_HXX
#define XSDE_CXX_PARSER_EXCEPTIONS_HXX

#include <xsde/cxx/config.hxx>

#ifdef XSDE_IOSTREAM
#  include <iosfwd>
#endif

#include <xsde/cxx/exceptions.hxx> // xsde::cxx::exception

#ifdef XSDE_PARSER_VALIDATION
#  include <xsde/cxx/schema-error.hxx>
#endif

#include <xsde/cxx/parser/expat/xml-error.hxx>

namespace xsde
{
  namespace cxx
  {
    namespace parser
    {
      // exception
      //
      struct exception: xsde::cxx::exception
      {
        exception (unsigned long line, unsigned long column);

        unsigned long
        line () const;

        unsigned long
        column () const;

        virtual const char*
        text () const = 0;

      private:
        unsigned long line_;
        unsigned long column_;
      };

#ifdef XSDE_IOSTREAM
      std::ostream&
      operator<< (std::ostream&, const exception&);
#endif


      // xml
      //
      using expat::xml_error;

      struct xml: exception
      {
        xml (xml_error, unsigned long line, unsigned long column);

        xml_error
        code () const;

        virtual const char*
        text () const;

        virtual const char*
        what () const throw ();

      private:
        xml_error code_;
      };


      // schema
      //
#ifdef XSDE_PARSER_VALIDATION
      struct schema: exception
      {
        schema (schema_error, unsigned long line, unsigned long column);

        schema_error
        code () const;

        virtual const char*
        text () const;

        virtual const char*
        what () const throw ();

      private:
        schema_error code_;
      };
#endif
    }
  }
}

#include <xsde/cxx/parser/exceptions.ixx>

#endif  // XSDE_CXX_PARSER_EXCEPTIONS_HXX