Statistics
| Revision:

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

History | View | Annotate | Download (4.5 kB)

1 2486 sjacqu01
#ifndef BOOST_ARCHIVE_BASIC_XML_OARCHIVE_HPP
2 2486 sjacqu01
#define BOOST_ARCHIVE_BASIC_XML_OARCHIVE_HPP
3 2486 sjacqu01
4 2486 sjacqu01
// MS compatible compilers support #pragma once
5 2486 sjacqu01
#if defined(_MSC_VER)
6 2486 sjacqu01
# pragma once
7 2486 sjacqu01
#endif
8 2486 sjacqu01
9 2486 sjacqu01
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10 2486 sjacqu01
// basic_xml_oarchive.hpp
11 2486 sjacqu01
12 2486 sjacqu01
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
13 2486 sjacqu01
// Use, modification and distribution is subject to the Boost Software
14 2486 sjacqu01
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
15 2486 sjacqu01
// http://www.boost.org/LICENSE_1_0.txt)
16 2486 sjacqu01
17 2486 sjacqu01
//  See http://www.boost.org for updates, documentation, and revision history.
18 2486 sjacqu01
19 2486 sjacqu01
#include <boost/config.hpp>
20 2486 sjacqu01
#include <boost/mpl/assert.hpp>
21 2486 sjacqu01
#include <boost/detail/workaround.hpp>
22 2486 sjacqu01
23 2486 sjacqu01
#include <boost/archive/detail/common_oarchive.hpp>
24 2486 sjacqu01
25 2486 sjacqu01
#include <boost/serialization/nvp.hpp>
26 2486 sjacqu01
#include <boost/serialization/tracking.hpp>
27 2486 sjacqu01
#include <boost/serialization/string.hpp>
28 2486 sjacqu01
29 2486 sjacqu01
30 2486 sjacqu01
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
31 2486 sjacqu01
32 2486 sjacqu01
#ifdef BOOST_MSVC
33 2486 sjacqu01
#  pragma warning(push)
34 2486 sjacqu01
#  pragma warning(disable : 4511 4512)
35 2486 sjacqu01
#endif
36 2486 sjacqu01
37 2486 sjacqu01
namespace boost {
38 2486 sjacqu01
namespace archive {
39 2486 sjacqu01
40 2486 sjacqu01
namespace detail {
41 2486 sjacqu01
    template<class Archive> class interface_oarchive;
42 2486 sjacqu01
} // namespace detail
43 2486 sjacqu01
44 2486 sjacqu01
//////////////////////////////////////////////////////////////////////
45 2486 sjacqu01
// class basic_xml_oarchive - write serialized objects to a xml output stream
46 2486 sjacqu01
template<class Archive>
47 2486 sjacqu01
class BOOST_SYMBOL_VISIBLE basic_xml_oarchive :
48 2486 sjacqu01
    public detail::common_oarchive<Archive>
49 2486 sjacqu01
{
50 2486 sjacqu01
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
51 2486 sjacqu01
public:
52 2486 sjacqu01
#else
53 2486 sjacqu01
protected:
54 2486 sjacqu01
#endif
55 2486 sjacqu01
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
56 2486 sjacqu01
    // for some inexplicable reason insertion of "class" generates compile erro
57 2486 sjacqu01
    // on msvc 7.1
58 2486 sjacqu01
    friend detail::interface_oarchive<Archive>;
59 2486 sjacqu01
#else
60 2486 sjacqu01
    friend class detail::interface_oarchive<Archive>;
61 2486 sjacqu01
#endif
62 2486 sjacqu01
    friend class save_access;
63 2486 sjacqu01
    // special stuff for xml output
64 2486 sjacqu01
    unsigned int depth;
65 2486 sjacqu01
    bool indent_next;
66 2486 sjacqu01
    bool pending_preamble;
67 2486 sjacqu01
    BOOST_ARCHIVE_OR_WARCHIVE_DECL void
68 2486 sjacqu01
    indent();
69 2486 sjacqu01
    BOOST_ARCHIVE_OR_WARCHIVE_DECL void
70 2486 sjacqu01
    init();
71 2486 sjacqu01
    BOOST_ARCHIVE_OR_WARCHIVE_DECL void
72 2486 sjacqu01
    write_attribute(
73 2486 sjacqu01
        const char *attribute_name,
74 2486 sjacqu01
        int t,
75 2486 sjacqu01
        const char *conjunction = "=\""
76 2486 sjacqu01
    );
77 2486 sjacqu01
    BOOST_ARCHIVE_OR_WARCHIVE_DECL void
78 2486 sjacqu01
    write_attribute(
79 2486 sjacqu01
        const char *attribute_name,
80 2486 sjacqu01
        const char *key
81 2486 sjacqu01
    );
82 2486 sjacqu01
    // helpers used below
83 2486 sjacqu01
    BOOST_ARCHIVE_OR_WARCHIVE_DECL void
84 2486 sjacqu01
    save_start(const char *name);
85 2486 sjacqu01
    BOOST_ARCHIVE_OR_WARCHIVE_DECL void
86 2486 sjacqu01
    save_end(const char *name);
87 2486 sjacqu01
    BOOST_ARCHIVE_OR_WARCHIVE_DECL void
88 2486 sjacqu01
    end_preamble();
89 2486 sjacqu01
90 2486 sjacqu01
    // Anything not an attribute and not a name-value pair is an
91 2486 sjacqu01
    // error and should be trapped here.
92 2486 sjacqu01
    template<class T>
93 2486 sjacqu01
    void save_override(T & t)
94 2486 sjacqu01
    {
95 2486 sjacqu01
        // If your program fails to compile here, its most likely due to
96 2486 sjacqu01
        // not specifying an nvp wrapper around the variable to
97 2486 sjacqu01
        // be serialized.
98 2486 sjacqu01
        BOOST_MPL_ASSERT((serialization::is_wrapper< T >));
99 2486 sjacqu01
        this->detail_common_oarchive::save_override(t);
100 2486 sjacqu01
    }
101 2486 sjacqu01
102 2486 sjacqu01
    // special treatment for name-value pairs.
103 2486 sjacqu01
    typedef detail::common_oarchive<Archive> detail_common_oarchive;
104 2486 sjacqu01
    template<class T>
105 2486 sjacqu01
    void save_override(
106 2486 sjacqu01
        const ::boost::serialization::nvp< T > & t
107 2486 sjacqu01
    ){
108 2486 sjacqu01
        this->This()->save_start(t.name());
109 2486 sjacqu01
        this->detail_common_oarchive::save_override(t.const_value());
110 2486 sjacqu01
        this->This()->save_end(t.name());
111 2486 sjacqu01
    }
112 2486 sjacqu01
113 2486 sjacqu01
    // specific overrides for attributes - not name value pairs so we
114 2486 sjacqu01
    // want to trap them before the above "fall through"
115 2486 sjacqu01
    BOOST_ARCHIVE_OR_WARCHIVE_DECL void
116 2486 sjacqu01
    save_override(const object_id_type & t);
117 2486 sjacqu01
    BOOST_ARCHIVE_OR_WARCHIVE_DECL void
118 2486 sjacqu01
    save_override(const object_reference_type & t);
119 2486 sjacqu01
    BOOST_ARCHIVE_OR_WARCHIVE_DECL void
120 2486 sjacqu01
    save_override(const version_type & t);
121 2486 sjacqu01
    BOOST_ARCHIVE_OR_WARCHIVE_DECL void
122 2486 sjacqu01
    save_override(const class_id_type & t);
123 2486 sjacqu01
    BOOST_ARCHIVE_OR_WARCHIVE_DECL void
124 2486 sjacqu01
    save_override(const class_id_optional_type & t);
125 2486 sjacqu01
    BOOST_ARCHIVE_OR_WARCHIVE_DECL void
126 2486 sjacqu01
    save_override(const class_id_reference_type & t);
127 2486 sjacqu01
    BOOST_ARCHIVE_OR_WARCHIVE_DECL void
128 2486 sjacqu01
    save_override(const class_name_type & t);
129 2486 sjacqu01
    BOOST_ARCHIVE_OR_WARCHIVE_DECL void
130 2486 sjacqu01
    save_override(const tracking_type & t);
131 2486 sjacqu01
132 2486 sjacqu01
    BOOST_ARCHIVE_OR_WARCHIVE_DECL
133 2486 sjacqu01
    basic_xml_oarchive(unsigned int flags);
134 2486 sjacqu01
    BOOST_ARCHIVE_OR_WARCHIVE_DECL
135 2486 sjacqu01
    ~basic_xml_oarchive();
136 2486 sjacqu01
};
137 2486 sjacqu01
138 2486 sjacqu01
} // namespace archive
139 2486 sjacqu01
} // namespace boost
140 2486 sjacqu01
141 2486 sjacqu01
#ifdef BOOST_MSVC
142 2486 sjacqu01
#pragma warning(pop)
143 2486 sjacqu01
#endif
144 2486 sjacqu01
145 2486 sjacqu01
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
146 2486 sjacqu01
147 2486 sjacqu01
#endif // BOOST_ARCHIVE_BASIC_XML_OARCHIVE_HPP