Brian Silverman | 8867871 | 2018-08-04 23:56:48 -0700 | [diff] [blame^] | 1 | #ifndef BOOST_ARCHIVE_XML_IARCHIVE_HPP |
| 2 | #define BOOST_ARCHIVE_XML_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 | // xml_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/scoped_ptr.hpp> |
| 22 | #include <boost/archive/detail/auto_link_archive.hpp> |
| 23 | #include <boost/archive/basic_text_iprimitive.hpp> |
| 24 | #include <boost/archive/basic_xml_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 CharType> |
| 43 | class basic_xml_grammar; |
| 44 | typedef basic_xml_grammar<char> xml_grammar; |
| 45 | |
| 46 | template<class Archive> |
| 47 | class BOOST_SYMBOL_VISIBLE xml_iarchive_impl : |
| 48 | public basic_text_iprimitive<std::istream>, |
| 49 | public basic_xml_iarchive<Archive> |
| 50 | { |
| 51 | #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS |
| 52 | public: |
| 53 | #else |
| 54 | protected: |
| 55 | friend class detail::interface_iarchive<Archive>; |
| 56 | friend class basic_xml_iarchive<Archive>; |
| 57 | friend class load_access; |
| 58 | #endif |
| 59 | // use boost:scoped_ptr to implement automatic deletion; |
| 60 | boost::scoped_ptr<xml_grammar> gimpl; |
| 61 | |
| 62 | std::istream & get_is(){ |
| 63 | return is; |
| 64 | } |
| 65 | template<class T> |
| 66 | void load(T & t){ |
| 67 | basic_text_iprimitive<std::istream>::load(t); |
| 68 | } |
| 69 | void |
| 70 | load(version_type & t){ |
| 71 | unsigned int v; |
| 72 | load(v); |
| 73 | t = version_type(v); |
| 74 | } |
| 75 | void |
| 76 | load(boost::serialization::item_version_type & t){ |
| 77 | unsigned int v; |
| 78 | load(v); |
| 79 | t = boost::serialization::item_version_type(v); |
| 80 | } |
| 81 | BOOST_ARCHIVE_DECL void |
| 82 | load(char * t); |
| 83 | #ifndef BOOST_NO_INTRINSIC_WCHAR_T |
| 84 | BOOST_ARCHIVE_DECL void |
| 85 | load(wchar_t * t); |
| 86 | #endif |
| 87 | BOOST_ARCHIVE_DECL void |
| 88 | load(std::string &s); |
| 89 | #ifndef BOOST_NO_STD_WSTRING |
| 90 | BOOST_ARCHIVE_DECL void |
| 91 | load(std::wstring &ws); |
| 92 | #endif |
| 93 | template<class T> |
| 94 | void load_override(T & t){ |
| 95 | basic_xml_iarchive<Archive>::load_override(t); |
| 96 | } |
| 97 | BOOST_ARCHIVE_DECL void |
| 98 | load_override(class_name_type & t); |
| 99 | BOOST_ARCHIVE_DECL void |
| 100 | init(); |
| 101 | BOOST_ARCHIVE_DECL |
| 102 | xml_iarchive_impl(std::istream & is, unsigned int flags); |
| 103 | BOOST_ARCHIVE_DECL |
| 104 | ~xml_iarchive_impl(); |
| 105 | }; |
| 106 | |
| 107 | } // namespace archive |
| 108 | } // namespace boost |
| 109 | |
| 110 | #ifdef BOOST_MSVC |
| 111 | #pragma warning(pop) |
| 112 | #endif |
| 113 | |
| 114 | #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas |
| 115 | #ifdef BOOST_MSVC |
| 116 | # pragma warning(push) |
| 117 | # pragma warning(disable : 4511 4512) |
| 118 | #endif |
| 119 | |
| 120 | namespace boost { |
| 121 | namespace archive { |
| 122 | |
| 123 | class BOOST_SYMBOL_VISIBLE xml_iarchive : |
| 124 | public xml_iarchive_impl<xml_iarchive>{ |
| 125 | public: |
| 126 | xml_iarchive(std::istream & is, unsigned int flags = 0) : |
| 127 | xml_iarchive_impl<xml_iarchive>(is, flags) |
| 128 | {} |
| 129 | ~xml_iarchive(){}; |
| 130 | }; |
| 131 | |
| 132 | } // namespace archive |
| 133 | } // namespace boost |
| 134 | |
| 135 | // required by export |
| 136 | BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_iarchive) |
| 137 | |
| 138 | #ifdef BOOST_MSVC |
| 139 | #pragma warning(pop) |
| 140 | #endif |
| 141 | |
| 142 | #endif // BOOST_ARCHIVE_XML_IARCHIVE_HPP |