From f0510d2f90467de8e8f260b47d79a9baaf9bef17 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 17 Sep 2009 07:15:29 +0200 Subject: Start tracking XSD with git --- libxsd/xsd/cxx/tree/exceptions.txx | 338 +++++++++++++++++++++++++++++++++++++ 1 file changed, 338 insertions(+) create mode 100644 libxsd/xsd/cxx/tree/exceptions.txx (limited to 'libxsd/xsd/cxx/tree/exceptions.txx') diff --git a/libxsd/xsd/cxx/tree/exceptions.txx b/libxsd/xsd/cxx/tree/exceptions.txx new file mode 100644 index 0000000..cd9bb3a --- /dev/null +++ b/libxsd/xsd/cxx/tree/exceptions.txx @@ -0,0 +1,338 @@ +// file : xsd/cxx/tree/exceptions.txx +// author : Boris Kolpackov +// copyright : Copyright (c) 2005-2009 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +namespace xsd +{ + namespace cxx + { + namespace tree + { + // error + // + template + error:: + error (tree::severity s, + const std::basic_string& id, + unsigned long line, + unsigned long column, + const std::basic_string& message) + : severity_ (s), + id_ (id), + line_ (line), + column_ (column), + message_ (message) + { + } + + template + error:: + error () + : severity_ (tree::severity::error), line_ (0), column_ (0) + { + } + + // parsing + // + template + parsing:: + ~parsing () throw () + { + } + + template + parsing:: + parsing () + { + } + + template + parsing:: + parsing (const tree::diagnostics& diagnostics) + : diagnostics_ (diagnostics) + { + } + + template + const char* parsing:: + what () const throw () + { + return "instance document parsing failed"; + } + + + // expected_element + // + template + expected_element:: + ~expected_element () throw () + { + } + + template + expected_element:: + expected_element (const std::basic_string& name, + const std::basic_string& namespace_) + : name_ (name), namespace__ (namespace_) + { + } + + template + const char* expected_element:: + what () const throw () + { + return "expected element not encountered"; + } + + + // unexpected_element + // + template + unexpected_element:: + ~unexpected_element () throw () + { + } + + template + unexpected_element:: + unexpected_element (const std::basic_string& encountered_name, + const std::basic_string& encountered_namespace, + const std::basic_string& expected_name, + const std::basic_string& expected_namespace) + : encountered_name_ (encountered_name), + encountered_namespace_ (encountered_namespace), + expected_name_ (expected_name), + expected_namespace_ (expected_namespace) + { + } + + template + const char* unexpected_element:: + what () const throw () + { + return "unexpected element encountered"; + } + + + // expected_attribute + // + template + expected_attribute:: + ~expected_attribute () throw () + { + } + + template + expected_attribute:: + expected_attribute (const std::basic_string& name, + const std::basic_string& namespace_) + : name_ (name), namespace__ (namespace_) + { + } + + template + const char* expected_attribute:: + what () const throw () + { + return "expected attribute not encountered"; + } + + + // unexpected_enumerator + // + template + unexpected_enumerator:: + ~unexpected_enumerator () throw () + { + } + + template + unexpected_enumerator:: + unexpected_enumerator (const std::basic_string& enumerator) + : enumerator_ (enumerator) + { + } + + template + const char* unexpected_enumerator:: + what () const throw () + { + return "unexpected enumerator encountered"; + } + + + // expected_text_content + // + template + const char* expected_text_content:: + what () const throw () + { + return "expected text content"; + } + + + // no_type_info + // + template + no_type_info:: + ~no_type_info () throw () + { + } + + template + no_type_info:: + no_type_info (const std::basic_string& type_name, + const std::basic_string& type_namespace) + : type_name_ (type_name), + type_namespace_ (type_namespace) + { + } + + template + const char* no_type_info:: + what () const throw () + { + return "no type information available for a type"; + } + + // no_element_info + // + template + no_element_info:: + ~no_element_info () throw () + { + } + + template + no_element_info:: + no_element_info (const std::basic_string& element_name, + const std::basic_string& element_namespace) + : element_name_ (element_name), + element_namespace_ (element_namespace) + { + } + + template + const char* no_element_info:: + what () const throw () + { + return "no parsing or serialization information available for " + "an element"; + } + + // not_derived + // + template + not_derived:: + ~not_derived () throw () + { + } + + template + not_derived:: + not_derived (const std::basic_string& base_type_name, + const std::basic_string& base_type_namespace, + const std::basic_string& derived_type_name, + const std::basic_string& derived_type_namespace) + : base_type_name_ (base_type_name), + base_type_namespace_ (base_type_namespace), + derived_type_name_ (derived_type_name), + derived_type_namespace_ (derived_type_namespace) + { + } + + template + const char* not_derived:: + what () const throw () + { + return "type is not derived"; + } + + + // duplicate_id + // + template + duplicate_id:: + ~duplicate_id () throw () + { + } + + template + duplicate_id:: + duplicate_id (const std::basic_string& id) + : id_ (id) + { + } + + template + const char* duplicate_id:: + what () const throw () + { + return "ID already exist"; + } + + + // serialization + // + template + serialization:: + ~serialization () throw () + { + } + + template + serialization:: + serialization () + { + } + + template + serialization:: + serialization (const tree::diagnostics& diagnostics) + : diagnostics_ (diagnostics) + { + } + + template + const char* serialization:: + what () const throw () + { + return "serialization failed"; + } + + + // no_prefix_mapping + // + template + no_prefix_mapping:: + ~no_prefix_mapping () throw () + { + } + + template + no_prefix_mapping:: + no_prefix_mapping (const std::basic_string& prefix) + : prefix_ (prefix) + { + } + + template + const char* no_prefix_mapping:: + what () const throw () + { + return "no mapping provided for a namespace prefix"; + } + + + // bounds + // + template + const char* bounds:: + what () const throw () + { + return "buffer boundary rules have been violated"; + } + } + } +} -- cgit v1.1