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
58 archive_exception(exception_code c) :
61 virtual const char *what( ) const throw( )
63 const char *msg = "programming error";
66 msg = "uninitialized exception";
68 case unregistered_class:
69 msg = "unregistered class";
71 case invalid_signature:
72 msg = "invalid signature";
74 case unsupported_version:
75 msg = "unsupported version";
77 case pointer_conflict:
78 msg = "pointer conflict";
80 case incompatible_native_format:
81 msg = "incompatible native format";
83 case array_size_too_short:
84 msg = "array size too short";
89 case invalid_class_name:
90 msg = "class name too long";
92 case unregistered_cast:
93 msg = "unregistered void cast";
96 // if get here - it indicates a derived exception
97 // was sliced by passing by value in catch
98 msg = "unknown derived exception";
107 archive_exception() :
112 }// namespace archive
115 #endif //BOOST_ARCHIVE_ARCHIVE_EXCEPTION_HPP