1 #ifndef BOOST_ARCHIVE_TEXT_IARCHIVE_HPP
2 #define BOOST_ARCHIVE_TEXT_IARCHIVE_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 // text_iarchive.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 <istream>
20 
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>
27 
28 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
29 
30 #ifdef BOOST_MSVC
31 #  pragma warning(push)
32 #  pragma warning(disable : 4511 4512)
33 #endif
34 
35 namespace boost {
36 namespace archive {
37 
38 namespace detail {
39     template<class Archive> class interface_iarchive;
40 } // namespace detail
41 
42 template<class Archive>
43 class BOOST_SYMBOL_VISIBLE text_iarchive_impl :
44     public basic_text_iprimitive<std::istream>,
45     public basic_text_iarchive<Archive>
46 {
47 #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
48 public:
49 #else
50 protected:
51     #if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
52         // for some inexplicable reason insertion of "class" generates compile erro
53         // on msvc 7.1
54         friend detail::interface_iarchive<Archive>;
55         friend load_access;
56     #else
57         friend class detail::interface_iarchive<Archive>;
58         friend class load_access;
59     #endif
60 #endif
61     template<class T>
load(T & t)62     void load(T & t){
63         basic_text_iprimitive<std::istream>::load(t);
64     }
load(version_type & t)65     void load(version_type & t){
66         unsigned int v;
67         load(v);
68         t = version_type(v);
69     }
load(boost::serialization::item_version_type & t)70     void load(boost::serialization::item_version_type & t){
71         unsigned int v;
72         load(v);
73         t = boost::serialization::item_version_type(v);
74     }
75     BOOST_ARCHIVE_DECL void
76     load(char * t);
77     #ifndef BOOST_NO_INTRINSIC_WCHAR_T
78     BOOST_ARCHIVE_DECL void
79     load(wchar_t * t);
80     #endif
81     BOOST_ARCHIVE_DECL void
82     load(std::string &s);
83     #ifndef BOOST_NO_STD_WSTRING
84     BOOST_ARCHIVE_DECL void
85     load(std::wstring &ws);
86     #endif
87     template<class T>
load_override(T & t)88     void load_override(T & t){
89         basic_text_iarchive<Archive>::load_override(t);
90     }
91     BOOST_ARCHIVE_DECL void
92     load_override(class_name_type & t);
93     BOOST_ARCHIVE_DECL void
94     init();
95     BOOST_ARCHIVE_DECL
96     text_iarchive_impl(std::istream & is, unsigned int flags);
97     // don't import inline definitions! leave this as a reminder.
98     //BOOST_ARCHIVE_DECL
~text_iarchive_impl()99     ~text_iarchive_impl(){};
100 };
101 
102 } // namespace archive
103 } // namespace boost
104 
105 #ifdef BOOST_MSVC
106 #pragma warning(pop)
107 #endif
108 
109 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
110 
111 #ifdef BOOST_MSVC
112 #  pragma warning(push)
113 #  pragma warning(disable : 4511 4512)
114 #endif
115 
116 namespace boost {
117 namespace archive {
118 
119 class BOOST_SYMBOL_VISIBLE text_iarchive :
120     public text_iarchive_impl<text_iarchive>{
121 public:
text_iarchive(std::istream & is_,unsigned int flags=0)122     text_iarchive(std::istream & is_, unsigned int flags = 0) :
123         // note: added _ to suppress useless gcc warning
124         text_iarchive_impl<text_iarchive>(is_, flags)
125     {}
~text_iarchive()126     ~text_iarchive(){}
127 };
128 
129 } // namespace archive
130 } // namespace boost
131 
132 // required by export
133 BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_iarchive)
134 
135 #ifdef BOOST_MSVC
136 #pragma warning(pop)
137 #endif
138 
139 #endif // BOOST_ARCHIVE_TEXT_IARCHIVE_HPP
140