1 #ifndef BOOST_ARCHIVE_TEXT_WOARCHIVE_HPP
2 #define BOOST_ARCHIVE_TEXT_WOARCHIVE_HPP
4 // MS compatible compilers support #pragma once
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
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)
17 // See http://www.boost.org for updates, documentation, and revision history.
19 #include <boost/config.hpp>
21 #ifdef BOOST_NO_STD_WSTREAMBUF
22 #error "wide char i/o not supported on this platform"
26 #include <cstddef> // size_t
28 #if defined(BOOST_NO_STDC_NAMESPACE)
34 #include <boost/archive/detail/auto_link_warchive.hpp>
35 #include <boost/archive/basic_text_oprimitive.hpp>
36 #include <boost/archive/basic_text_oarchive.hpp>
37 #include <boost/archive/detail/register_archive.hpp>
38 #include <boost/serialization/item_version_type.hpp>
40 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
43 # pragma warning(push)
44 # pragma warning(disable : 4511 4512)
51 template<class Archive> class interface_oarchive;
54 template<class Archive>
55 class BOOST_SYMBOL_VISIBLE text_woarchive_impl :
56 public basic_text_oprimitive<std::wostream>,
57 public basic_text_oarchive<Archive>
59 #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
63 #if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
64 // for some inexplicable reason insertion of "class" generates compile erro
66 friend detail::interface_oarchive<Archive>;
67 friend basic_text_oarchive<Archive>;
70 friend class detail::interface_oarchive<Archive>;
71 friend class basic_text_oarchive<Archive>;
72 friend class save_access;
76 void save(const T & t){
78 basic_text_oprimitive<std::wostream>::save(t);
80 void save(const version_type & t){
81 save(static_cast<const unsigned int>(t));
83 void save(const boost::serialization::item_version_type & t){
84 save(static_cast<const unsigned int>(t));
86 BOOST_WARCHIVE_DECL void
88 #ifndef BOOST_NO_INTRINSIC_WCHAR_T
89 BOOST_WARCHIVE_DECL void
90 save(const wchar_t * t);
92 BOOST_WARCHIVE_DECL void
93 save(const std::string &s);
94 #ifndef BOOST_NO_STD_WSTRING
95 BOOST_WARCHIVE_DECL void
96 save(const std::wstring &ws);
98 text_woarchive_impl(std::wostream & os, unsigned int flags) :
99 basic_text_oprimitive<std::wostream>(
101 0 != (flags & no_codecvt)
103 basic_text_oarchive<Archive>(flags)
105 if(0 == (flags & no_header))
106 basic_text_oarchive<Archive>::init();
109 void save_binary(const void *address, std::size_t count){
110 put(static_cast<wchar_t>('\n'));
111 this->end_preamble();
112 #if ! defined(__MWERKS__)
113 this->basic_text_oprimitive<std::wostream>::save_binary(
115 this->basic_text_oprimitive::save_binary(
120 put(static_cast<wchar_t>('\n'));
121 this->delimiter = this->none;
126 // we use the following because we can't use
127 // typedef text_oarchive_impl<text_oarchive_impl<...> > text_oarchive;
129 // do not derive from this class. If you want to extend this functionality
130 // via inhertance, derived from text_oarchive_impl instead. This will
131 // preserve correct static polymorphism.
132 class BOOST_SYMBOL_VISIBLE text_woarchive :
133 public text_woarchive_impl<text_woarchive>
136 text_woarchive(std::wostream & os, unsigned int flags = 0) :
137 text_woarchive_impl<text_woarchive>(os, flags)
142 } // namespace archive
145 // required by export
146 BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_woarchive)
152 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
154 #endif // BOOST_NO_STD_WSTREAMBUF
155 #endif // BOOST_ARCHIVE_TEXT_WOARCHIVE_HPP