| 1 | #ifndef BOOST_ARCHIVE_TEXT_WIARCHIVE_HPP | 
|---|
| 2 | #define BOOST_ARCHIVE_TEXT_WIARCHIVE_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_wiarchive.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 <boost/config.hpp> | 
|---|
| 20 | #ifdef BOOST_NO_STD_WSTREAMBUF | 
|---|
| 21 | #error "wide char i/o not supported on this platform" | 
|---|
| 22 | #else | 
|---|
| 23 |  | 
|---|
| 24 | #include <istream> | 
|---|
| 25 |  | 
|---|
| 26 | #include <boost/archive/detail/auto_link_warchive.hpp> | 
|---|
| 27 | #include <boost/archive/basic_text_iprimitive.hpp> | 
|---|
| 28 | #include <boost/archive/basic_text_iarchive.hpp> | 
|---|
| 29 |  | 
|---|
| 30 | #include <boost/archive/detail/abi_prefix.hpp> // must be the last header | 
|---|
| 31 |  | 
|---|
| 32 | namespace boost {  | 
|---|
| 33 | namespace archive { | 
|---|
| 34 |  | 
|---|
| 35 | template<class Archive> | 
|---|
| 36 | class text_wiarchive_impl :  | 
|---|
| 37 |     public basic_text_iprimitive<std::wistream>, | 
|---|
| 38 |     public basic_text_iarchive<Archive> | 
|---|
| 39 | { | 
|---|
| 40 | #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS | 
|---|
| 41 | public: | 
|---|
| 42 | #else | 
|---|
| 43 |     friend class detail::interface_iarchive<Archive>; | 
|---|
| 44 |     friend class basic_text_iarchive<Archive>; | 
|---|
| 45 |     friend class load_access; | 
|---|
| 46 | protected: | 
|---|
| 47 | #endif | 
|---|
| 48 |     template<class T> | 
|---|
| 49 |     void load(T & t){ | 
|---|
| 50 |         basic_text_iprimitive<std::wistream>::load(t); | 
|---|
| 51 |     } | 
|---|
| 52 |     BOOST_WARCHIVE_DECL(void) | 
|---|
| 53 |     load(char * t); | 
|---|
| 54 |     #ifndef BOOST_NO_INTRINSIC_WCHAR_T | 
|---|
| 55 |     BOOST_WARCHIVE_DECL(void) | 
|---|
| 56 |     load(wchar_t * t); | 
|---|
| 57 |     #endif | 
|---|
| 58 |     BOOST_WARCHIVE_DECL(void) | 
|---|
| 59 |     load(std::string &s); | 
|---|
| 60 |     #ifndef BOOST_NO_STD_WSTRING | 
|---|
| 61 |     BOOST_WARCHIVE_DECL(void) | 
|---|
| 62 |     load(std::wstring &ws); | 
|---|
| 63 |     #endif | 
|---|
| 64 |     // note: the following should not needed - but one compiler (vc 7.1) | 
|---|
| 65 |     // fails to compile one test (test_shared_ptr) without it !!! | 
|---|
| 66 |     template<class T> | 
|---|
| 67 |     void load_override(T & t, BOOST_PFTO int){ | 
|---|
| 68 |         basic_text_iarchive<Archive>::load_override(t, 0); | 
|---|
| 69 |     } | 
|---|
| 70 |     BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY())  | 
|---|
| 71 |     text_wiarchive_impl(std::wistream & is, unsigned int flags); | 
|---|
| 72 |     ~text_wiarchive_impl(){}; | 
|---|
| 73 | }; | 
|---|
| 74 |  | 
|---|
| 75 | // do not derive from this class.  If you want to extend this functionality | 
|---|
| 76 | // via inhertance, derived from text_wiarchive_impl instead.  This will | 
|---|
| 77 | // preserve correct static polymorphism. | 
|---|
| 78 | class text_wiarchive :  | 
|---|
| 79 |     public text_wiarchive_impl<text_wiarchive> | 
|---|
| 80 | { | 
|---|
| 81 | public: | 
|---|
| 82 |     text_wiarchive(std::wistream & is, unsigned int flags = 0) : | 
|---|
| 83 |         text_wiarchive_impl<text_wiarchive>(is, flags) | 
|---|
| 84 |     {} | 
|---|
| 85 |     ~text_wiarchive(){} | 
|---|
| 86 | }; | 
|---|
| 87 |  | 
|---|
| 88 | } // namespace archive | 
|---|
| 89 | } // namespace boost | 
|---|
| 90 |  | 
|---|
| 91 | // required by smart_cast for compilers not implementing  | 
|---|
| 92 | // partial template specialization | 
|---|
| 93 | BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::text_wiarchive) | 
|---|
| 94 |  | 
|---|
| 95 | #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas | 
|---|
| 96 |  | 
|---|
| 97 | #endif // BOOST_NO_STD_WSTREAMBUF | 
|---|
| 98 | #endif // BOOST_ARCHIVE_TEXT_WIARCHIVE_HPP | 
|---|