comparison DEPENDENCIES/generic/include/boost/archive/basic_text_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_TEXT_OARCHIVE_HPP
2 #define BOOST_ARCHIVE_BASIC_TEXT_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_text_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 // archives stored as text - note these ar templated on the basic
20 // stream templates to accommodate wide (and other?) kind of characters
21 //
22 // note the fact that on libraries without wide characters, ostream is
23 // is not a specialization of basic_ostream which in fact is not defined
24 // in such cases. So we can't use basic_ostream<OStream::char_type> but rather
25 // use two template parameters
26
27 #include <boost/assert.hpp>
28 #include <boost/config.hpp>
29 #include <boost/serialization/pfto.hpp>
30 #include <boost/detail/workaround.hpp>
31
32 #include <boost/archive/detail/common_oarchive.hpp>
33 #include <boost/serialization/string.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 /////////////////////////////////////////////////////////////////////////
46 // class basic_text_oarchive
47 template<class Archive>
48 class basic_text_oarchive :
49 public detail::common_oarchive<Archive>
50 {
51 protected:
52 #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \
53 || BOOST_WORKAROUND(__BORLANDC__,BOOST_TESTED_AT(0x560))
54 public:
55 #elif defined(BOOST_MSVC)
56 // for some inexplicable reason insertion of "class" generates compile erro
57 // on msvc 7.1
58 friend detail::interface_oarchive<Archive>;
59 #else
60 friend class detail::interface_oarchive<Archive>;
61 #endif
62 enum {
63 none,
64 eol,
65 space
66 } delimiter;
67
68 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
69 newtoken();
70
71 void newline(){
72 delimiter = eol;
73 }
74
75 // default processing - kick back to base class. Note the
76 // extra stuff to get it passed borland compilers
77 typedef detail::common_oarchive<Archive> detail_common_oarchive;
78 template<class T>
79 void save_override(T & t, BOOST_PFTO int){
80 this->detail_common_oarchive::save_override(t, 0);
81 }
82
83 // start new objects on a new line
84 void save_override(const object_id_type & t, int){
85 this->This()->newline();
86 this->detail_common_oarchive::save_override(t, 0);
87 }
88
89 // text file don't include the optional information
90 void save_override(const class_id_optional_type & /* t */, int){}
91
92 void save_override(const class_name_type & t, int){
93 const std::string s(t);
94 * this->This() << s;
95 }
96
97 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
98 init();
99
100 basic_text_oarchive(unsigned int flags) :
101 detail::common_oarchive<Archive>(flags),
102 delimiter(none)
103 {}
104 ~basic_text_oarchive(){}
105 };
106
107 } // namespace archive
108 } // namespace boost
109
110 #ifdef BOOST_MSVC
111 #pragma warning(pop)
112 #endif
113
114 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
115
116 #endif // BOOST_ARCHIVE_BASIC_TEXT_OARCHIVE_HPP