1 #ifndef BOOST_ARCHIVE_TEXT_IARCHIVE_HPP
2 #define BOOST_ARCHIVE_TEXT_IARCHIVE_HPP
4 // MS compatible compilers support #pragma once
5 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
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.
21 #include <boost/config.hpp>
22 #include <boost/archive/detail/auto_link_archive.hpp>
23 #include <boost/archive/basic_text_iprimitive.hpp>
24 #include <boost/archive/basic_text_iarchive.hpp>
25 #include <boost/archive/detail/register_archive.hpp>
26 #include <boost/serialization/item_version_type.hpp>
28 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
31 # pragma warning(push)
32 # pragma warning(disable : 4511 4512)
38 template<class Archive>
39 class text_iarchive_impl :
40 public basic_text_iprimitive<std::istream>,
41 public basic_text_iarchive<Archive>
43 #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
46 friend class detail::interface_iarchive<Archive>;
47 friend class basic_text_iarchive<Archive>;
48 friend class load_access;
53 basic_text_iprimitive<std::istream>::load(t);
55 void load(version_type & t){
60 void load(boost::serialization::item_version_type & t){
63 t = boost::serialization::item_version_type(v);
65 BOOST_ARCHIVE_DECL(void)
67 #ifndef BOOST_NO_INTRINSIC_WCHAR_T
68 BOOST_ARCHIVE_DECL(void)
71 BOOST_ARCHIVE_DECL(void)
73 #ifndef BOOST_NO_STD_WSTRING
74 BOOST_ARCHIVE_DECL(void)
75 load(std::wstring &ws);
77 // note: the following should not needed - but one compiler (vc 7.1)
78 // fails to compile one test (test_shared_ptr) without it !!!
79 // make this protected so it can be called from a derived archive
81 void load_override(T & t, BOOST_PFTO int){
82 basic_text_iarchive<Archive>::load_override(t, 0);
84 BOOST_ARCHIVE_DECL(void)
85 load_override(class_name_type & t, int);
86 BOOST_ARCHIVE_DECL(void)
88 BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
89 text_iarchive_impl(std::istream & is, unsigned int flags);
90 // don't import inline definitions! leave this as a reminder.
91 //BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
92 ~text_iarchive_impl(){};
95 // do not derive from the classes below. If you want to extend this functionality
96 // via inhertance, derived from text_iarchive_impl instead. This will
97 // preserve correct static polymorphism.
99 // same as text_iarchive below - without the shared_ptr_helper
100 class naked_text_iarchive :
101 public text_iarchive_impl<naked_text_iarchive>
104 naked_text_iarchive(std::istream & is_, unsigned int flags = 0) :
105 // note: added _ to suppress useless gcc warning
106 text_iarchive_impl<naked_text_iarchive>(is_, flags)
108 ~naked_text_iarchive(){}
111 } // namespace archive
118 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
120 // note special treatment of shared_ptr. This type needs a special
121 // structure associated with every archive. We created a "mix-in"
122 // class to provide this functionality. Since shared_ptr holds a
123 // special esteem in the boost library - we included it here by default.
124 #include <boost/archive/shared_ptr_helper.hpp>
127 # pragma warning(push)
128 # pragma warning(disable : 4511 4512)
134 class text_iarchive :
135 public text_iarchive_impl<text_iarchive>,
136 public detail::shared_ptr_helper
139 text_iarchive(std::istream & is_, unsigned int flags = 0) :
140 // note: added _ to suppress useless gcc warning
141 text_iarchive_impl<text_iarchive>(is_, flags)
146 } // namespace archive
149 // required by export
150 BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_iarchive)
156 #endif // BOOST_ARCHIVE_TEXT_IARCHIVE_HPP