fix doc example typo
[boost.git] / boost / archive / xml_wiarchive.hpp
blob2fb4477bee863f8f322d6e6cea9a7dd1f52193ec
1 #ifndef BOOST_ARCHIVE_XML_WIARCHIVE_HPP
2 #define BOOST_ARCHIVE_XML_WIARCHIVE_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_wiarchive.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 <istream>
26 //#include <boost/scoped_ptr.hpp>
27 #include <boost/archive/detail/auto_link_warchive.hpp>
28 #include <boost/archive/basic_text_iprimitive.hpp>
29 #include <boost/archive/basic_xml_iarchive.hpp>
31 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
33 namespace boost {
34 namespace archive {
36 template<class CharType>
37 class basic_xml_grammar;
38 typedef basic_xml_grammar<wchar_t> xml_wgrammar;
40 template<class Archive>
41 class xml_wiarchive_impl :
42 public basic_text_iprimitive<std::wistream>,
43 public basic_xml_iarchive<Archive>
45 #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
46 public:
47 #else
48 friend class detail::interface_iarchive<Archive>;
49 friend class basic_xml_iarchive<Archive>;
50 friend class load_access;
51 protected:
52 #endif
53 // instances of micro xml parser to parse start preambles
54 // scoped_ptr doesn't play nice with borland - so use a naked pointer
55 // scoped_ptr<xml_wgrammar> gimpl;
56 xml_wgrammar *gimpl;
57 std::wistream & get_is(){
58 return is;
60 template<class T>
61 void load(T & t){
62 basic_text_iprimitive<std::wistream>::load(t);
64 BOOST_WARCHIVE_DECL(void)
65 load(char * t);
66 #ifndef BOOST_NO_INTRINSIC_WCHAR_T
67 BOOST_WARCHIVE_DECL(void)
68 load(wchar_t * t);
69 #endif
70 BOOST_WARCHIVE_DECL(void)
71 load(std::string &s);
72 #ifndef BOOST_NO_STD_WSTRING
73 BOOST_WARCHIVE_DECL(void)
74 load(std::wstring &ws);
75 #endif
76 template<class T>
77 void load_override(T & t, BOOST_PFTO int){
78 basic_xml_iarchive<Archive>::load_override(t, 0);
80 BOOST_WARCHIVE_DECL(void)
81 load_override(class_name_type & t, int);
82 BOOST_WARCHIVE_DECL(void)
83 init();
84 BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY())
85 xml_wiarchive_impl(std::wistream & is, unsigned int flags) ;
86 BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY())
87 ~xml_wiarchive_impl();
90 // do not derive from the classes below. If you want to extend this functionality
91 // via inhertance, derived from xml_wiarchive_impl instead. This will
92 // preserve correct static polymorphism.
94 // same as xml_wiarchive below - without the shared_ptr_helper
95 class naked_xml_wiarchive :
96 public xml_wiarchive_impl<naked_xml_wiarchive>
98 public:
99 naked_xml_wiarchive(std::wistream & is, unsigned int flags = 0) :
100 xml_wiarchive_impl<naked_xml_wiarchive>(is, flags)
102 ~naked_xml_wiarchive(){}
105 } // namespace archive
106 } // namespace boost
108 // note special treatment of shared_ptr. This type needs a special
109 // structure associated with every archive. We created a "mix-in"
110 // class to provide this functionality. Since shared_ptr holds a
111 // special esteem in the boost library - we included it here by default.
112 #include <boost/archive/shared_ptr_helper.hpp>
114 namespace boost {
115 namespace archive {
117 class xml_wiarchive :
118 public xml_wiarchive_impl<xml_wiarchive>,
119 public detail::shared_ptr_helper
121 public:
122 xml_wiarchive(std::wistream & is, unsigned int flags = 0) :
123 xml_wiarchive_impl<xml_wiarchive>(is, flags)
125 ~xml_wiarchive(){}
128 } // namespace archive
129 } // namespace boost
131 // required by export
132 BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_wiarchive)
134 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
136 #endif // BOOST_NO_STD_WSTREAMBUF
137 #endif // BOOST_ARCHIVE_XML_WIARCHIVE_HPP