finally?! fixed problem with failing xml_warchive

This commit is contained in:
Robert Ramey
2014-12-12 15:55:02 -08:00
parent fb61aeea5c
commit a702dcb76f
12 changed files with 39 additions and 56 deletions

View File

@@ -56,9 +56,6 @@ namespace std{
namespace boost {
namespace archive {
template<class Ch>
class codecvt_null;
/////////////////////////////////////////////////////////////////////////
// class basic_text_iarchive - load serialized objects from a input text stream
#if defined(_MSC_VER)
@@ -74,7 +71,6 @@ protected:
io::ios_precision_saver precision_saver;
#ifndef BOOST_NO_STD_LOCALE
boost::scoped_ptr<codecvt_null<typename IStream::char_type> > codecvt_facet;
boost::scoped_ptr<std::locale> archive_locale;
basic_streambuf_locale_saver<
typename IStream::char_type,

View File

@@ -61,11 +61,6 @@ namespace std{
namespace boost {
namespace archive {
template<class Ch>
class codecvt_null;
class save_access;
/////////////////////////////////////////////////////////////////////////
// class basic_text_oprimitive - output of prmitives to stream
template<class OStream>
@@ -77,7 +72,6 @@ protected:
io::ios_precision_saver precision_saver;
#ifndef BOOST_NO_STD_LOCALE
boost::scoped_ptr<codecvt_null<typename OStream::char_type> > codecvt_facet;
boost::scoped_ptr<std::locale> archive_locale;
basic_streambuf_locale_saver<
typename OStream::char_type,

View File

@@ -155,9 +155,13 @@ basic_binary_iprimitive<Archive, Elem, Tr>::basic_binary_iprimitive(
locale_saver(m_sb)
{
if(! no_codecvt){
codecvt_facet.reset(new codecvt_null<Elem>(1));
archive_locale.reset(add_facet(std::locale::classic(),codecvt_facet.get()));
m_sb.pubimbue(* archive_locale);
archive_locale.reset(
add_facet(
std::locale::classic(),
new codecvt_null<Elem>
)
);
//m_sb.pubimbue(* archive_locale);
}
}
#else

View File

@@ -106,9 +106,13 @@ basic_binary_oprimitive<Archive, Elem, Tr>::basic_binary_oprimitive(
locale_saver(m_sb)
{
if(! no_codecvt){
codecvt_facet.reset(new codecvt_null<Elem>(1));
archive_locale.reset(add_facet(std::locale::classic(),codecvt_facet.get()));
m_sb.pubimbue(* archive_locale);
archive_locale.reset(
add_facet(
std::locale::classic(),
new codecvt_null<Elem>
)
);
//m_sb.pubimbue(* archive_locale);
}
}
#else

View File

@@ -124,11 +124,13 @@ basic_text_iprimitive<IStream>::basic_text_iprimitive(
locale_saver(* is_.rdbuf())
{
if(! no_codecvt){
codecvt_facet.reset(new boost::archive::codecvt_null<typename IStream::char_type>(1));
archive_locale.reset(
add_facet(std::locale::classic(),codecvt_facet.get())
add_facet(
std::locale::classic(),
new boost::archive::codecvt_null<typename IStream::char_type>
)
);
is.imbue(* archive_locale);
//is.imbue(* archive_locale);
}
is >> std::noboolalpha;
}

View File

@@ -87,13 +87,13 @@ basic_text_oprimitive<OStream>::basic_text_oprimitive(
locale_saver(* os_.rdbuf())
{
if(! no_codecvt){
// note usage of argument "1" so that the locale isn't
// automatically delete the facet
codecvt_facet.reset(new codecvt_null<typename OStream::char_type>(1));
archive_locale.reset(
add_facet(std::locale::classic(),codecvt_facet.get())
add_facet(
std::locale::classic(),
new boost::archive::codecvt_null<typename OStream::char_type>
)
);
os.imbue(* archive_locale);
//os.imbue(* archive_locale);
}
os << std::noboolalpha;
}

View File

@@ -167,15 +167,18 @@ xml_wiarchive_impl<Archive>::xml_wiarchive_impl(
true // don't change the codecvt - use the one below
),
basic_xml_iarchive<Archive>(flags),
locale_saver(*is_.rdbuf()),
gimpl(new xml_wgrammar())
{
if(0 == (flags & no_codecvt)){
// note usage of argument "1" so that the locale isn't
// automatically delete the facet
codecvt_facet.reset(new boost::archive::detail::utf8_codecvt_facet(1));
archive_locale.reset(add_facet(is_.getloc(), codecvt_facet.get()));
is.imbue(* archive_locale);
archive_locale.reset(
add_facet(
is_.getloc(),
new boost::archive::detail::utf8_codecvt_facet
)
);
//is.imbue(* archive_locale);
}
if(0 == (flags & no_header))
init();

View File

@@ -128,8 +128,7 @@ xml_woarchive_impl<Archive>::xml_woarchive_impl(
os_,
true // don't change the codecvt - use the one below
),
basic_xml_oarchive<Archive>(flags),
locale_saver(*os_.rdbuf())
basic_xml_oarchive<Archive>(flags)
{
// Standard behavior is that imbue can be called
// a) before output is invoked or
@@ -137,9 +136,13 @@ xml_woarchive_impl<Archive>::xml_woarchive_impl(
// transforms (such as one to many transforms from getting
// mixed up.
if(0 == (flags & no_codecvt)){
codecvt_facet.reset(new boost::archive::detail::utf8_codecvt_facet(1));
archive_locale.reset(add_facet(os_.getloc(), codecvt_facet.get()));
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();

View File

@@ -70,14 +70,6 @@ protected:
friend class load_access;
#endif
#endif
#ifndef BOOST_NO_STD_LOCALE
boost::scoped_ptr<detail::utf8_codecvt_facet> codecvt_facet;
boost::scoped_ptr<std::locale> archive_locale;
basic_streambuf_locale_saver<
typename std::wistream::char_type,
typename std::wistream::traits_type
> locale_saver;
#endif
boost::scoped_ptr<xml_wgrammar> gimpl;
std::wistream & get_is(){
return is;

View File

@@ -73,17 +73,9 @@ protected:
friend class save_access;
#endif
#endif
#ifndef BOOST_NO_STD_LOCALE
boost::scoped_ptr<detail::utf8_codecvt_facet> codecvt_facet;
boost::scoped_ptr<std::locale> archive_locale;
basic_streambuf_locale_saver<
typename std::wostream::char_type,
typename std::wostream::traits_type
> locale_saver;
//void end_preamble(){
// basic_xml_oarchive<Archive>::end_preamble();
//}
#endif
template<class T>
void
save(const T & t){