Brian Silverman | 8867871 | 2018-08-04 23:56:48 -0700 | [diff] [blame^] | 1 | #ifndef BOOST_ARCHIVE_TEXT_WIARCHIVE_HPP |
| 2 | #define BOOST_ARCHIVE_TEXT_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 | // text_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/archive/detail/auto_link_warchive.hpp> |
| 27 | #include <boost/archive/basic_text_iprimitive.hpp> |
| 28 | #include <boost/archive/basic_text_iarchive.hpp> |
| 29 | #include <boost/archive/detail/register_archive.hpp> |
| 30 | #include <boost/serialization/item_version_type.hpp> |
| 31 | |
| 32 | #include <boost/archive/detail/abi_prefix.hpp> // must be the last header |
| 33 | |
| 34 | #ifdef BOOST_MSVC |
| 35 | # pragma warning(push) |
| 36 | # pragma warning(disable : 4511 4512) |
| 37 | #endif |
| 38 | |
| 39 | namespace boost { |
| 40 | namespace archive { |
| 41 | |
| 42 | namespace detail { |
| 43 | template<class Archive> class interface_iarchive; |
| 44 | } // namespace detail |
| 45 | |
| 46 | template<class Archive> |
| 47 | class BOOST_SYMBOL_VISIBLE text_wiarchive_impl : |
| 48 | public basic_text_iprimitive<std::wistream>, |
| 49 | public basic_text_iarchive<Archive> |
| 50 | { |
| 51 | #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS |
| 52 | public: |
| 53 | #else |
| 54 | protected: |
| 55 | #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) |
| 56 | // for some inexplicable reason insertion of "class" generates compile erro |
| 57 | // on msvc 7.1 |
| 58 | friend detail::interface_iarchive<Archive>; |
| 59 | friend load_access; |
| 60 | #else |
| 61 | friend class detail::interface_iarchive<Archive>; |
| 62 | friend class load_access; |
| 63 | #endif |
| 64 | #endif |
| 65 | template<class T> |
| 66 | void load(T & t){ |
| 67 | basic_text_iprimitive<std::wistream>::load(t); |
| 68 | } |
| 69 | void load(version_type & t){ |
| 70 | unsigned int v; |
| 71 | load(v); |
| 72 | t = version_type(v); |
| 73 | } |
| 74 | void load(boost::serialization::item_version_type & t){ |
| 75 | unsigned int v; |
| 76 | load(v); |
| 77 | t = boost::serialization::item_version_type(v); |
| 78 | } |
| 79 | BOOST_WARCHIVE_DECL void |
| 80 | load(char * t); |
| 81 | #ifndef BOOST_NO_INTRINSIC_WCHAR_T |
| 82 | BOOST_WARCHIVE_DECL void |
| 83 | load(wchar_t * t); |
| 84 | #endif |
| 85 | BOOST_WARCHIVE_DECL void |
| 86 | load(std::string &s); |
| 87 | #ifndef BOOST_NO_STD_WSTRING |
| 88 | BOOST_WARCHIVE_DECL void |
| 89 | load(std::wstring &ws); |
| 90 | #endif |
| 91 | template<class T> |
| 92 | void load_override(T & t){ |
| 93 | basic_text_iarchive<Archive>::load_override(t); |
| 94 | } |
| 95 | BOOST_WARCHIVE_DECL |
| 96 | text_wiarchive_impl(std::wistream & is, unsigned int flags); |
| 97 | ~text_wiarchive_impl(){}; |
| 98 | }; |
| 99 | |
| 100 | } // namespace archive |
| 101 | } // namespace boost |
| 102 | |
| 103 | #ifdef BOOST_MSVC |
| 104 | #pragma warning(pop) |
| 105 | #endif |
| 106 | |
| 107 | #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas |
| 108 | |
| 109 | #ifdef BOOST_MSVC |
| 110 | # pragma warning(push) |
| 111 | # pragma warning(disable : 4511 4512) |
| 112 | #endif |
| 113 | |
| 114 | namespace boost { |
| 115 | namespace archive { |
| 116 | |
| 117 | class BOOST_SYMBOL_VISIBLE text_wiarchive : |
| 118 | public text_wiarchive_impl<text_wiarchive>{ |
| 119 | public: |
| 120 | text_wiarchive(std::wistream & is, unsigned int flags = 0) : |
| 121 | text_wiarchive_impl<text_wiarchive>(is, flags) |
| 122 | {} |
| 123 | ~text_wiarchive(){} |
| 124 | }; |
| 125 | |
| 126 | } // namespace archive |
| 127 | } // namespace boost |
| 128 | |
| 129 | // required by export |
| 130 | BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_wiarchive) |
| 131 | |
| 132 | #ifdef BOOST_MSVC |
| 133 | #pragma warning(pop) |
| 134 | #endif |
| 135 | |
| 136 | #endif // BOOST_NO_STD_WSTREAMBUF |
| 137 | #endif // BOOST_ARCHIVE_TEXT_WIARCHIVE_HPP |