1 | #ifndef BOOST_ARCHIVE_BINARY_WOARCHIVE_HPP |
---|
2 | #define BOOST_ARCHIVE_BINARY_WOARCHIVE_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_woarchive.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 <ostream> |
---|
25 | #include <boost/archive/detail/auto_link_warchive.hpp> |
---|
26 | #include <boost/archive/basic_binary_oprimitive.hpp> |
---|
27 | #include <boost/archive/basic_binary_oarchive.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_woarchive_impl : |
---|
36 | public basic_binary_oprimitive<Archive, std::wostream>, |
---|
37 | public basic_binary_oarchive<Archive> |
---|
38 | { |
---|
39 | #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS |
---|
40 | public: |
---|
41 | #else |
---|
42 | friend class detail::interface_oarchive<Archive>; |
---|
43 | friend class basic_binary_oarchive<Archive>; |
---|
44 | friend class save_access; |
---|
45 | protected: |
---|
46 | #endif |
---|
47 | void init(){ |
---|
48 | basic_binary_oarchive<Archive>::init(); |
---|
49 | basic_binary_oprimitive<Archive, std::wostream>::init(); |
---|
50 | } |
---|
51 | binary_woarchive_impl(std::wostream & os, unsigned int flags) : |
---|
52 | basic_binary_oprimitive<Archive, std::wostream>( |
---|
53 | os, |
---|
54 | 0 != (flags & no_codecvt) |
---|
55 | ), |
---|
56 | basic_binary_oarchive<Archive>(flags) |
---|
57 | { |
---|
58 | if(0 == (flags & no_header)) |
---|
59 | init(); |
---|
60 | } |
---|
61 | }; |
---|
62 | |
---|
63 | // do not derive from this class. If you want to extend this functionality |
---|
64 | // via inhertance, derived from binary_oarchive_impl instead. This will |
---|
65 | // preserve correct static polymorphism. |
---|
66 | class binary_woarchive : |
---|
67 | public binary_woarchive_impl<binary_woarchive> |
---|
68 | { |
---|
69 | public: |
---|
70 | binary_woarchive(std::wostream & os, unsigned int flags = 0) : |
---|
71 | binary_woarchive_impl<binary_woarchive>(os, flags) |
---|
72 | {} |
---|
73 | ~binary_woarchive(){} |
---|
74 | }; |
---|
75 | |
---|
76 | } // namespace archive |
---|
77 | } // namespace boost |
---|
78 | |
---|
79 | // required by smart_cast for compilers not implementing |
---|
80 | // partial template specialization |
---|
81 | BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::binary_woarchive) |
---|
82 | |
---|
83 | #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas |
---|
84 | |
---|
85 | #endif // BOOST_NO_STD_WSTREAMBUF |
---|
86 | #endif // BOOST_ARCHIVE_BINARY_WOARCHIVE_HPP |
---|