Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #ifndef BOOST_ARCHIVE_TEXT_WOARCHIVE_HPP
0002 #define BOOST_ARCHIVE_TEXT_WOARCHIVE_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 // text_woarchive.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 
0021 #ifdef BOOST_NO_STD_WSTREAMBUF
0022 #error "wide char i/o not supported on this platform"
0023 #else
0024 
0025 #include <ostream>
0026 #include <cstddef> // size_t
0027 
0028 #if defined(BOOST_NO_STDC_NAMESPACE)
0029 namespace std{
0030     using ::size_t;
0031 } // namespace std
0032 #endif
0033 
0034 #include <boost/archive/detail/auto_link_warchive.hpp>
0035 #include <boost/archive/basic_text_oprimitive.hpp>
0036 #include <boost/archive/basic_text_oarchive.hpp>
0037 #include <boost/archive/detail/register_archive.hpp>
0038 #include <boost/serialization/item_version_type.hpp>
0039 
0040 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
0041 
0042 #ifdef BOOST_MSVC
0043 #  pragma warning(push)
0044 #  pragma warning(disable : 4511 4512)
0045 #endif
0046 
0047 namespace boost {
0048 namespace archive {
0049 
0050 namespace detail {
0051     template<class Archive> class interface_oarchive;
0052 } // namespace detail
0053 
0054 template<class Archive>
0055 class BOOST_SYMBOL_VISIBLE text_woarchive_impl :
0056     public basic_text_oprimitive<std::wostream>,
0057     public basic_text_oarchive<Archive>
0058 {
0059 #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
0060 public:
0061 #else
0062 protected:
0063     #if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
0064         // for some inexplicable reason insertion of "class" generates compile erro
0065         // on msvc 7.1
0066         friend detail::interface_oarchive<Archive>;
0067         friend basic_text_oarchive<Archive>;
0068         friend save_access;
0069     #else
0070         friend class detail::interface_oarchive<Archive>;
0071         friend class basic_text_oarchive<Archive>;
0072         friend class save_access;
0073     #endif
0074 #endif
0075     template<class T>
0076     void save(const T & t){
0077         this->newtoken();
0078         basic_text_oprimitive<std::wostream>::save(t);
0079     }
0080     void save(const version_type & t){
0081         save(static_cast<unsigned int>(t));
0082     }
0083     void save(const boost::serialization::item_version_type & t){
0084         save(static_cast<unsigned int>(t));
0085     }
0086     BOOST_WARCHIVE_DECL void
0087     save(const char * t);
0088     #ifndef BOOST_NO_INTRINSIC_WCHAR_T
0089     BOOST_WARCHIVE_DECL void
0090     save(const wchar_t * t);
0091     #endif
0092     BOOST_WARCHIVE_DECL void
0093     save(const std::string &s);
0094     #ifndef BOOST_NO_STD_WSTRING
0095     BOOST_WARCHIVE_DECL void
0096     save(const std::wstring &ws);
0097     #endif
0098     text_woarchive_impl(std::wostream & os, unsigned int flags) :
0099         basic_text_oprimitive<std::wostream>(
0100             os,
0101             0 != (flags & no_codecvt)
0102         ),
0103         basic_text_oarchive<Archive>(flags)
0104     {}
0105 public:
0106     void save_binary(const void *address, std::size_t count){
0107         put(static_cast<wchar_t>('\n'));
0108         this->end_preamble();
0109         #if ! defined(__MWERKS__)
0110         this->basic_text_oprimitive<std::wostream>::save_binary(
0111         #else
0112         this->basic_text_oprimitive::save_binary(
0113         #endif
0114             address,
0115             count
0116         );
0117         put(static_cast<wchar_t>('\n'));
0118         this->delimiter = this->none;
0119     }
0120 
0121 };
0122 
0123 // we use the following because we can't use
0124 // typedef text_oarchive_impl<text_oarchive_impl<...> > text_oarchive;
0125 
0126 // do not derive from this class.  If you want to extend this functionality
0127 // via inheritance, derived from text_oarchive_impl instead.  This will
0128 // preserve correct static polymorphism.
0129 class BOOST_SYMBOL_VISIBLE text_woarchive :
0130     public text_woarchive_impl<text_woarchive>
0131 {
0132 public:
0133     text_woarchive(std::wostream & os, unsigned int flags = 0) :
0134         text_woarchive_impl<text_woarchive>(os, flags)
0135     {
0136         if(0 == (flags & no_header))
0137             init();
0138     }
0139     ~text_woarchive() BOOST_OVERRIDE {}
0140 };
0141 
0142 } // namespace archive
0143 } // namespace boost
0144 
0145 // required by export
0146 BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_woarchive)
0147 
0148 #ifdef BOOST_MSVC
0149 #pragma warning(pop)
0150 #endif
0151 
0152 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
0153 
0154 #endif // BOOST_NO_STD_WSTREAMBUF
0155 #endif // BOOST_ARCHIVE_TEXT_WOARCHIVE_HPP