| 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 | |
| 33 | #include <boost/archive/detail/abi_prefix.hpp> // must be the last header |
| 34 | |
| 35 | #ifdef BOOST_MSVC |
| 36 | # pragma warning(push) |
| 37 | # pragma warning(disable : 4511 4512) |
| 38 | #endif |
| 39 | |
| 40 | namespace boost { |
| 41 | namespace archive { |
| 42 | |
| 43 | namespace detail { |
| 44 | template<class Archive> class interface_iarchive; |
| 45 | } // namespace detail |
| 46 | |
| 47 | template<class CharType> |
| 48 | class basic_xml_grammar; |
| 49 | typedef basic_xml_grammar<wchar_t> xml_wgrammar; |
| 50 | |
| 51 | template<class Archive> |
| 52 | class BOOST_SYMBOL_VISIBLE xml_wiarchive_impl : |
| 53 | public basic_text_iprimitive<std::wistream>, |
| 54 | public basic_xml_iarchive<Archive> |
| 55 | { |
| 56 | #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS |
| 57 | public: |
| 58 | #else |
| 59 | protected: |
| 60 | friend class detail::interface_iarchive<Archive>; |
| 61 | friend class basic_xml_iarchive<Archive>; |
| 62 | friend class load_access; |
| 63 | #endif |
| 64 | std::locale archive_locale; |
| 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() BOOST_OVERRIDE; |
| 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 | if(0 == (flags & no_header)) |
| 136 | init(); |
| 137 | } |
| 138 | ~xml_wiarchive() BOOST_OVERRIDE {} |
| 139 | }; |
| 140 | |
| 141 | } // namespace archive |
| 142 | } // namespace boost |
| 143 | |
| 144 | // required by export |
| 145 | BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_wiarchive) |
| 146 | |
| 147 | #ifdef BOOST_MSVC |
| 148 | #pragma warning(pop) |
| 149 | #endif |
| 150 | |
| 151 | #endif // BOOST_NO_STD_WSTREAMBUF |
| 152 | #endif // BOOST_ARCHIVE_XML_WIARCHIVE_HPP |
| 153 |
