Line data Source code
1 : // file : xsd/cxx/xml/error-handler.hxx
2 : // copyright : Copyright (c) 2005-2017 Code Synthesis Tools CC
3 : // license : GNU GPL v2 + exceptions; see accompanying LICENSE file
4 :
5 : #ifndef XSD_CXX_XML_ERROR_HANDLER_HXX
6 : #define XSD_CXX_XML_ERROR_HANDLER_HXX
7 :
8 : #include <string>
9 :
10 : namespace xsd
11 : {
12 : namespace cxx
13 : {
14 : namespace xml
15 : {
16 : template <typename C>
17 : class error_handler
18 : {
19 : public:
20 : virtual
21 0 : ~error_handler ()
22 : {
23 0 : }
24 :
25 : public:
26 :
27 : // The fatal severity level results in termination
28 : // of the parsing process no matter what is returned
29 : // from handle.
30 : //
31 : struct severity
32 : {
33 : enum value
34 : {
35 : warning,
36 : error,
37 : fatal
38 : };
39 :
40 0 : severity (value v) : v_ (v) {}
41 0 : operator value () const { return v_; }
42 :
43 : private:
44 : value v_;
45 : };
46 :
47 : virtual bool
48 : handle (const std::basic_string<C>& id,
49 : unsigned long line,
50 : unsigned long column,
51 : severity,
52 : const std::basic_string<C>& message) = 0;
53 : };
54 : }
55 : }
56 : }
57 :
58 : #endif // XSD_CXX_XML_ERROR_HANDLER_HXX
|