85#ifdef _QX_ENABLE_BOOST_SERIALIZATION
86#if _QX_SERIALIZE_PORTABLE_BINARY
87#ifndef _QX_PORTABLE_BINARY_IARCHIVE_H_
88#define _QX_PORTABLE_BINARY_IARCHIVE_H_
96#pragma warning(disable:4996)
97#pragma warning(disable:4661)
103#include <boost/version.hpp>
104#include <boost/utility/enable_if.hpp>
105#include <boost/archive/basic_binary_iprimitive.hpp>
106#include <boost/archive/basic_binary_iarchive.hpp>
108#if BOOST_VERSION >= 103500 && BOOST_VERSION < 105600
109#include <boost/archive/shared_ptr_helper.hpp>
113#if BOOST_VERSION < 103600
114#include <boost/integer/endian.hpp>
115#include <boost/math/fpclassify.hpp>
116#elif BOOST_VERSION < 104800
117#include <boost/spirit/home/support/detail/integer/endian.hpp>
118#include <boost/spirit/home/support/detail/math/fpclassify.hpp>
120#include <boost/spirit/home/support/detail/endian/endian.hpp>
121#include <boost/spirit/home/support/detail/math/fpclassify.hpp>
125#if BOOST_VERSION < 103800
126namespace fp = boost::math;
128namespace fp = boost::spirit::math;
132#if BOOST_VERSION < 104800
133namespace endian = boost::detail;
135namespace endian = boost::spirit::detail;
138#if BOOST_VERSION >= 104500 && !defined BOOST_NO_STD_WSTRING
140#include <boost/program_options/config.hpp>
141#include <boost/program_options/detail/convert.hpp>
145#include <boost/type_traits/is_integral.hpp>
146#include <boost/type_traits/is_unsigned.hpp>
147#include <boost/type_traits/is_arithmetic.hpp>
148#include <boost/type_traits/is_floating_point.hpp>
154#if defined(__vms) && defined(__DECCXX) && !__IEEE_FLOAT
155#error "VAX floating point format is not supported!"
161 class portable_iarchive;
163 typedef boost::archive::basic_binary_iprimitive<
165 #if BOOST_VERSION < 103400
168 , std::istream::char_type
169 , std::istream::traits_type
191 ,
public boost::archive::basic_binary_iarchive<portable_iarchive>
193 #if BOOST_VERSION >= 103500 && BOOST_VERSION < 105600
195 ,
public boost::archive::detail::shared_ptr_helper
209 portable_iprimitive::load(c);
221 if (flags & no_header)
222 set_library_version(input_library_version);
226 throw archive_exception(archive_exception::invalid_signature);
235 throw archive_exception(archive_exception::unsupported_version);
238 else set_library_version(input_library_version);
255 #if BOOST_VERSION < 103400
260 , boost::archive::basic_binary_iarchive<portable_iarchive>(flags)
265 #if BOOST_VERSION >= 103400
277 portable_iprimitive::load(s);
280 #ifndef BOOST_NO_STD_WSTRING
297 s = boost::from_utf8(utf8);
318 case 0: b =
false;
break;
331 template <
typename T>
332 typename boost::enable_if<boost::is_integral<T> >::type
339 if (size < 0 && boost::is_unsigned<T>::value)
343 else if ((
unsigned) abs(size) >
sizeof(T))
347 T temp = size < 0 ? -1 : 0;
348 load_binary(&temp, abs(size));
352 t = endian::load_little_endian<T, sizeof(T)>(&temp);
385 template <
typename T>
386 typename boost::enable_if<boost::is_floating_point<T> >::type
389 typedef typename fp::detail::fp_traits<T>::type traits;
397 typename traits::bits bits;
398 BOOST_STATIC_ASSERT(
sizeof(bits) ==
sizeof(T));
399 BOOST_STATIC_ASSERT(std::numeric_limits<T>::is_iec559);
402 traits::set_bits(t, bits);
405 if (get_flags() &
no_infnan && !fp::isfinite(t))
411 if (std::numeric_limits<T>::has_denorm == std::denorm_absent
412 && fp::fpclassify(t) == (
int) FP_SUBNORMAL)
418 template <
typename T>
419 typename boost::disable_if<boost::is_arithmetic<T> >::type
427 load((
typename boost::uint_t<
sizeof(T)*CHAR_BIT>::least&)(t));
435#if BOOST_VERSION < 103500
436#define BOOST_ARCHIVE_CUSTOM_IARCHIVE_TYPES eos::portable_iarchive
445#ifndef NO_EXPLICIT_TEMPLATE_INSTANTIATION
447#ifndef _QX_BOOST_ARCHIVE_SERIALIZER_IMPL_DEFINED_
448#define _QX_BOOST_ARCHIVE_SERIALIZER_IMPL_DEFINED_
450#include <boost/archive/impl/basic_binary_iarchive.ipp>
451#include <boost/archive/impl/basic_binary_oarchive.ipp>
452#include <boost/archive/impl/basic_binary_iprimitive.ipp>
453#include <boost/archive/impl/basic_binary_oprimitive.ipp>
455#if _QX_SERIALIZE_TEXT
456#include <boost/archive/impl/basic_text_oprimitive.ipp>
457#include <boost/archive/impl/basic_text_iprimitive.ipp>
458#include <boost/archive/impl/basic_text_oarchive.ipp>
459#include <boost/archive/impl/basic_text_iarchive.ipp>
462#if (BOOST_VERSION < 104000)
463#include <boost/archive/impl/archive_pointer_iserializer.ipp>
464#include <boost/archive/impl/archive_pointer_oserializer.ipp>
465#elif !defined BOOST_ARCHIVE_SERIALIZER_INCLUDED
466#include <boost/archive/impl/archive_serializer_map.ipp>
467#define BOOST_ARCHIVE_SERIALIZER_INCLUDED
472namespace boost {
namespace archive {
475 template class basic_binary_iarchive<eos::portable_iarchive>;
477 template class basic_binary_iprimitive<
479 #if BOOST_VERSION < 103400
482 , std::istream::char_type
483 , std::istream::traits_type
487#if (! _QX_USE_EXPORT_DLL_BOOST_SERIALIZATION_SINGLETON)
488#if (BOOST_VERSION < 104000)
489 template class detail::archive_pointer_iserializer<eos::portable_iarchive>;
491 template class detail::archive_serializer_map<eos::portable_iarchive>;
QX_DLL_EXPORT QDataStream & operator>>(QDataStream &stream, qx::QxBool &t) QX_USED
Exception being thrown when serialization cannot proceed.
Portable binary input archive using little endian format.
void init(unsigned flags)
void load(std::wstring &s)
Load wide strings.
boost::enable_if< boost::is_integral< T > >::type load(T &t, dummy< 2 >=0)
Load integer types.
void load(bool &b)
Loading bool type.
portable_iarchive(std::istream &is, unsigned flags=0)
Constructor on a stream using ios::binary mode!
boost::enable_if< boost::is_floating_point< T > >::type load(T &t, dummy< 3 >=0)
Load floating point types.
boost::disable_if< boost::is_arithmetic< T > >::type load(T &t, dummy< 4 >=0)
void load(std::string &s)
Load narrow strings.
signed char load_signed_char()
const signed char magic_byte
boost::archive::version_type archive_version_type
const archive_version_type archive_version(boost::archive::ARCHIVE_VERSION())
boost::archive::basic_binary_iprimitive< portable_iarchive, std::istream > portable_iprimitive
Provides error handling and constants.