[111] | 1 | // file : xsd/cxx/tree/exceptions.txx |
---|
| 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 | namespace xsd |
---|
| 7 | { |
---|
| 8 | namespace cxx |
---|
| 9 | { |
---|
| 10 | namespace tree |
---|
| 11 | { |
---|
| 12 | // error |
---|
| 13 | // |
---|
| 14 | template <typename C> |
---|
| 15 | error<C>:: |
---|
| 16 | error (tree::severity s, |
---|
| 17 | const std::basic_string<C>& id, |
---|
| 18 | unsigned long line, |
---|
| 19 | unsigned long column, |
---|
| 20 | const std::basic_string<C>& message) |
---|
| 21 | : severity_ (s), |
---|
| 22 | id_ (id), |
---|
| 23 | line_ (line), |
---|
| 24 | column_ (column), |
---|
| 25 | message_ (message) |
---|
| 26 | { |
---|
| 27 | } |
---|
| 28 | |
---|
| 29 | |
---|
| 30 | // parsing |
---|
| 31 | // |
---|
| 32 | template <typename C> |
---|
| 33 | parsing<C>:: |
---|
| 34 | ~parsing () throw () |
---|
| 35 | { |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | template <typename C> |
---|
| 39 | parsing<C>:: |
---|
| 40 | parsing () |
---|
| 41 | { |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | template <typename C> |
---|
| 45 | parsing<C>:: |
---|
| 46 | parsing (const tree::diagnostics<C>& diagnostics) |
---|
| 47 | : diagnostics_ (diagnostics) |
---|
| 48 | { |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | template <typename C> |
---|
| 52 | const char* parsing<C>:: |
---|
| 53 | what () const throw () |
---|
| 54 | { |
---|
| 55 | return "instance document parsing failed"; |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | |
---|
| 59 | // expected_element |
---|
| 60 | // |
---|
| 61 | template <typename C> |
---|
| 62 | expected_element<C>:: |
---|
| 63 | ~expected_element () throw () |
---|
| 64 | { |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | template <typename C> |
---|
| 68 | expected_element<C>:: |
---|
| 69 | expected_element (const std::basic_string<C>& name, |
---|
| 70 | const std::basic_string<C>& namespace_) |
---|
| 71 | : name_ (name), namespace__ (namespace_) |
---|
| 72 | { |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | template <typename C> |
---|
| 76 | const char* expected_element<C>:: |
---|
| 77 | what () const throw () |
---|
| 78 | { |
---|
| 79 | return "expected element not encountered"; |
---|
| 80 | } |
---|
| 81 | |
---|
| 82 | |
---|
| 83 | // unexpected_element |
---|
| 84 | // |
---|
| 85 | template <typename C> |
---|
| 86 | unexpected_element<C>:: |
---|
| 87 | ~unexpected_element () throw () |
---|
| 88 | { |
---|
| 89 | } |
---|
| 90 | |
---|
| 91 | template <typename C> |
---|
| 92 | unexpected_element<C>:: |
---|
| 93 | unexpected_element (const std::basic_string<C>& encountered_name, |
---|
| 94 | const std::basic_string<C>& encountered_namespace, |
---|
| 95 | const std::basic_string<C>& expected_name, |
---|
| 96 | const std::basic_string<C>& expected_namespace) |
---|
| 97 | : encountered_name_ (encountered_name), |
---|
| 98 | encountered_namespace_ (encountered_namespace), |
---|
| 99 | expected_name_ (expected_name), |
---|
| 100 | expected_namespace_ (expected_namespace) |
---|
| 101 | { |
---|
| 102 | } |
---|
| 103 | |
---|
| 104 | template <typename C> |
---|
| 105 | const char* unexpected_element<C>:: |
---|
| 106 | what () const throw () |
---|
| 107 | { |
---|
| 108 | return "unexpected element encountered"; |
---|
| 109 | } |
---|
| 110 | |
---|
| 111 | |
---|
| 112 | // expected_attribute |
---|
| 113 | // |
---|
| 114 | template <typename C> |
---|
| 115 | expected_attribute<C>:: |
---|
| 116 | ~expected_attribute () throw () |
---|
| 117 | { |
---|
| 118 | } |
---|
| 119 | |
---|
| 120 | template <typename C> |
---|
| 121 | expected_attribute<C>:: |
---|
| 122 | expected_attribute (const std::basic_string<C>& name, |
---|
| 123 | const std::basic_string<C>& namespace_) |
---|
| 124 | : name_ (name), namespace__ (namespace_) |
---|
| 125 | { |
---|
| 126 | } |
---|
| 127 | |
---|
| 128 | template <typename C> |
---|
| 129 | const char* expected_attribute<C>:: |
---|
| 130 | what () const throw () |
---|
| 131 | { |
---|
| 132 | return "expected attribute not encountered"; |
---|
| 133 | } |
---|
| 134 | |
---|
| 135 | |
---|
| 136 | // unexpected_enumerator |
---|
| 137 | // |
---|
| 138 | template <typename C> |
---|
| 139 | unexpected_enumerator<C>:: |
---|
| 140 | ~unexpected_enumerator () throw () |
---|
| 141 | { |
---|
| 142 | } |
---|
| 143 | |
---|
| 144 | template <typename C> |
---|
| 145 | unexpected_enumerator<C>:: |
---|
| 146 | unexpected_enumerator (const std::basic_string<C>& enumerator) |
---|
| 147 | : enumerator_ (enumerator) |
---|
| 148 | { |
---|
| 149 | } |
---|
| 150 | |
---|
| 151 | template <typename C> |
---|
| 152 | const char* unexpected_enumerator<C>:: |
---|
| 153 | what () const throw () |
---|
| 154 | { |
---|
| 155 | return "unexpected enumerator encountered"; |
---|
| 156 | } |
---|
| 157 | |
---|
| 158 | |
---|
| 159 | // expected_text_content |
---|
| 160 | // |
---|
| 161 | template <typename C> |
---|
| 162 | const char* expected_text_content<C>:: |
---|
| 163 | what () const throw () |
---|
| 164 | { |
---|
| 165 | return "expected text content"; |
---|
| 166 | } |
---|
| 167 | |
---|
| 168 | |
---|
| 169 | // no_type_info |
---|
| 170 | // |
---|
| 171 | template <typename C> |
---|
| 172 | no_type_info<C>:: |
---|
| 173 | ~no_type_info () throw () |
---|
| 174 | { |
---|
| 175 | } |
---|
| 176 | |
---|
| 177 | template <typename C> |
---|
| 178 | no_type_info<C>:: |
---|
| 179 | no_type_info (const std::basic_string<C>& type_name, |
---|
| 180 | const std::basic_string<C>& type_namespace) |
---|
| 181 | : type_name_ (type_name), |
---|
| 182 | type_namespace_ (type_namespace) |
---|
| 183 | { |
---|
| 184 | } |
---|
| 185 | |
---|
| 186 | template <typename C> |
---|
| 187 | const char* no_type_info<C>:: |
---|
| 188 | what () const throw () |
---|
| 189 | { |
---|
| 190 | return "no type information registered for a type"; |
---|
| 191 | } |
---|
| 192 | |
---|
| 193 | |
---|
| 194 | // not_derived |
---|
| 195 | // |
---|
| 196 | template <typename C> |
---|
| 197 | not_derived<C>:: |
---|
| 198 | ~not_derived () throw () |
---|
| 199 | { |
---|
| 200 | } |
---|
| 201 | |
---|
| 202 | template <typename C> |
---|
| 203 | not_derived<C>:: |
---|
| 204 | not_derived (const std::basic_string<C>& base_type_name, |
---|
| 205 | const std::basic_string<C>& base_type_namespace, |
---|
| 206 | const std::basic_string<C>& derived_type_name, |
---|
| 207 | const std::basic_string<C>& derived_type_namespace) |
---|
| 208 | : base_type_name_ (base_type_name), |
---|
| 209 | base_type_namespace_ (base_type_namespace), |
---|
| 210 | derived_type_name_ (derived_type_name), |
---|
| 211 | derived_type_namespace_ (derived_type_namespace) |
---|
| 212 | { |
---|
| 213 | } |
---|
| 214 | |
---|
| 215 | template <typename C> |
---|
| 216 | const char* not_derived<C>:: |
---|
| 217 | what () const throw () |
---|
| 218 | { |
---|
| 219 | return "type is not derived"; |
---|
| 220 | } |
---|
| 221 | |
---|
| 222 | |
---|
| 223 | // duplicate_id |
---|
| 224 | // |
---|
| 225 | template <typename C> |
---|
| 226 | duplicate_id<C>:: |
---|
| 227 | ~duplicate_id () throw () |
---|
| 228 | { |
---|
| 229 | } |
---|
| 230 | |
---|
| 231 | template <typename C> |
---|
| 232 | duplicate_id<C>:: |
---|
| 233 | duplicate_id (const std::basic_string<C>& id) |
---|
| 234 | : id_ (id) |
---|
| 235 | { |
---|
| 236 | } |
---|
| 237 | |
---|
| 238 | template <typename C> |
---|
| 239 | const char* duplicate_id<C>:: |
---|
| 240 | what () const throw () |
---|
| 241 | { |
---|
| 242 | return "ID already exist"; |
---|
| 243 | } |
---|
| 244 | |
---|
| 245 | |
---|
| 246 | // serialization |
---|
| 247 | // |
---|
| 248 | template <typename C> |
---|
| 249 | serialization<C>:: |
---|
| 250 | ~serialization () throw () |
---|
| 251 | { |
---|
| 252 | } |
---|
| 253 | |
---|
| 254 | template <typename C> |
---|
| 255 | serialization<C>:: |
---|
| 256 | serialization () |
---|
| 257 | { |
---|
| 258 | } |
---|
| 259 | |
---|
| 260 | template <typename C> |
---|
| 261 | serialization<C>:: |
---|
| 262 | serialization (const tree::diagnostics<C>& diagnostics) |
---|
| 263 | : diagnostics_ (diagnostics) |
---|
| 264 | { |
---|
| 265 | } |
---|
| 266 | |
---|
| 267 | template <typename C> |
---|
| 268 | const char* serialization<C>:: |
---|
| 269 | what () const throw () |
---|
| 270 | { |
---|
| 271 | return "serialization failed"; |
---|
| 272 | } |
---|
| 273 | |
---|
| 274 | |
---|
| 275 | // no_namespace_mapping |
---|
| 276 | // |
---|
| 277 | template <typename C> |
---|
| 278 | no_namespace_mapping<C>:: |
---|
| 279 | ~no_namespace_mapping () throw () |
---|
| 280 | { |
---|
| 281 | } |
---|
| 282 | |
---|
| 283 | template <typename C> |
---|
| 284 | no_namespace_mapping<C>:: |
---|
| 285 | no_namespace_mapping (const std::basic_string<C>& namespace_) |
---|
| 286 | : namespace__ (namespace_) |
---|
| 287 | { |
---|
| 288 | } |
---|
| 289 | |
---|
| 290 | template <typename C> |
---|
| 291 | const char* no_namespace_mapping<C>:: |
---|
| 292 | what () const throw () |
---|
| 293 | { |
---|
| 294 | return "no mapping provided for a namespace"; |
---|
| 295 | } |
---|
| 296 | |
---|
| 297 | |
---|
| 298 | // no_prefix_mapping |
---|
| 299 | // |
---|
| 300 | template <typename C> |
---|
| 301 | no_prefix_mapping<C>:: |
---|
| 302 | ~no_prefix_mapping () throw () |
---|
| 303 | { |
---|
| 304 | } |
---|
| 305 | |
---|
| 306 | template <typename C> |
---|
| 307 | no_prefix_mapping<C>:: |
---|
| 308 | no_prefix_mapping (const std::basic_string<C>& prefix) |
---|
| 309 | : prefix_ (prefix) |
---|
| 310 | { |
---|
| 311 | } |
---|
| 312 | |
---|
| 313 | template <typename C> |
---|
| 314 | const char* no_prefix_mapping<C>:: |
---|
| 315 | what () const throw () |
---|
| 316 | { |
---|
| 317 | return "no mapping provided for a namespace prefix"; |
---|
| 318 | } |
---|
| 319 | |
---|
| 320 | |
---|
| 321 | // xsi_already_in_use |
---|
| 322 | // |
---|
| 323 | template <typename C> |
---|
| 324 | const char* xsi_already_in_use<C>:: |
---|
| 325 | what () const throw () |
---|
| 326 | { |
---|
| 327 | return "namespace prefix 'xsi' is already in use and no " |
---|
| 328 | "user-defined mapping has been provided for namespace " |
---|
| 329 | "'http://www.w3.org/2001/XMLSchema-instance'"; |
---|
| 330 | } |
---|
| 331 | |
---|
| 332 | |
---|
| 333 | // bounds |
---|
| 334 | // |
---|
| 335 | template <typename C> |
---|
| 336 | const char* bounds<C>:: |
---|
| 337 | what () const throw () |
---|
| 338 | { |
---|
| 339 | return "buffer boundary rules have been violated"; |
---|
| 340 | } |
---|
| 341 | } |
---|
| 342 | } |
---|
| 343 | } |
---|