1 | // file : xsd/cxx/parser/validating/exceptions.hxx |
---|
2 | // author : Boris Kolpackov <boris@codesynthesis.com> |
---|
3 | // copyright : Copyright (c) 2005-2008 Code Synthesis Tools CC |
---|
4 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file |
---|
5 | |
---|
6 | #ifndef XSD_CXX_PARSER_VALIDATING_EXCEPTIONS_HXX |
---|
7 | #define XSD_CXX_PARSER_VALIDATING_EXCEPTIONS_HXX |
---|
8 | |
---|
9 | #include <string> |
---|
10 | |
---|
11 | #include <xsd/cxx/parser/schema-exceptions.hxx> |
---|
12 | #include <xsd/cxx/ro-string.hxx> |
---|
13 | |
---|
14 | namespace xsd |
---|
15 | { |
---|
16 | namespace cxx |
---|
17 | { |
---|
18 | namespace parser |
---|
19 | { |
---|
20 | namespace validating |
---|
21 | { |
---|
22 | // |
---|
23 | // |
---|
24 | template <typename C> |
---|
25 | struct expected_attribute: schema_exception<C> |
---|
26 | { |
---|
27 | virtual |
---|
28 | ~expected_attribute (); |
---|
29 | |
---|
30 | expected_attribute (const std::basic_string<C>& expected_namespace, |
---|
31 | const std::basic_string<C>& expected_name); |
---|
32 | |
---|
33 | const std::basic_string<C>& |
---|
34 | expected_namespace () const |
---|
35 | { |
---|
36 | return expected_namespace_; |
---|
37 | } |
---|
38 | |
---|
39 | const std::basic_string<C>& |
---|
40 | expected_name () const |
---|
41 | { |
---|
42 | return expected_name_; |
---|
43 | } |
---|
44 | |
---|
45 | virtual std::basic_string<C> |
---|
46 | message () const; |
---|
47 | |
---|
48 | private: |
---|
49 | std::basic_string<C> expected_namespace_; |
---|
50 | std::basic_string<C> expected_name_; |
---|
51 | }; |
---|
52 | |
---|
53 | // |
---|
54 | // |
---|
55 | template <typename C> |
---|
56 | struct unexpected_attribute: schema_exception<C> |
---|
57 | { |
---|
58 | virtual |
---|
59 | ~unexpected_attribute (); |
---|
60 | |
---|
61 | unexpected_attribute ( |
---|
62 | const std::basic_string<C>& encountered_namespace, |
---|
63 | const std::basic_string<C>& encountered_name); |
---|
64 | |
---|
65 | |
---|
66 | const std::basic_string<C>& |
---|
67 | encountered_namespace () const |
---|
68 | { |
---|
69 | return encountered_namespace_; |
---|
70 | } |
---|
71 | |
---|
72 | const std::basic_string<C>& |
---|
73 | encountered_name () const |
---|
74 | { |
---|
75 | return encountered_name_; |
---|
76 | } |
---|
77 | |
---|
78 | virtual std::basic_string<C> |
---|
79 | message () const; |
---|
80 | |
---|
81 | private: |
---|
82 | std::basic_string<C> encountered_namespace_; |
---|
83 | std::basic_string<C> encountered_name_; |
---|
84 | }; |
---|
85 | |
---|
86 | |
---|
87 | // |
---|
88 | // |
---|
89 | template <typename C> |
---|
90 | struct unexpected_characters: schema_exception<C> |
---|
91 | { |
---|
92 | virtual |
---|
93 | ~unexpected_characters (); |
---|
94 | |
---|
95 | unexpected_characters (const std::basic_string<C>& s); |
---|
96 | |
---|
97 | const std::basic_string<C>& |
---|
98 | characters () const |
---|
99 | { |
---|
100 | return characters_; |
---|
101 | } |
---|
102 | |
---|
103 | virtual std::basic_string<C> |
---|
104 | message () const; |
---|
105 | |
---|
106 | private: |
---|
107 | std::basic_string<C> characters_; |
---|
108 | }; |
---|
109 | |
---|
110 | // |
---|
111 | // |
---|
112 | template <typename C> |
---|
113 | struct invalid_value: schema_exception<C> |
---|
114 | { |
---|
115 | virtual |
---|
116 | ~invalid_value (); |
---|
117 | |
---|
118 | invalid_value (const C* type, const std::basic_string<C>& value); |
---|
119 | |
---|
120 | invalid_value (const C* type, const ro_string<C>& value); |
---|
121 | |
---|
122 | invalid_value (const std::basic_string<C>& type, |
---|
123 | const std::basic_string<C>& value); |
---|
124 | |
---|
125 | const std::basic_string<C>& |
---|
126 | type () const |
---|
127 | { |
---|
128 | return type_; |
---|
129 | } |
---|
130 | |
---|
131 | const std::basic_string<C>& |
---|
132 | value () const |
---|
133 | { |
---|
134 | return value_; |
---|
135 | } |
---|
136 | |
---|
137 | virtual std::basic_string<C> |
---|
138 | message () const; |
---|
139 | |
---|
140 | private: |
---|
141 | std::basic_string<C> type_; |
---|
142 | std::basic_string<C> value_; |
---|
143 | }; |
---|
144 | } |
---|
145 | } |
---|
146 | } |
---|
147 | } |
---|
148 | |
---|
149 | #include <xsd/cxx/parser/validating/exceptions.txx> |
---|
150 | |
---|
151 | #endif // XSD_CXX_PARSER_VALIDATING_EXCEPTIONS_HXX |
---|
152 | |
---|
153 | #include <xsd/cxx/parser/validating/exceptions.ixx> |
---|