blob: 50d326a71b665d71275d3b9ea004c0086eed0a61 (
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// 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/archive_exception.hpp>
namespace boost {
namespace archive {
BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
archive_exception::archive_exception(
exception_code c,
const char * e1,
const char * e2
) :
code(c)
{
m_msg = "programming error";
switch(code){
case no_exception:
m_msg = "uninitialized exception";
break;
case unregistered_class:
m_msg = "unregistered class";
if(NULL != e1){
m_msg += " - ";
m_msg += e1;
}
break;
case invalid_signature:
m_msg = "invalid signature";
break;
case unsupported_version:
m_msg = "unsupported version";
break;
case pointer_conflict:
m_msg = "pointer conflict";
break;
case incompatible_native_format:
m_msg = "incompatible native format";
if(NULL != e1){
m_msg += " - ";
m_msg += e1;
}
break;
case array_size_too_short:
m_msg = "array size too short";
break;
case input_stream_error:
m_msg = "input stream error";
break;
case invalid_class_name:
m_msg = "class name too long";
break;
case unregistered_cast:
m_msg = "unregistered void cast ";
m_msg += (NULL != e1) ? e1 : "?";
m_msg += "<-";
m_msg += (NULL != e2) ? e2 : "?";
break;
case unsupported_class_version:
m_msg = "class version ";
m_msg += (NULL != e1) ? e1 : "<unknown class>";
break;
case other_exception:
// if get here - it indicates a derived exception
// was sliced by passing by value in catch
m_msg = "unknown derived exception";
break;
case multiple_code_instantiation:
m_msg = "code instantiated in more than one module";
if(NULL != e1){
m_msg += " - ";
m_msg += e1;
}
break;
case output_stream_error:
m_msg = "output stream error";
break;
default:
BOOST_ASSERT(false);
break;
}
}
BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
archive_exception::~archive_exception() throw () {}
BOOST_ARCHIVE_DECL(const char *)
archive_exception::what( ) const throw()
{
return m_msg.c_str();
}
BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
archive_exception::archive_exception() :
code(no_exception)
{}
} // archive
} // boost
|