Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/archive/basic_xml_oarchive.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children | c530137014c0 |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
1 #ifndef BOOST_ARCHIVE_BASIC_XML_OARCHIVE_HPP | |
2 #define BOOST_ARCHIVE_BASIC_XML_OARCHIVE_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 // basic_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 <boost/config.hpp> | |
20 | |
21 #include <boost/archive/detail/common_oarchive.hpp> | |
22 | |
23 #include <boost/serialization/nvp.hpp> | |
24 #include <boost/serialization/tracking.hpp> | |
25 #include <boost/serialization/string.hpp> | |
26 | |
27 #include <boost/mpl/assert.hpp> | |
28 | |
29 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header | |
30 | |
31 #ifdef BOOST_MSVC | |
32 # pragma warning(push) | |
33 # pragma warning(disable : 4511 4512) | |
34 #endif | |
35 | |
36 namespace boost { | |
37 namespace archive { | |
38 | |
39 ////////////////////////////////////////////////////////////////////// | |
40 // class basic_xml_oarchive - write serialized objects to a xml output stream | |
41 template<class Archive> | |
42 class basic_xml_oarchive : | |
43 public detail::common_oarchive<Archive> | |
44 { | |
45 protected: | |
46 #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) | |
47 public: | |
48 #elif defined(BOOST_MSVC) | |
49 // for some inexplicable reason insertion of "class" generates compile erro | |
50 // on msvc 7.1 | |
51 friend detail::interface_oarchive<Archive>; | |
52 friend class save_access; | |
53 #else | |
54 friend class detail::interface_oarchive<Archive>; | |
55 friend class save_access; | |
56 #endif | |
57 // special stuff for xml output | |
58 unsigned int depth; | |
59 bool indent_next; | |
60 bool pending_preamble; | |
61 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) | |
62 indent(); | |
63 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) | |
64 init(); | |
65 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) | |
66 write_attribute( | |
67 const char *attribute_name, | |
68 int t, | |
69 const char *conjunction = "=\"" | |
70 ); | |
71 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) | |
72 write_attribute( | |
73 const char *attribute_name, | |
74 const char *key | |
75 ); | |
76 // helpers used below | |
77 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) | |
78 save_start(const char *name); | |
79 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) | |
80 save_end(const char *name); | |
81 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) | |
82 end_preamble(); | |
83 | |
84 // Anything not an attribute and not a name-value pair is an | |
85 // error and should be trapped here. | |
86 template<class T> | |
87 void save_override(T & t, BOOST_PFTO int) | |
88 { | |
89 // If your program fails to compile here, its most likely due to | |
90 // not specifying an nvp wrapper around the variable to | |
91 // be serialized. | |
92 BOOST_MPL_ASSERT((serialization::is_wrapper< T >)); | |
93 this->detail_common_oarchive::save_override(t, 0); | |
94 } | |
95 | |
96 // special treatment for name-value pairs. | |
97 typedef detail::common_oarchive<Archive> detail_common_oarchive; | |
98 template<class T> | |
99 void save_override( | |
100 #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING | |
101 const | |
102 #endif | |
103 ::boost::serialization::nvp< T > & t, | |
104 int | |
105 ){ | |
106 this->This()->save_start(t.name()); | |
107 this->detail_common_oarchive::save_override(t.const_value(), 0); | |
108 this->This()->save_end(t.name()); | |
109 } | |
110 | |
111 // specific overrides for attributes - not name value pairs so we | |
112 // want to trap them before the above "fall through" | |
113 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) | |
114 save_override(const object_id_type & t, int); | |
115 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) | |
116 save_override(const object_reference_type & t, int); | |
117 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) | |
118 save_override(const version_type & t, int); | |
119 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) | |
120 save_override(const class_id_type & t, int); | |
121 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) | |
122 save_override(const class_id_optional_type & t, int); | |
123 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) | |
124 save_override(const class_id_reference_type & t, int); | |
125 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) | |
126 save_override(const class_name_type & t, int); | |
127 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) | |
128 save_override(const tracking_type & t, int); | |
129 | |
130 BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) | |
131 basic_xml_oarchive(unsigned int flags); | |
132 BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) | |
133 ~basic_xml_oarchive(); | |
134 }; | |
135 | |
136 } // namespace archive | |
137 } // namespace boost | |
138 | |
139 #ifdef BOOST_MSVC | |
140 #pragma warning(pop) | |
141 #endif | |
142 | |
143 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas | |
144 | |
145 #endif // BOOST_ARCHIVE_BASIC_XML_OARCHIVE_HPP |