Chris@16
|
1 #ifndef BOOST_ARCHIVE_ARCHIVE_EXCEPTION_HPP
|
Chris@16
|
2 #define BOOST_ARCHIVE_ARCHIVE_EXCEPTION_HPP
|
Chris@16
|
3
|
Chris@16
|
4 // MS compatible compilers support #pragma once
|
Chris@101
|
5 #if defined(_MSC_VER)
|
Chris@16
|
6 # pragma once
|
Chris@16
|
7 #endif
|
Chris@16
|
8
|
Chris@16
|
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
Chris@16
|
10 // archive/archive_exception.hpp:
|
Chris@16
|
11
|
Chris@16
|
12 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
Chris@16
|
13 // Use, modification and distribution is subject to the Boost Software
|
Chris@16
|
14 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
15 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
16
|
Chris@16
|
17 // See http://www.boost.org for updates, documentation, and revision history.
|
Chris@16
|
18
|
Chris@16
|
19 #include <exception>
|
Chris@16
|
20 #include <boost/assert.hpp>
|
Chris@16
|
21 #include <string>
|
Chris@16
|
22
|
Chris@16
|
23 #include <boost/config.hpp>
|
Chris@16
|
24 #include <boost/preprocessor/empty.hpp>
|
Chris@16
|
25 #include <boost/archive/detail/decl.hpp>
|
Chris@16
|
26
|
Chris@16
|
27 // note: the only reason this is in here is that windows header
|
Chris@16
|
28 // includes #define exception_code _exception_code (arrrgghhhh!).
|
Chris@16
|
29 // the most expedient way to address this is be sure that this
|
Chris@16
|
30 // header is always included whenever this header file is included.
|
Chris@16
|
31 #if defined(BOOST_WINDOWS)
|
Chris@16
|
32 #include <excpt.h>
|
Chris@16
|
33 #endif
|
Chris@16
|
34
|
Chris@16
|
35 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
Chris@16
|
36
|
Chris@16
|
37 namespace boost {
|
Chris@16
|
38 namespace archive {
|
Chris@16
|
39
|
Chris@16
|
40 //////////////////////////////////////////////////////////////////////
|
Chris@16
|
41 // exceptions thrown by archives
|
Chris@16
|
42 //
|
Chris@16
|
43 class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) archive_exception :
|
Chris@16
|
44 public virtual std::exception
|
Chris@16
|
45 {
|
Chris@16
|
46 protected:
|
Chris@16
|
47 char m_buffer[128];
|
Chris@16
|
48 public:
|
Chris@16
|
49 typedef enum {
|
Chris@16
|
50 no_exception, // initialized without code
|
Chris@16
|
51 other_exception, // any excepton not listed below
|
Chris@101
|
52 unregistered_class, // attempt to serialize a pointer of
|
Chris@16
|
53 // an unregistered class
|
Chris@16
|
54 invalid_signature, // first line of archive does not contain
|
Chris@16
|
55 // expected string
|
Chris@16
|
56 unsupported_version,// archive created with library version
|
Chris@16
|
57 // subsequent to this one
|
Chris@16
|
58 pointer_conflict, // an attempt has been made to directly
|
Chris@16
|
59 // serialize an object which has
|
Chris@101
|
60 // already been serialized through a pointer.
|
Chris@101
|
61 // Were this permitted, the archive load would result
|
Chris@16
|
62 // in the creation of an extra copy of the obect.
|
Chris@16
|
63 incompatible_native_format, // attempt to read native binary format
|
Chris@16
|
64 // on incompatible platform
|
Chris@16
|
65 array_size_too_short,// array being loaded doesn't fit in array allocated
|
Chris@16
|
66 input_stream_error, // error on input stream
|
Chris@16
|
67 invalid_class_name, // class name greater than the maximum permitted.
|
Chris@16
|
68 // most likely a corrupted archive or an attempt
|
Chris@16
|
69 // to insert virus via buffer overrun method.
|
Chris@16
|
70 unregistered_cast, // base - derived relationship not registered with
|
Chris@16
|
71 // void_cast_register
|
Chris@16
|
72 unsupported_class_version, // type saved with a version # greater than the
|
Chris@101
|
73 // one used by the program. This indicates that the program
|
Chris@16
|
74 // needs to be rebuilt.
|
Chris@16
|
75 multiple_code_instantiation, // code for implementing serialization for some
|
Chris@16
|
76 // type has been instantiated in more than one module.
|
Chris@16
|
77 output_stream_error // error on input stream
|
Chris@16
|
78 } exception_code;
|
Chris@16
|
79 public:
|
Chris@16
|
80 exception_code code;
|
Chris@16
|
81 archive_exception(
|
Chris@16
|
82 exception_code c,
|
Chris@16
|
83 const char * e1 = NULL,
|
Chris@16
|
84 const char * e2 = NULL
|
Chris@16
|
85 );
|
Chris@16
|
86 virtual ~archive_exception() throw();
|
Chris@16
|
87 virtual const char *what() const throw();
|
Chris@16
|
88 protected:
|
Chris@16
|
89 unsigned int
|
Chris@16
|
90 append(unsigned int l, const char * a);
|
Chris@16
|
91 archive_exception();
|
Chris@16
|
92 };
|
Chris@16
|
93
|
Chris@16
|
94 }// namespace archive
|
Chris@16
|
95 }// namespace boost
|
Chris@16
|
96
|
Chris@16
|
97 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
Chris@16
|
98
|
Chris@16
|
99 #endif //BOOST_ARCHIVE_ARCHIVE_EXCEPTION_HPP
|