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