Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:28:30

0001 #ifndef BOOST_ARCHIVE_BASIC_XML_OARCHIVE_HPP
0002 #define BOOST_ARCHIVE_BASIC_XML_OARCHIVE_HPP
0003 
0004 // MS compatible compilers support #pragma once
0005 #if defined(_MSC_VER)
0006 # pragma once
0007 #endif
0008 
0009 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
0010 // basic_xml_oarchive.hpp
0011 
0012 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
0013 // Use, modification and distribution is subject to the Boost Software
0014 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0015 // http://www.boost.org/LICENSE_1_0.txt)
0016 
0017 //  See http://www.boost.org for updates, documentation, and revision history.
0018 
0019 #include <boost/config.hpp>
0020 #include <boost/mpl/assert.hpp>
0021 
0022 #include <boost/archive/detail/common_oarchive.hpp>
0023 #include <boost/serialization/nvp.hpp>
0024 #include <boost/serialization/string.hpp>
0025 
0026 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
0027 
0028 #ifdef BOOST_MSVC
0029 #  pragma warning(push)
0030 #  pragma warning(disable : 4511 4512)
0031 #endif
0032 
0033 namespace boost {
0034 namespace archive {
0035 
0036 namespace detail {
0037     template<class Archive> class interface_oarchive;
0038 } // namespace detail
0039 
0040 //////////////////////////////////////////////////////////////////////
0041 // class basic_xml_oarchive - write serialized objects to a xml output stream
0042 template<class Archive>
0043 class BOOST_SYMBOL_VISIBLE basic_xml_oarchive :
0044     public detail::common_oarchive<Archive>
0045 {
0046     // special stuff for xml output
0047     unsigned int depth;
0048     bool pending_preamble;
0049 #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
0050 public:
0051 #else
0052 protected:
0053     friend class detail::interface_oarchive<Archive>;
0054 #endif
0055     bool indent_next;
0056     BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0057     indent();
0058     BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0059     init();
0060     BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0061     windup();
0062     BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0063     write_attribute(
0064         const char *attribute_name,
0065         int t,
0066         const char *conjunction = "=\""
0067     );
0068     BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0069     write_attribute(
0070         const char *attribute_name,
0071         const char *key
0072     );
0073     // helpers used below
0074     BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0075     save_start(const char *name);
0076     BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0077     save_end(const char *name);
0078     BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0079     end_preamble();
0080 
0081     // Anything not an attribute and not a name-value pair is an
0082     // error and should be trapped here.
0083     template<class T>
0084     void save_override(T & t)
0085     {
0086         // If your program fails to compile here, its most likely due to
0087         // not specifying an nvp wrapper around the variable to
0088         // be serialized.
0089         BOOST_MPL_ASSERT((serialization::is_wrapper< T >));
0090         this->detail_common_oarchive::save_override(t);
0091     }
0092 
0093     // special treatment for name-value pairs.
0094     typedef detail::common_oarchive<Archive> detail_common_oarchive;
0095     template<class T>
0096     void save_override(
0097         const ::boost::serialization::nvp< T > & t
0098     ){
0099         this->This()->save_start(t.name());
0100         this->detail_common_oarchive::save_override(t.const_value());
0101         this->This()->save_end(t.name());
0102     }
0103 
0104     // specific overrides for attributes - not name value pairs so we
0105     // want to trap them before the above "fall through"
0106     BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0107     save_override(const class_id_type & t);
0108     BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0109     save_override(const class_id_optional_type & t);
0110     BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0111     save_override(const class_id_reference_type & t);
0112     BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0113     save_override(const object_id_type & t);
0114     BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0115     save_override(const object_reference_type & t);
0116     BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0117     save_override(const version_type & t);
0118     BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0119     save_override(const class_name_type & t);
0120     BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0121     save_override(const tracking_type & t);
0122 
0123     BOOST_ARCHIVE_OR_WARCHIVE_DECL
0124     basic_xml_oarchive(unsigned int flags);
0125     BOOST_ARCHIVE_OR_WARCHIVE_DECL
0126     ~basic_xml_oarchive() BOOST_OVERRIDE;
0127 };
0128 
0129 } // namespace archive
0130 } // namespace boost
0131 
0132 #ifdef BOOST_MSVC
0133 #pragma warning(pop)
0134 #endif
0135 
0136 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
0137 
0138 #endif // BOOST_ARCHIVE_BASIC_XML_OARCHIVE_HPP