fix doc example typo
[boost.git] / boost / archive / xml_woarchive.hpp
blob3866ada7114eab6c47881a685579c9211c96b890
1 #ifndef BOOST_ARCHIVE_XML_WOARCHIVE_HPP
2 #define BOOST_ARCHIVE_XML_WOARCHIVE_HPP
4 // MS compatible compilers support #pragma once
5 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
6 # pragma once
7 #endif
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10 // xml_woarchive.hpp
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>
20 #ifdef BOOST_NO_STD_WSTREAMBUF
21 #error "wide char i/o not supported on this platform"
22 #else
24 #include <cstddef> // size_t
25 #if defined(BOOST_NO_STDC_NAMESPACE)
26 namespace std{
27 using ::size_t;
28 } // namespace std
29 #endif
31 #include <ostream>
33 #include <boost/archive/detail/auto_link_warchive.hpp>
34 #include <boost/archive/basic_text_oprimitive.hpp>
35 #include <boost/archive/basic_xml_oarchive.hpp>
37 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
39 namespace boost {
40 namespace archive {
42 #if 0
43 BOOST_WARCHIVE_DECL(std::wostream &)
44 operator<<(std::wostream &os, const char *t);
46 BOOST_WARCHIVE_DECL(std::wostream &)
47 operator<<(std::wostream &os, const char t);
48 #endif
50 template<class Archive>
51 class xml_woarchive_impl :
52 public basic_text_oprimitive<std::wostream>,
53 public basic_xml_oarchive<Archive>
55 #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
56 public:
57 #else
58 friend class detail::interface_oarchive<Archive>;
59 friend class basic_xml_oarchive<Archive>;
60 friend class save_access;
61 protected:
62 #endif
63 //void end_preamble(){
64 // basic_xml_oarchive<Archive>::end_preamble();
65 //}
66 template<class T>
67 void
68 save(const T & t){
69 basic_text_oprimitive<std::wostream>::save(t);
71 BOOST_WARCHIVE_DECL(void)
72 save(const char * t);
73 #ifndef BOOST_NO_INTRINSIC_WCHAR_T
74 BOOST_WARCHIVE_DECL(void)
75 save(const wchar_t * t);
76 #endif
77 BOOST_WARCHIVE_DECL(void)
78 save(const std::string &s);
79 #ifndef BOOST_NO_STD_WSTRING
80 BOOST_WARCHIVE_DECL(void)
81 save(const std::wstring &ws);
82 #endif
83 BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY())
84 xml_woarchive_impl(std::wostream & os, unsigned int flags);
85 ~xml_woarchive_impl(){}
86 public:
87 void
88 save_binary(const void *address, std::size_t count){
89 this->end_preamble();
90 #if ! defined(__MWERKS__)
91 this->basic_text_oprimitive<std::wostream>::save_binary(
92 #else
93 this->basic_text_oprimitive::save_binary(
94 #endif
95 address,
96 count
98 this->indent_next = true;
102 // we use the following because we can't use
103 // typedef xml_woarchive_impl<xml_woarchive_impl<...> > xml_woarchive;
105 // do not derive from this class. If you want to extend this functionality
106 // via inhertance, derived from xml_woarchive_impl instead. This will
107 // preserve correct static polymorphism.
108 class xml_woarchive :
109 public xml_woarchive_impl<xml_woarchive>
111 public:
112 xml_woarchive(std::wostream & os, unsigned int flags = 0) :
113 xml_woarchive_impl<xml_woarchive>(os, flags)
115 ~xml_woarchive(){}
118 typedef xml_woarchive naked_xml_woarchive;
120 } // namespace archive
121 } // namespace boost
123 // required by export
124 BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_woarchive)
126 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
128 #endif // BOOST_NO_STD_WSTREAMBUF
129 #endif // BOOST_ARCHIVE_XML_OARCHIVE_HPP