summaryrefslogtreecommitdiffstats
blob: 41d33fdabafe5e7a7dae22e2b8eda5b50c52741b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// xml_archive_exception.cpp:

// (C) Copyright 2009 Robert Ramey - http://www.rrsd.com . 
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

//  See http://www.boost.org for updates, documentation, and revision history.

#if (defined _MSC_VER) && (_MSC_VER == 1200)
#  pragma warning (disable : 4786) // too long name, harmless warning
#endif


#include <exception>
#include <boost/assert.hpp>
#include <string>

#define BOOST_ARCHIVE_SOURCE
#include <boost/archive/xml_archive_exception.hpp>

namespace boost {
namespace archive {

BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
xml_archive_exception::xml_archive_exception(
        exception_code c, 
        const char * e1,
        const char * e2
    ) : 
        archive_exception(other_exception, e1, e2)
    {
        switch(c){
        case xml_archive_parsing_error:
            archive_exception::append(0, "unrecognized XML syntax");
            break;
        case xml_archive_tag_mismatch:
            archive_exception::append(0, "XML start/end tag mismatch");
            if(NULL != e1){
                archive_exception::append(0, " - ");
                archive_exception::append(0, e1);
            }    
            break;
        case xml_archive_tag_name_error:
            archive_exception::append(0, "Invalid XML tag name");
            break;
        default:
            BOOST_ASSERT(false);
            archive_exception::append(0, "programming error");
            break;
        }
    }

} // archive
} // boost