Brian Silverman | 8867871 | 2018-08-04 23:56:48 -0700 | [diff] [blame^] | 1 | /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 |
| 2 | // xml_archive_exception.cpp: |
| 3 | |
| 4 | // (C) Copyright 2009 Robert Ramey - http://www.rrsd.com . |
| 5 | // Use, modification and distribution is subject to the Boost Software |
| 6 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
| 7 | // http://www.boost.org/LICENSE_1_0.txt) |
| 8 | |
| 9 | // See http://www.boost.org for updates, documentation, and revision history. |
| 10 | |
| 11 | #if (defined _MSC_VER) && (_MSC_VER == 1200) |
| 12 | # pragma warning (disable : 4786) // too long name, harmless warning |
| 13 | #endif |
| 14 | |
| 15 | |
| 16 | #include <exception> |
| 17 | #include <string> |
| 18 | |
| 19 | #include <boost/assert.hpp> |
| 20 | |
| 21 | #define BOOST_ARCHIVE_SOURCE |
| 22 | #include <boost/serialization/config.hpp> |
| 23 | #include <boost/archive/xml_archive_exception.hpp> |
| 24 | |
| 25 | namespace boost { |
| 26 | namespace archive { |
| 27 | |
| 28 | BOOST_ARCHIVE_DECL |
| 29 | xml_archive_exception::xml_archive_exception( |
| 30 | exception_code c, |
| 31 | const char * e1, |
| 32 | const char * e2 |
| 33 | ) : |
| 34 | archive_exception(other_exception, e1, e2) |
| 35 | { |
| 36 | switch(c){ |
| 37 | case xml_archive_parsing_error: |
| 38 | archive_exception::append(0, "unrecognized XML syntax"); |
| 39 | break; |
| 40 | case xml_archive_tag_mismatch:{ |
| 41 | unsigned int l; |
| 42 | l = archive_exception::append(0, "XML start/end tag mismatch"); |
| 43 | if(NULL != e1){ |
| 44 | l = archive_exception::append(l, " - "); |
| 45 | archive_exception::append(l, e1); |
| 46 | } |
| 47 | break; |
| 48 | } |
| 49 | case xml_archive_tag_name_error: |
| 50 | archive_exception::append(0, "Invalid XML tag name"); |
| 51 | break; |
| 52 | default: |
| 53 | BOOST_ASSERT(false); |
| 54 | archive_exception::append(0, "programming error"); |
| 55 | break; |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | BOOST_ARCHIVE_DECL |
| 60 | xml_archive_exception::xml_archive_exception(xml_archive_exception const & oth) : |
| 61 | archive_exception(oth) |
| 62 | { |
| 63 | } |
| 64 | |
| 65 | BOOST_ARCHIVE_DECL xml_archive_exception::~xml_archive_exception() BOOST_NOEXCEPT_OR_NOTHROW {} |
| 66 | |
| 67 | } // archive |
| 68 | } // boost |