comparison DEPENDENCIES/generic/include/boost/archive/archive_exception.hpp @ 16:2665513ce2d3

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