comparison DEPENDENCIES/generic/include/boost/archive/text_iarchive.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_TEXT_IARCHIVE_HPP
2 #define BOOST_ARCHIVE_TEXT_IARCHIVE_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 // text_iarchive.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 <istream>
20
21 #include <boost/config.hpp>
22 #include <boost/archive/detail/auto_link_archive.hpp>
23 #include <boost/archive/basic_text_iprimitive.hpp>
24 #include <boost/archive/basic_text_iarchive.hpp>
25 #include <boost/archive/detail/register_archive.hpp>
26 #include <boost/serialization/item_version_type.hpp>
27
28 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
29
30 #ifdef BOOST_MSVC
31 # pragma warning(push)
32 # pragma warning(disable : 4511 4512)
33 #endif
34
35 namespace boost {
36 namespace archive {
37
38 template<class Archive>
39 class text_iarchive_impl :
40 public basic_text_iprimitive<std::istream>,
41 public basic_text_iarchive<Archive>
42 {
43 #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
44 public:
45 #else
46 friend class detail::interface_iarchive<Archive>;
47 friend class basic_text_iarchive<Archive>;
48 friend class load_access;
49 protected:
50 #endif
51 template<class T>
52 void load(T & t){
53 basic_text_iprimitive<std::istream>::load(t);
54 }
55 void load(version_type & t){
56 unsigned int v;
57 load(v);
58 t = version_type(v);
59 }
60 void load(boost::serialization::item_version_type & t){
61 unsigned int v;
62 load(v);
63 t = boost::serialization::item_version_type(v);
64 }
65 BOOST_ARCHIVE_DECL(void)
66 load(char * t);
67 #ifndef BOOST_NO_INTRINSIC_WCHAR_T
68 BOOST_ARCHIVE_DECL(void)
69 load(wchar_t * t);
70 #endif
71 BOOST_ARCHIVE_DECL(void)
72 load(std::string &s);
73 #ifndef BOOST_NO_STD_WSTRING
74 BOOST_ARCHIVE_DECL(void)
75 load(std::wstring &ws);
76 #endif
77 // note: the following should not needed - but one compiler (vc 7.1)
78 // fails to compile one test (test_shared_ptr) without it !!!
79 // make this protected so it can be called from a derived archive
80 template<class T>
81 void load_override(T & t, BOOST_PFTO int){
82 basic_text_iarchive<Archive>::load_override(t, 0);
83 }
84 BOOST_ARCHIVE_DECL(void)
85 load_override(class_name_type & t, int);
86 BOOST_ARCHIVE_DECL(void)
87 init();
88 BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
89 text_iarchive_impl(std::istream & is, unsigned int flags);
90 // don't import inline definitions! leave this as a reminder.
91 //BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
92 ~text_iarchive_impl(){};
93 };
94
95 // do not derive from the classes below. If you want to extend this functionality
96 // via inhertance, derived from text_iarchive_impl instead. This will
97 // preserve correct static polymorphism.
98
99 // same as text_iarchive below - without the shared_ptr_helper
100 class naked_text_iarchive :
101 public text_iarchive_impl<naked_text_iarchive>
102 {
103 public:
104 naked_text_iarchive(std::istream & is_, unsigned int flags = 0) :
105 // note: added _ to suppress useless gcc warning
106 text_iarchive_impl<naked_text_iarchive>(is_, flags)
107 {}
108 ~naked_text_iarchive(){}
109 };
110
111 } // namespace archive
112 } // namespace boost
113
114 #ifdef BOOST_MSVC
115 #pragma warning(pop)
116 #endif
117
118 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
119
120 // note special treatment of shared_ptr. This type needs a special
121 // structure associated with every archive. We created a "mix-in"
122 // class to provide this functionality. Since shared_ptr holds a
123 // special esteem in the boost library - we included it here by default.
124 #include <boost/archive/shared_ptr_helper.hpp>
125
126 #ifdef BOOST_MSVC
127 # pragma warning(push)
128 # pragma warning(disable : 4511 4512)
129 #endif
130
131 namespace boost {
132 namespace archive {
133
134 class text_iarchive :
135 public text_iarchive_impl<text_iarchive>,
136 public detail::shared_ptr_helper
137 {
138 public:
139 text_iarchive(std::istream & is_, unsigned int flags = 0) :
140 // note: added _ to suppress useless gcc warning
141 text_iarchive_impl<text_iarchive>(is_, flags)
142 {}
143 ~text_iarchive(){}
144 };
145
146 } // namespace archive
147 } // namespace boost
148
149 // required by export
150 BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_iarchive)
151
152 #ifdef BOOST_MSVC
153 #pragma warning(pop)
154 #endif
155
156 #endif // BOOST_ARCHIVE_TEXT_IARCHIVE_HPP