Chris@16: #ifndef BOOST_ARCHIVE_BASIC_XML_IARCHIVE_HPP Chris@16: #define BOOST_ARCHIVE_BASIC_XML_IARCHIVE_HPP Chris@16: Chris@16: // MS compatible compilers support #pragma once Chris@101: #if defined(_MSC_VER) Chris@16: # pragma once Chris@16: #endif Chris@16: Chris@16: /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 Chris@16: // basic_xml_iarchive.hpp Chris@16: Chris@16: // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . Chris@16: // Use, modification and distribution is subject to the Boost Software Chris@16: // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: // See http://www.boost.org for updates, documentation, and revision history. Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@16: #include Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@16: #include // must be the last header Chris@16: Chris@16: #ifdef BOOST_MSVC Chris@16: # pragma warning(push) Chris@16: # pragma warning(disable : 4511 4512) Chris@16: #endif Chris@16: Chris@16: namespace boost { Chris@16: namespace archive { Chris@16: Chris@101: namespace detail { Chris@101: template class interface_iarchive; Chris@101: } // namespace detail Chris@101: Chris@16: ///////////////////////////////////////////////////////////////////////// Chris@16: // class xml_iarchive - read serialized objects from a input text stream Chris@16: template Chris@16: class basic_xml_iarchive : Chris@16: public detail::common_iarchive Chris@16: { Chris@101: #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS Chris@101: public: Chris@101: #else Chris@16: protected: Chris@101: #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) Chris@101: // for some inexplicable reason insertion of "class" generates compile erro Chris@101: // on msvc 7.1 Chris@101: friend detail::interface_iarchive; Chris@101: #else Chris@101: friend class detail::interface_iarchive; Chris@101: #endif Chris@16: #endif Chris@16: unsigned int depth; Chris@16: BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) Chris@16: load_start(const char *name); Chris@16: BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) Chris@16: load_end(const char *name); Chris@16: Chris@16: // Anything not an attribute and not a name-value pair is an Chris@16: // should be trapped here. Chris@16: template Chris@16: void load_override(T & t, BOOST_PFTO int) Chris@16: { Chris@16: // If your program fails to compile here, its most likely due to Chris@16: // not specifying an nvp wrapper around the variable to Chris@16: // be serialized. Chris@16: BOOST_MPL_ASSERT((serialization::is_wrapper< T >)); Chris@16: this->detail_common_iarchive::load_override(t, 0); Chris@16: } Chris@16: Chris@16: // Anything not an attribute - see below - should be a name value Chris@16: // pair and be processed here Chris@16: typedef detail::common_iarchive detail_common_iarchive; Chris@16: template Chris@16: void load_override( Chris@16: #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING Chris@16: const Chris@16: #endif Chris@16: boost::serialization::nvp< T > & t, Chris@16: int Chris@16: ){ Chris@16: this->This()->load_start(t.name()); Chris@16: this->detail_common_iarchive::load_override(t.value(), 0); Chris@16: this->This()->load_end(t.name()); Chris@16: } Chris@16: Chris@16: // specific overrides for attributes - handle as Chris@16: // primitives. These are not name-value pairs Chris@16: // so they have to be intercepted here and passed on to load. Chris@16: // although the class_id is included in the xml text file in order Chris@16: // to make the file self describing, it isn't used when loading Chris@16: // an xml archive. So we can skip it here. Note: we MUST override Chris@16: // it otherwise it will be loaded as a normal primitive w/o tag and Chris@16: // leaving the archive in an undetermined state Chris@16: void load_override(class_id_optional_type & /* t */, int){} Chris@16: BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) Chris@16: load_override(object_id_type & t, int); Chris@16: BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) Chris@16: load_override(version_type & t, int); Chris@16: BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) Chris@16: load_override(class_id_type & t, int); Chris@16: BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) Chris@16: load_override(tracking_type & t, int); Chris@16: // class_name_type can't be handled here as it depends upon the Chris@16: // char type used by the stream. So require the derived implementation Chris@16: // handle this. Chris@16: // void load_override(class_name_type & t, int); Chris@16: Chris@16: BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) Chris@16: basic_xml_iarchive(unsigned int flags); Chris@16: BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) Chris@16: ~basic_xml_iarchive(); Chris@16: }; Chris@16: Chris@16: } // namespace archive Chris@16: } // namespace boost Chris@16: Chris@16: #ifdef BOOST_MSVC Chris@16: #pragma warning(pop) Chris@16: #endif Chris@16: Chris@16: #include // pops abi_suffix.hpp pragmas Chris@16: Chris@16: #endif // BOOST_ARCHIVE_BASIC_XML_IARCHIVE_HPP