| 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 | friend class detail::interface_iarchive<Archive>; |
| 52 | friend class load_access; |
| 53 | #endif |
| 54 | template<class T> |
| 55 | void load(T & t){ |
| 56 | basic_text_iprimitive<std::istream>::load(t); |
| 57 | } |
| 58 | void load(version_type & t){ |
| 59 | unsigned int v; |
| 60 | load(v); |
| 61 | t = version_type(v); |
| 62 | } |
| 63 | void load(boost::serialization::item_version_type & t){ |
| 64 | unsigned int v; |
| 65 | load(v); |
| 66 | t = boost::serialization::item_version_type(v); |
| 67 | } |
| 68 | BOOST_ARCHIVE_DECL void |
| 69 | load(char * t); |
| 70 | #ifndef BOOST_NO_INTRINSIC_WCHAR_T |
| 71 | BOOST_ARCHIVE_DECL void |
| 72 | load(wchar_t * t); |
| 73 | #endif |
| 74 | BOOST_ARCHIVE_DECL void |
| 75 | load(std::string &s); |
| 76 | #ifndef BOOST_NO_STD_WSTRING |
| 77 | BOOST_ARCHIVE_DECL void |
| 78 | load(std::wstring &ws); |
| 79 | #endif |
| 80 | template<class T> |
| 81 | void load_override(T & t){ |
| 82 | basic_text_iarchive<Archive>::load_override(t); |
| 83 | } |
| 84 | BOOST_ARCHIVE_DECL void |
| 85 | load_override(class_name_type & t); |
| 86 | BOOST_ARCHIVE_DECL void |
| 87 | init(); |
| 88 | BOOST_ARCHIVE_DECL |
| 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 |
| 92 | ~text_iarchive_impl() BOOST_OVERRIDE {} |
| 93 | }; |
| 94 | |
| 95 | } // namespace archive |
| 96 | } // namespace boost |
| 97 | |
| 98 | #ifdef BOOST_MSVC |
| 99 | #pragma warning(pop) |
| 100 | #endif |
| 101 | |
| 102 | #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas |
| 103 | |
| 104 | #ifdef BOOST_MSVC |
| 105 | # pragma warning(push) |
| 106 | # pragma warning(disable : 4511 4512) |
| 107 | #endif |
| 108 | |
| 109 | namespace boost { |
| 110 | namespace archive { |
| 111 | |
| 112 | class BOOST_SYMBOL_VISIBLE text_iarchive : |
| 113 | public text_iarchive_impl<text_iarchive>{ |
| 114 | public: |
| 115 | text_iarchive(std::istream & is_, unsigned int flags = 0) : |
| 116 | // note: added _ to suppress useless gcc warning |
| 117 | text_iarchive_impl<text_iarchive>(is_, flags) |
| 118 | { |
| 119 | if(0 == (flags & no_header)) |
| 120 | init(); |
| 121 | } |
| 122 | ~text_iarchive() BOOST_OVERRIDE {} |
| 123 | }; |
| 124 | |
| 125 | } // namespace archive |
| 126 | } // namespace boost |
| 127 | |
| 128 | // required by export |
| 129 | BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_iarchive) |
| 130 | |
| 131 | #ifdef BOOST_MSVC |
| 132 | #pragma warning(pop) |
| 133 | #endif |
| 134 | |
| 135 | #endif // BOOST_ARCHIVE_TEXT_IARCHIVE_HPP |
| 136 |
