comparison DEPENDENCIES/generic/include/boost/archive/xml_woarchive.hpp @ 16:2665513ce2d3

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