Statistics
| Revision:

root / tmp / org.txm.statsengine.r.core.win32 / res / win32 / library / BH / include / boost / archive / text_woarchive.hpp @ 2486

History | View | Annotate | Download (4.4 kB)

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)
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)
29
namespace 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

    
47
namespace boost { 
48
namespace archive {
49

    
50
namespace detail {
51
    template<class Archive> class interface_oarchive;
52
} // namespace detail
53

    
54
template<class Archive>
55
class BOOST_SYMBOL_VISIBLE text_woarchive_impl :
56
    public basic_text_oprimitive<std::wostream>,
57
    public basic_text_oarchive<Archive>
58
{
59
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
60
public:
61
#else
62
protected:
63
    #if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
64
        // for some inexplicable reason insertion of "class" generates compile erro
65
        // on msvc 7.1
66
        friend detail::interface_oarchive<Archive>;
67
        friend basic_text_oarchive<Archive>;
68
        friend save_access;
69
    #else
70
        friend class detail::interface_oarchive<Archive>;
71
        friend class basic_text_oarchive<Archive>;
72
        friend class save_access;
73
    #endif
74
#endif
75
    template<class T>
76
    void save(const T & t){
77
        this->newtoken();
78
        basic_text_oprimitive<std::wostream>::save(t);
79
    }
80
    void save(const version_type & t){
81
        save(static_cast<const unsigned int>(t));
82
    }
83
    void save(const boost::serialization::item_version_type & t){
84
        save(static_cast<const unsigned int>(t));
85
    }
86
    BOOST_WARCHIVE_DECL void
87
    save(const char * t);
88
    #ifndef BOOST_NO_INTRINSIC_WCHAR_T
89
    BOOST_WARCHIVE_DECL void
90
    save(const wchar_t * t);
91
    #endif
92
    BOOST_WARCHIVE_DECL void
93
    save(const std::string &s);
94
    #ifndef BOOST_NO_STD_WSTRING
95
    BOOST_WARCHIVE_DECL void
96
    save(const std::wstring &ws);
97
    #endif
98
    text_woarchive_impl(std::wostream & os, unsigned int flags) :
99
        basic_text_oprimitive<std::wostream>(
100
            os, 
101
            0 != (flags & no_codecvt)
102
        ),
103
        basic_text_oarchive<Archive>(flags)
104
    {
105
        if(0 == (flags & no_header))
106
            basic_text_oarchive<Archive>::init();
107
    }
108
public:
109
    void save_binary(const void *address, std::size_t count){
110
        put(static_cast<wchar_t>('\n'));
111
        this->end_preamble();
112
        #if ! defined(__MWERKS__)
113
        this->basic_text_oprimitive<std::wostream>::save_binary(
114
        #else
115
        this->basic_text_oprimitive::save_binary(
116
        #endif
117
            address, 
118
            count
119
        );
120
        put(static_cast<wchar_t>('\n'));
121
        this->delimiter = this->none;
122
    }
123

    
124
};
125

    
126
// we use the following because we can't use
127
// typedef text_oarchive_impl<text_oarchive_impl<...> > text_oarchive;
128

    
129
// do not derive from this class.  If you want to extend this functionality
130
// via inhertance, derived from text_oarchive_impl instead.  This will
131
// preserve correct static polymorphism.
132
class BOOST_SYMBOL_VISIBLE text_woarchive : 
133
    public text_woarchive_impl<text_woarchive>
134
{
135
public:
136
    text_woarchive(std::wostream & os, unsigned int flags = 0) :
137
        text_woarchive_impl<text_woarchive>(os, flags)
138
    {}
139
    ~text_woarchive(){}
140
};
141

    
142
} // namespace archive
143
} // namespace boost
144

    
145
// required by export
146
BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_woarchive)
147

    
148
#ifdef BOOST_MSVC
149
#pragma warning(pop)
150
#endif
151

    
152
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
153

    
154
#endif // BOOST_NO_STD_WSTREAMBUF
155
#endif // BOOST_ARCHIVE_TEXT_WOARCHIVE_HPP