1 | #ifndef BOOST_ARCHIVE_BINARY_IARCHIVE_IMPL_HPP |
---|
2 | #define BOOST_ARCHIVE_BINARY_IARCHIVE_IMPL_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_iarchive_impl.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 <istream> |
---|
20 | #include <boost/pfto.hpp> |
---|
21 | #include <boost/archive/basic_binary_iprimitive.hpp> |
---|
22 | #include <boost/archive/basic_binary_iarchive.hpp> |
---|
23 | |
---|
24 | namespace boost { |
---|
25 | namespace archive { |
---|
26 | |
---|
27 | template<class Archive, class Elem, class Tr> |
---|
28 | class binary_iarchive_impl : |
---|
29 | public basic_binary_iprimitive<Archive, Elem, Tr>, |
---|
30 | public basic_binary_iarchive<Archive> |
---|
31 | { |
---|
32 | #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS |
---|
33 | public: |
---|
34 | #else |
---|
35 | friend class detail::interface_iarchive<Archive>; |
---|
36 | friend class basic_binary_iarchive<Archive>; |
---|
37 | friend class load_access; |
---|
38 | protected: |
---|
39 | #endif |
---|
40 | // note: the following should not needed - but one compiler (vc 7.1) |
---|
41 | // fails to compile one test (test_shared_ptr) without it !!! |
---|
42 | // make this protected so it can be called from a derived archive |
---|
43 | template<class T> |
---|
44 | void load_override(T & t, BOOST_PFTO int){ |
---|
45 | basic_binary_iarchive<Archive>::load_override(t, 0); |
---|
46 | } |
---|
47 | void init(unsigned int flags){ |
---|
48 | if(0 != (flags & no_header)) |
---|
49 | return; |
---|
50 | #if ! defined(__MWERKS__) |
---|
51 | this->basic_binary_iarchive<Archive>::init(); |
---|
52 | this->basic_binary_iprimitive<Archive, Elem, Tr>::init(); |
---|
53 | #else |
---|
54 | basic_binary_iarchive<Archive>::init(); |
---|
55 | basic_binary_iprimitive<Archive, Elem, Tr>::init(); |
---|
56 | #endif |
---|
57 | } |
---|
58 | binary_iarchive_impl( |
---|
59 | std::basic_streambuf<Elem, Tr> & bsb, |
---|
60 | unsigned int flags |
---|
61 | ) : |
---|
62 | basic_binary_iprimitive<Archive, Elem, Tr>( |
---|
63 | bsb, |
---|
64 | 0 != (flags & no_codecvt) |
---|
65 | ), |
---|
66 | basic_binary_iarchive<Archive>(flags) |
---|
67 | { |
---|
68 | init(flags); |
---|
69 | } |
---|
70 | binary_iarchive_impl( |
---|
71 | std::basic_istream<Elem, Tr> & is, |
---|
72 | unsigned int flags |
---|
73 | ) : |
---|
74 | basic_binary_iprimitive<Archive, Elem, Tr>( |
---|
75 | * is.rdbuf(), |
---|
76 | 0 != (flags & no_codecvt) |
---|
77 | ), |
---|
78 | basic_binary_iarchive<Archive>(flags) |
---|
79 | { |
---|
80 | init(flags); |
---|
81 | } |
---|
82 | }; |
---|
83 | |
---|
84 | } // namespace archive |
---|
85 | } // namespace boost |
---|
86 | |
---|
87 | #endif // BOOST_ARCHIVE_BINARY_IARCHIVE_IMPL_HPP |
---|