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