1 #ifndef BOOST_ARCHIVE_ARCHIVE_EXCEPTION_HPP
2 #define BOOST_ARCHIVE_ARCHIVE_EXCEPTION_HPP
4 // MS compatible compilers support #pragma once
5 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10 // archive/archive_exception.hpp:
12 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
13 // Use, modification and distribution is subject to the Boost Software
14 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
15 // http://www.boost.org/LICENSE_1_0.txt)
17 // See http://www.boost.org for updates, documentation, and revision history.
25 //////////////////////////////////////////////////////////////////////
26 // exceptions thrown by archives
28 class archive_exception
:
29 public virtual std::exception
33 no_exception
, // initialized without code
34 other_exception
, // any excepton not listed below
35 unregistered_class
, // attempt to serialize a pointer of an
36 // an unregistered class
37 invalid_signature
, // first line of archive does not contain
39 unsupported_version
,// archive created with library version
40 // subsequent to this one
41 pointer_conflict
, // an attempt has been made to directly
42 // serialization::detail an object
43 // after having already serialzed the same
44 // object through a pointer. Were this permited,
45 // it the archive load would result in the
46 // creation of an extra copy of the obect.
47 incompatible_native_format
, // attempt to read native binary format
48 // on incompatible platform
49 array_size_too_short
,// array being loaded doesn't fit in array allocated
50 stream_error
, // i/o error on stream
51 invalid_class_name
, // class name greater than the maximum permitted.
52 // most likely a corrupted archive or an attempt
53 // to insert virus via buffer overrun method.
54 unregistered_cast
, // base - derived relationship not registered with
56 unsupported_class_version
// type saved with a version # greater than the
57 // one used by the program. This indicates that the proggram
58 // needs to be rebuilt.
61 archive_exception(exception_code c
) :
64 virtual const char *what( ) const throw( )
66 const char *msg
= "programming error";
69 msg
= "uninitialized exception";
71 case unregistered_class
:
72 msg
= "unregistered class";
74 case invalid_signature
:
75 msg
= "invalid signature";
77 case unsupported_version
:
78 msg
= "unsupported version";
80 case pointer_conflict
:
81 msg
= "pointer conflict";
83 case incompatible_native_format
:
84 msg
= "incompatible native format";
86 case array_size_too_short
:
87 msg
= "array size too short";
92 case invalid_class_name
:
93 msg
= "class name too long";
95 case unregistered_cast
:
96 msg
= "unregistered void cast";
98 case unsupported_class_version
:
99 msg
= "class version";
101 case other_exception
:
102 // if get here - it indicates a derived exception
103 // was sliced by passing by value in catch
104 msg
= "unknown derived exception";
113 archive_exception() :
118 }// namespace archive
121 #endif //BOOST_ARCHIVE_ARCHIVE_EXCEPTION_HPP