Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:28:30

0001 #ifndef BOOST_ARCHIVE_BASIC_XML_IARCHIVE_HPP
0002 #define BOOST_ARCHIVE_BASIC_XML_IARCHIVE_HPP
0003 
0004 // MS compatible compilers support #pragma once
0005 #if defined(_MSC_VER)
0006 # pragma once
0007 #endif
0008 
0009 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
0010 // basic_xml_iarchive.hpp
0011 
0012 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
0013 // Use, modification and distribution is subject to the Boost Software
0014 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0015 // http://www.boost.org/LICENSE_1_0.txt)
0016 
0017 //  See http://www.boost.org for updates, documentation, and revision history.
0018 
0019 #include <boost/config.hpp>
0020 #include <boost/mpl/assert.hpp>
0021 
0022 #include <boost/archive/detail/common_iarchive.hpp>
0023 #include <boost/serialization/nvp.hpp>
0024 #include <boost/serialization/string.hpp>
0025 
0026 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
0027 
0028 #ifdef BOOST_MSVC
0029 #  pragma warning(push)
0030 #  pragma warning(disable : 4511 4512)
0031 #endif
0032 
0033 namespace boost {
0034 namespace archive {
0035 
0036 namespace detail {
0037     template<class Archive> class interface_iarchive;
0038 } // namespace detail
0039 
0040 /////////////////////////////////////////////////////////////////////////
0041 // class basic_xml_iarchive - read serialized objects from a input text stream
0042 template<class Archive>
0043 class BOOST_SYMBOL_VISIBLE basic_xml_iarchive :
0044     public detail::common_iarchive<Archive>
0045 {
0046     unsigned int depth;
0047 #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
0048 public:
0049 #else
0050 protected:
0051     friend class detail::interface_iarchive<Archive>;
0052 #endif
0053     BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0054     load_start(const char *name);
0055     BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0056     load_end(const char *name);
0057 
0058     // Anything not an attribute and not a name-value pair is an
0059     // should be trapped here.
0060     template<class T>
0061     void load_override(T & t)
0062     {
0063         // If your program fails to compile here, its most likely due to
0064         // not specifying an nvp wrapper around the variable to
0065         // be serialized.
0066         BOOST_MPL_ASSERT((serialization::is_wrapper< T >));
0067         this->detail_common_iarchive::load_override(t);
0068     }
0069 
0070     // Anything not an attribute - see below - should be a name value
0071     // pair and be processed here
0072     typedef detail::common_iarchive<Archive> detail_common_iarchive;
0073     template<class T>
0074     void load_override(
0075         const boost::serialization::nvp< T > & t
0076     ){
0077         this->This()->load_start(t.name());
0078         this->detail_common_iarchive::load_override(t.value());
0079         this->This()->load_end(t.name());
0080     }
0081 
0082     // specific overrides for attributes - handle as
0083     // primitives. These are not name-value pairs
0084     // so they have to be intercepted here and passed on to load.
0085     // although the class_id is included in the xml text file in order
0086     // to make the file self describing, it isn't used when loading
0087     // an xml archive.  So we can skip it here.  Note: we MUST override
0088     // it otherwise it will be loaded as a normal primitive w/o tag and
0089     // leaving the archive in an undetermined state
0090     BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0091     load_override(class_id_type & t);
0092     void load_override(class_id_optional_type & /* t */){}
0093     BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0094     load_override(object_id_type & t);
0095     BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0096     load_override(version_type & t);
0097     BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0098     load_override(tracking_type & t);
0099     // class_name_type can't be handled here as it depends upon the
0100     // char type used by the stream.  So require the derived implementation
0101     // handle this.
0102     // void load_override(class_name_type & t);
0103 
0104     BOOST_ARCHIVE_OR_WARCHIVE_DECL
0105     basic_xml_iarchive(unsigned int flags);
0106     BOOST_ARCHIVE_OR_WARCHIVE_DECL
0107     ~basic_xml_iarchive() BOOST_OVERRIDE;
0108 };
0109 
0110 } // namespace archive
0111 } // namespace boost
0112 
0113 #ifdef BOOST_MSVC
0114 #pragma warning(pop)
0115 #endif
0116 
0117 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
0118 
0119 #endif // BOOST_ARCHIVE_BASIC_XML_IARCHIVE_HPP