summaryrefslogtreecommitdiff
path: root/boost/archive
diff options
context:
space:
mode:
Diffstat (limited to 'boost/archive')
-rw-r--r--boost/archive/basic_binary_iprimitive.hpp9
-rw-r--r--boost/archive/basic_binary_oprimitive.hpp4
-rw-r--r--boost/archive/basic_streambuf_locale_saver.hpp8
-rw-r--r--boost/archive/basic_text_oarchive.hpp2
-rw-r--r--boost/archive/basic_text_oprimitive.hpp2
-rw-r--r--boost/archive/basic_xml_oarchive.hpp4
-rw-r--r--boost/archive/codecvt_null.hpp4
-rw-r--r--boost/archive/detail/basic_archive_impl.hpp3
-rw-r--r--boost/archive/detail/basic_iarchive.hpp8
-rw-r--r--boost/archive/detail/basic_oarchive.hpp8
-rw-r--r--boost/archive/detail/helper_collection.hpp40
-rw-r--r--boost/archive/detail/iserializer.hpp2
-rw-r--r--boost/archive/detail/register_archive.hpp2
-rw-r--r--boost/archive/impl/basic_binary_iarchive.ipp5
-rw-r--r--boost/archive/impl/basic_binary_iprimitive.ipp12
-rw-r--r--boost/archive/impl/basic_binary_oprimitive.ipp11
-rw-r--r--boost/archive/impl/basic_text_iprimitive.ipp7
-rw-r--r--boost/archive/impl/basic_text_oprimitive.ipp7
-rw-r--r--boost/archive/impl/basic_xml_oarchive.ipp2
-rw-r--r--boost/archive/impl/xml_iarchive_impl.ipp17
-rw-r--r--boost/archive/impl/xml_wiarchive_impl.ipp37
-rw-r--r--boost/archive/impl/xml_woarchive_impl.ipp42
-rw-r--r--boost/archive/iterators/transform_width.hpp1
-rw-r--r--boost/archive/shared_ptr_helper.hpp219
-rw-r--r--boost/archive/xml_iarchive.hpp8
-rw-r--r--boost/archive/xml_wiarchive.hpp18
-rw-r--r--boost/archive/xml_woarchive.hpp14
27 files changed, 121 insertions, 375 deletions
diff --git a/boost/archive/basic_binary_iprimitive.hpp b/boost/archive/basic_binary_iprimitive.hpp
index 2e72a1c6fa..4b4199126b 100644
--- a/boost/archive/basic_binary_iprimitive.hpp
+++ b/boost/archive/basic_binary_iprimitive.hpp
@@ -49,17 +49,21 @@ namespace std{
#include <boost/integer.hpp>
#include <boost/integer_traits.hpp>
-#include <boost/archive/basic_streambuf_locale_saver.hpp>
-#include <boost/archive/archive_exception.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/serialization/is_bitwise_serializable.hpp>
#include <boost/serialization/array.hpp>
+
+#include <boost/archive/basic_streambuf_locale_saver.hpp>
+#include <boost/archive/archive_exception.hpp>
#include <boost/archive/detail/auto_link_archive.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
namespace archive {
+template<class Ch>
+class codecvt_null;
+
/////////////////////////////////////////////////////////////////////////////
// class binary_iarchive - read serialized objects from a input binary stream
template<class Archive, class Elem, class Tr>
@@ -78,6 +82,7 @@ public:
}
#ifndef BOOST_NO_STD_LOCALE
+ boost::scoped_ptr<codecvt_null<Elem> > codecvt_facet;
boost::scoped_ptr<std::locale> archive_locale;
basic_streambuf_locale_saver<Elem, Tr> locale_saver;
#endif
diff --git a/boost/archive/basic_binary_oprimitive.hpp b/boost/archive/basic_binary_oprimitive.hpp
index ba070cd39a..a79cd1dacb 100644
--- a/boost/archive/basic_binary_oprimitive.hpp
+++ b/boost/archive/basic_binary_oprimitive.hpp
@@ -54,6 +54,9 @@ namespace std{
namespace boost {
namespace archive {
+template<class Ch>
+class codecvt_null;
+
/////////////////////////////////////////////////////////////////////////
// class basic_binary_oprimitive - binary output of prmitives
@@ -71,6 +74,7 @@ public:
return static_cast<Archive *>(this);
}
#ifndef BOOST_NO_STD_LOCALE
+ boost::scoped_ptr<codecvt_null<Elem> > codecvt_facet;
boost::scoped_ptr<std::locale> archive_locale;
basic_streambuf_locale_saver<Elem, Tr> locale_saver;
#endif
diff --git a/boost/archive/basic_streambuf_locale_saver.hpp b/boost/archive/basic_streambuf_locale_saver.hpp
index 6bf8f715cb..64c8e5d314 100644
--- a/boost/archive/basic_streambuf_locale_saver.hpp
+++ b/boost/archive/basic_streambuf_locale_saver.hpp
@@ -7,7 +7,7 @@
#endif
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
-// basic_streambuf_local_saver.hpp
+// basic_streambuf_locale_saver.hpp
// (C) Copyright 2005 Robert Ramey - http://www.rrsd.com
@@ -55,8 +55,10 @@ public:
{}
~basic_streambuf_locale_saver()
{ this->restore(); }
- void restore()
- { s_save_.pubimbue( a_save_ ); }
+ void restore(){
+ s_save_.pubsync();
+ s_save_.pubimbue( a_save_ );
+ }
private:
state_type & s_save_;
aspect_type const a_save_;
diff --git a/boost/archive/basic_text_oarchive.hpp b/boost/archive/basic_text_oarchive.hpp
index bed9cd34d6..0c60a310f0 100644
--- a/boost/archive/basic_text_oarchive.hpp
+++ b/boost/archive/basic_text_oarchive.hpp
@@ -24,11 +24,9 @@
// in such cases. So we can't use basic_ostream<OStream::char_type> but rather
// use two template parameters
-#include <boost/assert.hpp>
#include <boost/config.hpp>
#include <boost/serialization/pfto.hpp>
#include <boost/detail/workaround.hpp>
-
#include <boost/archive/detail/common_oarchive.hpp>
#include <boost/serialization/string.hpp>
diff --git a/boost/archive/basic_text_oprimitive.hpp b/boost/archive/basic_text_oprimitive.hpp
index 73a0a62e56..3c4cb5bddb 100644
--- a/boost/archive/basic_text_oprimitive.hpp
+++ b/boost/archive/basic_text_oprimitive.hpp
@@ -61,8 +61,6 @@ namespace std{
namespace boost {
namespace archive {
-class save_access;
-
/////////////////////////////////////////////////////////////////////////
// class basic_text_oprimitive - output of prmitives to stream
template<class OStream>
diff --git a/boost/archive/basic_xml_oarchive.hpp b/boost/archive/basic_xml_oarchive.hpp
index c986833c27..8a039fa16d 100644
--- a/boost/archive/basic_xml_oarchive.hpp
+++ b/boost/archive/basic_xml_oarchive.hpp
@@ -17,6 +17,9 @@
// See http://www.boost.org for updates, documentation, and revision history.
#include <boost/config.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/serialization/pfto.hpp>
+#include <boost/detail/workaround.hpp>
#include <boost/archive/detail/common_oarchive.hpp>
@@ -24,7 +27,6 @@
#include <boost/serialization/tracking.hpp>
#include <boost/serialization/string.hpp>
-#include <boost/mpl/assert.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
diff --git a/boost/archive/codecvt_null.hpp b/boost/archive/codecvt_null.hpp
index caeefee5c0..75387a970e 100644
--- a/boost/archive/codecvt_null.hpp
+++ b/boost/archive/codecvt_null.hpp
@@ -87,6 +87,10 @@ class codecvt_null<wchar_t> : public std::codecvt<wchar_t, char, std::mbstate_t>
virtual int do_max_length( ) const throw( ){
return do_encoding();
}
+public:
+ explicit codecvt_null(std::size_t no_locale_manage = 0) :
+ std::codecvt<wchar_t, char, std::mbstate_t>(no_locale_manage)
+ {}
};
} // namespace archive
diff --git a/boost/archive/detail/basic_archive_impl.hpp b/boost/archive/detail/basic_archive_impl.hpp
index b84a509837..860066f89f 100644
--- a/boost/archive/detail/basic_archive_impl.hpp
+++ b/boost/archive/detail/basic_archive_impl.hpp
@@ -16,9 +16,6 @@
// See http://www.boost.org for updates, documentation, and revision history.
-// can't use this - much as I'd like to as borland doesn't support it
-// #include <boost/scoped_ptr.hpp>
-
#include <set>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
diff --git a/boost/archive/detail/basic_iarchive.hpp b/boost/archive/detail/basic_iarchive.hpp
index fdafbbf841..ce8dbc0793 100644
--- a/boost/archive/detail/basic_iarchive.hpp
+++ b/boost/archive/detail/basic_iarchive.hpp
@@ -17,10 +17,10 @@
// See http://www.boost.org for updates, documentation, and revision history.
// can't use this - much as I'd like to as borland doesn't support it
-// #include <boost/scoped_ptr.hpp>
#include <boost/config.hpp>
#include <boost/noncopyable.hpp>
+#include <boost/scoped_ptr.hpp>
#include <boost/serialization/tracking_enum.hpp>
#include <boost/archive/basic_archive.hpp>
@@ -47,9 +47,7 @@ class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iarchive :
{
friend class basic_iarchive_impl;
// hide implementation of this class to minimize header conclusion
- // in client code. I couldn't used scoped pointer with borland
- // boost::scoped_ptr<basic_iarchive_impl> pimpl;
- basic_iarchive_impl * pimpl;
+ boost::scoped_ptr<basic_iarchive_impl> pimpl;
virtual void vload(version_type &t) = 0;
virtual void vload(object_id_type &t) = 0;
@@ -59,12 +57,12 @@ class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iarchive :
virtual void vload(tracking_type &t) = 0;
protected:
basic_iarchive(unsigned int flags);
+public:
// account for bogus gcc warning
#if defined(__GNUC__)
virtual
#endif
~basic_iarchive();
-public:
// note: NOT part of the public API.
void next_object_pointer(void *t);
void register_basic_serializer(
diff --git a/boost/archive/detail/basic_oarchive.hpp b/boost/archive/detail/basic_oarchive.hpp
index f65d11036c..fe192f0ab3 100644
--- a/boost/archive/detail/basic_oarchive.hpp
+++ b/boost/archive/detail/basic_oarchive.hpp
@@ -19,9 +19,7 @@
#include <cstddef> // NULL
#include <boost/config.hpp>
#include <boost/noncopyable.hpp>
-
-// can't use this - much as I'd like to as borland doesn't support it
-// #include <boost/scoped_ptr.hpp>
+#include <boost/scoped_ptr.hpp>
#include <boost/archive/basic_archive.hpp>
#include <boost/serialization/tracking_enum.hpp>
@@ -48,9 +46,7 @@ class BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oarchive :
{
friend class basic_oarchive_impl;
// hide implementation of this class to minimize header conclusion
- // in client code. note: borland can't use scoped_ptr
- //boost::scoped_ptr<basic_oarchive_impl> pimpl;
- basic_oarchive_impl * pimpl;
+ boost::scoped_ptr<basic_oarchive_impl> pimpl;
// overload these to bracket object attributes. Used to implement
// xml archives
diff --git a/boost/archive/detail/helper_collection.hpp b/boost/archive/detail/helper_collection.hpp
index c01656777d..cfa644f7d4 100644
--- a/boost/archive/detail/helper_collection.hpp
+++ b/boost/archive/detail/helper_collection.hpp
@@ -24,10 +24,8 @@
#include <boost/config.hpp>
-#ifdef BOOST_NO_CXX11_SMART_PTR
- #include <boost/smart_ptr/shared_ptr.hpp>
- #include <boost/smart_ptr/make_shared.hpp>
-#endif
+#include <boost/smart_ptr/shared_ptr.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
namespace boost {
@@ -42,25 +40,17 @@ class helper_collection
// note: we dont' actually "share" the function object pointer
// we only use shared_ptr to make sure that it get's deleted
- #ifndef BOOST_NO_CXX11_SMART_PTR
- typedef std::pair<
- const void *,
- std::shared_ptr<void>
- > helper_value_type;
- template<class T>
- std::shared_ptr<void> make_helper_ptr(){
- return std::make_shared<T>();
- }
- #else
- typedef std::pair<
- const void *,
- boost::shared_ptr<void>
- > helper_value_type;
- template<class T>
- boost::shared_ptr<void> make_helper_ptr(){
- return boost::make_shared<T>();
- }
- #endif
+ typedef std::pair<
+ const void *,
+ boost::shared_ptr<void>
+ > helper_value_type;
+ template<class T>
+ boost::shared_ptr<void> make_helper_ptr(){
+ // use boost::shared_ptr rather than std::shared_ptr to maintain
+ // c++03 compatibility
+ return boost::make_shared<T>();
+ }
+
typedef std::vector<helper_value_type> collection;
collection m_collection;
@@ -69,6 +59,7 @@ class helper_collection
bool operator()(helper_value_type const &rhs) const {
return m_ti == rhs.first;
}
+ predicate & operator=(const void * ti); // to suppress warning
predicate(const void * ti) :
m_ti(ti)
{}
@@ -79,7 +70,6 @@ protected:
public:
template<typename Helper>
Helper& get_helper(void * const id = 0) {
-
collection::const_iterator it =
std::find_if(
m_collection.begin(),
@@ -87,7 +77,7 @@ public:
predicate(id)
);
- void * rval;
+ void * rval = 0;
if(it == m_collection.end()){
m_collection.push_back(
std::make_pair(id, make_helper_ptr<Helper>())
diff --git a/boost/archive/detail/iserializer.hpp b/boost/archive/detail/iserializer.hpp
index 42d00a3350..65dfe8e305 100644
--- a/boost/archive/detail/iserializer.hpp
+++ b/boost/archive/detail/iserializer.hpp
@@ -40,7 +40,7 @@ namespace std{
#include <boost/mpl/greater_equal.hpp>
#include <boost/mpl/equal_to.hpp>
#include <boost/mpl/bool.hpp>
-#include <boost/detail/no_exceptions_support.hpp>
+#include <boost/core/no_exceptions_support.hpp>
#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO
#include <boost/serialization/extended_type_info_typeid.hpp>
diff --git a/boost/archive/detail/register_archive.hpp b/boost/archive/detail/register_archive.hpp
index 81a19b9cf5..5ffecc702c 100644
--- a/boost/archive/detail/register_archive.hpp
+++ b/boost/archive/detail/register_archive.hpp
@@ -28,7 +28,7 @@ struct _ptr_serialization_support
typedef int type;
};
-#ifdef __SUNPRO_CC
+#if defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x5130)
template<int N>
struct counter : counter<N-1> {};
diff --git a/boost/archive/impl/basic_binary_iarchive.ipp b/boost/archive/impl/basic_binary_iarchive.ipp
index b8e7f454c5..5067b09819 100644
--- a/boost/archive/impl/basic_binary_iarchive.ipp
+++ b/boost/archive/impl/basic_binary_iarchive.ipp
@@ -53,7 +53,7 @@ basic_binary_iarchive<Archive>::init(){
std::string file_signature;
#if 0 // commented out since it interfers with derivation
- try {
+ BOOST_TRY {
std::size_t l;
this->This()->load(l);
if(l == std::strlen(BOOST_ARCHIVE_SIGNATURE())) {
@@ -67,10 +67,11 @@ basic_binary_iarchive<Archive>::init(){
this->This()->load_binary(&(*file_signature.begin()), l);
}
}
- catch(archive_exception const &) { // catch stream_error archive exceptions
+ BOOST_CATCH(archive_exception const &) { // catch stream_error archive exceptions
// will cause invalid_signature archive exception to be thrown below
file_signature = "";
}
+ BOOST_CATCH_END
#else
// https://svn.boost.org/trac/boost/ticket/7301
* this->This() >> file_signature;
diff --git a/boost/archive/impl/basic_binary_iprimitive.ipp b/boost/archive/impl/basic_binary_iprimitive.ipp
index 9e2340eb2d..e22c3bd66b 100644
--- a/boost/archive/impl/basic_binary_iprimitive.ipp
+++ b/boost/archive/impl/basic_binary_iprimitive.ipp
@@ -23,8 +23,8 @@ namespace std{
#include <boost/detail/workaround.hpp> // fixup for RogueWave
#include <boost/serialization/throw_exception.hpp>
-#include <boost/scoped_ptr.hpp>
+#include <boost/core/no_exceptions_support.hpp>
#include <boost/archive/archive_exception.hpp>
#include <boost/archive/codecvt_null.hpp>
#include <boost/archive/add_facet.hpp>
@@ -152,17 +152,16 @@ basic_binary_iprimitive<Archive, Elem, Tr>::basic_binary_iprimitive(
) :
#ifndef BOOST_NO_STD_LOCALE
m_sb(sb),
- archive_locale(NULL),
locale_saver(m_sb)
{
if(! no_codecvt){
archive_locale.reset(
- boost::archive::add_facet(
+ add_facet(
std::locale::classic(),
new codecvt_null<Elem>
)
);
- m_sb.pubimbue(* archive_locale);
+ //m_sb.pubimbue(* archive_locale);
}
}
#else
@@ -199,11 +198,12 @@ BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
basic_binary_iprimitive<Archive, Elem, Tr>::~basic_binary_iprimitive(){
// push back unread characters
//destructor can't throw !
- try{
+ BOOST_TRY{
static_cast<detail::input_streambuf_access<Elem, Tr> &>(m_sb).sync();
}
- catch(...){
+ BOOST_CATCH(...){
}
+ BOOST_CATCH_END
}
} // namespace archive
diff --git a/boost/archive/impl/basic_binary_oprimitive.ipp b/boost/archive/impl/basic_binary_oprimitive.ipp
index 509decb4e6..238617d5ed 100644
--- a/boost/archive/impl/basic_binary_oprimitive.ipp
+++ b/boost/archive/impl/basic_binary_oprimitive.ipp
@@ -32,6 +32,7 @@ namespace std{ using ::wcslen; }
#include <boost/archive/add_facet.hpp>
#include <boost/archive/codecvt_null.hpp>
#include <boost/archive/basic_binary_oprimitive.hpp>
+#include <boost/core/no_exceptions_support.hpp>
namespace boost {
namespace archive {
@@ -103,17 +104,16 @@ basic_binary_oprimitive<Archive, Elem, Tr>::basic_binary_oprimitive(
) :
#ifndef BOOST_NO_STD_LOCALE
m_sb(sb),
- archive_locale(NULL),
locale_saver(m_sb)
{
if(! no_codecvt){
archive_locale.reset(
add_facet(
- std::locale::classic(),
+ std::locale::classic(),
new codecvt_null<Elem>
)
);
- m_sb.pubimbue(* archive_locale);
+ //m_sb.pubimbue(* archive_locale);
}
}
#else
@@ -150,11 +150,12 @@ BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
basic_binary_oprimitive<Archive, Elem, Tr>::~basic_binary_oprimitive(){
// flush buffer
//destructor can't throw
- try{
+ BOOST_TRY{
static_cast<detail::output_streambuf_access<Elem, Tr> &>(m_sb).sync();
}
- catch(...){
+ BOOST_CATCH(...){
}
+ BOOST_CATCH_END
}
} // namespace archive
diff --git a/boost/archive/impl/basic_text_iprimitive.ipp b/boost/archive/impl/basic_text_iprimitive.ipp
index ee52edec5a..9b66789698 100644
--- a/boost/archive/impl/basic_text_iprimitive.ipp
+++ b/boost/archive/impl/basic_text_iprimitive.ipp
@@ -121,17 +121,16 @@ basic_text_iprimitive<IStream>::basic_text_iprimitive(
is(is_),
flags_saver(is_),
precision_saver(is_),
- archive_locale(NULL),
locale_saver(* is_.rdbuf())
{
if(! no_codecvt){
archive_locale.reset(
add_facet(
- std::locale::classic(),
- new codecvt_null<typename IStream::char_type>
+ std::locale::classic(),
+ new boost::archive::codecvt_null<typename IStream::char_type>
)
);
- is.imbue(* archive_locale);
+ //is.imbue(* archive_locale);
}
is >> std::noboolalpha;
}
diff --git a/boost/archive/impl/basic_text_oprimitive.ipp b/boost/archive/impl/basic_text_oprimitive.ipp
index 33ab4a8b65..10e2133840 100644
--- a/boost/archive/impl/basic_text_oprimitive.ipp
+++ b/boost/archive/impl/basic_text_oprimitive.ipp
@@ -84,17 +84,16 @@ basic_text_oprimitive<OStream>::basic_text_oprimitive(
os(os_),
flags_saver(os_),
precision_saver(os_),
- archive_locale(NULL),
locale_saver(* os_.rdbuf())
{
if(! no_codecvt){
archive_locale.reset(
add_facet(
- std::locale::classic(),
- new codecvt_null<typename OStream::char_type>
+ std::locale::classic(),
+ new boost::archive::codecvt_null<typename OStream::char_type>
)
);
- os.imbue(* archive_locale);
+ //os.imbue(* archive_locale);
}
os << std::noboolalpha;
}
diff --git a/boost/archive/impl/basic_xml_oarchive.ipp b/boost/archive/impl/basic_xml_oarchive.ipp
index e2cc8d4d5e..0c57a12c90 100644
--- a/boost/archive/impl/basic_xml_oarchive.ipp
+++ b/boost/archive/impl/basic_xml_oarchive.ipp
@@ -20,7 +20,7 @@ namespace std{
#include <boost/archive/basic_xml_archive.hpp>
#include <boost/archive/basic_xml_oarchive.hpp>
#include <boost/archive/xml_archive_exception.hpp>
-#include <boost/detail/no_exceptions_support.hpp>
+#include <boost/core/no_exceptions_support.hpp>
namespace boost {
namespace archive {
diff --git a/boost/archive/impl/xml_iarchive_impl.ipp b/boost/archive/impl/xml_iarchive_impl.ipp
index dc62eed331..89e09818d8 100644
--- a/boost/archive/impl/xml_iarchive_impl.ipp
+++ b/boost/archive/impl/xml_iarchive_impl.ipp
@@ -31,7 +31,7 @@ namespace std{
#include <boost/archive/dinkumware.hpp>
#endif
-#include <boost/detail/no_exceptions_support.hpp>
+#include <boost/core/no_exceptions_support.hpp>
#include <boost/archive/xml_archive_exception.hpp>
#include <boost/archive/iterators/dataflow_exception.hpp>
@@ -174,18 +174,8 @@ xml_iarchive_impl<Archive>::xml_iarchive_impl(
basic_xml_iarchive<Archive>(flags),
gimpl(new xml_grammar())
{
- if(0 == (flags & no_header)){
- BOOST_TRY{
- init();
- }
- BOOST_CATCH(...){
- delete gimpl;
- #ifndef BOOST_NO_EXCEPTIONS
- throw; // re-throw
- #endif
- }
- BOOST_CATCH_END
- }
+ if(0 == (flags & no_header))
+ init();
}
template<class Archive>
@@ -198,7 +188,6 @@ xml_iarchive_impl<Archive>::~xml_iarchive_impl(){
BOOST_CATCH(...){}
BOOST_CATCH_END
}
- delete gimpl;
}
} // namespace archive
} // namespace boost
diff --git a/boost/archive/impl/xml_wiarchive_impl.ipp b/boost/archive/impl/xml_wiarchive_impl.ipp
index a4665ad4ce..257b57590d 100644
--- a/boost/archive/impl/xml_wiarchive_impl.ipp
+++ b/boost/archive/impl/xml_wiarchive_impl.ipp
@@ -27,26 +27,18 @@ namespace std{
#endif
#include <boost/io/ios_state.hpp>
-#include <boost/detail/no_exceptions_support.hpp>
+#include <boost/core/no_exceptions_support.hpp>
#include <boost/serialization/pfto.hpp>
-
#include <boost/serialization/string.hpp>
+
+#include <boost/archive/basic_xml_archive.hpp>
+#include <boost/archive/xml_wiarchive.hpp>
+
#include <boost/archive/add_facet.hpp>
-#ifndef BOOST_NO_CXX11_HDR_CODECVT
- #include <codecvt>
- namespace boost { namespace archive { namespace detail {
- typedef std::codecvt_utf8<wchar_t> utf8_codecvt_facet;
- } } }
-#else
- #include <boost/archive/detail/utf8_codecvt_facet.hpp>
-#endif
#include <boost/archive/xml_archive_exception.hpp>
#include <boost/archive/iterators/mb_from_wchar.hpp>
-#include <boost/archive/basic_xml_archive.hpp>
-#include <boost/archive/xml_wiarchive.hpp>
-
#include "basic_xml_grammar.hpp"
namespace boost {
@@ -170,26 +162,18 @@ xml_wiarchive_impl<Archive>::xml_wiarchive_impl(
gimpl(new xml_wgrammar())
{
if(0 == (flags & no_codecvt)){
+ // note usage of argument "1" so that the locale isn't
+ // automatically delete the facet
archive_locale.reset(
add_facet(
is_.getloc(),
new boost::archive::detail::utf8_codecvt_facet
)
);
- is.imbue(* archive_locale);
- }
- if(0 == (flags & no_header)){
- BOOST_TRY{
- this->init();
- }
- BOOST_CATCH(...){
- delete gimpl;
- #ifndef BOOST_NO_EXCEPTIONS
- throw; // re-throw
- #endif
- }
- BOOST_CATCH_END
+ //is.imbue(* archive_locale);
}
+ if(0 == (flags & no_header))
+ init();
}
template<class Archive>
@@ -202,7 +186,6 @@ xml_wiarchive_impl<Archive>::~xml_wiarchive_impl(){
BOOST_CATCH(...){}
BOOST_CATCH_END
}
- delete gimpl;
}
} // namespace archive
diff --git a/boost/archive/impl/xml_woarchive_impl.ipp b/boost/archive/impl/xml_woarchive_impl.ipp
index 6092a91524..1e5139bc40 100644
--- a/boost/archive/impl/xml_woarchive_impl.ipp
+++ b/boost/archive/impl/xml_woarchive_impl.ipp
@@ -29,8 +29,8 @@ namespace std{
} // namespace std
#endif
+#include <boost/archive/xml_woarchive.hpp>
#include <boost/serialization/throw_exception.hpp>
-#include <boost/serialization/pfto.hpp>
#include <boost/archive/iterators/xml_escape.hpp>
#include <boost/archive/iterators/wchar_from_mb.hpp>
@@ -38,14 +38,6 @@ namespace std{
#include <boost/archive/iterators/dataflow_exception.hpp>
#include <boost/archive/add_facet.hpp>
-#ifndef BOOST_NO_CXX11_HDR_CODECVT
- #include <codecvt>
- namespace boost { namespace archive { namespace detail {
- typedef std::codecvt_utf8<wchar_t> utf8_codecvt_facet;
- } } }
-#else
- #include <boost/archive/detail/utf8_codecvt_facet.hpp>
-#endif
namespace boost {
namespace archive {
@@ -136,31 +128,23 @@ xml_woarchive_impl<Archive>::xml_woarchive_impl(
// transforms (such as one to many transforms from getting
// mixed up.
if(0 == (flags & no_codecvt)){
- boost::archive::detail::utf8_codecvt_facet *pfacet;
- #if defined(__SGI_STL_PORT)
- // Unfortunately, STLPort doesn't respect b) above
- // so the restoration of the original archive locale done by
- // the locale_saver doesn't get processed,
- // before the current one is destroyed.
- // so the codecvt doesn't get replaced with the orginal
- // so closing the stream invokes codecvt::do_unshift
- // so it crashes because the corresponding locale that contained
- // the codecvt isn't around any more.
- // we can hack around this by using a static codecvt that never
- // gets destroyed.
- static boost::archive::detail::utf8_codecvt_facet
- facet(static_cast<size_t>(1));
- pfacet = & facet;
- #else
- pfacet = new boost::archive::detail::utf8_codecvt_facet;
- #endif
- archive_locale.reset(add_facet(os_.getloc(), pfacet));
- os.imbue(* archive_locale);
+ archive_locale.reset(
+ add_facet(
+ os_.getloc(),
+ new boost::archive::detail::utf8_codecvt_facet
+ )
+ );
+ //os.imbue(* archive_locale);
}
if(0 == (flags & no_header))
this->init();
}
+template<class Archive>
+BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY())
+xml_woarchive_impl<Archive>::~xml_woarchive_impl(){
+}
+
} // namespace archive
} // namespace boost
diff --git a/boost/archive/iterators/transform_width.hpp b/boost/archive/iterators/transform_width.hpp
index 4e11953bc5..15dd8dfc0e 100644
--- a/boost/archive/iterators/transform_width.hpp
+++ b/boost/archive/iterators/transform_width.hpp
@@ -124,6 +124,7 @@ public:
transform_width(const transform_width & rhs) :
super_t(rhs.base_reference()),
m_buffer_out_full(rhs.m_buffer_out_full),
+ m_buffer_out(rhs.m_buffer_out),
m_buffer_in(rhs.m_buffer_in),
m_remaining_bits(rhs.m_remaining_bits),
m_end_of_sequence(false)
diff --git a/boost/archive/shared_ptr_helper.hpp b/boost/archive/shared_ptr_helper.hpp
deleted file mode 100644
index 3df4605551..0000000000
--- a/boost/archive/shared_ptr_helper.hpp
+++ /dev/null
@@ -1,219 +0,0 @@
-#ifndef BOOST_ARCHIVE_SHARED_PTR_HELPER_HPP
-#define BOOST_ARCHIVE_SHARED_PTR_HELPER_HPP
-
-// MS compatible compilers support #pragma once
-#if defined(_MSC_VER)
-# pragma once
-#endif
-
-/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
-// shared_ptr_helper.hpp: serialization for boost shared pointern
-
-// (C) Copyright 2004-2009 Robert Ramey, Martin Ecker and Takatoshi Kondo
-// Use, modification and distribution is subject to the Boost Software
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org for updates, documentation, and revision history.
-
-#include <set>
-#include <list>
-#include <utility>
-#include <cstddef> // NULL
-
-#include <boost/config.hpp>
-#include <boost/shared_ptr.hpp>
-
-#include <boost/type_traits/is_polymorphic.hpp>
-#include <boost/serialization/type_info_implementation.hpp>
-#include <boost/serialization/shared_ptr_132.hpp>
-#include <boost/serialization/throw_exception.hpp>
-
-#include <boost/archive/archive_exception.hpp>
-#include <boost/archive/detail/decl.hpp>
-
-#include <boost/archive/detail/abi_prefix.hpp> // must be the last headern
-
-namespace boost_132 {
- template<class T> class shared_ptr;
-}
-namespace boost {
- template<class T> class shared_ptr;
- namespace serialization {
- class extended_type_info;
- template<class Archive, class T>
- inline void load(
- Archive & ar,
- boost::shared_ptr< T > &t,
- const unsigned int file_version
- );
- }
-namespace archive{
-namespace detail {
-
-/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
-// a common class for holding various types of shared pointers
-
-class shared_ptr_helper {
- struct collection_type_compare {
- bool operator()(
- const shared_ptr<const void> &lhs,
- const shared_ptr<const void> &rhs
- )const{
- return lhs.get() < rhs.get();
- }
- };
- typedef std::set<
- boost::shared_ptr<const void>,
- collection_type_compare
- > collection_type;
- typedef collection_type::const_iterator iterator_type;
- // list of shared_pointers create accessable by raw pointer. This
- // is used to "match up" shared pointers loaded at different
- // points in the archive. Note, we delay construction until
- // it is actually used since this is by default included as
- // a "mix-in" even if shared_ptr isn't used.
- collection_type * m_pointers;
-
- struct null_deleter {
- void operator()(void const *) const {}
- };
-
- struct void_deleter {
- const boost::serialization::extended_type_info * m_eti;
- void_deleter(const boost::serialization::extended_type_info *eti) :
- m_eti(eti)
- {}
- void operator()(void *vp) const {
- m_eti->destroy(vp);
- }
- };
-
-#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
-public:
-#else
- template<class Archive, class T>
- friend inline void boost::serialization::load(
- Archive & ar,
- boost::shared_ptr< T > &t,
- const unsigned int file_version
- );
-#endif
-
-// #ifdef BOOST_SERIALIZATION_SHARED_PTR_132_HPP
- // list of loaded pointers. This is used to be sure that the pointers
- // stay around long enough to be "matched" with other pointers loaded
- // by the same archive. These are created with a "null_deleter" so that
- // when this list is destroyed - the underlaying raw pointers are not
- // destroyed. This has to be done because the pointers are also held by
- // new system which is disjoint from this set. This is implemented
- // by a change in load_construct_data below. It makes this file suitable
- // only for loading pointers into a 1.33 or later boost system.
- std::list<boost_132::shared_ptr<const void> > * m_pointers_132;
-// #endif
-
- // returns pointer to object and an indicator whether this is a
- // new entry (true) or a previous one (false)
- BOOST_ARCHIVE_DECL(shared_ptr<void>)
- get_od(
- const void * od,
- const boost::serialization::extended_type_info * true_type,
- const boost::serialization::extended_type_info * this_type
- );
-
- BOOST_ARCHIVE_DECL(void)
- append(const boost::shared_ptr<const void> &);
-
- template<class T>
- struct non_polymorphic {
- static const boost::serialization::extended_type_info *
- get_object_identifier(T &){
- return & boost::serialization::singleton<
- BOOST_DEDUCED_TYPENAME
- boost::serialization::type_info_implementation< T >::type
- >::get_const_instance();
- }
- };
- template<class T>
- struct polymorphic {
- static const boost::serialization::extended_type_info *
- get_object_identifier(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);
- }
- };
-public:
- template<class T>
- void reset(shared_ptr< T > & s, T * t){
- if(NULL == t){
- s.reset();
- return;
- }
- const boost::serialization::extended_type_info * this_type
- = & boost::serialization::type_info_implementation< T >::type
- ::get_const_instance();
-
- // get pointer to the most derived object. This is effectively
- // the object identifern
- typedef BOOST_DEDUCED_TYPENAME mpl::eval_if<
- is_polymorphic< T >,
- mpl::identity<polymorphic< T > >,
- mpl::identity<non_polymorphic< T > >
- >::type type;
-
- const boost::serialization::extended_type_info * true_type
- = type::get_object_identifier(*t);
-
- // note:if this exception is thrown, be sure that derived pointern
- // is either registered or exported.
- if(NULL == true_type)
- boost::serialization::throw_exception(
- archive_exception(
- archive_exception::unregistered_class,
- this_type->get_debug_info()
- )
- );
- shared_ptr<void> r =
- get_od(
- static_cast<const void *>(t),
- true_type,
- this_type
- );
- if(!r){
- s.reset(t);
- const void * od = void_downcast(
- *true_type,
- *this_type,
- static_cast<const void *>(t)
- );
- shared_ptr<const void> sp(s, od);
- append(sp);
- }
- else{
- s = shared_ptr< T >(
- r,
- static_cast<T *>(r.get())
- );
- }
- }
-
-// #ifdef BOOST_SERIALIZATION_SHARED_PTR_132_HPP
- BOOST_ARCHIVE_DECL(void)
- append(const boost_132::shared_ptr<const void> & t);
-// #endif
-public:
- BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
- shared_ptr_helper();
- BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
- ~shared_ptr_helper();
-};
-
-} // namespace detail
-} // namespace archive
-} // namespace boost
-
-#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
-
-#endif // BOOST_ARCHIVE_SHARED_PTR_HELPER_HPP
diff --git a/boost/archive/xml_iarchive.hpp b/boost/archive/xml_iarchive.hpp
index ba50d7cc48..ecaeeebe03 100644
--- a/boost/archive/xml_iarchive.hpp
+++ b/boost/archive/xml_iarchive.hpp
@@ -18,7 +18,7 @@
#include <istream>
-//#include <boost/scoped_ptr.hpp>
+#include <boost/scoped_ptr.hpp>
#include <boost/archive/detail/auto_link_archive.hpp>
#include <boost/archive/basic_text_iprimitive.hpp>
#include <boost/archive/basic_xml_iarchive.hpp>
@@ -64,10 +64,8 @@ protected:
friend class load_access;
#endif
#endif
- // instances of micro xml parser to parse start preambles
- // scoped_ptr doesn't play nice with borland - so use a naked pointer
- // scoped_ptr<xml_grammar> gimpl;
- xml_grammar *gimpl;
+ // use boost:scoped_ptr to implement automatic deletion;
+ boost::scoped_ptr<xml_grammar> gimpl;
std::istream & get_is(){
return is;
diff --git a/boost/archive/xml_wiarchive.hpp b/boost/archive/xml_wiarchive.hpp
index 31aff88ad0..a1baa1f8ab 100644
--- a/boost/archive/xml_wiarchive.hpp
+++ b/boost/archive/xml_wiarchive.hpp
@@ -23,13 +23,22 @@
#include <istream>
-//#include <boost/scoped_ptr.hpp>
+#include <boost/smart_ptr/scoped_ptr.hpp>
#include <boost/archive/detail/auto_link_warchive.hpp>
#include <boost/archive/basic_text_iprimitive.hpp>
#include <boost/archive/basic_xml_iarchive.hpp>
#include <boost/archive/detail/register_archive.hpp>
#include <boost/serialization/item_version_type.hpp>
+#ifdef BOOST_NO_CXX11_HDR_CODECVT
+ #include <boost/archive/detail/utf8_codecvt_facet.hpp>
+#else
+ #include <codecvt>
+ namespace boost { namespace archive { namespace detail {
+ typedef std::codecvt_utf8<wchar_t> utf8_codecvt_facet;
+ } } }
+#endif
+
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
#ifdef BOOST_MSVC
@@ -37,7 +46,7 @@
# pragma warning(disable : 4511 4512)
#endif
-namespace boost {
+namespace boost {
namespace archive {
namespace detail {
@@ -69,10 +78,7 @@ protected:
friend class load_access;
#endif
#endif
- // instances of micro xml parser to parse start preambles
- // scoped_ptr doesn't play nice with borland - so use a naked pointer
- // scoped_ptr<xml_wgrammar> gimpl;
- xml_wgrammar *gimpl;
+ boost::scoped_ptr<xml_wgrammar> gimpl;
std::wistream & get_is(){
return is;
}
diff --git a/boost/archive/xml_woarchive.hpp b/boost/archive/xml_woarchive.hpp
index 7fcaeb9634..338bf748b3 100644
--- a/boost/archive/xml_woarchive.hpp
+++ b/boost/archive/xml_woarchive.hpp
@@ -30,12 +30,22 @@ namespace std{
#include <ostream>
+#include <boost/smart_ptr/scoped_ptr.hpp>
#include <boost/archive/detail/auto_link_warchive.hpp>
#include <boost/archive/basic_text_oprimitive.hpp>
#include <boost/archive/basic_xml_oarchive.hpp>
#include <boost/archive/detail/register_archive.hpp>
#include <boost/serialization/item_version_type.hpp>
+#ifdef BOOST_NO_CXX11_HDR_CODECVT
+ #include <boost/archive/detail/utf8_codecvt_facet.hpp>
+#else
+ #include <codecvt>
+ namespace boost { namespace archive { namespace detail {
+ typedef std::codecvt_utf8<wchar_t> utf8_codecvt_facet;
+ } } }
+#endif
+
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
#ifdef BOOST_MSVC
@@ -71,7 +81,6 @@ protected:
friend class save_access;
#endif
#endif
-
//void end_preamble(){
// basic_xml_oarchive<Archive>::end_preamble();
//}
@@ -102,7 +111,8 @@ protected:
#endif
BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY())
xml_woarchive_impl(std::wostream & os, unsigned int flags);
- ~xml_woarchive_impl(){}
+ BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY())
+ ~xml_woarchive_impl();
public:
void
save_binary(const void *address, std::size_t count){