diff --git a/include/boost/archive/basic_xml_iarchive.hpp b/include/boost/archive/basic_xml_iarchive.hpp index 0a824b42..a882df56 100644 --- a/include/boost/archive/basic_xml_iarchive.hpp +++ b/include/boost/archive/basic_xml_iarchive.hpp @@ -17,15 +17,12 @@ // See http://www.boost.org for updates, documentation, and revision history. #include -//#include +#include #include - #include #include -#include - #include // must be the last header #ifdef BOOST_MSVC @@ -41,18 +38,18 @@ namespace detail { } // namespace detail ///////////////////////////////////////////////////////////////////////// -// class xml_iarchive - read serialized objects from a input text stream +// class basic_xml_iarchive - read serialized objects from a input text stream template class BOOST_SYMBOL_VISIBLE basic_xml_iarchive : public detail::common_iarchive { + unsigned int depth; #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS public: #else protected: friend class detail::interface_iarchive; #endif - unsigned int depth; BOOST_ARCHIVE_OR_WARCHIVE_DECL void load_start(const char *name); BOOST_ARCHIVE_OR_WARCHIVE_DECL void @@ -90,14 +87,15 @@ protected: // an xml archive. So we can skip it here. Note: we MUST override // it otherwise it will be loaded as a normal primitive w/o tag and // leaving the archive in an undetermined state - void load_override(class_id_optional_type & /* t */){} + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + load_override(class_id_type & t); + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + load_override(class_id_optional_type & /* t */){} BOOST_ARCHIVE_OR_WARCHIVE_DECL void load_override(object_id_type & t); BOOST_ARCHIVE_OR_WARCHIVE_DECL void load_override(version_type & t); BOOST_ARCHIVE_OR_WARCHIVE_DECL void - load_override(class_id_type & t); - BOOST_ARCHIVE_OR_WARCHIVE_DECL void load_override(tracking_type & t); // class_name_type can't be handled here as it depends upon the // char type used by the stream. So require the derived implementation diff --git a/include/boost/archive/basic_xml_oarchive.hpp b/include/boost/archive/basic_xml_oarchive.hpp index 33b139b4..55fb6cce 100644 --- a/include/boost/archive/basic_xml_oarchive.hpp +++ b/include/boost/archive/basic_xml_oarchive.hpp @@ -18,12 +18,9 @@ #include #include -//#include #include - #include -#include #include #include // must be the last header @@ -46,17 +43,16 @@ template class BOOST_SYMBOL_VISIBLE basic_xml_oarchive : public detail::common_oarchive { + // special stuff for xml output + unsigned int depth; + bool pending_preamble; #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS public: #else protected: friend class detail::interface_oarchive; #endif - friend class save_access; - // special stuff for xml output - unsigned int depth; bool indent_next; - bool pending_preamble; BOOST_ARCHIVE_OR_WARCHIVE_DECL void indent(); BOOST_ARCHIVE_OR_WARCHIVE_DECL void @@ -106,18 +102,18 @@ protected: // specific overrides for attributes - not name value pairs so we // want to trap them before the above "fall through" BOOST_ARCHIVE_OR_WARCHIVE_DECL void - save_override(const object_id_type & t); - BOOST_ARCHIVE_OR_WARCHIVE_DECL void - save_override(const object_reference_type & t); - BOOST_ARCHIVE_OR_WARCHIVE_DECL void - save_override(const version_type & t); - BOOST_ARCHIVE_OR_WARCHIVE_DECL void save_override(const class_id_type & t); BOOST_ARCHIVE_OR_WARCHIVE_DECL void save_override(const class_id_optional_type & t); BOOST_ARCHIVE_OR_WARCHIVE_DECL void save_override(const class_id_reference_type & t); BOOST_ARCHIVE_OR_WARCHIVE_DECL void + save_override(const object_id_type & t); + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + save_override(const object_reference_type & t); + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + save_override(const version_type & t); + BOOST_ARCHIVE_OR_WARCHIVE_DECL void save_override(const class_name_type & t); BOOST_ARCHIVE_OR_WARCHIVE_DECL void save_override(const tracking_type & t); diff --git a/include/boost/archive/impl/basic_xml_oarchive.ipp b/include/boost/archive/impl/basic_xml_oarchive.ipp index dd3cde8d..76917758 100644 --- a/include/boost/archive/impl/basic_xml_oarchive.ipp +++ b/include/boost/archive/impl/basic_xml_oarchive.ipp @@ -251,8 +251,8 @@ BOOST_ARCHIVE_OR_WARCHIVE_DECL basic_xml_oarchive::basic_xml_oarchive(unsigned int flags) : detail::common_oarchive(flags), depth(0), - indent_next(false), - pending_preamble(false) + pending_preamble(false), + indent_next(false) { } diff --git a/include/boost/archive/xml_oarchive.hpp b/include/boost/archive/xml_oarchive.hpp index fe4eaaa8..eea12680 100644 --- a/include/boost/archive/xml_oarchive.hpp +++ b/include/boost/archive/xml_oarchive.hpp @@ -87,11 +87,27 @@ protected: xml_oarchive_impl(std::ostream & os, unsigned int flags); BOOST_ARCHIVE_DECL ~xml_oarchive_impl(); - BOOST_ARCHIVE_DECL public: + BOOST_ARCHIVE_DECL void save_binary(const void *address, std::size_t count); }; +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + // we use the following because we can't use // typedef xml_oarchive_impl > xml_oarchive; @@ -118,6 +134,4 @@ BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_oarchive) #pragma warning(pop) #endif -#include // pops abi_suffix.hpp pragmas - #endif // BOOST_ARCHIVE_XML_OARCHIVE_HPP diff --git a/include/boost/serialization/archive_input_unordered_map.hpp b/include/boost/serialization/archive_input_unordered_map.hpp index 32c477f8..ef0fd93e 100644 --- a/include/boost/serialization/archive_input_unordered_map.hpp +++ b/include/boost/serialization/archive_input_unordered_map.hpp @@ -22,10 +22,6 @@ #include -#ifdef BOOST_NO_CXX11_STD_UNORDERED -#error "not supported for versions earlier than c++11 -#endif - namespace boost { namespace serialization { namespace stl { @@ -43,8 +39,11 @@ struct archive_input_unordered_map detail::stack_construct t(ar, v); ar >> boost::serialization::make_nvp("item", t.reference()); std::pair result = - s.emplace(t.reference()); - + #ifdef BOOST_NO_CXX11_HDR_UNORDERED_MAP + s.insert(t.reference()); + #else + s.emplace(t.reference()); + #endif // note: the following presumes that the map::value_type was NOT tracked // in the archive. This is the usual case, but here there is no way // to determine that. @@ -70,7 +69,11 @@ struct archive_input_unordered_multimap detail::stack_construct t(ar, v); ar >> boost::serialization::make_nvp("item", t.reference()); typename Container::const_iterator result = - s.emplace(t.reference()); + #ifdef BOOST_NO_CXX11_HDR_UNORDERED_MAP + s.insert(t.reference()); + #else + s.emplace(t.reference()); + #endif // note: the following presumes that the map::value_type was NOT tracked // in the archive. This is the usual case, but here there is no way // to determine that. diff --git a/include/boost/serialization/archive_input_unordered_set.hpp b/include/boost/serialization/archive_input_unordered_set.hpp index cf420284..961b58f1 100644 --- a/include/boost/serialization/archive_input_unordered_set.hpp +++ b/include/boost/serialization/archive_input_unordered_set.hpp @@ -17,11 +17,6 @@ // See http://www.boost.org for updates, documentation, and revision history. -#include -#ifdef BOOST_NO_CXX11_HDR_UNORDERED_SET -#error "not supported for versions earlier than c++11 -#endif - namespace boost { namespace serialization { @@ -41,7 +36,11 @@ struct archive_input_unordered_set // borland fails silently w/o full namespace ar >> boost::serialization::make_nvp("item", t.reference()); std::pair result = - s.emplace(t.reference()); + #ifdef BOOST_NO_CXX11_HDR_UNORDERED_SET + s.insert(t.reference()); + #else + s.emplace(t.reference()); + #endif if(result.second) ar.reset_object_address(& (* result.first), & t.reference()); } @@ -59,8 +58,12 @@ struct archive_input_unordered_multiset typedef typename Container::value_type type; detail::stack_construct t(ar, v); ar >> boost::serialization::make_nvp("item", t.reference()); - typename Container::const_iterator result - = s.emplace(t.reference()); + typename Container::const_iterator result = + #ifdef BOOST_NO_CXX11_HDR_UNORDERED_SET + s.insert(t.reference()); + #else + s.emplace(t.reference()); + #endif ar.reset_object_address(& (* result), & t.reference()); } }; diff --git a/include/boost/serialization/collection_traits.hpp b/include/boost/serialization/collection_traits.hpp index b3fe8434..3ec9401e 100644 --- a/include/boost/serialization/collection_traits.hpp +++ b/include/boost/serialization/collection_traits.hpp @@ -23,7 +23,7 @@ // exists for archives to be non-portable if class information for primitive // types is included. This is addressed by the following macros. #include -#include +//#include #include #include diff --git a/include/boost/serialization/nvp.hpp b/include/boost/serialization/nvp.hpp index 1a563a96..4e2297b3 100644 --- a/include/boost/serialization/nvp.hpp +++ b/include/boost/serialization/nvp.hpp @@ -57,22 +57,16 @@ public: return *(this->second); } - // True64 compiler complains with a warning about the use of - // the name "Archive" hiding some higher level usage. I'm sure this - // is an error but I want to accomodated as it generates a long warning - // listing and might be related to a lot of test failures. - // default treatment for name-value pairs. The name is - // just discarded and only the value is serialized. - template + template void save( - Archivex & ar, + Archive & ar, const unsigned int /* file_version */ ) const { ar.operator<<(const_value()); } - template + template void load( - Archivex & ar, + Archive & ar, const unsigned int /* file_version */ ){ ar.operator>>(value()); @@ -110,7 +104,6 @@ struct tracking_level > BOOST_STATIC_CONSTANT(int, value = tracking_level::type::value); }; - } // seralization } // boost diff --git a/include/boost/serialization/vector_135.hpp b/include/boost/serialization/vector_135.hpp index 2097cf64..fd1a7393 100644 --- a/include/boost/serialization/vector_135.hpp +++ b/include/boost/serialization/vector_135.hpp @@ -15,7 +15,7 @@ #ifdef BOOST_SERIALIZATION_VECTOR_VERSIONED #if BOOST_SERIALIZATION_VECTOR_VERSION != 4 -#error Boost.Serialization cannot be compatible with both 1.35 and 1.36-1.40 files +#error "Boost.Serialization cannot be compatible with both 1.35 and 1.36-1.40 files" #endif #else #define BOOST_SERIALIZATION_VECTOR_VERSIONED(V) (V>4) diff --git a/test/test_z.cpp b/test/test_z.cpp index a1467e4b..2a3e56fd 100644 --- a/test/test_z.cpp +++ b/test/test_z.cpp @@ -1,4 +1,4 @@ -#if true +#if 1 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 // test_optional.cpp @@ -22,6 +22,9 @@ namespace std{ #endif #include + +#define BOOST_ARCHIVE_TEST xml_archive.hpp + #include "test_tools.hpp" #include @@ -39,8 +42,8 @@ int test_main( int /* argc */, char* /* argv */[] ) { test_ostream os(testfile, TEST_STREAM_FLAGS); test_oarchive oa(os, TEST_ARCHIVE_FLAGS); - oa << boost::serialization::make_nvp("aoptional1",aoptional1); - oa << boost::serialization::make_nvp("aoptional2",aoptional2); + //oa << boost::serialization::make_nvp("aoptional1",aoptional1); + //oa << boost::serialization::make_nvp("aoptional2",aoptional2); } /* boost::optional aoptional1a(999);