Imported Upstream version 1.57.0
[platform/upstream/boost.git] / libs / serialization / test / A.hpp
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 #include "test_decl.hpp"
48
49 #if defined(A_IMPORT)
50     #define DLL_DECL IMPORT_DECL
51 #elif defined(A_EXPORT)
52     #define DLL_DECL EXPORT_DECL
53 #else
54     #define DLL_DECL(x)
55 #endif
56
57 class DLL_DECL(BOOST_PP_EMPTY()) A
58 {
59 private:
60     friend class boost::serialization::access;
61     // note: from an aesthetic perspective, I would much prefer to have this
62     // defined out of line.  Unfortunately, this trips a bug in the VC 6.0
63     // compiler. So hold our nose and put it her to permit running of tests.
64     // mscvc 6.0 requires template functions to be implemented. For this
65     // reason we can't make abstract.
66     #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
67         template<class Archive>
68         void serialize(
69             Archive &ar,
70             const unsigned int /* file_version */
71         ){
72             ar & BOOST_SERIALIZATION_NVP(b);
73             #ifndef BOOST_NO_INT64_T
74             ar & BOOST_SERIALIZATION_NVP(f);
75             ar & BOOST_SERIALIZATION_NVP(g);
76             #endif
77             #if BOOST_WORKAROUND(__BORLANDC__,  <= 0x551 )
78                 int i;
79                 if(BOOST_DEDUCED_TYPENAME Archive::is_saving::value){
80                     i = l;
81                     ar & BOOST_SERIALIZATION_NVP(i);
82                 }
83                 else{
84                     ar & BOOST_SERIALIZATION_NVP(i);
85                     l = i;
86                 }
87             #else
88                 ar & BOOST_SERIALIZATION_NVP(l);
89             #endif
90             ar & BOOST_SERIALIZATION_NVP(m);
91             ar & BOOST_SERIALIZATION_NVP(n);
92             ar & BOOST_SERIALIZATION_NVP(o);
93             ar & BOOST_SERIALIZATION_NVP(p);
94             ar & BOOST_SERIALIZATION_NVP(q);
95             #ifndef BOOST_NO_CWCHAR
96             ar & BOOST_SERIALIZATION_NVP(r);
97             #endif
98             ar & BOOST_SERIALIZATION_NVP(c);
99             ar & BOOST_SERIALIZATION_NVP(s);
100             ar & BOOST_SERIALIZATION_NVP(t);
101             ar & BOOST_SERIALIZATION_NVP(u);
102             ar & BOOST_SERIALIZATION_NVP(v);
103             ar & BOOST_SERIALIZATION_NVP(w);
104             ar & BOOST_SERIALIZATION_NVP(x);
105             ar & BOOST_SERIALIZATION_NVP(y);
106             #ifndef BOOST_NO_STD_WSTRING
107             ar & BOOST_SERIALIZATION_NVP(z);
108             #endif
109         }
110     #else
111         template<class Archive>
112         void serialize(
113             Archive &ar,
114             const unsigned int /* file_version */
115         );
116     #endif
117     bool b;
118     #ifndef BOOST_NO_INT64_T
119     boost::int64_t f;
120     boost::uint64_t g;
121     #endif
122     enum h {
123         i = 0,
124         j,
125         k
126     } l;
127     std::size_t m;
128     signed long n;
129     unsigned long o;
130     signed  short p;
131     unsigned short q;
132     #ifndef BOOST_NO_CWCHAR
133     wchar_t r;
134     #endif
135     char c;
136     signed char s;
137     unsigned char t;
138     signed int u;
139     unsigned int v;
140     float w;
141     double x;
142     std::string y;
143     #ifndef BOOST_NO_STD_WSTRING
144     std::wstring z;
145     #endif
146 public:
147     A();
148     bool check_equal(const A &rhs) const;
149     bool operator==(const A &rhs) const;
150     bool operator!=(const A &rhs) const;
151     bool operator<(const A &rhs) const; // used by less
152     // hash function for class A
153     operator std::size_t () const;
154     friend std::ostream & operator<<(std::ostream & os, A const & a);
155 };
156
157 #undef DLL_DECL
158
159 #endif // BOOST_SERIALIZATION_TEST_A_HPP