source: NonGTP/Boost/boost/archive/binary_iarchive.hpp @ 857

Revision 857, 3.1 KB checked in by igarcia, 19 years ago (diff)
RevLine 
[857]1#ifndef BOOST_ARCHIVE_BINARY_IARCHIVE_HPP
2#define BOOST_ARCHIVE_BINARY_IARCHIVE_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.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/detail/auto_link_archive.hpp>
21#include <boost/archive/basic_binary_iarchive.hpp>
22#include <boost/archive/basic_binary_iprimitive.hpp>
23
24#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
25
26namespace boost {
27namespace archive {
28
29template<class Archive>
30class binary_iarchive_impl :
31    public basic_binary_iprimitive<Archive, std::istream>,
32    public basic_binary_iarchive<Archive>
33{
34#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
35public:
36#else
37    friend class detail::interface_iarchive<Archive>;
38    friend class basic_binary_iarchive<Archive>;
39    friend class load_access;
40protected:
41#endif
42    // note: the following should not needed - but one compiler (vc 7.1)
43    // fails to compile one test (test_shared_ptr) without it !!!
44    // make this protected so it can be called from a derived archive
45    template<class T>
46    void load_override(T & t, BOOST_PFTO int){
47        basic_binary_iarchive<Archive>::load_override(t, 0);
48    }
49    void init(){
50        #if ! defined(__MWERKS__)
51            this->basic_binary_iarchive<Archive>::init();
52            this->basic_binary_iprimitive<Archive, std::istream>::init();
53        #else
54            basic_binary_iarchive<Archive>::init();
55            basic_binary_iprimitive<Archive, std::istream>::init();
56        #endif
57    }
58    binary_iarchive_impl(std::istream & is, unsigned int flags) :
59        basic_binary_iprimitive<Archive, std::istream>(
60            is,
61            0 != (flags & no_codecvt)
62        ),
63        basic_binary_iarchive<Archive>(flags)
64    {
65        if(0 == (flags & no_header)){
66            init();
67        }
68    }
69};
70
71// do not derive from this class.  If you want to extend this functionality
72// via inhertance, derived from binary_iarchive_impl instead.  This will
73// preserve correct static polymorphism.
74class binary_iarchive :
75    public binary_iarchive_impl<binary_iarchive>
76{
77public:
78    binary_iarchive(std::istream & is, unsigned int flags = 0) :
79        binary_iarchive_impl<binary_iarchive>(is, flags)
80    {}
81};
82
83} // namespace archive
84} // namespace boost
85
86// required by smart_cast for compilers not implementing
87// partial template specialization
88BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::binary_iarchive)
89
90#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
91
92#endif // BOOST_ARCHIVE_BINARY_IARCHIVE_HPP
Note: See TracBrowser for help on using the repository browser.