fix doc example typo
[boost.git] / boost / archive / text_wiarchive.hpp
blob058fbda64e2334689f4c0a3ec6704c97f3d6bb97
1 #ifndef BOOST_ARCHIVE_TEXT_WIARCHIVE_HPP
2 #define BOOST_ARCHIVE_TEXT_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 // text_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/archive/detail/auto_link_warchive.hpp>
27 #include <boost/archive/basic_text_iprimitive.hpp>
28 #include <boost/archive/basic_text_iarchive.hpp>
30 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
32 namespace boost {
33 namespace archive {
35 template<class Archive>
36 class text_wiarchive_impl :
37 public basic_text_iprimitive<std::wistream>,
38 public basic_text_iarchive<Archive>
40 #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
41 public:
42 #else
43 friend class detail::interface_iarchive<Archive>;
44 friend class basic_text_iarchive<Archive>;
45 friend class load_access;
46 protected:
47 #endif
48 template<class T>
49 void load(T & t){
50 basic_text_iprimitive<std::wistream>::load(t);
52 BOOST_WARCHIVE_DECL(void)
53 load(char * t);
54 #ifndef BOOST_NO_INTRINSIC_WCHAR_T
55 BOOST_WARCHIVE_DECL(void)
56 load(wchar_t * t);
57 #endif
58 BOOST_WARCHIVE_DECL(void)
59 load(std::string &s);
60 #ifndef BOOST_NO_STD_WSTRING
61 BOOST_WARCHIVE_DECL(void)
62 load(std::wstring &ws);
63 #endif
64 // note: the following should not needed - but one compiler (vc 7.1)
65 // fails to compile one test (test_shared_ptr) without it !!!
66 template<class T>
67 void load_override(T & t, BOOST_PFTO int){
68 basic_text_iarchive<Archive>::load_override(t, 0);
70 BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY())
71 text_wiarchive_impl(std::wistream & is, unsigned int flags);
72 ~text_wiarchive_impl(){};
75 // do not derive from the classes below. If you want to extend this functionality
76 // via inhertance, derived from text_iarchive_impl instead. This will
77 // preserve correct static polymorphism.
79 // same as text_wiarchive below - without the shared_ptr_helper
80 class naked_text_wiarchive :
81 public text_wiarchive_impl<naked_text_wiarchive>
83 public:
84 naked_text_wiarchive(std::wistream & is, unsigned int flags = 0) :
85 text_wiarchive_impl<naked_text_wiarchive>(is, flags)
87 ~naked_text_wiarchive(){}
90 } // namespace archive
91 } // namespace boost
93 // note special treatment of shared_ptr. This type needs a special
94 // structure associated with every archive. We created a "mix-in"
95 // class to provide this functionality. Since shared_ptr holds a
96 // special esteem in the boost library - we included it here by default.
97 #include <boost/archive/shared_ptr_helper.hpp>
99 namespace boost {
100 namespace archive {
102 class text_wiarchive :
103 public text_wiarchive_impl<text_wiarchive>,
104 public detail::shared_ptr_helper
106 public:
107 text_wiarchive(std::wistream & is, unsigned int flags = 0) :
108 text_wiarchive_impl<text_wiarchive>(is, flags)
110 ~text_wiarchive(){}
113 } // namespace archive
114 } // namespace boost
116 // required by export
117 BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_wiarchive)
119 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
121 #endif // BOOST_NO_STD_WSTREAMBUF
122 #endif // BOOST_ARCHIVE_TEXT_WIARCHIVE_HPP