• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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)
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/archive/basic_binary_iprimitive.hpp>
21 #include <boost/archive/basic_binary_iarchive.hpp>
22 
23 #ifdef BOOST_MSVC
24 #  pragma warning(push)
25 #  pragma warning(disable : 4511 4512)
26 #endif
27 
28 namespace boost {
29 namespace archive {
30 
31 namespace detail {
32     template<class Archive> class interface_iarchive;
33 } // namespace detail
34 
35 template<class Archive, class Elem, class Tr>
36 class BOOST_SYMBOL_VISIBLE binary_iarchive_impl :
37     public basic_binary_iprimitive<Archive, Elem, Tr>,
38     public basic_binary_iarchive<Archive>
39 {
40 #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
41 public:
42 #else
43 protected:
44     #if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
45         // for some inexplicable reason insertion of "class" generates compile erro
46         // on msvc 7.1
47         friend detail::interface_iarchive<Archive>;
48         friend basic_binary_iarchive<Archive>;
49         friend load_access;
50     #else
51         friend class detail::interface_iarchive<Archive>;
52         friend class basic_binary_iarchive<Archive>;
53         friend class load_access;
54     #endif
55 #endif
56     template<class T>
load_override(T & t)57     void load_override(T & t){
58         this->basic_binary_iarchive<Archive>::load_override(t);
59     }
init(unsigned int flags)60     void init(unsigned int flags){
61         if(0 != (flags & no_header)){
62             return;
63         }
64         #if ! defined(__MWERKS__)
65             this->basic_binary_iarchive<Archive>::init();
66             this->basic_binary_iprimitive<Archive, Elem, Tr>::init();
67         #else
68             basic_binary_iarchive<Archive>::init();
69             basic_binary_iprimitive<Archive, Elem, Tr>::init();
70         #endif
71     }
binary_iarchive_impl(std::basic_streambuf<Elem,Tr> & bsb,unsigned int flags)72     binary_iarchive_impl(
73         std::basic_streambuf<Elem, Tr> & bsb,
74         unsigned int flags
75     ) :
76         basic_binary_iprimitive<Archive, Elem, Tr>(
77             bsb,
78             0 != (flags & no_codecvt)
79         ),
80         basic_binary_iarchive<Archive>(flags)
81     {}
binary_iarchive_impl(std::basic_istream<Elem,Tr> & is,unsigned int flags)82     binary_iarchive_impl(
83         std::basic_istream<Elem, Tr> & is,
84         unsigned int flags
85     ) :
86         basic_binary_iprimitive<Archive, Elem, Tr>(
87             * is.rdbuf(),
88             0 != (flags & no_codecvt)
89         ),
90         basic_binary_iarchive<Archive>(flags)
91     {}
92 };
93 
94 } // namespace archive
95 } // namespace boost
96 
97 #ifdef BOOST_MSVC
98 #pragma warning(pop)
99 #endif
100 
101 #endif // BOOST_ARCHIVE_BINARY_IARCHIVE_IMPL_HPP
102