PageRenderTime 20ms CodeModel.GetById 12ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://hadesmem.googlecode.com/
C++ Header | 145 lines | 109 code | 22 blank | 14 comment | 4 complexity | f68d7dfedac9f37dfc7040faeb9cafbf MD5 | raw file
  1#ifndef BOOST_ARCHIVE_TEXT_WOARCHIVE_HPP
  2#define BOOST_ARCHIVE_TEXT_WOARCHIVE_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_woarchive.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
 21#ifdef BOOST_NO_STD_WSTREAMBUF
 22#error "wide char i/o not supported on this platform"
 23#else
 24
 25#include <ostream>
 26#include <cstddef> // size_t
 27
 28#if defined(BOOST_NO_STDC_NAMESPACE)
 29namespace std{ 
 30    using ::size_t; 
 31} // namespace std
 32#endif
 33
 34#include <boost/archive/detail/auto_link_warchive.hpp>
 35#include <boost/archive/basic_text_oprimitive.hpp>
 36#include <boost/archive/basic_text_oarchive.hpp>
 37#include <boost/archive/detail/register_archive.hpp>
 38#include <boost/serialization/item_version_type.hpp>
 39
 40#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
 41
 42#ifdef BOOST_MSVC
 43#  pragma warning(push)
 44#  pragma warning(disable : 4511 4512)
 45#endif
 46
 47namespace boost { 
 48namespace archive {
 49
 50template<class Archive>
 51class text_woarchive_impl : 
 52    public basic_text_oprimitive<std::wostream>,
 53    public basic_text_oarchive<Archive>
 54{
 55#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
 56public:
 57#else
 58    friend class detail::interface_oarchive<Archive>;
 59    friend class basic_text_oarchive<Archive>;
 60    friend class save_access;
 61protected:
 62#endif
 63    template<class T>
 64    void save(const T & t){
 65        this->newtoken();
 66        basic_text_oprimitive<std::wostream>::save(t);
 67    }
 68    void save(const version_type & t){
 69        save(static_cast<const unsigned int>(t));
 70    }
 71    void save(const boost::serialization::item_version_type & t){
 72        save(static_cast<const unsigned int>(t));
 73    }
 74    BOOST_WARCHIVE_DECL(void)
 75    save(const char * t);
 76    #ifndef BOOST_NO_INTRINSIC_WCHAR_T
 77    BOOST_WARCHIVE_DECL(void)
 78    save(const wchar_t * t);
 79    #endif
 80    BOOST_WARCHIVE_DECL(void)
 81    save(const std::string &s);
 82    #ifndef BOOST_NO_STD_WSTRING
 83    BOOST_WARCHIVE_DECL(void)
 84    save(const std::wstring &ws);
 85    #endif
 86    text_woarchive_impl(std::wostream & os, unsigned int flags) :
 87        basic_text_oprimitive<std::wostream>(
 88            os, 
 89            0 != (flags & no_codecvt)
 90        ),
 91        basic_text_oarchive<Archive>(flags)
 92    {
 93        if(0 == (flags & no_header))
 94            basic_text_oarchive<Archive>::init();
 95    }
 96public:
 97    void save_binary(const void *address, std::size_t count){
 98        put(static_cast<wchar_t>('\n'));
 99        this->end_preamble();
100        #if ! defined(__MWERKS__)
101        this->basic_text_oprimitive<std::wostream>::save_binary(
102        #else
103        this->basic_text_oprimitive::save_binary(
104        #endif
105            address, 
106            count
107        );
108        put(static_cast<wchar_t>('\n'));
109        this->delimiter = this->none;
110    }
111
112};
113
114// we use the following because we can't use
115// typedef text_oarchive_impl<text_oarchive_impl<...> > text_oarchive;
116
117// do not derive from this class.  If you want to extend this functionality
118// via inhertance, derived from text_oarchive_impl instead.  This will
119// preserve correct static polymorphism.
120class text_woarchive : 
121    public text_woarchive_impl<text_woarchive>
122{
123public:
124    text_woarchive(std::wostream & os, unsigned int flags = 0) :
125        text_woarchive_impl<text_woarchive>(os, flags)
126    {}
127    ~text_woarchive(){}
128};
129
130typedef text_woarchive naked_text_woarchive;
131
132} // namespace archive
133} // namespace boost
134
135// required by export
136BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_woarchive)
137
138#ifdef BOOST_MSVC
139#pragma warning(pop)
140#endif
141
142#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
143
144#endif // BOOST_NO_STD_WSTREAMBUF
145#endif // BOOST_ARCHIVE_TEXT_WOARCHIVE_HPP