1 #ifndef BOOST_ARCHIVE_BASIC_TEXT_IPRIMITIVE_HPP
2 #define BOOST_ARCHIVE_BASIC_TEXT_IPRIMITIVE_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
10 // basic_text_iprimitive.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 // archives stored as text - note these ar templated on the basic
20 // stream templates to accommodate wide (and other?) kind of characters
22 // note the fact that on libraries without wide characters, ostream is
23 // is not a specialization of basic_ostream which in fact is not defined
24 // in such cases. So we can't use basic_ostream<IStream::char_type> but rather
25 // use two template parameters
29 #include <cstddef> // size_t
31 #include <boost/config.hpp>
32 #if defined(BOOST_NO_STDC_NAMESPACE)
35 #if ! defined(BOOST_DINKUMWARE_STDLIB) && ! defined(__SGI_STL_PORT)
41 #include <boost/detail/workaround.hpp>
42 #if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1)
43 #include <boost/archive/dinkumware.hpp>
46 #include <boost/throw_exception.hpp>
47 #include <boost/limits.hpp>
48 #include <boost/io/ios_state.hpp>
49 #include <boost/scoped_ptr.hpp>
51 #include <boost/archive/archive_exception.hpp>
53 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
58 /////////////////////////////////////////////////////////////////////////
59 // class basic_text_iarchive - load serialized objects from a input text stream
60 template<class IStream>
61 class basic_text_iprimitive
63 #ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
69 io::ios_flags_saver flags_saver;
70 io::ios_precision_saver precision_saver;
71 boost::scoped_ptr<std::locale> archive_locale;
72 io::basic_ios_locale_saver<
73 BOOST_DEDUCED_TYPENAME IStream::char_type, BOOST_DEDUCED_TYPENAME IStream::traits_type
79 boost::throw_exception(archive_exception(archive_exception::stream_error));
82 void load(unsigned char & t)
85 boost::throw_exception(archive_exception(archive_exception::stream_error));
88 t = static_cast<unsigned char>(i);
90 void load(signed char & t)
93 boost::throw_exception(archive_exception(archive_exception::stream_error));
96 t = static_cast<signed char>(i);
101 boost::throw_exception(archive_exception(archive_exception::stream_error));
104 t = static_cast<char>(i);
106 #ifndef BOOST_NO_INTRINSIC_WCHAR_T
107 void load(wchar_t & t)
110 boost::throw_exception(archive_exception(archive_exception::stream_error));
113 t = static_cast<wchar_t>(i);
116 BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
117 basic_text_iprimitive(IStream &is, bool no_codecvt);
118 BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
119 ~basic_text_iprimitive();
121 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
122 load_binary(void *address, std::size_t count);
125 } // namespace archive
128 #include <boost/archive/detail/abi_suffix.hpp> // pop pragams
130 #endif // BOOST_ARCHIVE_BASIC_TEXT_IPRIMITIVE_HPP