]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #ifndef BOOST_ARCHIVE_XML_WIARCHIVE_HPP |
2 | #define BOOST_ARCHIVE_XML_WIARCHIVE_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_wiarchive.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 | #ifdef BOOST_NO_STD_WSTREAMBUF | |
21 | #error "wide char i/o not supported on this platform" | |
22 | #else | |
23 | ||
24 | #include <istream> | |
25 | ||
26 | #include <boost/smart_ptr/scoped_ptr.hpp> | |
27 | #include <boost/archive/detail/auto_link_warchive.hpp> | |
28 | #include <boost/archive/basic_text_iprimitive.hpp> | |
29 | #include <boost/archive/basic_xml_iarchive.hpp> | |
30 | #include <boost/archive/detail/register_archive.hpp> | |
31 | #include <boost/serialization/item_version_type.hpp> | |
32 | // #include <boost/archive/detail/utf8_codecvt_facet.hpp> | |
33 | ||
34 | #include <boost/archive/detail/abi_prefix.hpp> // must be the last header | |
35 | ||
36 | #ifdef BOOST_MSVC | |
37 | # pragma warning(push) | |
38 | # pragma warning(disable : 4511 4512) | |
39 | #endif | |
40 | ||
41 | namespace boost { | |
42 | namespace archive { | |
43 | ||
44 | namespace detail { | |
45 | template<class Archive> class interface_iarchive; | |
46 | } // namespace detail | |
47 | ||
48 | template<class CharType> | |
49 | class basic_xml_grammar; | |
50 | typedef basic_xml_grammar<wchar_t> xml_wgrammar; | |
51 | ||
52 | template<class Archive> | |
53 | class BOOST_SYMBOL_VISIBLE xml_wiarchive_impl : | |
54 | public basic_text_iprimitive<std::wistream>, | |
55 | public basic_xml_iarchive<Archive> | |
56 | { | |
57 | #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS | |
58 | public: | |
59 | #else | |
60 | protected: | |
61 | friend class detail::interface_iarchive<Archive>; | |
62 | friend class basic_xml_iarchive<Archive>; | |
63 | friend class load_access; | |
64 | #endif | |
65 | boost::scoped_ptr<xml_wgrammar> gimpl; | |
66 | std::wistream & get_is(){ | |
67 | return is; | |
68 | } | |
69 | template<class T> | |
70 | void | |
71 | load(T & t){ | |
72 | basic_text_iprimitive<std::wistream>::load(t); | |
73 | } | |
74 | void | |
75 | load(version_type & t){ | |
76 | unsigned int v; | |
77 | load(v); | |
78 | t = version_type(v); | |
79 | } | |
80 | void | |
81 | load(boost::serialization::item_version_type & t){ | |
82 | unsigned int v; | |
83 | load(v); | |
84 | t = boost::serialization::item_version_type(v); | |
85 | } | |
86 | BOOST_WARCHIVE_DECL void | |
87 | load(char * t); | |
88 | #ifndef BOOST_NO_INTRINSIC_WCHAR_T | |
89 | BOOST_WARCHIVE_DECL void | |
90 | load(wchar_t * t); | |
91 | #endif | |
92 | BOOST_WARCHIVE_DECL void | |
93 | load(std::string &s); | |
94 | #ifndef BOOST_NO_STD_WSTRING | |
95 | BOOST_WARCHIVE_DECL void | |
96 | load(std::wstring &ws); | |
97 | #endif | |
98 | template<class T> | |
99 | void load_override(T & t){ | |
100 | basic_xml_iarchive<Archive>::load_override(t); | |
101 | } | |
102 | BOOST_WARCHIVE_DECL void | |
103 | load_override(class_name_type & t); | |
104 | BOOST_WARCHIVE_DECL void | |
105 | init(); | |
106 | BOOST_WARCHIVE_DECL | |
107 | xml_wiarchive_impl(std::wistream & is, unsigned int flags) ; | |
108 | BOOST_WARCHIVE_DECL | |
109 | ~xml_wiarchive_impl(); | |
110 | }; | |
111 | ||
112 | } // namespace archive | |
113 | } // namespace boost | |
114 | ||
115 | #ifdef BOOST_MSVC | |
116 | # pragma warning(pop) | |
117 | #endif | |
118 | ||
119 | #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas | |
120 | ||
121 | #ifdef BOOST_MSVC | |
122 | # pragma warning(push) | |
123 | # pragma warning(disable : 4511 4512) | |
124 | #endif | |
125 | ||
126 | namespace boost { | |
127 | namespace archive { | |
128 | ||
129 | class BOOST_SYMBOL_VISIBLE xml_wiarchive : | |
130 | public xml_wiarchive_impl<xml_wiarchive>{ | |
131 | public: | |
132 | xml_wiarchive(std::wistream & is, unsigned int flags = 0) : | |
133 | xml_wiarchive_impl<xml_wiarchive>(is, flags) | |
134 | {} | |
135 | ~xml_wiarchive(){} | |
136 | }; | |
137 | ||
138 | } // namespace archive | |
139 | } // namespace boost | |
140 | ||
141 | // required by export | |
142 | BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_wiarchive) | |
143 | ||
144 | #ifdef BOOST_MSVC | |
145 | #pragma warning(pop) | |
146 | #endif | |
147 | ||
148 | #endif // BOOST_NO_STD_WSTREAMBUF | |
149 | #endif // BOOST_ARCHIVE_XML_WIARCHIVE_HPP |