]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #ifndef BOOST_ARCHIVE_XML_IARCHIVE_HPP |
2 | #define BOOST_ARCHIVE_XML_IARCHIVE_HPP | |
3 | ||
4 | // MS compatible compilers support #pragma once | |
5 | #if defined(_MSC_VER) | |
6 | # pragma once | |
7 | #endif | |
8 | ||
9 | /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 | |
10 | // xml_iarchive.hpp | |
11 | ||
f67539c2 | 12 | // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . |
7c673cae FG |
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 <istream> | |
20 | ||
21 | #include <boost/scoped_ptr.hpp> | |
22 | #include <boost/archive/detail/auto_link_archive.hpp> | |
23 | #include <boost/archive/basic_text_iprimitive.hpp> | |
24 | #include <boost/archive/basic_xml_iarchive.hpp> | |
25 | #include <boost/archive/detail/register_archive.hpp> | |
26 | #include <boost/serialization/item_version_type.hpp> | |
27 | ||
28 | #include <boost/archive/detail/abi_prefix.hpp> // must be the last header | |
29 | ||
30 | #ifdef BOOST_MSVC | |
31 | # pragma warning(push) | |
32 | # pragma warning(disable : 4511 4512) | |
33 | #endif | |
34 | ||
f67539c2 | 35 | namespace boost { |
7c673cae FG |
36 | namespace archive { |
37 | ||
38 | namespace detail { | |
39 | template<class Archive> class interface_iarchive; | |
40 | } // namespace detail | |
41 | ||
42 | template<class CharType> | |
43 | class basic_xml_grammar; | |
44 | typedef basic_xml_grammar<char> xml_grammar; | |
45 | ||
46 | template<class Archive> | |
f67539c2 | 47 | class BOOST_SYMBOL_VISIBLE xml_iarchive_impl : |
7c673cae FG |
48 | public basic_text_iprimitive<std::istream>, |
49 | public basic_xml_iarchive<Archive> | |
50 | { | |
51 | #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS | |
52 | public: | |
53 | #else | |
54 | protected: | |
55 | friend class detail::interface_iarchive<Archive>; | |
56 | friend class basic_xml_iarchive<Archive>; | |
57 | friend class load_access; | |
58 | #endif | |
59 | // use boost:scoped_ptr to implement automatic deletion; | |
60 | boost::scoped_ptr<xml_grammar> gimpl; | |
61 | ||
62 | std::istream & get_is(){ | |
63 | return is; | |
64 | } | |
65 | template<class T> | |
66 | void load(T & t){ | |
67 | basic_text_iprimitive<std::istream>::load(t); | |
68 | } | |
f67539c2 | 69 | void |
7c673cae FG |
70 | load(version_type & t){ |
71 | unsigned int v; | |
72 | load(v); | |
73 | t = version_type(v); | |
74 | } | |
f67539c2 | 75 | void |
7c673cae FG |
76 | load(boost::serialization::item_version_type & t){ |
77 | unsigned int v; | |
78 | load(v); | |
79 | t = boost::serialization::item_version_type(v); | |
80 | } | |
81 | BOOST_ARCHIVE_DECL void | |
82 | load(char * t); | |
83 | #ifndef BOOST_NO_INTRINSIC_WCHAR_T | |
84 | BOOST_ARCHIVE_DECL void | |
85 | load(wchar_t * t); | |
86 | #endif | |
87 | BOOST_ARCHIVE_DECL void | |
88 | load(std::string &s); | |
89 | #ifndef BOOST_NO_STD_WSTRING | |
90 | BOOST_ARCHIVE_DECL void | |
91 | load(std::wstring &ws); | |
92 | #endif | |
93 | template<class T> | |
94 | void load_override(T & t){ | |
95 | basic_xml_iarchive<Archive>::load_override(t); | |
96 | } | |
97 | BOOST_ARCHIVE_DECL void | |
98 | load_override(class_name_type & t); | |
99 | BOOST_ARCHIVE_DECL void | |
100 | init(); | |
f67539c2 | 101 | BOOST_ARCHIVE_DECL |
7c673cae FG |
102 | xml_iarchive_impl(std::istream & is, unsigned int flags); |
103 | BOOST_ARCHIVE_DECL | |
104 | ~xml_iarchive_impl(); | |
105 | }; | |
106 | ||
107 | } // namespace archive | |
108 | } // namespace boost | |
109 | ||
110 | #ifdef BOOST_MSVC | |
111 | #pragma warning(pop) | |
112 | #endif | |
113 | ||
114 | #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas | |
115 | #ifdef BOOST_MSVC | |
116 | # pragma warning(push) | |
117 | # pragma warning(disable : 4511 4512) | |
118 | #endif | |
119 | ||
f67539c2 | 120 | namespace boost { |
7c673cae FG |
121 | namespace archive { |
122 | ||
f67539c2 | 123 | class BOOST_SYMBOL_VISIBLE xml_iarchive : |
7c673cae FG |
124 | public xml_iarchive_impl<xml_iarchive>{ |
125 | public: | |
126 | xml_iarchive(std::istream & is, unsigned int flags = 0) : | |
127 | xml_iarchive_impl<xml_iarchive>(is, flags) | |
f67539c2 TL |
128 | { |
129 | if(0 == (flags & no_header)) | |
130 | init(); | |
131 | } | |
7c673cae FG |
132 | ~xml_iarchive(){}; |
133 | }; | |
134 | ||
135 | } // namespace archive | |
136 | } // namespace boost | |
137 | ||
138 | // required by export | |
139 | BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_iarchive) | |
140 | ||
141 | #ifdef BOOST_MSVC | |
142 | #pragma warning(pop) | |
143 | #endif | |
144 | ||
145 | #endif // BOOST_ARCHIVE_XML_IARCHIVE_HPP |