]>
Commit | Line | Data |
---|---|---|
1 | #ifndef BOOST_SERIALIZATION_TEST_A_HPP | |
2 | #define BOOST_SERIALIZATION_TEST_A_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 | // A.hpp simple class test | |
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> // for friend output operators | |
20 | #include <cstddef> // size_t | |
21 | #include <string> | |
22 | #include <boost/config.hpp> | |
23 | #if defined(BOOST_NO_STDC_NAMESPACE) | |
24 | namespace std{ | |
25 | using ::size_t; | |
26 | } | |
27 | #endif | |
28 | ||
29 | #include <boost/detail/workaround.hpp> | |
30 | #include <boost/limits.hpp> | |
31 | #include <boost/cstdint.hpp> | |
32 | ||
33 | #include <boost/serialization/access.hpp> | |
34 | ||
35 | #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) | |
36 | #include <boost/detail/workaround.hpp> | |
37 | #if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) | |
38 | #include <boost/archive/dinkumware.hpp> | |
39 | #endif | |
40 | #endif | |
41 | ||
42 | #include <boost/serialization/nvp.hpp> | |
43 | #include <boost/serialization/string.hpp> | |
44 | ||
45 | #include <boost/preprocessor/facilities/empty.hpp> | |
46 | ||
47 | #if defined(A_IMPORT) | |
48 | #define DLL_DECL BOOST_SYMBOL_IMPORT | |
49 | #elif defined(A_EXPORT) | |
50 | #define DLL_DECL BOOST_SYMBOL_EXPORT | |
51 | #else | |
52 | #define DLL_DECL | |
53 | #endif | |
54 | ||
55 | class DLL_DECL A | |
56 | { | |
57 | private: | |
58 | friend class boost::serialization::access; | |
59 | // note: from an aesthetic perspective, I would much prefer to have this | |
60 | // defined out of line. Unfortunately, this trips a bug in the VC 6.0 | |
61 | // compiler. So hold our nose and put it her to permit running of tests. | |
62 | // mscvc 6.0 requires template functions to be implemented. For this | |
63 | // reason we can't make abstract. | |
64 | #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) | |
65 | template<class Archive> | |
66 | void serialize( | |
67 | Archive &ar, | |
68 | const unsigned int /* file_version */ | |
69 | ){ | |
70 | ar & BOOST_SERIALIZATION_NVP(b); | |
71 | #ifndef BOOST_NO_INT64_T | |
72 | ar & BOOST_SERIALIZATION_NVP(f); | |
73 | ar & BOOST_SERIALIZATION_NVP(g); | |
74 | #endif | |
75 | #if BOOST_WORKAROUND(__BORLANDC__, <= 0x551 ) | |
76 | int i; | |
77 | if(BOOST_DEDUCED_TYPENAME Archive::is_saving::value){ | |
78 | i = l; | |
79 | ar & BOOST_SERIALIZATION_NVP(i); | |
80 | } | |
81 | else{ | |
82 | ar & BOOST_SERIALIZATION_NVP(i); | |
83 | l = i; | |
84 | } | |
85 | #else | |
86 | ar & BOOST_SERIALIZATION_NVP(l); | |
87 | #endif | |
88 | ar & BOOST_SERIALIZATION_NVP(m); | |
89 | ar & BOOST_SERIALIZATION_NVP(n); | |
90 | ar & BOOST_SERIALIZATION_NVP(o); | |
91 | ar & BOOST_SERIALIZATION_NVP(p); | |
92 | ar & BOOST_SERIALIZATION_NVP(q); | |
93 | #ifndef BOOST_NO_CWCHAR | |
94 | ar & BOOST_SERIALIZATION_NVP(r); | |
95 | #endif | |
96 | ar & BOOST_SERIALIZATION_NVP(c); | |
97 | ar & BOOST_SERIALIZATION_NVP(s); | |
98 | ar & BOOST_SERIALIZATION_NVP(t); | |
99 | ar & BOOST_SERIALIZATION_NVP(u); | |
100 | ar & BOOST_SERIALIZATION_NVP(v); | |
101 | ar & BOOST_SERIALIZATION_NVP(w); | |
102 | ar & BOOST_SERIALIZATION_NVP(x); | |
103 | ar & BOOST_SERIALIZATION_NVP(y); | |
104 | #ifndef BOOST_NO_STD_WSTRING | |
105 | ar & BOOST_SERIALIZATION_NVP(z); | |
106 | #endif | |
107 | } | |
108 | #else | |
109 | template<class Archive> | |
110 | void serialize( | |
111 | Archive &ar, | |
112 | const unsigned int /* file_version */ | |
113 | ); | |
114 | #endif | |
115 | bool b; | |
116 | #ifndef BOOST_NO_INT64_T | |
117 | boost::int64_t f; | |
118 | boost::uint64_t g; | |
119 | #endif | |
120 | enum h { | |
121 | i = 0, | |
122 | j, | |
123 | k | |
124 | } l; | |
125 | std::size_t m; | |
126 | signed long n; | |
127 | unsigned long o; | |
128 | signed short p; | |
129 | unsigned short q; | |
130 | #ifndef BOOST_NO_CWCHAR | |
131 | wchar_t r; | |
132 | #endif | |
133 | char c; | |
134 | signed char s; | |
135 | unsigned char t; | |
136 | signed int u; | |
137 | unsigned int v; | |
138 | float w; | |
139 | double x; | |
140 | std::string y; | |
141 | #ifndef BOOST_NO_STD_WSTRING | |
142 | std::wstring z; | |
143 | #endif | |
144 | public: | |
145 | A(); | |
146 | bool check_equal(const A &rhs) const; | |
147 | bool operator==(const A &rhs) const; | |
148 | bool operator!=(const A &rhs) const; | |
149 | bool operator<(const A &rhs) const; // used by less | |
150 | // hash function for class A | |
151 | operator std::size_t () const; | |
152 | friend std::ostream & operator<<(std::ostream & os, A const & a); | |
153 | }; | |
154 | ||
155 | #undef DLL_DECL | |
156 | ||
157 | #endif // BOOST_SERIALIZATION_TEST_A_HPP |