|
1 #ifndef BOOST_ARCHIVE_XML_IARCHIVE_HPP |
|
2 #define BOOST_ARCHIVE_XML_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 // xml_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/scoped_ptr.hpp> |
|
22 #include <boost/archive/detail/auto_link_archive.hpp> |
|
23 #include <boost/archive/basic_text_iprimitive.hpp> |
|
24 #include <boost/archive/basic_xml_iarchive.hpp> |
|
25 |
|
26 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header |
|
27 |
|
28 namespace boost { |
|
29 namespace archive { |
|
30 |
|
31 template<class CharType> |
|
32 class basic_xml_grammar; |
|
33 typedef basic_xml_grammar<char> xml_grammar; |
|
34 |
|
35 template<class Archive> |
|
36 class xml_iarchive_impl : |
|
37 public basic_text_iprimitive<std::istream>, |
|
38 public basic_xml_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_xml_iarchive<Archive>; |
|
45 friend class load_access; |
|
46 protected: |
|
47 #endif |
|
48 // instances of micro xml parser to parse start preambles |
|
49 // scoped_ptr doesn't play nice with borland - so use a naked pointer |
|
50 // scoped_ptr<xml_grammar> gimpl; |
|
51 xml_grammar *gimpl; |
|
52 |
|
53 std::istream & get_is(){ |
|
54 return is; |
|
55 } |
|
56 template<class T> |
|
57 void load(T & t){ |
|
58 basic_text_iprimitive<std::istream>::load(t); |
|
59 } |
|
60 BOOST_ARCHIVE_DECL(void) |
|
61 load(char * t); |
|
62 #ifndef BOOST_NO_INTRINSIC_WCHAR_T |
|
63 BOOST_ARCHIVE_DECL(void) |
|
64 load(wchar_t * t); |
|
65 #endif |
|
66 BOOST_ARCHIVE_DECL(void) |
|
67 load(std::string &s); |
|
68 #ifndef BOOST_NO_STD_WSTRING |
|
69 BOOST_ARCHIVE_DECL(void) |
|
70 load(std::wstring &ws); |
|
71 #endif |
|
72 template<class T> |
|
73 void load_override(T & t, BOOST_PFTO int){ |
|
74 basic_xml_iarchive<Archive>::load_override(t, 0); |
|
75 } |
|
76 BOOST_ARCHIVE_DECL(void) |
|
77 load_override(class_name_type & t, int); |
|
78 BOOST_ARCHIVE_DECL(void) |
|
79 init(); |
|
80 BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) |
|
81 xml_iarchive_impl(std::istream & is, unsigned int flags); |
|
82 BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) |
|
83 ~xml_iarchive_impl(); |
|
84 }; |
|
85 |
|
86 // we use the following because we can't use |
|
87 // typedef xml_iarchive_impl<xml_iarchive_impl<...> > xml_iarchive; |
|
88 |
|
89 // do not derive from this class. If you want to extend this functionality |
|
90 // via inhertance, derived from xml_iarchive_impl instead. This will |
|
91 // preserve correct static polymorphism. |
|
92 class xml_iarchive : |
|
93 public xml_iarchive_impl<xml_iarchive> |
|
94 { |
|
95 public: |
|
96 xml_iarchive(std::istream & is, unsigned int flags = 0) : |
|
97 xml_iarchive_impl<xml_iarchive>(is, flags) |
|
98 {} |
|
99 ~xml_iarchive(){}; |
|
100 }; |
|
101 |
|
102 } // namespace archive |
|
103 } // namespace boost |
|
104 |
|
105 // required by smart_cast for compilers not implementing |
|
106 // partial template specialization |
|
107 BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::xml_iarchive) |
|
108 |
|
109 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas |
|
110 |
|
111 #endif // BOOST_ARCHIVE_XML_IARCHIVE_HPP |