annotate DEPENDENCIES/generic/include/boost/archive/basic_xml_iarchive.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 #ifndef BOOST_ARCHIVE_BASIC_XML_IARCHIVE_HPP
Chris@16 2 #define BOOST_ARCHIVE_BASIC_XML_IARCHIVE_HPP
Chris@16 3
Chris@16 4 // MS compatible compilers support #pragma once
Chris@101 5 #if defined(_MSC_VER)
Chris@16 6 # pragma once
Chris@16 7 #endif
Chris@16 8
Chris@16 9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
Chris@16 10 // basic_xml_iarchive.hpp
Chris@16 11
Chris@16 12 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
Chris@16 13 // Use, modification and distribution is subject to the Boost Software
Chris@16 14 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 15 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 16
Chris@16 17 // See http://www.boost.org for updates, documentation, and revision history.
Chris@16 18
Chris@16 19 #include <boost/config.hpp>
Chris@16 20 #include <boost/serialization/pfto.hpp>
Chris@16 21 #include <boost/detail/workaround.hpp>
Chris@16 22
Chris@16 23 #include <boost/archive/detail/common_iarchive.hpp>
Chris@16 24
Chris@16 25 #include <boost/serialization/nvp.hpp>
Chris@16 26 #include <boost/serialization/string.hpp>
Chris@16 27
Chris@16 28 #include <boost/mpl/assert.hpp>
Chris@16 29
Chris@16 30 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
Chris@16 31
Chris@16 32 #ifdef BOOST_MSVC
Chris@16 33 # pragma warning(push)
Chris@16 34 # pragma warning(disable : 4511 4512)
Chris@16 35 #endif
Chris@16 36
Chris@16 37 namespace boost {
Chris@16 38 namespace archive {
Chris@16 39
Chris@101 40 namespace detail {
Chris@101 41 template<class Archive> class interface_iarchive;
Chris@101 42 } // namespace detail
Chris@101 43
Chris@16 44 /////////////////////////////////////////////////////////////////////////
Chris@16 45 // class xml_iarchive - read serialized objects from a input text stream
Chris@16 46 template<class Archive>
Chris@16 47 class basic_xml_iarchive :
Chris@16 48 public detail::common_iarchive<Archive>
Chris@16 49 {
Chris@101 50 #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
Chris@101 51 public:
Chris@101 52 #else
Chris@16 53 protected:
Chris@101 54 #if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
Chris@101 55 // for some inexplicable reason insertion of "class" generates compile erro
Chris@101 56 // on msvc 7.1
Chris@101 57 friend detail::interface_iarchive<Archive>;
Chris@101 58 #else
Chris@101 59 friend class detail::interface_iarchive<Archive>;
Chris@101 60 #endif
Chris@16 61 #endif
Chris@16 62 unsigned int depth;
Chris@16 63 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
Chris@16 64 load_start(const char *name);
Chris@16 65 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
Chris@16 66 load_end(const char *name);
Chris@16 67
Chris@16 68 // Anything not an attribute and not a name-value pair is an
Chris@16 69 // should be trapped here.
Chris@16 70 template<class T>
Chris@16 71 void load_override(T & t, BOOST_PFTO int)
Chris@16 72 {
Chris@16 73 // If your program fails to compile here, its most likely due to
Chris@16 74 // not specifying an nvp wrapper around the variable to
Chris@16 75 // be serialized.
Chris@16 76 BOOST_MPL_ASSERT((serialization::is_wrapper< T >));
Chris@16 77 this->detail_common_iarchive::load_override(t, 0);
Chris@16 78 }
Chris@16 79
Chris@16 80 // Anything not an attribute - see below - should be a name value
Chris@16 81 // pair and be processed here
Chris@16 82 typedef detail::common_iarchive<Archive> detail_common_iarchive;
Chris@16 83 template<class T>
Chris@16 84 void load_override(
Chris@16 85 #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
Chris@16 86 const
Chris@16 87 #endif
Chris@16 88 boost::serialization::nvp< T > & t,
Chris@16 89 int
Chris@16 90 ){
Chris@16 91 this->This()->load_start(t.name());
Chris@16 92 this->detail_common_iarchive::load_override(t.value(), 0);
Chris@16 93 this->This()->load_end(t.name());
Chris@16 94 }
Chris@16 95
Chris@16 96 // specific overrides for attributes - handle as
Chris@16 97 // primitives. These are not name-value pairs
Chris@16 98 // so they have to be intercepted here and passed on to load.
Chris@16 99 // although the class_id is included in the xml text file in order
Chris@16 100 // to make the file self describing, it isn't used when loading
Chris@16 101 // an xml archive. So we can skip it here. Note: we MUST override
Chris@16 102 // it otherwise it will be loaded as a normal primitive w/o tag and
Chris@16 103 // leaving the archive in an undetermined state
Chris@16 104 void load_override(class_id_optional_type & /* t */, int){}
Chris@16 105 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
Chris@16 106 load_override(object_id_type & t, int);
Chris@16 107 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
Chris@16 108 load_override(version_type & t, int);
Chris@16 109 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
Chris@16 110 load_override(class_id_type & t, int);
Chris@16 111 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
Chris@16 112 load_override(tracking_type & t, int);
Chris@16 113 // class_name_type can't be handled here as it depends upon the
Chris@16 114 // char type used by the stream. So require the derived implementation
Chris@16 115 // handle this.
Chris@16 116 // void load_override(class_name_type & t, int);
Chris@16 117
Chris@16 118 BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
Chris@16 119 basic_xml_iarchive(unsigned int flags);
Chris@16 120 BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
Chris@16 121 ~basic_xml_iarchive();
Chris@16 122 };
Chris@16 123
Chris@16 124 } // namespace archive
Chris@16 125 } // namespace boost
Chris@16 126
Chris@16 127 #ifdef BOOST_MSVC
Chris@16 128 #pragma warning(pop)
Chris@16 129 #endif
Chris@16 130
Chris@16 131 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
Chris@16 132
Chris@16 133 #endif // BOOST_ARCHIVE_BASIC_XML_IARCHIVE_HPP