comparison DEPENDENCIES/generic/include/boost/archive/basic_xml_iarchive.hpp @ 16:2665513ce2d3

Add boost headers
author Chris Cannam
date Tue, 05 Aug 2014 11:11:38 +0100
parents
children c530137014c0
comparison
equal deleted inserted replaced
15:663ca0da4350 16:2665513ce2d3
1 #ifndef BOOST_ARCHIVE_BASIC_XML_IARCHIVE_HPP
2 #define BOOST_ARCHIVE_BASIC_XML_IARCHIVE_HPP
3
4 // MS compatible compilers support #pragma once
5 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
6 # pragma once
7 #endif
8
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10 // basic_xml_iarchive.hpp
11
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)
16
17 // See http://www.boost.org for updates, documentation, and revision history.
18
19 #include <boost/config.hpp>
20 #include <boost/serialization/pfto.hpp>
21 #include <boost/detail/workaround.hpp>
22
23 #include <boost/archive/detail/common_iarchive.hpp>
24
25 #include <boost/serialization/nvp.hpp>
26 #include <boost/serialization/string.hpp>
27
28 #include <boost/mpl/assert.hpp>
29
30 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
31
32 #ifdef BOOST_MSVC
33 # pragma warning(push)
34 # pragma warning(disable : 4511 4512)
35 #endif
36
37 namespace boost {
38 namespace archive {
39
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>
45 {
46 protected:
47 #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
48 public:
49 #elif defined(BOOST_MSVC)
50 // for some inexplicable reason insertion of "class" generates compile erro
51 // on msvc 7.1
52 friend detail::interface_oarchive<Archive>;
53 #else
54 friend class detail::interface_oarchive<Archive>;
55 #endif
56 unsigned int depth;
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);
61
62 // Anything not an attribute and not a name-value pair is an
63 // should be trapped here.
64 template<class T>
65 void load_override(T & t, BOOST_PFTO int)
66 {
67 // If your program fails to compile here, its most likely due to
68 // not specifying an nvp wrapper around the variable to
69 // be serialized.
70 BOOST_MPL_ASSERT((serialization::is_wrapper< T >));
71 this->detail_common_iarchive::load_override(t, 0);
72 }
73
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;
77 template<class T>
78 void load_override(
79 #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
80 const
81 #endif
82 boost::serialization::nvp< T > & t,
83 int
84 ){
85 this->This()->load_start(t.name());
86 this->detail_common_iarchive::load_override(t.value(), 0);
87 this->This()->load_end(t.name());
88 }
89
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
109 // handle this.
110 // void load_override(class_name_type & t, int);
111
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();
116 };
117
118 } // namespace archive
119 } // namespace boost
120
121 #ifdef BOOST_MSVC
122 #pragma warning(pop)
123 #endif
124
125 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
126
127 #endif // BOOST_ARCHIVE_BASIC_XML_IARCHIVE_HPP