]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #ifndef BOOST_ARCHIVE_XML_WOARCHIVE_HPP |
2 | #define BOOST_ARCHIVE_XML_WOARCHIVE_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 | // xml_woarchive.hpp | |
11 | ||
f67539c2 | 12 | // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . |
7c673cae FG |
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 <boost/config.hpp> | |
20 | #ifdef BOOST_NO_STD_WSTREAMBUF | |
21 | #error "wide char i/o not supported on this platform" | |
22 | #else | |
23 | #include <cstddef> // size_t | |
24 | #if defined(BOOST_NO_STDC_NAMESPACE) | |
f67539c2 TL |
25 | namespace std{ |
26 | using ::size_t; | |
7c673cae FG |
27 | } // namespace std |
28 | #endif | |
29 | ||
30 | #include <ostream> | |
31 | ||
7c673cae FG |
32 | #include <boost/archive/detail/auto_link_warchive.hpp> |
33 | #include <boost/archive/basic_text_oprimitive.hpp> | |
34 | #include <boost/archive/basic_xml_oarchive.hpp> | |
35 | #include <boost/archive/detail/register_archive.hpp> | |
36 | #include <boost/serialization/item_version_type.hpp> | |
7c673cae FG |
37 | |
38 | #include <boost/archive/detail/abi_prefix.hpp> // must be the last header | |
39 | ||
40 | #ifdef BOOST_MSVC | |
41 | # pragma warning(push) | |
42 | # pragma warning(disable : 4511 4512) | |
43 | #endif | |
44 | ||
45 | namespace boost { | |
46 | namespace archive { | |
47 | ||
48 | namespace detail { | |
49 | template<class Archive> class interface_oarchive; | |
50 | } // namespace detail | |
51 | ||
52 | template<class Archive> | |
53 | class BOOST_SYMBOL_VISIBLE xml_woarchive_impl : | |
54 | public basic_text_oprimitive<std::wostream>, | |
55 | public basic_xml_oarchive<Archive> | |
56 | { | |
57 | #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS | |
58 | public: | |
59 | #else | |
60 | protected: | |
61 | friend class detail::interface_oarchive<Archive>; | |
62 | friend class basic_xml_oarchive<Archive>; | |
63 | friend class save_access; | |
64 | #endif | |
65 | //void end_preamble(){ | |
66 | // basic_xml_oarchive<Archive>::end_preamble(); | |
67 | //} | |
68 | template<class T> | |
69 | void | |
70 | save(const T & t){ | |
71 | basic_text_oprimitive<std::wostream>::save(t); | |
72 | } | |
73 | void | |
74 | save(const version_type & t){ | |
92f5a8d4 | 75 | save(static_cast<unsigned int>(t)); |
7c673cae | 76 | } |
f67539c2 | 77 | void |
7c673cae | 78 | save(const boost::serialization::item_version_type & t){ |
92f5a8d4 | 79 | save(static_cast<unsigned int>(t)); |
7c673cae FG |
80 | } |
81 | BOOST_WARCHIVE_DECL void | |
82 | save(const char * t); | |
83 | #ifndef BOOST_NO_INTRINSIC_WCHAR_T | |
f67539c2 | 84 | BOOST_WARCHIVE_DECL void |
7c673cae FG |
85 | save(const wchar_t * t); |
86 | #endif | |
f67539c2 | 87 | BOOST_WARCHIVE_DECL void |
7c673cae FG |
88 | save(const std::string &s); |
89 | #ifndef BOOST_NO_STD_WSTRING | |
90 | BOOST_WARCHIVE_DECL void | |
91 | save(const std::wstring &ws); | |
92 | #endif | |
f67539c2 | 93 | BOOST_WARCHIVE_DECL |
7c673cae FG |
94 | xml_woarchive_impl(std::wostream & os, unsigned int flags); |
95 | BOOST_WARCHIVE_DECL | |
20effc67 | 96 | ~xml_woarchive_impl() BOOST_OVERRIDE; |
7c673cae FG |
97 | public: |
98 | BOOST_WARCHIVE_DECL void | |
99 | save_binary(const void *address, std::size_t count); | |
100 | ||
101 | }; | |
102 | ||
103 | // we use the following because we can't use | |
104 | // typedef xml_woarchive_impl<xml_woarchive_impl<...> > xml_woarchive; | |
105 | ||
106 | // do not derive from this class. If you want to extend this functionality | |
20effc67 | 107 | // via inheritance, derived from xml_woarchive_impl instead. This will |
7c673cae FG |
108 | // preserve correct static polymorphism. |
109 | class BOOST_SYMBOL_VISIBLE xml_woarchive : | |
110 | public xml_woarchive_impl<xml_woarchive> | |
111 | { | |
112 | public: | |
113 | xml_woarchive(std::wostream & os, unsigned int flags = 0) : | |
114 | xml_woarchive_impl<xml_woarchive>(os, flags) | |
f67539c2 TL |
115 | { |
116 | if(0 == (flags & no_header)) | |
117 | init(); | |
118 | } | |
20effc67 | 119 | ~xml_woarchive() BOOST_OVERRIDE {} |
7c673cae FG |
120 | }; |
121 | ||
122 | } // namespace archive | |
123 | } // namespace boost | |
124 | ||
125 | // required by export | |
126 | BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_woarchive) | |
127 | ||
128 | #ifdef BOOST_MSVC | |
129 | #pragma warning(pop) | |
130 | #endif | |
131 | ||
132 | #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas | |
133 | ||
134 | #endif // BOOST_NO_STD_WSTREAMBUF | |
135 | #endif // BOOST_ARCHIVE_XML_OARCHIVE_HPP |