From c04b1b7641e50aab6e7191c22d40e2edea7c707c Mon Sep 17 00:00:00 2001 From: Robert Ramey Date: Fri, 3 Jun 2005 05:28:09 +0000 Subject: [PATCH] invoke auto-link only when necessary [SVN r29394] --- include/boost/archive/basic_archive.hpp | 16 +++- .../boost/archive/basic_text_oprimitive.hpp | 2 - include/boost/archive/basic_xml_archive.hpp | 88 +++++++++++++++++-- include/boost/archive/basic_xml_iarchive.hpp | 2 +- include/boost/archive/basic_xml_oarchive.hpp | 1 + .../detail/archive_pointer_iserializer.hpp | 11 ++- .../detail/archive_pointer_oserializer.hpp | 9 +- .../archive/detail/auto_link_archive.hpp | 2 +- .../archive/detail/auto_link_warchive.hpp | 2 +- .../boost/archive/detail/basic_iarchive.hpp | 1 + .../boost/archive/detail/basic_oarchive.hpp | 2 +- .../detail/basic_pointer_iserializer.hpp | 4 + .../detail/basic_pointer_oserializer.hpp | 3 +- .../boost/archive/detail/basic_serializer.hpp | 2 +- .../boost/archive/detail/common_iarchive.hpp | 5 -- include/boost/archive/detail/decl.hpp | 11 +-- .../archive/detail/interface_iarchive.hpp | 5 +- .../archive/detail/interface_oarchive.hpp | 6 +- include/boost/archive/detail/iserializer.hpp | 51 +++-------- .../archive/detail/known_archive_types.hpp | 55 +----------- include/boost/archive/detail/oserializer.hpp | 50 +++-------- .../impl/archive_pointer_iserializer.ipp | 11 ++- .../impl/archive_pointer_oserializer.ipp | 11 ++- .../boost/archive/impl/xml_oarchive_impl.ipp | 2 +- .../boost/archive/polymorphic_iarchive.hpp | 2 +- .../boost/archive/polymorphic_oarchive.hpp | 2 +- include/boost/serialization/base_object.hpp | 49 ++++------- include/boost/serialization/binary_object.hpp | 44 ---------- .../boost/serialization/collection_traits.hpp | 3 + include/boost/serialization/config.hpp | 33 ++----- include/boost/serialization/export.hpp | 73 +++++++-------- .../extended_type_info_typeid_fwd.hpp | 41 +++++++++ include/boost/serialization/level.hpp | 82 ++++++++--------- include/boost/serialization/nvp.hpp | 42 +++------ include/boost/serialization/optional.hpp | 3 + include/boost/serialization/shared_ptr.hpp | 17 +++- include/boost/serialization/tracking.hpp | 1 + include/boost/serialization/traits.hpp | 2 +- .../type_info_implementation.hpp | 29 ++++-- include/boost/serialization/version.hpp | 1 + include/boost/serialization/void_cast.hpp | 8 +- src/basic_archive.cpp | 15 +++- src/basic_iarchive.cpp | 32 ++++--- src/basic_iserializer.cpp | 2 +- src/basic_oarchive.cpp | 20 +++-- src/basic_oserializer.cpp | 2 +- src/basic_pointer_iserializer.cpp | 2 +- src/basic_pointer_oserializer.cpp | 2 +- src/basic_serializer_map.cpp | 13 ++- src/basic_text_iprimitive.cpp | 2 +- src/basic_text_oprimitive.cpp | 2 +- src/basic_text_wiprimitive.cpp | 2 +- src/basic_text_woprimitive.cpp | 2 +- src/basic_xml_archive.cpp | 74 ++++++++++++++-- src/binary_iarchive.cpp | 2 +- src/binary_oarchive.cpp | 2 +- src/binary_wiarchive.cpp | 2 +- src/binary_woarchive.cpp | 2 +- src/polymorphic_iarchive.cpp | 2 +- src/polymorphic_oarchive.cpp | 2 +- src/text_iarchive.cpp | 2 +- src/text_oarchive.cpp | 2 +- src/text_wiarchive.cpp | 2 +- src/text_woarchive.cpp | 2 +- src/void_cast.cpp | 7 +- src/xml_grammar.cpp | 2 +- src/xml_iarchive.cpp | 2 +- src/xml_oarchive.cpp | 2 +- src/xml_wgrammar.cpp | 2 +- src/xml_wiarchive.cpp | 2 +- src/xml_woarchive.cpp | 2 +- 71 files changed, 540 insertions(+), 453 deletions(-) create mode 100644 include/boost/serialization/extended_type_info_typeid_fwd.hpp diff --git a/include/boost/archive/basic_archive.hpp b/include/boost/archive/basic_archive.hpp index 7855e56f..c5315b1d 100644 --- a/include/boost/archive/basic_archive.hpp +++ b/include/boost/archive/basic_archive.hpp @@ -16,6 +16,7 @@ // See http://www.boost.org for updates, documentation, and revision history. +#include #include #include @@ -91,8 +92,19 @@ enum archive_flags { #define NULL_POINTER_TAG class_id_type(-1) -BOOST_DECL_ARCHIVE const char * ARCHIVE_SIGNATURE(); -BOOST_DECL_ARCHIVE unsigned char ARCHIVE_VERSION(); + +#if defined(BOOST_MSVC) +BOOST_DECL_ARCHIVE +const char * +#else +BOOST_DECL_ARCHIVE +const char * +#endif +ARCHIVE_SIGNATURE(); + +unsigned char +BOOST_DECL_ARCHIVE +ARCHIVE_VERSION(); }// namespace archive }// namespace boost diff --git a/include/boost/archive/basic_text_oprimitive.hpp b/include/boost/archive/basic_text_oprimitive.hpp index 70dbf9e2..d603d924 100644 --- a/include/boost/archive/basic_text_oprimitive.hpp +++ b/include/boost/archive/basic_text_oprimitive.hpp @@ -47,8 +47,6 @@ namespace std{ #include #include #include - -#include #include #include // must be the last header diff --git a/include/boost/archive/basic_xml_archive.hpp b/include/boost/archive/basic_xml_archive.hpp index 848c7aa5..d0c0e702 100644 --- a/include/boost/archive/basic_xml_archive.hpp +++ b/include/boost/archive/basic_xml_archive.hpp @@ -60,14 +60,86 @@ public: }; // constant strings used in xml i/o -extern BOOST_DECL_ARCHIVE const char * OBJECT_ID(); -extern BOOST_DECL_ARCHIVE const char * OBJECT_REFERENCE(); -extern BOOST_DECL_ARCHIVE const char * CLASS_ID(); -extern BOOST_DECL_ARCHIVE const char * CLASS_ID_REFERENCE(); -extern BOOST_DECL_ARCHIVE const char * CLASS_NAME(); -extern BOOST_DECL_ARCHIVE const char * TRACKING(); -extern BOOST_DECL_ARCHIVE const char * VERSION(); -extern BOOST_DECL_ARCHIVE const char * SIGNATURE(); + +extern +#if defined(BOOST_MSVC) + BOOST_DECL_ARCHIVE + const char * +#else + const char * + BOOST_DECL_ARCHIVE +#endif +OBJECT_ID(); + +extern +#if defined(BOOST_MSVC) + BOOST_DECL_ARCHIVE + const char * +#else + const char * + BOOST_DECL_ARCHIVE +#endif +OBJECT_REFERENCE(); + +extern +#if defined(BOOST_MSVC) + BOOST_DECL_ARCHIVE + const char * +#else + const char * + BOOST_DECL_ARCHIVE +#endif +CLASS_ID(); + +extern +#if defined(BOOST_MSVC) + BOOST_DECL_ARCHIVE + const char * +#else + const char * + BOOST_DECL_ARCHIVE +#endif +CLASS_ID_REFERENCE(); + +extern +#if defined(BOOST_MSVC) + BOOST_DECL_ARCHIVE + const char * +#else + const char * + BOOST_DECL_ARCHIVE +#endif +CLASS_NAME(); + +extern +#if defined(BOOST_MSVC) + BOOST_DECL_ARCHIVE + const char * +#else + const char * + BOOST_DECL_ARCHIVE +#endif +TRACKING(); + +extern +#if defined(BOOST_MSVC) + BOOST_DECL_ARCHIVE + const char * +#else + const char * + BOOST_DECL_ARCHIVE +#endif +VERSION(); + +extern +#if defined(BOOST_MSVC) + BOOST_DECL_ARCHIVE + const char * +#else + const char * + BOOST_DECL_ARCHIVE +#endif +SIGNATURE(); }// namespace archive }// namespace boost diff --git a/include/boost/archive/basic_xml_iarchive.hpp b/include/boost/archive/basic_xml_iarchive.hpp index 6e6a6d72..dc899d78 100644 --- a/include/boost/archive/basic_xml_iarchive.hpp +++ b/include/boost/archive/basic_xml_iarchive.hpp @@ -20,7 +20,7 @@ #include #include -//#include +#include #include #include diff --git a/include/boost/archive/basic_xml_oarchive.hpp b/include/boost/archive/basic_xml_oarchive.hpp index 280c4dd8..0a336ac7 100644 --- a/include/boost/archive/basic_xml_oarchive.hpp +++ b/include/boost/archive/basic_xml_oarchive.hpp @@ -18,6 +18,7 @@ #include +#include #include #include diff --git a/include/boost/archive/detail/archive_pointer_iserializer.hpp b/include/boost/archive/detail/archive_pointer_iserializer.hpp index bb8ff03a..52aa20b1 100644 --- a/include/boost/archive/detail/archive_pointer_iserializer.hpp +++ b/include/boost/archive/detail/archive_pointer_iserializer.hpp @@ -70,9 +70,14 @@ public: // type_info. returns NULL if there is no such instance. This // would indicate that the no object of the specified type was loaded // any where in the code. - BOOST_DECL_ARCHIVE_OR_WARCHIVE - static const - basic_pointer_iserializer * find( + #if defined(BOOST_MSVC) + BOOST_DECL_ARCHIVE_OR_WARCHIVE + static const basic_pointer_iserializer * + #else + static const basic_pointer_iserializer * + BOOST_DECL_ARCHIVE_OR_WARCHIVE + #endif + find( const boost::serialization::extended_type_info & type_ ); diff --git a/include/boost/archive/detail/archive_pointer_oserializer.hpp b/include/boost/archive/detail/archive_pointer_oserializer.hpp index 4569d7de..78c3ab89 100644 --- a/include/boost/archive/detail/archive_pointer_oserializer.hpp +++ b/include/boost/archive/detail/archive_pointer_oserializer.hpp @@ -44,8 +44,13 @@ public: // type_info. returns NULL, if there is no such instance. This // would indicate that the no object of the specified type was saved // any where in the code. - BOOST_DECL_ARCHIVE_OR_WARCHIVE - static const basic_pointer_oserializer * + #if defined(BOOST_MSVC) + BOOST_DECL_ARCHIVE_OR_WARCHIVE + static const basic_pointer_oserializer * + #else + static const basic_pointer_oserializer * + BOOST_DECL_ARCHIVE_OR_WARCHIVE + #endif find( const boost::serialization::extended_type_info & type_ ); diff --git a/include/boost/archive/detail/auto_link_archive.hpp b/include/boost/archive/detail/auto_link_archive.hpp index 99b0b2c9..126f66d3 100644 --- a/include/boost/archive/detail/auto_link_archive.hpp +++ b/include/boost/archive/detail/auto_link_archive.hpp @@ -25,7 +25,7 @@ #include -#if !defined(BOOST_ARCHIVE) \ +#if !defined(BOOST_ARCHIVE_SOURCE) \ && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_SERIALIZATION_NO_LIB) // Set the name of our library, this will get undef'ed by auto_link.hpp diff --git a/include/boost/archive/detail/auto_link_warchive.hpp b/include/boost/archive/detail/auto_link_warchive.hpp index a3da1055..2ef45f8a 100644 --- a/include/boost/archive/detail/auto_link_warchive.hpp +++ b/include/boost/archive/detail/auto_link_warchive.hpp @@ -25,7 +25,7 @@ #include -#if !defined(BOOST_WARCHIVE) \ +#if !defined(BOOST_WARCHIVE_SOURCE) \ && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_SERIALIZATION_NO_LIB) // Set the name of our library, this will get undef'ed by auto_link.hpp diff --git a/include/boost/archive/detail/basic_iarchive.hpp b/include/boost/archive/detail/basic_iarchive.hpp index 17df52a4..f5f1fb96 100644 --- a/include/boost/archive/detail/basic_iarchive.hpp +++ b/include/boost/archive/detail/basic_iarchive.hpp @@ -20,6 +20,7 @@ // #include #include +#include #include // must be the last header diff --git a/include/boost/archive/detail/basic_oarchive.hpp b/include/boost/archive/detail/basic_oarchive.hpp index 5fbbc5c4..814d1ba4 100644 --- a/include/boost/archive/detail/basic_oarchive.hpp +++ b/include/boost/archive/detail/basic_oarchive.hpp @@ -23,7 +23,7 @@ // #include #include -#include +#include #include // must be the last header diff --git a/include/boost/archive/detail/basic_pointer_iserializer.hpp b/include/boost/archive/detail/basic_pointer_iserializer.hpp index f2d33eeb..e9237270 100644 --- a/include/boost/archive/detail/basic_pointer_iserializer.hpp +++ b/include/boost/archive/detail/basic_pointer_iserializer.hpp @@ -24,6 +24,10 @@ namespace boost { +namespace serialization { + class extended_type_info; +} // namespace serialization + // forward declarations namespace archive { namespace detail { diff --git a/include/boost/archive/detail/basic_pointer_oserializer.hpp b/include/boost/archive/detail/basic_pointer_oserializer.hpp index b23646d4..fb92abbd 100644 --- a/include/boost/archive/detail/basic_pointer_oserializer.hpp +++ b/include/boost/archive/detail/basic_pointer_oserializer.hpp @@ -34,7 +34,8 @@ namespace detail { class BOOST_DECL_ARCHIVE basic_oarchive; class BOOST_DECL_ARCHIVE basic_oserializer; -class BOOST_DECL_ARCHIVE basic_pointer_oserializer : public basic_serializer { +class BOOST_DECL_ARCHIVE basic_pointer_oserializer : + public basic_serializer { protected: explicit basic_pointer_oserializer( const boost::serialization::extended_type_info & type_ diff --git a/include/boost/archive/detail/basic_serializer.hpp b/include/boost/archive/detail/basic_serializer.hpp index 71c6e0ce..98d30dfd 100644 --- a/include/boost/archive/detail/basic_serializer.hpp +++ b/include/boost/archive/detail/basic_serializer.hpp @@ -19,8 +19,8 @@ #include #include #include +namespace boost { -namespace boost { namespace archive { namespace detail { diff --git a/include/boost/archive/detail/common_iarchive.hpp b/include/boost/archive/detail/common_iarchive.hpp index 212f8963..9699421d 100644 --- a/include/boost/archive/detail/common_iarchive.hpp +++ b/include/boost/archive/detail/common_iarchive.hpp @@ -16,14 +16,9 @@ // See http://www.boost.org for updates, documentation, and revision history. -#include - -#include #include #include -#include - namespace boost { namespace archive { namespace detail { diff --git a/include/boost/archive/detail/decl.hpp b/include/boost/archive/detail/decl.hpp index 6cb295f5..dcc4261b 100644 --- a/include/boost/archive/detail/decl.hpp +++ b/include/boost/archive/detail/decl.hpp @@ -26,27 +26,28 @@ #if defined(BOOST_HAS_DECLSPEC) \ && (defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK)) -#if defined(BOOST_ARCHIVE) +#if defined(BOOST_ARCHIVE_SOURCE) #define BOOST_DECL_ARCHIVE __declspec(dllexport) #pragma message( "BOOST_DECL_ARCHIVE __declspec(dllexport)" ) #define BOOST_DECL_ARCHIVE_OR_WARCHIVE __declspec(dllexport) #pragma message( "BOOST_DECL_ARCHIVE_OR_WARCHIVE __declspec(dllexport)" ) -#elif defined(BOOST_WARCHIVE) +#elif defined(BOOST_WARCHIVE_SOURCE) #define BOOST_DECL_WARCHIVE __declspec(dllexport) #pragma message( "BOOST_DECL_WARCHIVE __declspec(dllexport)" ) #define BOOST_DECL_ARCHIVE_OR_WARCHIVE __declspec(dllexport) #pragma message( "BOOST_DECL_ARCHIVE_OR_WARCHIVE __declspec(dllexport)" ) #endif -#if !defined(BOOST_DECL_ARCHIVE) +#if !defined(BOOST_DECL_ARCHIVE) && !defined(BOOST_ARCHIVE_SOURCE) #define BOOST_DECL_ARCHIVE __declspec(dllimport) #pragma message( "BOOST_DECL_ARCHIVE __declspec(dllimport)" ) #endif -#if !defined(BOOST_DECL_WARCHIVE) +#if !defined(BOOST_DECL_WARCHIVE) && !defined(BOOST_ARCHIVE_SOURCE) #define BOOST_DECL_WARCHIVE __declspec(dllimport) #pragma message( "BOOST_DECL_WARCHIVE __declspec(dllimport)" ) #endif -#if !defined(BOOST_DECL_ARCHIVE_OR_WARCHIVE) +#if !defined(BOOST_DECL_ARCHIVE_OR_WARCHIVE) \ +&& !defined(BOOST_ARCHIVE_SOURCE) && !defined(BOOST_WARCHIVE_SOURCE) #define BOOST_DECL_ARCHIVE_OR_WARCHIVE __declspec(dllimport) #pragma message( "BOOST_DECL_WARCHIVE_OR_WARCHIVE __declspec(dllimport)" ) #endif diff --git a/include/boost/archive/detail/interface_iarchive.hpp b/include/boost/archive/detail/interface_iarchive.hpp index 530f831c..44534265 100644 --- a/include/boost/archive/detail/interface_iarchive.hpp +++ b/include/boost/archive/detail/interface_iarchive.hpp @@ -22,7 +22,10 @@ #include #include // must be the last header -namespace boost { +namespace boost { +namespace serialization { + class extended_type_info; +} // namespace serialization namespace archive { namespace detail { diff --git a/include/boost/archive/detail/interface_oarchive.hpp b/include/boost/archive/detail/interface_oarchive.hpp index b9c5c9b5..23ec88f3 100644 --- a/include/boost/archive/detail/interface_oarchive.hpp +++ b/include/boost/archive/detail/interface_oarchive.hpp @@ -18,17 +18,17 @@ #include #include #include -//#include -//#include #include #include // must be the last header namespace boost { +namespace serialization { + class extended_type_info; +} // namespace serialization namespace archive { namespace detail { -class BOOST_DECL_ARCHIVE basic_oserializer; class BOOST_DECL_ARCHIVE basic_pointer_oserializer; template diff --git a/include/boost/archive/detail/iserializer.hpp b/include/boost/archive/detail/iserializer.hpp index f105d0d5..227fdb40 100644 --- a/include/boost/archive/detail/iserializer.hpp +++ b/include/boost/archive/detail/iserializer.hpp @@ -4,12 +4,12 @@ // MS compatible compilers support #pragma once #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once -#pragma inline_depth(255) +#pragma inline_depth(511) #pragma inline_recursion(on) #endif #if defined(__MWERKS__) -#pragma inline_depth(255) +#pragma inline_depth(511) #endif /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 @@ -33,12 +33,10 @@ namespace std{ using ::size_t; } // namespace std #endif - -#include - +#include +#include #include #include -#include #include #include @@ -46,7 +44,6 @@ namespace std{ #include #include #include -#include #include #include @@ -60,10 +57,9 @@ namespace std{ #include #include #include -// the following is only used with VC for now and it crashes -// at least one other compiler (Borland) -#if defined(BOOST_MSVC) -#include + +#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO + #include #endif // the following is need only for dynamic cast of polymorphic pointers @@ -72,7 +68,6 @@ namespace std{ #include #include -#include #include #include #include @@ -83,9 +78,12 @@ namespace std{ #include -#include - namespace boost { + +namespace serialization { + class extended_type_info; +} // namespace serialization + namespace archive { // an accessor to permit friend access to archives. Needed because @@ -411,31 +409,6 @@ struct load_pointer_type { template static const basic_pointer_iserializer * register_type(Archive &ar, T & /*t*/){ - #if defined(BOOST_MSVC) - // note: if you program traps here its because - // a) your serializing through a base class pointer - // b) to an archive not in the known list. - // This will usually occur when one makes a custom archive and - // forgets to add it to the list of known archive. If the derived - // class is explictly registered or if no derived pointer is used - // there won't be a problem - that's why its a warning. However - // if you export the derived type and the archive used isn't on the - // known list it will fail below at execution time and one will have - // a hell of time figuring out why. Hence this warning. - BOOST_STATIC_WARNING(( - mpl::not_< - mpl::and_< - BOOST_DEDUCED_TYPENAME serialization::type_info_implementation::type::is_polymorphic, - mpl::not_::type > >, - is_same< - mpl::end::type >::type, - BOOST_DEDUCED_TYPENAME mpl::find::type, Archive>::type - > - > - > - ::value - )); - #endif // there should never be any need to load an abstract polymorphic // class pointer. Inhibiting code generation for this // permits abstract base classes to be used - note: exception diff --git a/include/boost/archive/detail/known_archive_types.hpp b/include/boost/archive/detail/known_archive_types.hpp index f02458f0..e8322b3b 100644 --- a/include/boost/archive/detail/known_archive_types.hpp +++ b/include/boost/archive/detail/known_archive_types.hpp @@ -21,114 +21,65 @@ #include #include -#include - namespace boost { namespace archive { + +// class text_oarchive; namespace detail { class null_type; -template<> -struct known_archive_types { +struct known_archive_types { typedef mpl::pop_front< mpl::list< null_type #if defined(BOOST_ARCHIVE_TEXT_OARCHIVE_HPP) - #if ! defined(BOOST_ARCHIVE_EXPORT) - #define BOOST_ARCHIVE_EXPORT - #endif , boost::archive::text_oarchive #endif #if defined(BOOST_ARCHIVE_TEXT_IARCHIVE_HPP) - #if ! defined(BOOST_ARCHIVE_EXPORT) - #define BOOST_ARCHIVE_EXPORT - #endif , boost::archive::text_iarchive #endif #if defined(BOOST_ARCHIVE_TEXT_WOARCHIVE_HPP) - #if ! defined(BOOST_ARCHIVE_EXPORT) - #define BOOST_ARCHIVE_EXPORT - #endif , boost::archive::text_woarchive #endif #if defined(BOOST_ARCHIVE_TEXT_WIARCHIVE_HPP) - #if ! defined(BOOST_ARCHIVE_EXPORT) - #define BOOST_ARCHIVE_EXPORT - #endif , boost::archive::text_wiarchive #endif #if defined(BOOST_ARCHIVE_BINARY_OARCHIVE_HPP) - #if ! defined(BOOST_ARCHIVE_EXPORT) - #define BOOST_ARCHIVE_EXPORT - #endif , boost::archive::binary_oarchive #endif #if defined(BOOST_ARCHIVE_BINARY_IARCHIVE_HPP) - #if ! defined(BOOST_ARCHIVE_EXPORT) - #define BOOST_ARCHIVE_EXPORT - #endif , boost::archive::binary_iarchive #endif #if defined(BOOST_ARCHIVE_BINARY_WOARCHIVE_HPP) - #if ! defined(BOOST_ARCHIVE_EXPORT) - #define BOOST_ARCHIVE_EXPORT - #endif , boost::archive::binary_woarchive #endif #if defined(BOOST_ARCHIVE_BINARY_WIARCHIVE_HPP) - #if ! defined(BOOST_ARCHIVE_EXPORT) - #define BOOST_ARCHIVE_EXPORT - #endif , boost::archive::binary_wiarchive #endif #if defined(BOOST_ARCHIVE_XML_OARCHIVE_HPP) - #if ! defined(BOOST_ARCHIVE_EXPORT) - #define BOOST_ARCHIVE_EXPORT - #endif , boost::archive::xml_oarchive #endif #if defined(BOOST_ARCHIVE_XML_IARCHIVE_HPP) - #if ! defined(BOOST_ARCHIVE_EXPORT) - #define BOOST_ARCHIVE_EXPORT - #endif , boost::archive::xml_iarchive #endif #if defined(BOOST_ARCHIVE_XML_WOARCHIVE_HPP) - #if ! defined(BOOST_ARCHIVE_EXPORT) - #define BOOST_ARCHIVE_EXPORT - #endif , boost::archive::xml_woarchive #endif #if defined(BOOST_ARCHIVE_XML_WIARCHIVE_HPP) - #if ! defined(BOOST_ARCHIVE_EXPORT) - #define BOOST_ARCHIVE_EXPORT - #endif , boost::archive::xml_wiarchive #endif #if defined(BOOST_ARCHIVE_POLYMORPHIC_OARCHIVE_HPP) - #if ! defined(BOOST_ARCHIVE_EXPORT) - #define BOOST_ARCHIVE_EXPORT - #endif , boost::archive::polymorphic_oarchive #endif #if defined(BOOST_ARCHIVE_POLYMORPHIC_IARCHIVE_HPP) - #if ! defined(BOOST_ARCHIVE_EXPORT) - #define BOOST_ARCHIVE_EXPORT - #endif , boost::archive::polymorphic_iarchive #endif #if defined(BOOST_ARCHIVE_CUSTOM_IARCHIVE_TYPES) - #if ! defined(BOOST_ARCHIVE_EXPORT) - #define BOOST_ARCHIVE_EXPORT - #endif , BOOST_ARCHIVE_CUSTOM_IARCHIVE_TYPES #endif #if defined(BOOST_ARCHIVE_CUSTOM_OARCHIVE_TYPES) - #if ! defined(BOOST_ARCHIVE_EXPORT) - #define BOOST_ARCHIVE_EXPORT - #endif , BOOST_ARCHIVE_CUSTOM_OARCHIVE_TYPES #endif >::type diff --git a/include/boost/archive/detail/oserializer.hpp b/include/boost/archive/detail/oserializer.hpp index a5fd936d..c782375a 100644 --- a/include/boost/archive/detail/oserializer.hpp +++ b/include/boost/archive/detail/oserializer.hpp @@ -4,12 +4,12 @@ // MS compatible compilers support #pragma once #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once -#pragma inline_depth(255) +#pragma inline_depth(511) #pragma inline_recursion(on) #endif #if defined(__MWERKS__) -#pragma inline_depth(255) +#pragma inline_depth(511) #endif /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 @@ -49,10 +49,9 @@ #include #include #include -// the following is only used with VC for now and it crashes -// at least one other compiler (Borland) -#if defined(BOOST_MSVC) -#include + +#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO + #include #endif // the following is need only for dynamic cast of polymorphic pointers @@ -60,25 +59,25 @@ #include #include +#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO + #include +#endif #include -#include #include #include #include #include #include #include -#include #include -#include - namespace boost { + namespace serialization { -// template -// void serialize(Archive &ar, T & t, const unsigned int file_version); -} + class extended_type_info; +} // namespace serialization + namespace archive { // an accessor to permit friend access to archives. Needed because @@ -353,31 +352,6 @@ struct save_pointer_type { const T & t, const basic_pointer_oserializer * bpos_ptr ){ - // currently only known to work with VC - #if defined(BOOST_MSVC) - // note: if you program traps here its because - // a) your serializing through a baae class pointer - // b) to an archive not in the known list. - // This will usually occur when one makes a custom archive and - // forgets to add it to the list of known archive. If the derived - // class is explictly registered or if no derived pointer is used - // there won't be a problem - that's why its a warning. However - // if you export the derived type and the archive used isn't on the - // known list it will fail below at execution time and one will have - // a hell of time figuring out why. Hence this warning. - BOOST_STATIC_WARNING(( - mpl::not_< - mpl::and_< - mpl::not_::type > >, - is_same< - mpl::end::type >::type, - BOOST_DEDUCED_TYPENAME mpl::find::type, Archive>::type - > - > - > - ::value - )); - #endif const boost::serialization::extended_type_info * this_type = boost::serialization::type_info_implementation::type::get_instance(); // retrieve the true type of the object pointed to diff --git a/include/boost/archive/impl/archive_pointer_iserializer.ipp b/include/boost/archive/impl/archive_pointer_iserializer.ipp index 01ebb857..a7b265f4 100644 --- a/include/boost/archive/impl/archive_pointer_iserializer.ipp +++ b/include/boost/archive/impl/archive_pointer_iserializer.ipp @@ -37,9 +37,16 @@ archive_pointer_iserializer::archive_pointer_iserializer( template #if !defined(__BORLANDC__) -BOOST_DECL_ARCHIVE_OR_WARCHIVE + #if defined(BOOST_MSVC) + BOOST_DECL_ARCHIVE_OR_WARCHIVE + const basic_pointer_iserializer * + #else + const basic_pointer_iserializer * + BOOST_DECL_ARCHIVE_OR_WARCHIVE + #endif +#else + const basic_pointer_iserializer * #endif -const basic_pointer_iserializer * archive_pointer_iserializer::find( const boost::serialization::extended_type_info & type ){ diff --git a/include/boost/archive/impl/archive_pointer_oserializer.ipp b/include/boost/archive/impl/archive_pointer_oserializer.ipp index 64262722..7bac71f9 100644 --- a/include/boost/archive/impl/archive_pointer_oserializer.ipp +++ b/include/boost/archive/impl/archive_pointer_oserializer.ipp @@ -38,9 +38,16 @@ archive_pointer_oserializer::archive_pointer_oserializer( template #if !defined(__BORLANDC__) -BOOST_DECL_ARCHIVE_OR_WARCHIVE + #if defined(BOOST_MSVC) + BOOST_DECL_ARCHIVE_OR_WARCHIVE + const basic_pointer_oserializer * + #else + const basic_pointer_oserializer * + BOOST_DECL_ARCHIVE_OR_WARCHIVE + #endif +#else + const basic_pointer_oserializer * #endif -const basic_pointer_oserializer * archive_pointer_oserializer::find( const boost::serialization::extended_type_info & type ){ diff --git a/include/boost/archive/impl/xml_oarchive_impl.ipp b/include/boost/archive/impl/xml_oarchive_impl.ipp index 0c0a65dd..7c9559ac 100644 --- a/include/boost/archive/impl/xml_oarchive_impl.ipp +++ b/include/boost/archive/impl/xml_oarchive_impl.ipp @@ -123,7 +123,7 @@ xml_oarchive_impl::xml_oarchive_impl( ), basic_xml_oarchive(flags) { - if(0 == flags & no_header) + if(0 == (flags & no_header)) this->init(); } diff --git a/include/boost/archive/polymorphic_iarchive.hpp b/include/boost/archive/polymorphic_iarchive.hpp index 2355112e..259928ef 100644 --- a/include/boost/archive/polymorphic_iarchive.hpp +++ b/include/boost/archive/polymorphic_iarchive.hpp @@ -28,9 +28,9 @@ namespace std{ #include #include +#include #include #include -#include #include // determine if its necessary to handle (u)int64_t specifically diff --git a/include/boost/archive/polymorphic_oarchive.hpp b/include/boost/archive/polymorphic_oarchive.hpp index 94496633..8a224573 100644 --- a/include/boost/archive/polymorphic_oarchive.hpp +++ b/include/boost/archive/polymorphic_oarchive.hpp @@ -28,9 +28,9 @@ namespace std{ #include +#include #include #include -#include #include // determine if its necessary to handle (u)int64_t specifically diff --git a/include/boost/serialization/base_object.hpp b/include/boost/serialization/base_object.hpp index 1a3285b6..52280b14 100644 --- a/include/boost/serialization/base_object.hpp +++ b/include/boost/serialization/base_object.hpp @@ -16,6 +16,10 @@ // See http://www.boost.org for updates, documentation, and revision history. +// if no archive headers have been included this is a no op +// this is to permit BOOST_EXPORT etc to be included in a +// file declaration header + #include #include @@ -27,8 +31,20 @@ #include -#include -#include +// if no archive headers have been included +// skip inclusion of void_cast.hpp . This is to avoid auto-link when +// a module doesn't doesn't actually invoke serializaton but rather +// just declares it. + +#if ! defined(BOOST_ARCHIVE_BASIC_ARCHIVE_HPP) + template + const void * void_cast_register( + const Derived * /* dnull = NULL */, + const Base * /* bnull = NULL */ + ); +#else + #include +#endif namespace boost { namespace archive{ @@ -79,35 +95,6 @@ namespace detail { }; } // namespace detail -#if 0 -#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - template - inline const Base & - base_object(const Derived & d){ - BOOST_STATIC_ASSERT(! is_pointer::value); - detail::base_register::invoke(); - return d; - } - template - inline Base & - base_object(Derived & d){ - BOOST_STATIC_ASSERT(! is_pointer::value); - detail::base_register::invoke(); - return d; - } -#else - template - inline BOOST_DEDUCED_TYPENAME detail::base_cast::type & - base_object(Derived & d) - { - BOOST_STATIC_ASSERT(( is_base_and_derived::value)); - BOOST_STATIC_ASSERT(! is_pointer::value); - detail::base_register::invoke(); - return d; - } -#endif -#endif - // BORLAND #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) template diff --git a/include/boost/serialization/binary_object.hpp b/include/boost/serialization/binary_object.hpp index cf93e8df..c3214703 100644 --- a/include/boost/serialization/binary_object.hpp +++ b/include/boost/serialization/binary_object.hpp @@ -68,50 +68,6 @@ make_binary_object(/* const */ void * t, std::size_t size){ return binary_object(t, size); } -#if 0 -// make special version of nvp which for binary object wrapper rather than -// a pointer to them. This permits a better composition of nvp(binary_object) -// than would otherwise be possible. - -template<> -struct nvp : - public std::pair, - public traits, object_serializable, track_never> -{ - explicit nvp(const char * name, binary_object & t) : - std::pair(name, t) - {} - nvp(const nvp & rhs) : - std::pair(rhs.first, rhs.second) - {} - - const char * name() const { - return this->first; - } - binary_object & value() { - return this->second; - } - const binary_object & value() const { - return this->second; - } - // default treatment for name-value pairs. The name is - // just discarded and only the value is serialized. Note the unusual - // fact that his is "const". This is because wrappers themselves are - // in fact "const" - even though the things they wrap may not be. - // note: removed "const" because it confuses MSVC 6.0 - template - void serialize(Archive & ar, const unsigned int /* file_version */) /*const*/ - { - ar & value(); - } -}; - -inline const nvp make_nvp(const char * name, binary_object t){ - return nvp(name, t); -} - -#endif - } // namespace serialization } // boost diff --git a/include/boost/serialization/collection_traits.hpp b/include/boost/serialization/collection_traits.hpp index efca9509..130c9383 100644 --- a/include/boost/serialization/collection_traits.hpp +++ b/include/boost/serialization/collection_traits.hpp @@ -23,6 +23,9 @@ // 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/config.hpp b/include/boost/serialization/config.hpp index 9d22cfb3..090917c9 100644 --- a/include/boost/serialization/config.hpp +++ b/include/boost/serialization/config.hpp @@ -32,18 +32,14 @@ // libraries to be dynamically linked, or BOOST_SERIALIZATION_DYN_LINK // if they want just this one to be dynamically liked: #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK) +#define BOOST_DYN_LINK // export if this is our own source, otherwise import: #if defined(BOOST_SERIALIZATION_SOURCE) #define BOOST_SERIALIZATION_DECL __declspec(dllexport) - #pragma message( "BOOST_SERIALIZATION_DECL __declspec(dllexport) (1)" ) -#elif defined(BOOST_ARCHIVE) -#else - #define BOOST_SERIALIZATION_DECL __declspec(dllimport) - #pragma message( "BOOST_SERIALIZATION_DECL __declspec(dllimport) (3)" ) - #define IMPORT -#endif // BOOST_SERIALIZATION_SOURCE -#endif // DYN_LINK -#endif // BOOST_HAS_DECLSPEC + #pragma message( "BOOST_SERIALIZATION_DECL __declspec(dllexport)" ) +#endif // defined(BOOST_SERIALIZATION_SOURCE) +#endif // defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK) +#endif // BOOST_HAS_DECLSPEC // if BOOST_SERIALIZATION_DECL isn't defined yet define it now: #ifndef BOOST_SERIALIZATION_DECL @@ -52,30 +48,19 @@ // enable automatic library variant selection ------------------------------// -#if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_SERIALIZATION_NO_LIB) +#if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_SERIALIZATION_NO_LIB) \ +&& !defined(BOOST_SERIALIZATION_SOURCE) \ +&& !defined(BOOST_ARCHIVE_SOURCE) && !defined(BOOST_WARCHIVE_SOURCE) // // Set the name of our library, this will get undef'ed by auto_link.hpp // once it's done with it: // #define BOOST_LIB_NAME boost_serialization -// -// If we're importing code from a dll, then tell auto_link.hpp about it: -// - -#if defined(IMPORT) -#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK) -# define BOOST_DYN_LINK -#endif -#endif - // // And include the header that does the work: // #include -#endif // auto-linking disabled -#if defined(IMPORT) -#undef IMPORT -#endif +#endif // !defined(BOOST_SERIALIZATION_SOURCE) && !defined(BOOST_ARCHIVE_SOURCE) #endif // BOOST_SERIALIZATION_CONFIG_HPP diff --git a/include/boost/serialization/export.hpp b/include/boost/serialization/export.hpp index 02a9ae92..097720ac 100644 --- a/include/boost/serialization/export.hpp +++ b/include/boost/serialization/export.hpp @@ -24,6 +24,13 @@ #include +// if no archive headers have been included this is a no op +// this is to permit BOOST_EXPORT etc to be included in a +// file declaration header +#if ! defined(BOOST_ARCHIVE_BASIC_ARCHIVE_HPP) +#define BOOST_CLASS_EXPORT_GUID_ARCHIVE_LIST(T, K, ASEQ) + +#else #include #include #include @@ -34,12 +41,11 @@ #include #include +#include #include #include #include -#include - namespace boost { namespace archive { @@ -157,38 +163,33 @@ const guid_initializer guid_initializer::instance; } // namespace archive } // namespace boost -// if no archive headers have been included this is a no op -// this is to permit BOOST_EXPORT etc to be included in a -// file declaration header -#if ! defined(BOOST_ARCHIVE_EXPORT) - #define BOOST_CLASS_EXPORT_GUID_ARCHIVE_LIST(T, K, ASEQ) -#else - // only gcc seems to be able to explicitly instantiate a static instance. - // all but can instantiate a function that refers to a static instance - namespace boost { namespace archive { namespace detail { - // note declaration to permit gcc trailing function attribute - template - BOOST_DLLEXPORT std::pair - boost_template_instantiate(T &, ASeq &) BOOST_USED; - template - BOOST_DLLEXPORT std::pair - boost_template_instantiate(T &, ASeq &){ - return std::pair( - & export_generator::instance, - & guid_initializer::instance - ); - } - } } } - #define BOOST_CLASS_EXPORT_GUID_ARCHIVE_LIST(T, K, ASEQ) \ - namespace boost { namespace archive { namespace detail { \ - template<> \ - const guid_initializer \ - guid_initializer::instance(K); \ - template \ - BOOST_DLLEXPORT std::pair \ - boost_template_instantiate(T &, ASEQ &); \ - } } } \ - /**/ +// only gcc seems to be able to explicitly instantiate a static instance. +// all but can instantiate a function that refers to a static instance +namespace boost { namespace archive { namespace detail { +// note declaration to permit gcc trailing function attribute +template +BOOST_DLLEXPORT std::pair +boost_template_instantiate(T &, ASeq &) BOOST_USED; +template +BOOST_DLLEXPORT std::pair +boost_template_instantiate(T &, ASeq &){ + return std::pair( + & export_generator::instance, + & guid_initializer::instance + ); +} +} } } +#define BOOST_CLASS_EXPORT_GUID_ARCHIVE_LIST(T, K, ASEQ) \ + namespace boost { namespace archive { namespace detail { \ + template<> \ + const guid_initializer \ + guid_initializer::instance(K); \ + template \ + BOOST_DLLEXPORT std::pair \ + boost_template_instantiate(T &, ASEQ &); \ + } } } \ + /**/ + #endif // check for unnecessary export. T isn't polymorphic so there is no @@ -205,7 +206,7 @@ const guid_initializer guid_initializer::instance; BOOST_CLASS_EXPORT_GUID_ARCHIVE_LIST( \ T, \ K, \ - boost::archive::detail::known_archive_types::type \ + boost::archive::detail::known_archive_types::type \ ) \ /**/ @@ -220,7 +221,7 @@ const guid_initializer guid_initializer::instance; BOOST_CLASS_EXPORT_GUID_ARCHIVE_LIST( \ T, \ BOOST_PP_STRINGIZE(T), \ - boost::archive::detail::known_archive_types::type \ + boost::archive::detail::known_archive_types::type \ ) \ /**/ diff --git a/include/boost/serialization/extended_type_info_typeid_fwd.hpp b/include/boost/serialization/extended_type_info_typeid_fwd.hpp new file mode 100644 index 00000000..0a6c5d70 --- /dev/null +++ b/include/boost/serialization/extended_type_info_typeid_fwd.hpp @@ -0,0 +1,41 @@ +#ifndef BOOST_SERIALIZATION_EXTENDED_TYPE_INFO_TYPEID_FWD_HPP +#define BOOST_SERIALIZATION_EXTENDED_TYPE_INFO_TYPEID_FWD_HPP +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// extended_type_info_typeid.hpp: implementation for version that depends +// on runtime typing (rtti - typeid) but uses a user specified string +// as the portable class identifier. + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// 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. + +namespace boost { +namespace serialization { + +/////////////////////////////////////////////////////////////////////////////// +template +class extended_type_info_typeid; + +} // namespace serialization +} // namespace boost + +/////////////////////////////////////////////////////////////////////////////// +// If no other implementation has been designated as default, +// use this one. To use this implementation as the default, specify it +// before any of the other headers. + +#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO +#define BOOST_SERIALIZATION_DEFAULT_TYPE_INFO(T) \ + extended_type_info_typeid +/**/ +#endif + +#endif // BOOST_SERIALIZATION_EXTENDED_TYPE_INFO_TYPEID_FWD_HPP diff --git a/include/boost/serialization/level.hpp b/include/boost/serialization/level.hpp index 2d6772e0..20bebb2b 100644 --- a/include/boost/serialization/level.hpp +++ b/include/boost/serialization/level.hpp @@ -24,9 +24,11 @@ #include #include #include + #include #include #include +#include #include #include @@ -43,52 +45,42 @@ struct implementation_level { }; typedef mpl::integral_c_tag tag; - -// #if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) -// typedef -// BOOST_DEDUCED_TYPENAME mpl::eval_if< -// is_base_and_derived, -// traits_class_level, -// mpl::int_ -// >::type type; -// #else - typedef - BOOST_DEDUCED_TYPENAME mpl::eval_if< - is_base_and_derived, - traits_class_level, - //else - BOOST_DEDUCED_TYPENAME mpl::eval_if< - is_fundamental, + typedef + BOOST_DEDUCED_TYPENAME mpl::eval_if< + is_base_and_derived, + traits_class_level, + //else + BOOST_DEDUCED_TYPENAME mpl::eval_if< + is_fundamental, + mpl::int_, + //else + BOOST_DEDUCED_TYPENAME mpl::eval_if< + is_class, + mpl::int_, + //else + BOOST_DEDUCED_TYPENAME mpl::eval_if< + is_array, + #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) + mpl::int_, + #else + mpl::int_, + #endif + //else + BOOST_DEDUCED_TYPENAME mpl::eval_if< + is_enum, + //#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) + // mpl::int_, + //#else mpl::int_, - //else - BOOST_DEDUCED_TYPENAME mpl::eval_if< - is_class, - mpl::int_, - //else - BOOST_DEDUCED_TYPENAME mpl::eval_if< - is_array, - #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) - mpl::int_, - #else - mpl::int_, - #endif - //else - BOOST_DEDUCED_TYPENAME mpl::eval_if< - is_enum, - //#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) - // mpl::int_, - //#else - mpl::int_, - //#endif - //else - mpl::int_ - > - > - > - > - >::type type; - // vc 7.1 doesn't like enums here -// #endif + //#endif + //else + mpl::int_ + > + > + > + > + >::type type; + // vc 7.1 doesn't like enums here BOOST_STATIC_CONSTANT(int, value = implementation_level::type::value); }; diff --git a/include/boost/serialization/nvp.hpp b/include/boost/serialization/nvp.hpp index 572dea46..f49f4652 100644 --- a/include/boost/serialization/nvp.hpp +++ b/include/boost/serialization/nvp.hpp @@ -25,6 +25,9 @@ # pragma warning (disable : 4786) // too long name, harmless warning #endif +#include +#include + #include #include #include @@ -43,15 +46,6 @@ struct nvp : // note: rudundant cast works around borland issue std::pair(name, (T*)(& t)) {} -#if 0 - // borland needs this - #if BOOST_WORKAROUND(__BORLANDC__, <= 0x564 ) - explicit nvp(const char * name, const T & t) : - // note: rudundant cast works around borland issue - std::pair(name, (T*)(& t)) - {} - #endif -#endif nvp(const nvp & rhs) : // note: rudundant cast works around borland issue std::pair(rhs.first, (T*)rhs.second) @@ -75,24 +69,26 @@ struct nvp : Archive & ar, const unsigned int /* file_version */ ) const { - #if BOOST_WORKAROUND(__MWERKS__, <= 0x3003) // CodeWarrior 8.x can't seem to resolve the << op for a rhs of "const T *" ar.operator<<(const_value()); - #else - ar << const_value(); - #endif +// #if BOOST_WORKAROUND(__MWERKS__, <= 0x3003) +// ar.operator<<(const_value()); +// #else +// ar << const_value(); +// #endif } template void load( Archive & ar, const unsigned int /* file_version */ ){ - #if BOOST_WORKAROUND(__MWERKS__, <= 0x3003) // CodeWarrior 8.x can't seem to resolve the >> op for a rhs of "const T *" ar.operator>>(value()); - #else - ar >> value(); - #endif +// #if BOOST_WORKAROUND(__MWERKS__, <= 0x3003) +// ar.operator>>(value()); +// #else +// ar >> value(); +// #endif } BOOST_SERIALIZATION_SPLIT_MEMBER() }; @@ -106,18 +102,6 @@ nvp make_nvp(const char * name, T & t){ return nvp(name, t); } -#if 0 -// It seems that borland compilers add a "const" when invoking nvp. -// This creates problems when loading data. -#if BOOST_WORKAROUND(__BORLANDC__, <= 0x564 ) -template -const -nvp make_nvp(const char * name, const T & t){ - return nvp(name, t); -} -#endif -#endif - // to maintain efficiency and portability, we want to assign // specific serialization traits to all instances of this wrappers. // we can't strait forward method below as it depends upon diff --git a/include/boost/serialization/optional.hpp b/include/boost/serialization/optional.hpp index 7d93a5b4..b3d60f18 100644 --- a/include/boost/serialization/optional.hpp +++ b/include/boost/serialization/optional.hpp @@ -16,6 +16,9 @@ #include +#include +#include + #include #include #include diff --git a/include/boost/serialization/shared_ptr.hpp b/include/boost/serialization/shared_ptr.hpp index 3ae76a8a..df5a64ca 100644 --- a/include/boost/serialization/shared_ptr.hpp +++ b/include/boost/serialization/shared_ptr.hpp @@ -18,6 +18,9 @@ #include +#include +#include + #include #include @@ -155,14 +158,24 @@ template inline void load( Archive & ar, boost::shared_ptr &t, - const unsigned int /* file_version */ + const unsigned int file_version ){ // The most common cause of trapping here would be serializing // something like shared_ptr. This occurs because int // is never tracked by default. Wrap int in a trackable type BOOST_STATIC_ASSERT((tracking_level::value != track_never)); T* r; - ar >> boost::serialization::make_nvp("px", r); + #ifdef BOOST_SERIALIZATION_SHARED_PTR_132_HPP + if(file_version < 1){ + boost_132::shared_ptr sp; + ar >> sp; + r = sp.get(); + } + else + #endif + { + ar >> boost::serialization::make_nvp("px", r); + } detail::shared_ptr_helper & sph = ar.get_helper( static_cast(NULL) ); diff --git a/include/boost/serialization/tracking.hpp b/include/boost/serialization/tracking.hpp index 343b3def..7b3cdde6 100644 --- a/include/boost/serialization/tracking.hpp +++ b/include/boost/serialization/tracking.hpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include diff --git a/include/boost/serialization/traits.hpp b/include/boost/serialization/traits.hpp index ba865ee0..eba7669e 100644 --- a/include/boost/serialization/traits.hpp +++ b/include/boost/serialization/traits.hpp @@ -44,7 +44,7 @@ template< int Level, int Tracking, unsigned int Version = 0, - class ETII = BOOST_SERIALIZATION_DEFAULT_TYPE_INFO(T) + class ETII = BOOST_SERIALIZATION_EXTENDED_TYPE_INFO_STUB(T) > struct traits : public basic_traits { BOOST_STATIC_ASSERT(Version == 0 || Level >= object_class_info); diff --git a/include/boost/serialization/type_info_implementation.hpp b/include/boost/serialization/type_info_implementation.hpp index 9661f021..66d00629 100644 --- a/include/boost/serialization/type_info_implementation.hpp +++ b/include/boost/serialization/type_info_implementation.hpp @@ -16,17 +16,23 @@ // See http://www.boost.org for updates, documentation, and revision history. -/////////////////////////////////////////////////////////////////////////////// -// If no other implementation has been designated as default, -// use extended_type_info_typeid.hpp - -#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO -#include -#endif #include #include +/////////////////////////////////////////////////////////////////////////////// +// If no other implementation has been designated as default, +// use extended_type_info_typeid.hpp + +#ifdef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO + #define BOOST_SERIALIZATION_EXTENDED_TYPE_INFO_STUB(T) \ + BOOST_SERIALIZATION_DEFAULT_TYPE_INFO(T) +#else + #define BOOST_SERIALIZATION_EXTENDED_TYPE_INFO_STUB(T) \ + extended_type_info_null +#endif + +#include #include #include #include @@ -35,6 +41,13 @@ namespace boost { namespace serialization { +template +class extended_type_info_null { + #if ! BOOST_WORKAROUND(BOOST_MSVC, <= 1200) + BOOST_STATIC_ASSERT(0 == sizeof(T)); + #endif +}; + struct basic_traits; // note that T and const T are folded into const T so that @@ -51,7 +64,7 @@ struct type_info_implementation { traits_class_typeinfo_implementation, //else mpl::identity< - BOOST_SERIALIZATION_DEFAULT_TYPE_INFO(T) + BOOST_SERIALIZATION_EXTENDED_TYPE_INFO_STUB(T) > >::type type; }; diff --git a/include/boost/serialization/version.hpp b/include/boost/serialization/version.hpp index 2d52b35e..7d7b3a0d 100644 --- a/include/boost/serialization/version.hpp +++ b/include/boost/serialization/version.hpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include diff --git a/include/boost/serialization/void_cast.hpp b/include/boost/serialization/void_cast.hpp index ffeac346..20a34609 100644 --- a/include/boost/serialization/void_cast.hpp +++ b/include/boost/serialization/void_cast.hpp @@ -21,8 +21,6 @@ #include #include -#include - #include #include #include @@ -170,12 +168,14 @@ const void_caster_primitive // void pointer from Base to Derived. Note bogus arguments to workaround // bug in msvc 6.0 template -BOOST_DLLEXPORT const void * void_cast_register( +BOOST_DLLEXPORT +const void * void_cast_register( const Derived * /* dnull = NULL */, const Base * /* bnull = NULL */ ) BOOST_USED; template -BOOST_DLLEXPORT const void * void_cast_register( +BOOST_DLLEXPORT +const void * void_cast_register( const Derived * /* dnull = NULL */, const Base * /* bnull = NULL */ ){ diff --git a/src/basic_archive.cpp b/src/basic_archive.cpp index 7eb9361e..f84d2d6e 100644 --- a/src/basic_archive.cpp +++ b/src/basic_archive.cpp @@ -31,7 +31,7 @@ // // * required only for pointers - optional for objects -#define BOOST_ARCHIVE +#define BOOST_ARCHIVE_SOURCE #include namespace boost { @@ -41,8 +41,14 @@ namespace archive { // constants used in archive signature //This should never ever change. note that is not an std::string // string. -BOOST_DECL_ARCHIVE -const char * ARCHIVE_SIGNATURE(){ +#if defined(BOOST_MSVC) + BOOST_DECL_ARCHIVE + const char * +#else + const char * + BOOST_DECL_ARCHIVE +#endif +ARCHIVE_SIGNATURE(){ return "serialization::archive"; } @@ -52,8 +58,9 @@ const char * ARCHIVE_SIGNATURE(){ // 1 - initial version // 2 - made address tracking optional // 3 - numerous changes - can't guarentee compatibility with previous versions +unsigned char BOOST_DECL_ARCHIVE -unsigned char ARCHIVE_VERSION(){ +ARCHIVE_VERSION(){ return 3; } diff --git a/src/basic_iarchive.cpp b/src/basic_iarchive.cpp index e414d851..b721ab27 100644 --- a/src/basic_iarchive.cpp +++ b/src/basic_iarchive.cpp @@ -23,7 +23,7 @@ namespace std{ } // namespace std #endif -#define BOOST_ARCHIVE +#define BOOST_ARCHIVE_SOURCE #include #include @@ -42,9 +42,6 @@ namespace std{ using namespace boost::serialization; namespace boost { -namespace serialization { - class extended_type_info; -} namespace archive { namespace detail { @@ -600,8 +597,13 @@ basic_iarchive::load_object( } // load a pointer object -BOOST_DECL_ARCHIVE -const basic_pointer_iserializer * +#if defined(BOOST_MSVC) + BOOST_DECL_ARCHIVE + const basic_pointer_iserializer * +#else + const basic_pointer_iserializer * + BOOST_DECL_ARCHIVE +#endif basic_iarchive::load_pointer( void * &t, const basic_pointer_iserializer * bpis_ptr, @@ -637,16 +639,26 @@ basic_iarchive::get_flags() const{ return pimpl->m_flags; } -BOOST_DECL_ARCHIVE -boost::serialization::basic_helper * +#if defined(BOOST_MSVC) + BOOST_DECL_ARCHIVE + boost::serialization::basic_helper * +#else + boost::serialization::basic_helper * + BOOST_DECL_ARCHIVE +#endif basic_iarchive::lookup_helper( const boost::serialization::extended_type_info * const eti ){ return pimpl->lookup_helper(eti); } -BOOST_DECL_ARCHIVE -boost::serialization::basic_helper * +#if defined(BOOST_MSVC) + BOOST_DECL_ARCHIVE + boost::serialization::basic_helper * +#else + boost::serialization::basic_helper * + BOOST_DECL_ARCHIVE +#endif basic_iarchive::insert_helper( boost::serialization::basic_helper * h, const boost::serialization::extended_type_info * const eti diff --git a/src/basic_iserializer.cpp b/src/basic_iserializer.cpp index 0d680e6e..75cb3f38 100644 --- a/src/basic_iserializer.cpp +++ b/src/basic_iserializer.cpp @@ -8,7 +8,7 @@ // See http://www.boost.org for updates, documentation, and revision history. -#define BOOST_ARCHIVE +#define BOOST_ARCHIVE_SOURCE #include namespace boost { diff --git a/src/basic_oarchive.cpp b/src/basic_oarchive.cpp index 90c3c087..7503cb2a 100644 --- a/src/basic_oarchive.cpp +++ b/src/basic_oarchive.cpp @@ -19,7 +19,7 @@ // including this here to work around an ICC in intel 7.0 // normally this would be part of basic_oarchive.hpp below. -#define BOOST_ARCHIVE +#define BOOST_ARCHIVE_SOURCE #include #include @@ -503,16 +503,26 @@ BOOST_DECL_ARCHIVE basic_oarchive::end_preamble(){ } -BOOST_DECL_ARCHIVE -boost::serialization::basic_helper * +#if defined(BOOST_MSVC) + BOOST_DECL_ARCHIVE + boost::serialization::basic_helper * +#else + boost::serialization::basic_helper * + BOOST_DECL_ARCHIVE +#endif basic_oarchive::lookup_helper( const boost::serialization::extended_type_info * const eti ){ return pimpl->lookup_helper(eti); } -BOOST_DECL_ARCHIVE -boost::serialization::basic_helper * +#if defined(BOOST_MSVC) + BOOST_DECL_ARCHIVE + boost::serialization::basic_helper * +#else + boost::serialization::basic_helper * + BOOST_DECL_ARCHIVE +#endif basic_oarchive::insert_helper( boost::serialization::basic_helper * h, const boost::serialization::extended_type_info * const eti diff --git a/src/basic_oserializer.cpp b/src/basic_oserializer.cpp index 6ef6fc6c..5fd0ece2 100644 --- a/src/basic_oserializer.cpp +++ b/src/basic_oserializer.cpp @@ -8,7 +8,7 @@ // See http://www.boost.org for updates, documentation, and revision history. -#define BOOST_ARCHIVE +#define BOOST_ARCHIVE_SOURCE #include namespace boost { diff --git a/src/basic_pointer_iserializer.cpp b/src/basic_pointer_iserializer.cpp index d4486fd6..bf04ae12 100644 --- a/src/basic_pointer_iserializer.cpp +++ b/src/basic_pointer_iserializer.cpp @@ -8,7 +8,7 @@ // See http://www.boost.org for updates, documentation, and revision history. -#define BOOST_ARCHIVE +#define BOOST_ARCHIVE_SOURCE #include namespace boost { diff --git a/src/basic_pointer_oserializer.cpp b/src/basic_pointer_oserializer.cpp index fccdb790..ae126706 100644 --- a/src/basic_pointer_oserializer.cpp +++ b/src/basic_pointer_oserializer.cpp @@ -8,7 +8,7 @@ // See http://www.boost.org for updates, documentation, and revision history. -#define BOOST_ARCHIVE +#define BOOST_ARCHIVE_SOURCE #include namespace boost { diff --git a/src/basic_serializer_map.cpp b/src/basic_serializer_map.cpp index e88fd588..4a9b5b59 100644 --- a/src/basic_serializer_map.cpp +++ b/src/basic_serializer_map.cpp @@ -14,7 +14,7 @@ #include -#define BOOST_ARCHIVE +#define BOOST_ARCHIVE_SOURCE #include #include @@ -29,7 +29,8 @@ BOOST_DECL_ARCHIVE basic_serializer_map::basic_serializer_map(){ } -BOOST_DECL_ARCHIVE bool +bool +BOOST_DECL_ARCHIVE basic_serializer_map::insert(const basic_serializer * bs){ return map.insert(bs).second; } @@ -41,7 +42,13 @@ public: {} }; -BOOST_DECL_ARCHIVE const basic_serializer * +#if defined(BOOST_MSVC) + BOOST_DECL_ARCHIVE + const basic_serializer * +#else + const basic_serializer * + BOOST_DECL_ARCHIVE +#endif basic_serializer_map::tfind( const boost::serialization::extended_type_info & type_ ) const { diff --git a/src/basic_text_iprimitive.cpp b/src/basic_text_iprimitive.cpp index 70373f20..c67a9420 100644 --- a/src/basic_text_iprimitive.cpp +++ b/src/basic_text_iprimitive.cpp @@ -14,7 +14,7 @@ #include -#define BOOST_ARCHIVE +#define BOOST_ARCHIVE_SOURCE #include #include diff --git a/src/basic_text_oprimitive.cpp b/src/basic_text_oprimitive.cpp index 6c191034..d8d98d69 100644 --- a/src/basic_text_oprimitive.cpp +++ b/src/basic_text_oprimitive.cpp @@ -14,7 +14,7 @@ #include -#define BOOST_ARCHIVE +#define BOOST_ARCHIVE_SOURCE #include #include diff --git a/src/basic_text_wiprimitive.cpp b/src/basic_text_wiprimitive.cpp index c80a8628..4797485b 100644 --- a/src/basic_text_wiprimitive.cpp +++ b/src/basic_text_wiprimitive.cpp @@ -20,7 +20,7 @@ #include -#define BOOST_WARCHIVE +#define BOOST_WARCHIVE_SOURCE #include #include diff --git a/src/basic_text_woprimitive.cpp b/src/basic_text_woprimitive.cpp index 4fd6320e..e13294e7 100644 --- a/src/basic_text_woprimitive.cpp +++ b/src/basic_text_woprimitive.cpp @@ -20,7 +20,7 @@ #include -#define BOOST_WARCHIVE +#define BOOST_WARCHIVE_SOURCE #include #include diff --git a/src/basic_xml_archive.cpp b/src/basic_xml_archive.cpp index 7d2ace93..0446dd5d 100644 --- a/src/basic_xml_archive.cpp +++ b/src/basic_xml_archive.cpp @@ -8,34 +8,90 @@ // See http://www.boost.org for updates, documentation, and revision history. -#define BOOST_ARCHIVE +#define BOOST_ARCHIVE_SOURCE #include namespace boost { namespace archive { -BOOST_DECL_ARCHIVE const char * OBJECT_ID(){ +#if defined(BOOST_MSVC) +BOOST_DECL_ARCHIVE +const char * +#else +const char * +BOOST_DECL_ARCHIVE +#endif +OBJECT_ID(){ return "object_id"; } -BOOST_DECL_ARCHIVE const char * OBJECT_REFERENCE(){ +#if defined(BOOST_MSVC) +BOOST_DECL_ARCHIVE +const char * +#else +const char * +BOOST_DECL_ARCHIVE +#endif +OBJECT_REFERENCE(){ return "object_id_reference"; } -BOOST_DECL_ARCHIVE const char * CLASS_ID(){ +#if defined(BOOST_MSVC) +BOOST_DECL_ARCHIVE +const char * +#else +const char * +BOOST_DECL_ARCHIVE +#endif +CLASS_ID(){ return "class_id"; } -BOOST_DECL_ARCHIVE const char * CLASS_ID_REFERENCE(){ +#if defined(BOOST_MSVC) +BOOST_DECL_ARCHIVE +const char * +#else +const char * +BOOST_DECL_ARCHIVE +#endif +CLASS_ID_REFERENCE(){ return "class_id_reference"; } -BOOST_DECL_ARCHIVE const char * CLASS_NAME(){ +#if defined(BOOST_MSVC) +BOOST_DECL_ARCHIVE +const char * +#else +const char * +BOOST_DECL_ARCHIVE +#endif +CLASS_NAME(){ return "class_name"; } -BOOST_DECL_ARCHIVE const char * TRACKING(){ +#if defined(BOOST_MSVC) +BOOST_DECL_ARCHIVE +const char * +#else +const char * +BOOST_DECL_ARCHIVE +#endif +TRACKING(){ return "tracking_level"; } -BOOST_DECL_ARCHIVE const char * VERSION(){ +#if defined(BOOST_MSVC) +BOOST_DECL_ARCHIVE +const char * +#else +const char * +BOOST_DECL_ARCHIVE +#endif +VERSION(){ return "version"; } -BOOST_DECL_ARCHIVE const char * SIGNATURE(){ +#if defined(BOOST_MSVC) +BOOST_DECL_ARCHIVE +const char * +#else +const char * +BOOST_DECL_ARCHIVE +#endif +SIGNATURE(){ return "signature"; } diff --git a/src/binary_iarchive.cpp b/src/binary_iarchive.cpp index 3fb8f320..39eeedc7 100644 --- a/src/binary_iarchive.cpp +++ b/src/binary_iarchive.cpp @@ -10,7 +10,7 @@ #include -#define BOOST_ARCHIVE +#define BOOST_ARCHIVE_SOURCE #include #include diff --git a/src/binary_oarchive.cpp b/src/binary_oarchive.cpp index d593a1fd..0e462146 100644 --- a/src/binary_oarchive.cpp +++ b/src/binary_oarchive.cpp @@ -10,7 +10,7 @@ #include -#define BOOST_ARCHIVE +#define BOOST_ARCHIVE_SOURCE #include #include diff --git a/src/binary_wiarchive.cpp b/src/binary_wiarchive.cpp index 23b8e66e..b9fdfb06 100644 --- a/src/binary_wiarchive.cpp +++ b/src/binary_wiarchive.cpp @@ -14,7 +14,7 @@ #error "wide char i/o not supported on this platform" #else -#define BOOST_WARCHIVE +#define BOOST_WARCHIVE_SOURCE #include #include diff --git a/src/binary_woarchive.cpp b/src/binary_woarchive.cpp index 59a43a1e..887ff6fc 100644 --- a/src/binary_woarchive.cpp +++ b/src/binary_woarchive.cpp @@ -14,7 +14,7 @@ #error "wide char i/o not supported on this platform" #else -#define BOOST_WARCHIVE +#define BOOST_WARCHIVE_SOURCE #include #include diff --git a/src/polymorphic_iarchive.cpp b/src/polymorphic_iarchive.cpp index 1d0a09ae..e3f85224 100644 --- a/src/polymorphic_iarchive.cpp +++ b/src/polymorphic_iarchive.cpp @@ -14,7 +14,7 @@ #include -#define BOOST_ARCHIVE +#define BOOST_ARCHIVE_SOURCE #include // explicitly instantiate for this type of text stream diff --git a/src/polymorphic_oarchive.cpp b/src/polymorphic_oarchive.cpp index 078d21dc..a98172d6 100644 --- a/src/polymorphic_oarchive.cpp +++ b/src/polymorphic_oarchive.cpp @@ -14,7 +14,7 @@ #include -#define BOOST_ARCHIVE +#define BOOST_ARCHIVE_SOURCE #include // explicitly instantiate for this type of text stream diff --git a/src/text_iarchive.cpp b/src/text_iarchive.cpp index 583cee61..76e57157 100644 --- a/src/text_iarchive.cpp +++ b/src/text_iarchive.cpp @@ -8,7 +8,7 @@ // See http://www.boost.org for updates, documentation, and revision history. -#define BOOST_ARCHIVE +#define BOOST_ARCHIVE_SOURCE #include // explicitly instantiate for this type of text stream diff --git a/src/text_oarchive.cpp b/src/text_oarchive.cpp index d76789a8..1d802844 100644 --- a/src/text_oarchive.cpp +++ b/src/text_oarchive.cpp @@ -12,7 +12,7 @@ # pragma warning (disable : 4786) // too long name, harmless warning #endif -#define BOOST_ARCHIVE +#define BOOST_ARCHIVE_SOURCE #include // explicitly instantiate for this type of text stream diff --git a/src/text_wiarchive.cpp b/src/text_wiarchive.cpp index c50d9a0e..3a2420dd 100644 --- a/src/text_wiarchive.cpp +++ b/src/text_wiarchive.cpp @@ -14,7 +14,7 @@ #error "wide char i/o not supported on this platform" #else -#define BOOST_WARCHIVE +#define BOOST_WARCHIVE_SOURCE #include // explicitly instantiate for this type of text stream diff --git a/src/text_woarchive.cpp b/src/text_woarchive.cpp index 36afdd08..455872c4 100644 --- a/src/text_woarchive.cpp +++ b/src/text_woarchive.cpp @@ -13,7 +13,7 @@ #error "wide char i/o not supported on this platform" #else -#define BOOST_WARCHIVE +#define BOOST_WARCHIVE_SOURCE #include #include diff --git a/src/void_cast.cpp b/src/void_cast.cpp index 9e68b15e..aa9dc260 100644 --- a/src/void_cast.cpp +++ b/src/void_cast.cpp @@ -23,13 +23,18 @@ // BOOST #define BOOST_SERIALIZATION_SOURCE +// specify the default type_info implementation if it hasn't been done already +#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO + #include +#endif #include #include -#include namespace boost { namespace serialization { +class extended_type_info; + namespace void_cast_detail { struct void_caster_compare diff --git a/src/xml_grammar.cpp b/src/xml_grammar.cpp index e1f1abe1..4a31ed90 100644 --- a/src/xml_grammar.cpp +++ b/src/xml_grammar.cpp @@ -12,7 +12,7 @@ # pragma warning (disable : 4786) // too long name, harmless warning #endif -#define BOOST_ARCHIVE +#define BOOST_ARCHIVE_SOURCE #include using namespace boost::spirit; diff --git a/src/xml_iarchive.cpp b/src/xml_iarchive.cpp index 66d10582..64ff2b5d 100644 --- a/src/xml_iarchive.cpp +++ b/src/xml_iarchive.cpp @@ -12,7 +12,7 @@ # pragma warning (disable : 4786) // too long name, harmless warning #endif -#define BOOST_ARCHIVE +#define BOOST_ARCHIVE_SOURCE // the following works around an issue between spirit 1.61 and borland. // it turns out the the certain spirit stuff must be defined before diff --git a/src/xml_oarchive.cpp b/src/xml_oarchive.cpp index 43d47a44..cf9456b5 100644 --- a/src/xml_oarchive.cpp +++ b/src/xml_oarchive.cpp @@ -12,7 +12,7 @@ # pragma warning (disable : 4786) // too long name, harmless warning #endif -#define BOOST_ARCHIVE +#define BOOST_ARCHIVE_SOURCE #include #include diff --git a/src/xml_wgrammar.cpp b/src/xml_wgrammar.cpp index 431b81d3..3adc99e9 100644 --- a/src/xml_wgrammar.cpp +++ b/src/xml_wgrammar.cpp @@ -14,7 +14,7 @@ #error "wide char i/o not supported on this platform" #else -#define BOOST_WARCHIVE +#define BOOST_WARCHIVE_SOURCE #include using namespace boost::spirit; diff --git a/src/xml_wiarchive.cpp b/src/xml_wiarchive.cpp index 0410dd9f..3403ff7f 100644 --- a/src/xml_wiarchive.cpp +++ b/src/xml_wiarchive.cpp @@ -19,7 +19,7 @@ # pragma warning (disable : 4786) // too long name, harmless warning #endif -#define BOOST_WARCHIVE +#define BOOST_WARCHIVE_SOURCE // the following works around an issue between spirit 1.61 and borland. // it turns out the the certain spirit stuff must be defined before diff --git a/src/xml_woarchive.cpp b/src/xml_woarchive.cpp index 138b18a9..f10d10a1 100644 --- a/src/xml_woarchive.cpp +++ b/src/xml_woarchive.cpp @@ -13,7 +13,7 @@ #error "wide char i/o not supported on this platform" #else -#define BOOST_WARCHIVE +#define BOOST_WARCHIVE_SOURCE #include /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8