sl@0
|
1 |
#ifndef BOOST_ARCHIVE_XML_WIARCHIVE_HPP
|
sl@0
|
2 |
#define BOOST_ARCHIVE_XML_WIARCHIVE_HPP
|
sl@0
|
3 |
|
sl@0
|
4 |
// MS compatible compilers support #pragma once
|
sl@0
|
5 |
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
sl@0
|
6 |
# pragma once
|
sl@0
|
7 |
#endif
|
sl@0
|
8 |
|
sl@0
|
9 |
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
sl@0
|
10 |
// xml_wiarchive.hpp
|
sl@0
|
11 |
|
sl@0
|
12 |
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
sl@0
|
13 |
// Use, modification and distribution is subject to the Boost Software
|
sl@0
|
14 |
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
sl@0
|
15 |
// http://www.boost.org/LICENSE_1_0.txt)
|
sl@0
|
16 |
|
sl@0
|
17 |
// See http://www.boost.org for updates, documentation, and revision history.
|
sl@0
|
18 |
|
sl@0
|
19 |
#include <boost/config.hpp>
|
sl@0
|
20 |
#ifdef BOOST_NO_STD_WSTREAMBUF
|
sl@0
|
21 |
#error "wide char i/o not supported on this platform"
|
sl@0
|
22 |
#else
|
sl@0
|
23 |
|
sl@0
|
24 |
#include <istream>
|
sl@0
|
25 |
|
sl@0
|
26 |
//#include <boost/scoped_ptr.hpp>
|
sl@0
|
27 |
#include <boost/archive/detail/auto_link_warchive.hpp>
|
sl@0
|
28 |
#include <boost/archive/basic_text_iprimitive.hpp>
|
sl@0
|
29 |
#include <boost/archive/basic_xml_iarchive.hpp>
|
sl@0
|
30 |
|
sl@0
|
31 |
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
sl@0
|
32 |
|
sl@0
|
33 |
namespace boost {
|
sl@0
|
34 |
namespace archive {
|
sl@0
|
35 |
|
sl@0
|
36 |
template<class CharType>
|
sl@0
|
37 |
class basic_xml_grammar;
|
sl@0
|
38 |
typedef basic_xml_grammar<wchar_t> xml_wgrammar;
|
sl@0
|
39 |
|
sl@0
|
40 |
template<class Archive>
|
sl@0
|
41 |
class xml_wiarchive_impl :
|
sl@0
|
42 |
public basic_text_iprimitive<std::wistream>,
|
sl@0
|
43 |
public basic_xml_iarchive<Archive>
|
sl@0
|
44 |
{
|
sl@0
|
45 |
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
sl@0
|
46 |
public:
|
sl@0
|
47 |
#else
|
sl@0
|
48 |
friend class detail::interface_iarchive<Archive>;
|
sl@0
|
49 |
friend class basic_xml_iarchive<Archive>;
|
sl@0
|
50 |
friend class load_access;
|
sl@0
|
51 |
protected:
|
sl@0
|
52 |
#endif
|
sl@0
|
53 |
// instances of micro xml parser to parse start preambles
|
sl@0
|
54 |
// scoped_ptr doesn't play nice with borland - so use a naked pointer
|
sl@0
|
55 |
// scoped_ptr<xml_wgrammar> gimpl;
|
sl@0
|
56 |
xml_wgrammar *gimpl;
|
sl@0
|
57 |
std::wistream & get_is(){
|
sl@0
|
58 |
return is;
|
sl@0
|
59 |
}
|
sl@0
|
60 |
template<class T>
|
sl@0
|
61 |
void load(T & t){
|
sl@0
|
62 |
basic_text_iprimitive<std::wistream>::load(t);
|
sl@0
|
63 |
}
|
sl@0
|
64 |
BOOST_WARCHIVE_DECL(void)
|
sl@0
|
65 |
load(char * t);
|
sl@0
|
66 |
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
sl@0
|
67 |
BOOST_WARCHIVE_DECL(void)
|
sl@0
|
68 |
load(wchar_t * t);
|
sl@0
|
69 |
#endif
|
sl@0
|
70 |
BOOST_WARCHIVE_DECL(void)
|
sl@0
|
71 |
load(std::string &s);
|
sl@0
|
72 |
#ifndef BOOST_NO_STD_WSTRING
|
sl@0
|
73 |
BOOST_WARCHIVE_DECL(void)
|
sl@0
|
74 |
load(std::wstring &ws);
|
sl@0
|
75 |
#endif
|
sl@0
|
76 |
template<class T>
|
sl@0
|
77 |
void load_override(T & t, BOOST_PFTO int){
|
sl@0
|
78 |
basic_xml_iarchive<Archive>::load_override(t, 0);
|
sl@0
|
79 |
}
|
sl@0
|
80 |
BOOST_WARCHIVE_DECL(void)
|
sl@0
|
81 |
load_override(class_name_type & t, int);
|
sl@0
|
82 |
BOOST_WARCHIVE_DECL(void)
|
sl@0
|
83 |
init();
|
sl@0
|
84 |
BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY())
|
sl@0
|
85 |
xml_wiarchive_impl(std::wistream & is, unsigned int flags) ;
|
sl@0
|
86 |
BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY())
|
sl@0
|
87 |
~xml_wiarchive_impl();
|
sl@0
|
88 |
};
|
sl@0
|
89 |
|
sl@0
|
90 |
// we use the following because we can't use
|
sl@0
|
91 |
// typedef xml_wiarchive_impl<xml_wiarchive_impl<...> > xml_wiarchive;
|
sl@0
|
92 |
|
sl@0
|
93 |
// do not derive from this class. If you want to extend this functionality
|
sl@0
|
94 |
// via inhertance, derived from xml_wiarchive_impl instead. This will
|
sl@0
|
95 |
// preserve correct static polymorphism.
|
sl@0
|
96 |
class xml_wiarchive :
|
sl@0
|
97 |
public xml_wiarchive_impl<xml_wiarchive>
|
sl@0
|
98 |
{
|
sl@0
|
99 |
public:
|
sl@0
|
100 |
xml_wiarchive(std::wistream & is, unsigned int flags = 0) :
|
sl@0
|
101 |
xml_wiarchive_impl<xml_wiarchive>(is, flags)
|
sl@0
|
102 |
{}
|
sl@0
|
103 |
~xml_wiarchive(){}
|
sl@0
|
104 |
};
|
sl@0
|
105 |
|
sl@0
|
106 |
} // namespace archive
|
sl@0
|
107 |
} // namespace boost
|
sl@0
|
108 |
|
sl@0
|
109 |
// required by smart_cast for compilers not implementing
|
sl@0
|
110 |
// partial template specialization
|
sl@0
|
111 |
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::xml_wiarchive)
|
sl@0
|
112 |
|
sl@0
|
113 |
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
sl@0
|
114 |
|
sl@0
|
115 |
#endif // BOOST_NO_STD_WSTREAMBUF
|
sl@0
|
116 |
#endif // BOOST_ARCHIVE_XML_WIARCHIVE_HPP
|