1 #ifndef BOOST_ARCHIVE_BASIC_XML_IARCHIVE_HPP
2 #define BOOST_ARCHIVE_BASIC_XML_IARCHIVE_HPP
4 // MS compatible compilers support #pragma once
5 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10 // basic_xml_iarchive.hpp
12 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
13 // Use, modification and distribution is subject to the Boost Software
14 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
15 // http://www.boost.org/LICENSE_1_0.txt)
17 // See http://www.boost.org for updates, documentation, and revision history.
19 #include <boost/config.hpp>
20 #include <boost/serialization/pfto.hpp>
21 #include <boost/detail/workaround.hpp>
23 #include <boost/archive/detail/common_iarchive.hpp>
25 #include <boost/serialization/nvp.hpp>
26 #include <boost/serialization/string.hpp>
28 #include <boost/mpl/assert.hpp>
30 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
33 # pragma warning(push)
34 # pragma warning(disable : 4511 4512)
40 /////////////////////////////////////////////////////////////////////////
41 // class xml_iarchive - read serialized objects from a input text stream
42 template<class Archive>
43 class basic_xml_iarchive :
44 public detail::common_iarchive<Archive>
47 #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
49 #elif defined(BOOST_MSVC)
50 // for some inexplicable reason insertion of "class" generates compile erro
52 friend detail::interface_oarchive<Archive>;
54 friend class detail::interface_oarchive<Archive>;
57 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
58 load_start(const char *name);
59 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
60 load_end(const char *name);
62 // Anything not an attribute and not a name-value pair is an
63 // should be trapped here.
65 void load_override(T & t, BOOST_PFTO int)
67 // If your program fails to compile here, its most likely due to
68 // not specifying an nvp wrapper around the variable to
70 BOOST_MPL_ASSERT((serialization::is_wrapper< T >));
71 this->detail_common_iarchive::load_override(t, 0);
74 // Anything not an attribute - see below - should be a name value
75 // pair and be processed here
76 typedef detail::common_iarchive<Archive> detail_common_iarchive;
79 #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
82 boost::serialization::nvp< T > & t,
85 this->This()->load_start(t.name());
86 this->detail_common_iarchive::load_override(t.value(), 0);
87 this->This()->load_end(t.name());
90 // specific overrides for attributes - handle as
91 // primitives. These are not name-value pairs
92 // so they have to be intercepted here and passed on to load.
93 // although the class_id is included in the xml text file in order
94 // to make the file self describing, it isn't used when loading
95 // an xml archive. So we can skip it here. Note: we MUST override
96 // it otherwise it will be loaded as a normal primitive w/o tag and
97 // leaving the archive in an undetermined state
98 void load_override(class_id_optional_type & /* t */, int){}
99 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
100 load_override(object_id_type & t, int);
101 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
102 load_override(version_type & t, int);
103 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
104 load_override(class_id_type & t, int);
105 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
106 load_override(tracking_type & t, int);
107 // class_name_type can't be handled here as it depends upon the
108 // char type used by the stream. So require the derived implementation
110 // void load_override(class_name_type & t, int);
112 BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
113 basic_xml_iarchive(unsigned int flags);
114 BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
115 ~basic_xml_iarchive();
118 } // namespace archive
125 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
127 #endif // BOOST_ARCHIVE_BASIC_XML_IARCHIVE_HPP