source: NonGTP/Boost/boost/archive/xml_wiarchive.hpp @ 857

Revision 857, 3.6 KB checked in by igarcia, 19 years ago (diff)
Line 
1#ifndef BOOST_ARCHIVE_XML_WIARCHIVE_HPP
2#define BOOST_ARCHIVE_XML_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// xml_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/scoped_ptr.hpp>
27#include <boost/archive/detail/auto_link_warchive.hpp>
28#include <boost/archive/basic_text_iprimitive.hpp>
29#include <boost/archive/basic_xml_iarchive.hpp>
30
31#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
32
33namespace boost {
34namespace archive {
35
36template<class CharType>
37class basic_xml_grammar;
38typedef basic_xml_grammar<wchar_t> xml_wgrammar;
39
40template<class Archive>
41class xml_wiarchive_impl :
42    public basic_text_iprimitive<std::wistream>,
43    public basic_xml_iarchive<Archive>
44{
45#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
46public:
47#else
48    friend class detail::interface_iarchive<Archive>;
49    friend class basic_xml_iarchive<Archive>;
50    friend class load_access;
51protected:
52#endif
53    // instances of micro xml parser to parse start preambles
54    // scoped_ptr doesn't play nice with borland - so use a naked pointer
55    // scoped_ptr<xml_wgrammar> gimpl;
56    xml_wgrammar *gimpl;
57    std::wistream & get_is(){
58        return is;
59    }
60    template<class T>
61    void load(T & t){
62        basic_text_iprimitive<std::wistream>::load(t);
63    }
64    BOOST_WARCHIVE_DECL(void)
65    load(char * t);
66    #ifndef BOOST_NO_INTRINSIC_WCHAR_T
67    BOOST_WARCHIVE_DECL(void)
68    load(wchar_t * t);
69    #endif
70    BOOST_WARCHIVE_DECL(void)
71    load(std::string &s);
72    #ifndef BOOST_NO_STD_WSTRING
73    BOOST_WARCHIVE_DECL(void)
74    load(std::wstring &ws);
75    #endif
76    template<class T>
77    void load_override(T & t, BOOST_PFTO int){
78        basic_xml_iarchive<Archive>::load_override(t, 0);
79    }
80    BOOST_WARCHIVE_DECL(void)
81    load_override(class_name_type & t, int);
82    BOOST_WARCHIVE_DECL(void)
83    init();
84    BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY())
85    xml_wiarchive_impl(std::wistream & is, unsigned int flags) ;
86    BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY())
87    ~xml_wiarchive_impl();
88};
89
90// we use the following because we can't use
91// typedef xml_wiarchive_impl<xml_wiarchive_impl<...> > xml_wiarchive;
92
93// do not derive from this class.  If you want to extend this functionality
94// via inhertance, derived from xml_wiarchive_impl instead.  This will
95// preserve correct static polymorphism.
96class xml_wiarchive :
97    public xml_wiarchive_impl<xml_wiarchive>
98{
99public:
100    xml_wiarchive(std::wistream & is, unsigned int flags = 0) :
101        xml_wiarchive_impl<xml_wiarchive>(is, flags)
102    {}
103    ~xml_wiarchive(){}
104};
105
106} // namespace archive
107} // namespace boost
108
109// required by smart_cast for compilers not implementing
110// partial template specialization
111BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::xml_wiarchive)
112
113#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
114
115#endif // BOOST_NO_STD_WSTREAMBUF
116#endif // BOOST_ARCHIVE_XML_WIARCHIVE_HPP
Note: See TracBrowser for help on using the repository browser.