| 1 | #ifndef BOOST_ARCHIVE_BINARY_WIARCHIVE_HPP |
|---|
| 2 | #define BOOST_ARCHIVE_BINARY_WIARCHIVE_HPP |
|---|
| 3 | |
|---|
| 4 | // MS compatible compilers support #pragma once |
|---|
| 5 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) |
|---|
| 6 | # pragma once |
|---|
| 7 | #endif |
|---|
| 8 | |
|---|
| 9 | /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 |
|---|
| 10 | // binary_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 | #include <boost/archive/detail/auto_link_warchive.hpp> |
|---|
| 26 | #include <boost/archive/basic_binary_iprimitive.hpp> |
|---|
| 27 | #include <boost/archive/basic_binary_iarchive.hpp> |
|---|
| 28 | |
|---|
| 29 | #include <boost/archive/detail/abi_prefix.hpp> // must be the last header |
|---|
| 30 | |
|---|
| 31 | namespace boost { |
|---|
| 32 | namespace archive { |
|---|
| 33 | |
|---|
| 34 | template<class Archive> |
|---|
| 35 | class binary_wiarchive_impl : |
|---|
| 36 | public basic_binary_iprimitive<Archive, std::wistream>, |
|---|
| 37 | public basic_binary_iarchive<Archive> |
|---|
| 38 | { |
|---|
| 39 | #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS |
|---|
| 40 | public: |
|---|
| 41 | #else |
|---|
| 42 | friend class detail::interface_iarchive<Archive>; |
|---|
| 43 | friend class basic_binary_iarchive<Archive>; |
|---|
| 44 | friend class load_access; |
|---|
| 45 | protected: |
|---|
| 46 | #endif |
|---|
| 47 | // note: the following should not needed - but one compiler (vc 7.1) |
|---|
| 48 | // fails to compile one test (test_shared_ptr) without it !!! |
|---|
| 49 | template<class T> |
|---|
| 50 | void load_override(T & t, BOOST_PFTO int){ |
|---|
| 51 | basic_binary_iarchive<Archive>::load_override(t, 0); |
|---|
| 52 | } |
|---|
| 53 | void init(){ |
|---|
| 54 | basic_binary_iarchive<Archive>::init(); |
|---|
| 55 | basic_binary_iprimitive<Archive, std::wistream>::init(); |
|---|
| 56 | } |
|---|
| 57 | binary_wiarchive_impl(std::wistream & is, unsigned int flags) : |
|---|
| 58 | basic_binary_iprimitive<Archive, std::wistream>( |
|---|
| 59 | is, |
|---|
| 60 | 0 != (flags & no_codecvt) |
|---|
| 61 | ), |
|---|
| 62 | basic_binary_iarchive<Archive>(flags) |
|---|
| 63 | { |
|---|
| 64 | if(0 == (flags & no_header)) |
|---|
| 65 | init(); |
|---|
| 66 | } |
|---|
| 67 | }; |
|---|
| 68 | |
|---|
| 69 | // do not derive from this class. If you want to extend this functionality |
|---|
| 70 | // via inhertance, derived from binary_iarchive_impl instead. This will |
|---|
| 71 | // preserve correct static polymorphism. |
|---|
| 72 | class binary_wiarchive : |
|---|
| 73 | public binary_wiarchive_impl<binary_wiarchive> |
|---|
| 74 | { |
|---|
| 75 | public: |
|---|
| 76 | binary_wiarchive(std::wistream & is, unsigned int flags = 0) : |
|---|
| 77 | binary_wiarchive_impl<binary_wiarchive>(is, flags) |
|---|
| 78 | {} |
|---|
| 79 | }; |
|---|
| 80 | |
|---|
| 81 | } // namespace archive |
|---|
| 82 | } // namespace boost |
|---|
| 83 | |
|---|
| 84 | // required by smart_cast for compilers not implementing |
|---|
| 85 | // partial template specialization |
|---|
| 86 | BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::binary_wiarchive) |
|---|
| 87 | |
|---|
| 88 | #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas |
|---|
| 89 | |
|---|
| 90 | #endif // BOOST_NO_STD_WSTREAMBUF |
|---|
| 91 | #endif // BOOST_ARCHIVE_BINARY_WIARCHIVE_HPP |
|---|