1 #ifndef BOOST_ARCHIVE_XML_OARCHIVE_HPP
2 #define BOOST_ARCHIVE_XML_OARCHIVE_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.
21 #include <cstddef> // size_t
22 #include <boost/config.hpp>
23 #if defined(BOOST_NO_STDC_NAMESPACE)
29 #include <boost/archive/detail/auto_link_archive.hpp>
30 #include <boost/archive/basic_text_oprimitive.hpp>
31 #include <boost/archive/basic_xml_oarchive.hpp>
32 #include <boost/archive/detail/register_archive.hpp>
33 #include <boost/serialization/item_version_type.hpp>
35 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
38 # pragma warning(push)
39 # pragma warning(disable : 4511 4512)
46 template<class Archive> class interface_oarchive;
49 template<class Archive>
50 class BOOST_SYMBOL_VISIBLE xml_oarchive_impl :
51 public basic_text_oprimitive<std::ostream>,
52 public basic_xml_oarchive<Archive>
54 #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
58 friend class detail::interface_oarchive<Archive>;
59 friend class basic_xml_oarchive<Archive>;
60 friend class save_access;
63 void save(const T & t){
64 basic_text_oprimitive<std::ostream>::save(t);
67 save(const version_type & t){
68 save(static_cast<unsigned int>(t));
71 save(const boost::serialization::item_version_type & t){
72 save(static_cast<unsigned int>(t));
74 BOOST_ARCHIVE_DECL void
76 #ifndef BOOST_NO_INTRINSIC_WCHAR_T
77 BOOST_ARCHIVE_DECL void
78 save(const wchar_t * t);
80 BOOST_ARCHIVE_DECL void
81 save(const std::string &s);
82 #ifndef BOOST_NO_STD_WSTRING
83 BOOST_ARCHIVE_DECL void
84 save(const std::wstring &ws);
87 xml_oarchive_impl(std::ostream & os, unsigned int flags);
89 ~xml_oarchive_impl() BOOST_OVERRIDE;
92 void save_binary(const void *address, std::size_t count);
95 } // namespace archive
102 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
104 # pragma warning(push)
105 # pragma warning(disable : 4511 4512)
111 // we use the following because we can't use
112 // typedef xml_oarchive_impl<xml_oarchive_impl<...> > xml_oarchive;
114 // do not derive from this class. If you want to extend this functionality
115 // via inheritance, derived from xml_oarchive_impl instead. This will
116 // preserve correct static polymorphism.
117 class BOOST_SYMBOL_VISIBLE xml_oarchive :
118 public xml_oarchive_impl<xml_oarchive>
121 xml_oarchive(std::ostream & os, unsigned int flags = 0) :
122 xml_oarchive_impl<xml_oarchive>(os, flags)
124 if(0 == (flags & no_header))
127 ~xml_oarchive() BOOST_OVERRIDE {}
130 } // namespace archive
133 // required by export
134 BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_oarchive)
140 #endif // BOOST_ARCHIVE_XML_OARCHIVE_HPP