PageRenderTime 46ms CodeModel.GetById 40ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/archive/archive_exception.hpp

http://hadesmem.googlecode.com/
C++ Header | 97 lines | 55 code | 13 blank | 29 comment | 1 complexity | 8d28cff3b21e82fadaa23994fc80b99b MD5 | raw file
 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
37namespace boost {
38namespace archive {
39
40//////////////////////////////////////////////////////////////////////
41// exceptions thrown by archives
42//
43class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) archive_exception : 
44    public virtual std::exception
45{
46public:
47    typedef enum {
48        no_exception,       // initialized without code
49        other_exception,    // any excepton not listed below
50        unregistered_class, // attempt to serialize a pointer of an
51                            // an unregistered class
52        invalid_signature,  // first line of archive does not contain
53                            // expected string
54        unsupported_version,// archive created with library version
55                            // subsequent to this one
56        pointer_conflict,   // an attempt has been made to directly
57                            // serialize an object which has
58                            // already been serialzed through a pointer.  
59                            // Were this permited, the archive load would result 
60                            // in the creation of an extra copy of the obect.
61        incompatible_native_format, // attempt to read native binary format
62                            // on incompatible platform
63        array_size_too_short,// array being loaded doesn't fit in array allocated
64        input_stream_error, // error on input stream
65        invalid_class_name, // class name greater than the maximum permitted.
66                            // most likely a corrupted archive or an attempt
67                            // to insert virus via buffer overrun method.
68        unregistered_cast,   // base - derived relationship not registered with 
69                            // void_cast_register
70        unsupported_class_version, // type saved with a version # greater than the 
71                            // one used by the program.  This indicates that the proggram
72                            // needs to be rebuilt.
73        multiple_code_instantiation, // code for implementing serialization for some
74                            // type has been instantiated in more than one module.
75        output_stream_error // error on input stream
76    } exception_code;
77protected:
78    std::string m_msg;
79public:
80    exception_code code;
81    archive_exception(
82        exception_code c, 
83        const char * e1 = NULL,
84        const char * e2 = NULL
85    );
86    ~archive_exception() throw ();
87    virtual const char *what( ) const throw();
88protected:
89    archive_exception();
90};
91
92}// namespace archive
93}// namespace boost
94
95#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
96
97#endif //BOOST_ARCHIVE_ARCHIVE_EXCEPTION_HPP