1 | // file : xsd/cxx/parser/validating/exceptions.ixx |
---|
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 | #if defined(XSD_CXX_PARSER_USE_CHAR) || !defined(XSD_CXX_PARSER_USE_WCHAR) |
---|
7 | |
---|
8 | #ifndef XSD_CXX_PARSER_VALIDATING_EXCEPTIONS_IXX_CHAR |
---|
9 | #define XSD_CXX_PARSER_VALIDATING_EXCEPTIONS_IXX_CHAR |
---|
10 | |
---|
11 | namespace xsd |
---|
12 | { |
---|
13 | namespace cxx |
---|
14 | { |
---|
15 | namespace parser |
---|
16 | { |
---|
17 | namespace validating |
---|
18 | { |
---|
19 | // expected_attribute |
---|
20 | // |
---|
21 | template<> |
---|
22 | inline |
---|
23 | std::basic_string<char> expected_attribute<char>:: |
---|
24 | message () const |
---|
25 | { |
---|
26 | std::basic_string<char> r ("expected attribute '"); |
---|
27 | r += expected_namespace_; |
---|
28 | r += expected_namespace_.empty () ? "" : "#"; |
---|
29 | r += expected_name_; |
---|
30 | r += "'"; |
---|
31 | return r; |
---|
32 | } |
---|
33 | |
---|
34 | // unexpected_attribute |
---|
35 | // |
---|
36 | template<> |
---|
37 | inline |
---|
38 | std::basic_string<char> unexpected_attribute<char>:: |
---|
39 | message () const |
---|
40 | { |
---|
41 | std::basic_string<char> r ("unexpected attribute '"); |
---|
42 | r += encountered_namespace_; |
---|
43 | r += encountered_namespace_.empty () ? "" : "#"; |
---|
44 | r += encountered_name_; |
---|
45 | r += "'"; |
---|
46 | return r; |
---|
47 | } |
---|
48 | |
---|
49 | // unexpected_characters |
---|
50 | // |
---|
51 | template<> |
---|
52 | inline |
---|
53 | std::basic_string<char> unexpected_characters<char>:: |
---|
54 | message () const |
---|
55 | { |
---|
56 | std::basic_string<char> r ("unexpected characters '"); |
---|
57 | r += characters_; |
---|
58 | r += "'"; |
---|
59 | return r; |
---|
60 | } |
---|
61 | |
---|
62 | // invalid_value |
---|
63 | // |
---|
64 | template<> |
---|
65 | inline |
---|
66 | std::basic_string<char> invalid_value<char>:: |
---|
67 | message () const |
---|
68 | { |
---|
69 | std::basic_string<char> r ("'"); |
---|
70 | r += value_; |
---|
71 | r += "' is not a valid value representation "; |
---|
72 | r += "for type '"; |
---|
73 | r += type_; |
---|
74 | r += "'"; |
---|
75 | return r; |
---|
76 | } |
---|
77 | } |
---|
78 | } |
---|
79 | } |
---|
80 | } |
---|
81 | |
---|
82 | #endif // XSD_CXX_PARSER_VALIDATING_EXCEPTIONS_IXX_CHAR |
---|
83 | #endif // XSD_CXX_PARSER_USE_CHAR |
---|
84 | |
---|
85 | |
---|
86 | #if defined(XSD_CXX_PARSER_USE_WCHAR) || !defined(XSD_CXX_PARSER_USE_CHAR) |
---|
87 | |
---|
88 | #ifndef XSD_CXX_PARSER_VALIDATING_EXCEPTIONS_IXX_WCHAR |
---|
89 | #define XSD_CXX_PARSER_VALIDATING_EXCEPTIONS_IXX_WCHAR |
---|
90 | |
---|
91 | namespace xsd |
---|
92 | { |
---|
93 | namespace cxx |
---|
94 | { |
---|
95 | namespace parser |
---|
96 | { |
---|
97 | namespace validating |
---|
98 | { |
---|
99 | // expected_attribute |
---|
100 | // |
---|
101 | template<> |
---|
102 | inline |
---|
103 | std::basic_string<wchar_t> expected_attribute<wchar_t>:: |
---|
104 | message () const |
---|
105 | { |
---|
106 | std::basic_string<wchar_t> r (L"expected attribute '"); |
---|
107 | r += expected_namespace_; |
---|
108 | r += expected_namespace_.empty () ? L"" : L"#"; |
---|
109 | r += expected_name_; |
---|
110 | r += L"'"; |
---|
111 | return r; |
---|
112 | } |
---|
113 | |
---|
114 | // unexpected_attribute |
---|
115 | // |
---|
116 | template<> |
---|
117 | inline |
---|
118 | std::basic_string<wchar_t> unexpected_attribute<wchar_t>:: |
---|
119 | message () const |
---|
120 | { |
---|
121 | std::basic_string<wchar_t> r (L"unexpected attribute '"); |
---|
122 | r += encountered_namespace_; |
---|
123 | r += encountered_namespace_.empty () ? L"" : L"#"; |
---|
124 | r += encountered_name_; |
---|
125 | r += L"'"; |
---|
126 | return r; |
---|
127 | } |
---|
128 | |
---|
129 | // unexpected_characters |
---|
130 | // |
---|
131 | template<> |
---|
132 | inline |
---|
133 | std::basic_string<wchar_t> unexpected_characters<wchar_t>:: |
---|
134 | message () const |
---|
135 | { |
---|
136 | std::basic_string<wchar_t> r (L"unexpected characters '"); |
---|
137 | r += characters_; |
---|
138 | r += L"'"; |
---|
139 | return r; |
---|
140 | } |
---|
141 | |
---|
142 | // invalid_value |
---|
143 | // |
---|
144 | template<> |
---|
145 | inline |
---|
146 | std::basic_string<wchar_t> invalid_value<wchar_t>:: |
---|
147 | message () const |
---|
148 | { |
---|
149 | std::basic_string<wchar_t> r (L"'"); |
---|
150 | r += value_; |
---|
151 | r += L"' is not a valid value representation "; |
---|
152 | r += L"for type '"; |
---|
153 | r += type_; |
---|
154 | r += L"'"; |
---|
155 | return r; |
---|
156 | } |
---|
157 | } |
---|
158 | } |
---|
159 | } |
---|
160 | } |
---|
161 | |
---|
162 | #endif // XSD_CXX_PARSER_VALIDATING_EXCEPTIONS_IXX_WCHAR |
---|
163 | #endif // XSD_CXX_PARSER_USE_WCHAR |
---|