[29] | 1 | #ifndef BOOST_ARCHIVE_TEXT_OARCHIVE_HPP |
---|
| 2 | #define BOOST_ARCHIVE_TEXT_OARCHIVE_HPP |
---|
| 3 | |
---|
| 4 | // MS compatible compilers support #pragma once |
---|
| 5 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) |
---|
| 6 | # pragma once |
---|
| 7 | #endif |
---|
| 8 | |
---|
| 9 | /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 |
---|
| 10 | // text_oarchive.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 <ostream> |
---|
| 20 | #include <cstddef> // std::size_t |
---|
| 21 | |
---|
| 22 | #include <boost/config.hpp> |
---|
| 23 | #if defined(BOOST_NO_STDC_NAMESPACE) |
---|
| 24 | namespace std{ |
---|
| 25 | using ::size_t; |
---|
| 26 | } // namespace std |
---|
| 27 | #endif |
---|
| 28 | |
---|
| 29 | #include <boost/archive/detail/auto_link_archive.hpp> |
---|
| 30 | #include <boost/archive/basic_text_oprimitive.hpp> |
---|
| 31 | #include <boost/archive/basic_text_oarchive.hpp> |
---|
| 32 | |
---|
| 33 | #include <boost/archive/detail/abi_prefix.hpp> // must be the last header |
---|
| 34 | |
---|
| 35 | namespace boost { |
---|
| 36 | namespace archive { |
---|
| 37 | |
---|
| 38 | template<class Archive> |
---|
| 39 | class text_oarchive_impl : |
---|
| 40 | /* protected ? */ public basic_text_oprimitive<std::ostream>, |
---|
| 41 | public basic_text_oarchive<Archive> |
---|
| 42 | { |
---|
| 43 | #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS |
---|
| 44 | public: |
---|
| 45 | #else |
---|
| 46 | friend class detail::interface_oarchive<Archive>; |
---|
| 47 | friend class basic_text_oarchive<Archive>; |
---|
| 48 | friend class save_access; |
---|
| 49 | protected: |
---|
| 50 | #endif |
---|
| 51 | template<class T> |
---|
| 52 | void save(const T & t){ |
---|
| 53 | this->newtoken(); |
---|
| 54 | basic_text_oprimitive<std::ostream>::save(t); |
---|
| 55 | } |
---|
| 56 | BOOST_ARCHIVE_DECL(void) |
---|
| 57 | save(const char * t); |
---|
| 58 | #ifndef BOOST_NO_INTRINSIC_WCHAR_T |
---|
| 59 | BOOST_ARCHIVE_DECL(void) |
---|
| 60 | save(const wchar_t * t); |
---|
| 61 | #endif |
---|
| 62 | BOOST_ARCHIVE_DECL(void) |
---|
| 63 | save(const std::string &s); |
---|
| 64 | #ifndef BOOST_NO_STD_WSTRING |
---|
| 65 | BOOST_ARCHIVE_DECL(void) |
---|
| 66 | save(const std::wstring &ws); |
---|
| 67 | #endif |
---|
| 68 | BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) |
---|
| 69 | text_oarchive_impl(std::ostream & os, unsigned int flags); |
---|
| 70 | BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) |
---|
| 71 | ~text_oarchive_impl(){}; |
---|
| 72 | public: |
---|
| 73 | BOOST_ARCHIVE_DECL(void) |
---|
| 74 | save_binary(const void *address, std::size_t count); |
---|
| 75 | }; |
---|
| 76 | |
---|
| 77 | // do not derive from this class. If you want to extend this functionality |
---|
| 78 | // via inhertance, derived from text_oarchive_impl instead. This will |
---|
| 79 | // preserve correct static polymorphism. |
---|
| 80 | class text_oarchive : |
---|
| 81 | public text_oarchive_impl<text_oarchive> |
---|
| 82 | { |
---|
| 83 | public: |
---|
| 84 | |
---|
| 85 | text_oarchive(std::ostream & os, unsigned int flags = 0) : |
---|
| 86 | text_oarchive_impl<text_oarchive>(os, flags) |
---|
| 87 | {} |
---|
| 88 | ~text_oarchive(){} |
---|
| 89 | }; |
---|
| 90 | |
---|
| 91 | } // namespace archive |
---|
| 92 | } // namespace boost |
---|
| 93 | |
---|
| 94 | // required by smart_cast for compilers not implementing |
---|
| 95 | // partial template specialization |
---|
| 96 | BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::text_oarchive) |
---|
| 97 | |
---|
| 98 | #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas |
---|
| 99 | |
---|
| 100 | #endif // BOOST_ARCHIVE_TEXT_OARCHIVE_HPP |
---|