Statistics
| Revision:

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

History | View | Annotate | Download (4 kB)

1
#ifndef BOOST_ARCHIVE_XML_OARCHIVE_HPP
2
#define BOOST_ARCHIVE_XML_OARCHIVE_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
// xml_oarchive.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 <ostream>
20

    
21
#include <cstddef> // size_t
22
#include <boost/config.hpp>
23
#if defined(BOOST_NO_STDC_NAMESPACE)
24
namespace std{ 
25
    using ::size_t; 
26
} // namespace std
27
#endif
28

    
29
#include <boost/archive/detail/auto_link_archive.hpp>
30
#include <boost/archive/basic_text_oprimitive.hpp>
31
#include <boost/archive/basic_xml_oarchive.hpp>
32
#include <boost/archive/detail/register_archive.hpp>
33
#include <boost/serialization/item_version_type.hpp>
34

    
35
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
36

    
37
#ifdef BOOST_MSVC
38
#  pragma warning(push)
39
#  pragma warning(disable : 4511 4512)
40
#endif
41

    
42
namespace boost {
43
namespace archive {
44

    
45
namespace detail {
46
    template<class Archive> class interface_oarchive;
47
} // namespace detail
48

    
49
template<class Archive>
50
class BOOST_SYMBOL_VISIBLE xml_oarchive_impl : 
51
    public basic_text_oprimitive<std::ostream>,
52
    public basic_xml_oarchive<Archive>
53
{
54
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
55
public:
56
#else
57
protected:
58
    #if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
59
        // for some inexplicable reason insertion of "class" generates compile erro
60
        // on msvc 7.1
61
        friend detail::interface_oarchive<Archive>;
62
        friend basic_xml_oarchive<Archive>;
63
        friend save_access;
64
    #else
65
        friend class detail::interface_oarchive<Archive>;
66
        friend class basic_xml_oarchive<Archive>;
67
        friend class save_access;
68
    #endif
69
#endif
70
    //void end_preamble(){
71
    //    basic_xml_oarchive<Archive>::end_preamble();
72
    //}
73
    template<class T>
74
    void save(const T & t){
75
        basic_text_oprimitive<std::ostream>::save(t);
76
    }
77
    void 
78
    save(const version_type & t){
79
        save(static_cast<const unsigned int>(t));
80
    }
81
    void 
82
    save(const boost::serialization::item_version_type & t){
83
        save(static_cast<const unsigned int>(t));
84
    }
85
    BOOST_ARCHIVE_DECL void 
86
    save(const char * t);
87
    #ifndef BOOST_NO_INTRINSIC_WCHAR_T
88
    BOOST_ARCHIVE_DECL void
89
    save(const wchar_t * t);
90
    #endif
91
    BOOST_ARCHIVE_DECL void
92
    save(const std::string &s);
93
    #ifndef BOOST_NO_STD_WSTRING
94
    BOOST_ARCHIVE_DECL void
95
    save(const std::wstring &ws);
96
    #endif
97
    BOOST_ARCHIVE_DECL 
98
    xml_oarchive_impl(std::ostream & os, unsigned int flags);
99
    ~xml_oarchive_impl(){}
100
public:
101
    void save_binary(const void *address, std::size_t count){
102
        this->end_preamble();
103
        #if ! defined(__MWERKS__)
104
        this->basic_text_oprimitive<std::ostream>::save_binary(
105
        #else
106
        this->basic_text_oprimitive::save_binary(
107
        #endif
108
            address, 
109
            count
110
        );
111
        this->indent_next = true;
112
    }
113
};
114

    
115
// we use the following because we can't use
116
// typedef xml_oarchive_impl<xml_oarchive_impl<...> > xml_oarchive;
117

    
118
// do not derive from this class.  If you want to extend this functionality
119
// via inhertance, derived from xml_oarchive_impl instead.  This will
120
// preserve correct static polymorphism.
121
class BOOST_SYMBOL_VISIBLE xml_oarchive : 
122
    public xml_oarchive_impl<xml_oarchive>
123
{
124
public:
125
    xml_oarchive(std::ostream & os, unsigned int flags = 0) :
126
        xml_oarchive_impl<xml_oarchive>(os, flags)
127
    {}
128
    ~xml_oarchive(){}
129
};
130

    
131
} // namespace archive
132
} // namespace boost
133

    
134
// required by export
135
BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_oarchive)
136

    
137
#ifdef BOOST_MSVC
138
#pragma warning(pop)
139
#endif
140

    
141
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
142

    
143
#endif // BOOST_ARCHIVE_XML_OARCHIVE_HPP