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