PageRenderTime 23ms CodeModel.GetById 15ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/archive/xml_wiarchive.hpp

http://hadesmem.googlecode.com/
C++ Header | 171 lines | 125 code | 25 blank | 21 comment | 1 complexity | 2e887532fc80c01cf821835e78433996 MD5 | raw file
  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#include <boost/archive/detail/register_archive.hpp>
 31#include <boost/serialization/item_version_type.hpp>
 32
 33#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
 34
 35#ifdef BOOST_MSVC
 36#  pragma warning(push)
 37#  pragma warning(disable : 4511 4512)
 38#endif
 39
 40namespace boost { 
 41namespace archive {
 42
 43template<class CharType>
 44class basic_xml_grammar;
 45typedef basic_xml_grammar<wchar_t> xml_wgrammar;
 46
 47template<class Archive>
 48class xml_wiarchive_impl : 
 49    public basic_text_iprimitive<std::wistream>,
 50    public basic_xml_iarchive<Archive>
 51{
 52#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
 53public:
 54#else
 55    friend class detail::interface_iarchive<Archive>;
 56    friend class basic_xml_iarchive<Archive>;
 57    friend class load_access;
 58protected:
 59#endif
 60    // instances of micro xml parser to parse start preambles
 61    // scoped_ptr doesn't play nice with borland - so use a naked pointer
 62    // scoped_ptr<xml_wgrammar> gimpl;
 63    xml_wgrammar *gimpl;
 64    std::wistream & get_is(){
 65        return is;
 66    }
 67    template<class T>
 68    void 
 69    load(T & t){
 70        basic_text_iprimitive<std::wistream>::load(t);
 71    }
 72    void 
 73    load(version_type & t){
 74        unsigned int v;
 75        load(v);
 76        t = version_type(v);
 77    }
 78    void 
 79    load(boost::serialization::item_version_type & t){
 80        unsigned int v;
 81        load(v);
 82        t = boost::serialization::item_version_type(v);
 83    }
 84    BOOST_WARCHIVE_DECL(void)
 85    load(char * t);
 86    #ifndef BOOST_NO_INTRINSIC_WCHAR_T
 87    BOOST_WARCHIVE_DECL(void)
 88    load(wchar_t * t);
 89    #endif
 90    BOOST_WARCHIVE_DECL(void)
 91    load(std::string &s);
 92    #ifndef BOOST_NO_STD_WSTRING
 93    BOOST_WARCHIVE_DECL(void)
 94    load(std::wstring &ws);
 95    #endif
 96    template<class T>
 97    void load_override(T & t, BOOST_PFTO int){
 98        basic_xml_iarchive<Archive>::load_override(t, 0);
 99    }
100    BOOST_WARCHIVE_DECL(void)
101    load_override(class_name_type & t, int);
102    BOOST_WARCHIVE_DECL(void) 
103    init();
104    BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY()) 
105    xml_wiarchive_impl(std::wistream & is, unsigned int flags) ;
106    BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY()) 
107    ~xml_wiarchive_impl();
108};
109
110// do not derive from the classes below.  If you want to extend this functionality
111// via inhertance, derived from xml_wiarchive_impl instead.  This will
112// preserve correct static polymorphism.
113
114// same as xml_wiarchive below - without the shared_ptr_helper
115class naked_xml_wiarchive : 
116    public xml_wiarchive_impl<naked_xml_wiarchive>
117{
118public:
119    naked_xml_wiarchive(std::wistream & is, unsigned int flags = 0) :
120        xml_wiarchive_impl<naked_xml_wiarchive>(is, flags)
121    {}
122    ~naked_xml_wiarchive(){}
123};
124
125} // namespace archive
126} // namespace boost
127
128#ifdef BOOST_MSVC
129#  pragma warning(push)
130#  pragma warning(disable : 4511 4512)
131#endif
132
133#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
134
135// note special treatment of shared_ptr. This type needs a special
136// structure associated with every archive.  We created a "mix-in"
137// class to provide this functionality.  Since shared_ptr holds a
138// special esteem in the boost library - we included it here by default.
139#include <boost/archive/shared_ptr_helper.hpp>
140
141#ifdef BOOST_MSVC
142#  pragma warning(push)
143#  pragma warning(disable : 4511 4512)
144#endif
145
146namespace boost { 
147namespace archive {
148
149class xml_wiarchive : 
150    public xml_wiarchive_impl<xml_wiarchive>,
151    public detail::shared_ptr_helper
152{
153public:
154    xml_wiarchive(std::wistream & is, unsigned int flags = 0) :
155        xml_wiarchive_impl<xml_wiarchive>(is, flags)
156    {}
157    ~xml_wiarchive(){}
158};
159
160} // namespace archive
161} // namespace boost
162
163// required by export
164BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_wiarchive)
165
166#ifdef BOOST_MSVC
167#pragma warning(pop)
168#endif
169
170#endif // BOOST_NO_STD_WSTREAMBUF
171#endif // BOOST_ARCHIVE_XML_WIARCHIVE_HPP