1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/stdapis/boost/archive/archive_exception.hpp Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -0,0 +1,115 @@
1.4 +#ifndef BOOST_ARCHIVE_ARCHIVE_EXCEPTION_HPP
1.5 +#define BOOST_ARCHIVE_ARCHIVE_EXCEPTION_HPP
1.6 +
1.7 +// MS compatible compilers support #pragma once
1.8 +#if defined(_MSC_VER) && (_MSC_VER >= 1020)
1.9 +# pragma once
1.10 +#endif
1.11 +
1.12 +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
1.13 +// archive/archive_exception.hpp:
1.14 +
1.15 +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
1.16 +// Use, modification and distribution is subject to the Boost Software
1.17 +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
1.18 +// http://www.boost.org/LICENSE_1_0.txt)
1.19 +
1.20 +// See http://www.boost.org for updates, documentation, and revision history.
1.21 +
1.22 +#include <exception>
1.23 +#include <cassert>
1.24 +
1.25 +namespace boost {
1.26 +namespace archive {
1.27 +
1.28 +//////////////////////////////////////////////////////////////////////
1.29 +// exceptions thrown by archives
1.30 +//
1.31 +class archive_exception :
1.32 + public virtual std::exception
1.33 +{
1.34 +public:
1.35 + typedef enum {
1.36 + no_exception, // initialized without code
1.37 + other_exception, // any excepton not listed below
1.38 + unregistered_class, // attempt to serialize a pointer of an
1.39 + // an unregistered class
1.40 + invalid_signature, // first line of archive does not contain
1.41 + // expected string
1.42 + unsupported_version,// archive created with library version
1.43 + // subsequent to this one
1.44 + pointer_conflict, // an attempt has been made to directly
1.45 + // serialization::detail an object
1.46 + // after having already serialzed the same
1.47 + // object through a pointer. Were this permited,
1.48 + // it the archive load would result in the
1.49 + // creation of an extra copy of the obect.
1.50 + incompatible_native_format, // attempt to read native binary format
1.51 + // on incompatible platform
1.52 + array_size_too_short,// array being loaded doesn't fit in array allocated
1.53 + stream_error, // i/o error on stream
1.54 + invalid_class_name, // class name greater than the maximum permitted.
1.55 + // most likely a corrupted archive or an attempt
1.56 + // to insert virus via buffer overrun method.
1.57 + unregistered_cast // base - derived relationship not registered with
1.58 + // void_cast_register
1.59 + } exception_code;
1.60 + exception_code code;
1.61 + archive_exception(exception_code c) :
1.62 + code(c)
1.63 + {}
1.64 + virtual const char *what( ) const throw( )
1.65 + {
1.66 + const char *msg = "programming error";
1.67 + switch(code){
1.68 + case no_exception:
1.69 + msg = "uninitialized exception";
1.70 + break;
1.71 + case unregistered_class:
1.72 + msg = "unregistered class";
1.73 + break;
1.74 + case invalid_signature:
1.75 + msg = "invalid signature";
1.76 + break;
1.77 + case unsupported_version:
1.78 + msg = "unsupported version";
1.79 + break;
1.80 + case pointer_conflict:
1.81 + msg = "pointer conflict";
1.82 + break;
1.83 + case incompatible_native_format:
1.84 + msg = "incompatible native format";
1.85 + break;
1.86 + case array_size_too_short:
1.87 + msg = "array size too short";
1.88 + break;
1.89 + case stream_error:
1.90 + msg = "stream error";
1.91 + break;
1.92 + case invalid_class_name:
1.93 + msg = "class name too long";
1.94 + break;
1.95 + case unregistered_cast:
1.96 + msg = "unregistered void cast";
1.97 + break;
1.98 + case other_exception:
1.99 + // if get here - it indicates a derived exception
1.100 + // was sliced by passing by value in catch
1.101 + msg = "unknown derived exception";
1.102 + break;
1.103 + default:
1.104 + assert(false);
1.105 + break;
1.106 + }
1.107 + return msg;
1.108 + }
1.109 +protected:
1.110 + archive_exception() :
1.111 + code(no_exception)
1.112 + {}
1.113 +};
1.114 +
1.115 +}// namespace archive
1.116 +}// namespace boost
1.117 +
1.118 +#endif //BOOST_ARCHIVE_ARCHIVE_EXCEPTION_HPP