Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:28:29

0001 #ifndef BOOST_ARCHIVE_ARCHIVE_EXCEPTION_HPP
0002 #define BOOST_ARCHIVE_ARCHIVE_EXCEPTION_HPP
0003 
0004 // MS compatible compilers support #pragma once
0005 #if defined(_MSC_VER)
0006 # pragma once
0007 #endif
0008 
0009 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
0010 // archive/archive_exception.hpp:
0011 
0012 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
0013 // Use, modification and distribution is subject to the Boost Software
0014 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0015 // http://www.boost.org/LICENSE_1_0.txt)
0016 
0017 //  See http://www.boost.org for updates, documentation, and revision history.
0018 
0019 #include <exception>
0020 #include <boost/assert.hpp>
0021 #include <string>
0022 
0023 #include <boost/config.hpp>
0024 #include <boost/archive/detail/decl.hpp>
0025 
0026 // note: the only reason this is in here is that windows header
0027 // includes #define exception_code _exception_code (arrrgghhhh!).
0028 // the most expedient way to address this is be sure that this
0029 // header is always included whenever this header file is included.
0030 #if defined(BOOST_WINDOWS)
0031 #include <excpt.h>
0032 #endif
0033 
0034 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
0035 
0036 namespace boost {
0037 namespace archive {
0038 
0039 //////////////////////////////////////////////////////////////////////
0040 // exceptions thrown by archives
0041 //
0042 class BOOST_SYMBOL_VISIBLE archive_exception :
0043     public virtual std::exception
0044 {
0045 private:
0046     char m_buffer[128];
0047 protected:
0048     BOOST_ARCHIVE_DECL unsigned int
0049     append(unsigned int l, const char * a);
0050     BOOST_ARCHIVE_DECL
0051     archive_exception() BOOST_NOEXCEPT;
0052 public:
0053     typedef enum {
0054         no_exception,       // initialized without code
0055         other_exception,    // any exception not listed below
0056         unregistered_class, // attempt to serialize a pointer of
0057                             // an unregistered class
0058         invalid_signature,  // first line of archive does not contain
0059                             // expected string
0060         unsupported_version,// archive created with library version
0061                             // subsequent to this one
0062         pointer_conflict,   // an attempt has been made to directly
0063                             // serialize an object which has
0064                             // already been serialized through a pointer.
0065                             // Were this permitted, the archive load would result
0066                             // in the creation of an extra copy of the object.
0067         incompatible_native_format, // attempt to read native binary format
0068                             // on incompatible platform
0069         array_size_too_short,// array being loaded doesn't fit in array allocated
0070         input_stream_error, // error on input stream
0071         invalid_class_name, // class name greater than the maximum permitted.
0072                             // most likely a corrupted archive or an attempt
0073                             // to insert virus via buffer overrun method.
0074         unregistered_cast,   // base - derived relationship not registered with
0075                             // void_cast_register
0076         unsupported_class_version, // type saved with a version # greater than the
0077                             // one used by the program.  This indicates that the program
0078                             // needs to be rebuilt.
0079         multiple_code_instantiation, // code for implementing serialization for some
0080                             // type has been instantiated in more than one module.
0081         output_stream_error // error on input stream
0082     } exception_code;
0083     exception_code code;
0084 
0085     BOOST_ARCHIVE_DECL archive_exception(
0086         exception_code c,
0087         const char * e1 = NULL,
0088         const char * e2 = NULL
0089     ) BOOST_NOEXCEPT;
0090     BOOST_ARCHIVE_DECL archive_exception(archive_exception const &) BOOST_NOEXCEPT;
0091     BOOST_ARCHIVE_DECL ~archive_exception() BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE;
0092     BOOST_ARCHIVE_DECL const char * what() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE;
0093 };
0094 
0095 }// namespace archive
0096 }// namespace boost
0097 
0098 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
0099 
0100 #endif //BOOST_ARCHIVE_ARCHIVE_EXCEPTION_HPP