mirror of
https://github.com/boostorg/serialization.git
synced 2026-02-20 15:02:27 +00:00
Merge branch 'develop'
This commit is contained in:
@@ -86,10 +86,8 @@ public:
|
||||
template<class T>
|
||||
void load(T & t)
|
||||
{
|
||||
if(! is.fail()){
|
||||
is >> t;
|
||||
if(is >> t)
|
||||
return;
|
||||
}
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::input_stream_error)
|
||||
);
|
||||
|
||||
@@ -51,6 +51,8 @@ BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
|
||||
basic_binary_iarchive<Archive>::init(){
|
||||
// read signature in an archive version independent manner
|
||||
std::string file_signature;
|
||||
|
||||
#if 0 // commented out since it interfers with derivation
|
||||
try {
|
||||
std::size_t l;
|
||||
this->This()->load(l);
|
||||
@@ -69,6 +71,11 @@ basic_binary_iarchive<Archive>::init(){
|
||||
// will cause invalid_signature archive exception to be thrown below
|
||||
file_signature = "";
|
||||
}
|
||||
#else
|
||||
// https://svn.boost.org/trac/boost/ticket/7301
|
||||
* this->This() >> file_signature;
|
||||
#endif
|
||||
|
||||
if(file_signature != BOOST_ARCHIVE_SIGNATURE())
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::invalid_signature)
|
||||
|
||||
@@ -30,10 +30,10 @@ namespace std{
|
||||
#include <boost/archive/iterators/binary_from_base64.hpp>
|
||||
#include <boost/archive/iterators/transform_width.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
namespace {
|
||||
namespace detail {
|
||||
template<class CharType>
|
||||
bool is_whitespace(CharType c);
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace {
|
||||
return 0 != std::iswspace(t);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} // detail
|
||||
|
||||
// translate base64 text into binary and copy into buffer
|
||||
// until buffer is full.
|
||||
@@ -106,7 +106,7 @@ basic_text_iprimitive<IStream>::load_binary(
|
||||
r = is.get();
|
||||
if(is.eof())
|
||||
break;
|
||||
if(is_whitespace(static_cast<CharType>(r)))
|
||||
if(detail::is_whitespace(static_cast<CharType>(r)))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// xml_wiprimitive.cpp:
|
||||
// xml_wiarchive_impl.ipp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
@@ -174,7 +174,7 @@ xml_wiarchive_impl<Archive>::xml_wiarchive_impl(
|
||||
if(0 == (flags & no_codecvt)){
|
||||
archive_locale.reset(
|
||||
add_facet(
|
||||
std::locale::classic(),
|
||||
is_.getloc(),
|
||||
new boost::archive::detail::utf8_codecvt_facet
|
||||
)
|
||||
);
|
||||
|
||||
@@ -155,7 +155,7 @@ xml_woarchive_impl<Archive>::xml_woarchive_impl(
|
||||
#else
|
||||
pfacet = new boost::archive::detail::utf8_codecvt_facet;
|
||||
#endif
|
||||
archive_locale.reset(add_facet(std::locale::classic(), pfacet));
|
||||
archive_locale.reset(add_facet(os_.getloc(), pfacet));
|
||||
os.imbue(* archive_locale);
|
||||
}
|
||||
if(0 == (flags & no_header))
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace boost {
|
||||
namespace archive {
|
||||
|
||||
typedef detail::polymorphic_oarchive_route<
|
||||
text_woarchive_impl<text_woarchive>
|
||||
text_woarchive_impl<text_woarchive>
|
||||
> polymorphic_text_woarchive;
|
||||
|
||||
} // namespace archive
|
||||
|
||||
@@ -27,9 +27,10 @@
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
||||
#include <boost/serialization/type_info_implementation.hpp>
|
||||
#include <boost/serialization/shared_ptr_132.hpp>
|
||||
//#include <boost/serialization/shared_ptr_132.hpp>
|
||||
#include <boost/serialization/singleton.hpp>
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
|
||||
#include <boost/serialization/extended_type_info.hpp>
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include <boost/archive/detail/decl.hpp>
|
||||
|
||||
@@ -100,6 +101,26 @@ public:
|
||||
const unsigned int file_version
|
||||
);
|
||||
#endif
|
||||
template<class U>
|
||||
struct non_polymorphic {
|
||||
static const boost::serialization::extended_type_info *
|
||||
get_object_type(U & ){
|
||||
return & boost::serialization::singleton<
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
boost::serialization::type_info_implementation< U >::type
|
||||
>::get_const_instance();
|
||||
}
|
||||
};
|
||||
template<class U>
|
||||
struct polymorphic {
|
||||
static const boost::serialization::extended_type_info *
|
||||
get_object_type(U & u){
|
||||
return boost::serialization::singleton<
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
boost::serialization::type_info_implementation< U >::type
|
||||
>::get_const_instance().get_derived_extended_type_info(u);
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
template<class T>
|
||||
@@ -112,30 +133,12 @@ public:
|
||||
= & boost::serialization::type_info_implementation< T >::type
|
||||
::get_const_instance();
|
||||
|
||||
struct non_polymorphic {
|
||||
static const boost::serialization::extended_type_info *
|
||||
get_object_type(T &){
|
||||
return & boost::serialization::singleton<
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
boost::serialization::type_info_implementation< T >::type
|
||||
>::get_const_instance();
|
||||
}
|
||||
};
|
||||
struct polymorphic {
|
||||
static const boost::serialization::extended_type_info *
|
||||
get_object_type(T & t){
|
||||
return boost::serialization::singleton<
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
boost::serialization::type_info_implementation< T >::type
|
||||
>::get_const_instance().get_derived_extended_type_info(t);
|
||||
}
|
||||
};
|
||||
// get pointer to the most derived object's eti. This is effectively
|
||||
// the object type identifer
|
||||
typedef BOOST_DEDUCED_TYPENAME mpl::if_<
|
||||
is_polymorphic< T >,
|
||||
polymorphic,
|
||||
non_polymorphic
|
||||
polymorphic<T>,
|
||||
non_polymorphic<T>
|
||||
>::type type;
|
||||
|
||||
const boost::serialization::extended_type_info * true_type
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
#include <memory>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user