File indexing completed on 2024-04-06 12:02:32
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #pragma once
0016
0017 #include <boost/archive/basic_archive.hpp>
0018 #include <boost/archive/archive_exception.hpp>
0019
0020 namespace eos {
0021
0022
0023 const signed char magic_byte = 'e' | 'o' | 's';
0024
0025
0026 const unsigned no_infnan = 64;
0027
0028
0029 #if BOOST_VERSION < 104400
0030 typedef boost::archive::version_type archive_version_type;
0031 #else
0032 typedef boost::archive::library_version_type archive_version_type;
0033 #endif
0034
0035
0036 const archive_version_type archive_version(
0037 #if BOOST_VERSION < 103700
0038 boost::archive::ARCHIVE_VERSION()
0039 #else
0040 boost::archive::BOOST_ARCHIVE_VERSION()
0041 #endif
0042 );
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058 class portable_archive_exception : public boost::archive::archive_exception {
0059 std::string msg;
0060
0061 public:
0062
0063 portable_archive_exception(signed char invalid_size)
0064 : boost::archive::archive_exception(other_exception), msg("requested integer size exceeds type size: ") {
0065 msg += std::to_string(invalid_size);
0066 }
0067
0068
0069 portable_archive_exception()
0070 : boost::archive::archive_exception(other_exception),
0071 msg("cannot read a negative number into an unsigned type") {}
0072
0073
0074 template <typename T>
0075 portable_archive_exception(const T& abnormal)
0076 : boost::archive::archive_exception(other_exception), msg("serialization of illegal floating point value: ") {
0077 msg += std::to_string(abnormal);
0078 }
0079
0080
0081 const char* what() const throw() override { return msg.c_str(); }
0082 ~portable_archive_exception() throw() override {}
0083 };
0084
0085 }