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

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

http://hadesmem.googlecode.com/
C++ Header | 152 lines | 109 code | 24 blank | 19 comment | 1 complexity | b48b801d619caffa030128ea6c2539b6 MD5 | raw file
  1#ifndef BOOST_ARCHIVE_TEXT_WIARCHIVE_HPP
  2#define BOOST_ARCHIVE_TEXT_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// text_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/archive/detail/auto_link_warchive.hpp>
 27#include <boost/archive/basic_text_iprimitive.hpp>
 28#include <boost/archive/basic_text_iarchive.hpp>
 29#include <boost/archive/detail/register_archive.hpp>
 30#include <boost/serialization/item_version_type.hpp>
 31
 32#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
 33
 34#ifdef BOOST_MSVC
 35#  pragma warning(push)
 36#  pragma warning(disable : 4511 4512)
 37#endif
 38
 39namespace boost { 
 40namespace archive {
 41
 42template<class Archive>
 43class text_wiarchive_impl : 
 44    public basic_text_iprimitive<std::wistream>,
 45    public basic_text_iarchive<Archive>
 46{
 47#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
 48public:
 49#else
 50    friend class detail::interface_iarchive<Archive>;
 51    friend class basic_text_iarchive<Archive>;
 52    friend class load_access;
 53protected:
 54#endif
 55    template<class T>
 56    void load(T & t){
 57        basic_text_iprimitive<std::wistream>::load(t);
 58    }
 59    void load(version_type & t){
 60        unsigned int v;
 61        load(v);
 62        t = version_type(v);
 63    }
 64    void load(boost::serialization::item_version_type & t){
 65        unsigned int v;
 66        load(v);
 67        t = boost::serialization::item_version_type(v);
 68    }
 69    BOOST_WARCHIVE_DECL(void)
 70    load(char * t);
 71    #ifndef BOOST_NO_INTRINSIC_WCHAR_T
 72    BOOST_WARCHIVE_DECL(void)
 73    load(wchar_t * t);
 74    #endif
 75    BOOST_WARCHIVE_DECL(void)
 76    load(std::string &s);
 77    #ifndef BOOST_NO_STD_WSTRING
 78    BOOST_WARCHIVE_DECL(void)
 79    load(std::wstring &ws);
 80    #endif
 81    // note: the following should not needed - but one compiler (vc 7.1)
 82    // fails to compile one test (test_shared_ptr) without it !!!
 83    template<class T>
 84    void load_override(T & t, BOOST_PFTO int){
 85        basic_text_iarchive<Archive>::load_override(t, 0);
 86    }
 87    BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY()) 
 88    text_wiarchive_impl(std::wistream & is, unsigned int flags);
 89    ~text_wiarchive_impl(){};
 90};
 91
 92// do not derive from the classes below.  If you want to extend this functionality
 93// via inhertance, derived from text_iarchive_impl instead.  This will
 94// preserve correct static polymorphism.
 95
 96// same as text_wiarchive below - without the shared_ptr_helper
 97class naked_text_wiarchive : 
 98    public text_wiarchive_impl<naked_text_wiarchive>
 99{
100public:
101    naked_text_wiarchive(std::wistream & is, unsigned int flags = 0) :
102        text_wiarchive_impl<naked_text_wiarchive>(is, flags)
103    {}
104    ~naked_text_wiarchive(){}
105};
106
107} // namespace archive
108} // namespace boost
109
110#ifdef BOOST_MSVC
111#pragma warning(pop)
112#endif
113
114#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
115
116// note special treatment of shared_ptr. This type needs a special
117// structure associated with every archive.  We created a "mix-in"
118// class to provide this functionality.  Since shared_ptr holds a
119// special esteem in the boost library - we included it here by default.
120#include <boost/archive/shared_ptr_helper.hpp>
121
122#ifdef BOOST_MSVC
123#  pragma warning(push)
124#  pragma warning(disable : 4511 4512)
125#endif
126
127namespace boost { 
128namespace archive {
129
130class text_wiarchive : 
131    public text_wiarchive_impl<text_wiarchive>,
132    public detail::shared_ptr_helper
133{
134public:
135    text_wiarchive(std::wistream & is, unsigned int flags = 0) :
136        text_wiarchive_impl<text_wiarchive>(is, flags)
137    {}
138    ~text_wiarchive(){}
139};
140
141} // namespace archive
142} // namespace boost
143
144// required by export
145BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_wiarchive)
146
147#ifdef BOOST_MSVC
148#pragma warning(pop)
149#endif
150
151#endif // BOOST_NO_STD_WSTREAMBUF
152#endif // BOOST_ARCHIVE_TEXT_WIARCHIVE_HPP