Brian Silverman | 8867871 | 2018-08-04 23:56:48 -0700 | [diff] [blame^] | 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 | std::locale archive_locale; |
| 66 | boost::scoped_ptr<xml_wgrammar> gimpl; |
| 67 | std::wistream & get_is(){ |
| 68 | return is; |
| 69 | } |
| 70 | template<class T> |
| 71 | void |
| 72 | load(T & t){ |
| 73 | basic_text_iprimitive<std::wistream>::load(t); |
| 74 | } |
| 75 | void |
| 76 | load(version_type & t){ |
| 77 | unsigned int v; |
| 78 | load(v); |
| 79 | t = version_type(v); |
| 80 | } |
| 81 | void |
| 82 | load(boost::serialization::item_version_type & t){ |
| 83 | unsigned int v; |
| 84 | load(v); |
| 85 | t = boost::serialization::item_version_type(v); |
| 86 | } |
| 87 | BOOST_WARCHIVE_DECL void |
| 88 | load(char * t); |
| 89 | #ifndef BOOST_NO_INTRINSIC_WCHAR_T |
| 90 | BOOST_WARCHIVE_DECL void |
| 91 | load(wchar_t * t); |
| 92 | #endif |
| 93 | BOOST_WARCHIVE_DECL void |
| 94 | load(std::string &s); |
| 95 | #ifndef BOOST_NO_STD_WSTRING |
| 96 | BOOST_WARCHIVE_DECL void |
| 97 | load(std::wstring &ws); |
| 98 | #endif |
| 99 | template<class T> |
| 100 | void load_override(T & t){ |
| 101 | basic_xml_iarchive<Archive>::load_override(t); |
| 102 | } |
| 103 | BOOST_WARCHIVE_DECL void |
| 104 | load_override(class_name_type & t); |
| 105 | BOOST_WARCHIVE_DECL void |
| 106 | init(); |
| 107 | BOOST_WARCHIVE_DECL |
| 108 | xml_wiarchive_impl(std::wistream & is, unsigned int flags) ; |
| 109 | BOOST_WARCHIVE_DECL |
| 110 | ~xml_wiarchive_impl(); |
| 111 | }; |
| 112 | |
| 113 | } // namespace archive |
| 114 | } // namespace boost |
| 115 | |
| 116 | #ifdef BOOST_MSVC |
| 117 | # pragma warning(pop) |
| 118 | #endif |
| 119 | |
| 120 | #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas |
| 121 | |
| 122 | #ifdef BOOST_MSVC |
| 123 | # pragma warning(push) |
| 124 | # pragma warning(disable : 4511 4512) |
| 125 | #endif |
| 126 | |
| 127 | namespace boost { |
| 128 | namespace archive { |
| 129 | |
| 130 | class BOOST_SYMBOL_VISIBLE xml_wiarchive : |
| 131 | public xml_wiarchive_impl<xml_wiarchive>{ |
| 132 | public: |
| 133 | xml_wiarchive(std::wistream & is, unsigned int flags = 0) : |
| 134 | xml_wiarchive_impl<xml_wiarchive>(is, flags) |
| 135 | {} |
| 136 | ~xml_wiarchive(){} |
| 137 | }; |
| 138 | |
| 139 | } // namespace archive |
| 140 | } // namespace boost |
| 141 | |
| 142 | // required by export |
| 143 | BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_wiarchive) |
| 144 | |
| 145 | #ifdef BOOST_MSVC |
| 146 | #pragma warning(pop) |
| 147 | #endif |
| 148 | |
| 149 | #endif // BOOST_NO_STD_WSTREAMBUF |
| 150 | #endif // BOOST_ARCHIVE_XML_WIARCHIVE_HPP |