williamr@2
|
1 |
#ifndef BOOST_ARCHIVE_BASIC_ARCHIVE_HPP
|
williamr@2
|
2 |
#define BOOST_ARCHIVE_BASIC_ARCHIVE_HPP
|
williamr@2
|
3 |
|
williamr@2
|
4 |
// MS compatible compilers support #pragma once
|
williamr@2
|
5 |
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
williamr@2
|
6 |
# pragma once
|
williamr@2
|
7 |
#endif
|
williamr@2
|
8 |
|
williamr@2
|
9 |
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
williamr@2
|
10 |
// basic_archive.hpp:
|
williamr@2
|
11 |
|
williamr@2
|
12 |
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
williamr@2
|
13 |
// Use, modification and distribution is subject to the Boost Software
|
williamr@2
|
14 |
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
williamr@2
|
15 |
// http://www.boost.org/LICENSE_1_0.txt)
|
williamr@2
|
16 |
|
williamr@2
|
17 |
// See http://www.boost.org for updates, documentation, and revision history.
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#include <boost/config.hpp>
|
williamr@2
|
20 |
#include <boost/strong_typedef.hpp>
|
williamr@2
|
21 |
#include <boost/noncopyable.hpp>
|
williamr@2
|
22 |
|
williamr@2
|
23 |
#include <boost/archive/detail/auto_link_archive.hpp>
|
williamr@2
|
24 |
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
williamr@2
|
25 |
|
williamr@2
|
26 |
namespace boost {
|
williamr@2
|
27 |
namespace archive {
|
williamr@2
|
28 |
|
williamr@2
|
29 |
BOOST_STRONG_TYPEDEF(unsigned int, version_type)
|
williamr@2
|
30 |
BOOST_STRONG_TYPEDEF(int, class_id_type)
|
williamr@2
|
31 |
BOOST_STRONG_TYPEDEF(int, class_id_optional_type)
|
williamr@2
|
32 |
BOOST_STRONG_TYPEDEF(int, class_id_reference_type)
|
williamr@2
|
33 |
BOOST_STRONG_TYPEDEF(unsigned int, object_id_type)
|
williamr@2
|
34 |
BOOST_STRONG_TYPEDEF(unsigned int, object_reference_type)
|
williamr@2
|
35 |
|
williamr@2
|
36 |
struct tracking_type {
|
williamr@2
|
37 |
typedef bool value_type;
|
williamr@2
|
38 |
bool t;
|
williamr@2
|
39 |
explicit tracking_type(const bool t_ = false)
|
williamr@2
|
40 |
: t(t_)
|
williamr@2
|
41 |
{};
|
williamr@2
|
42 |
tracking_type(const tracking_type & t_)
|
williamr@2
|
43 |
: t(t_.t)
|
williamr@2
|
44 |
{}
|
williamr@2
|
45 |
operator bool () const {
|
williamr@2
|
46 |
return t;
|
williamr@2
|
47 |
};
|
williamr@2
|
48 |
operator bool & () {
|
williamr@2
|
49 |
return t;
|
williamr@2
|
50 |
};
|
williamr@2
|
51 |
tracking_type & operator=(const bool t_){
|
williamr@2
|
52 |
t = t_;
|
williamr@2
|
53 |
return *this;
|
williamr@2
|
54 |
}
|
williamr@2
|
55 |
bool operator==(const tracking_type & rhs) const {
|
williamr@2
|
56 |
return t == rhs.t;
|
williamr@2
|
57 |
}
|
williamr@2
|
58 |
bool operator==(const bool & rhs) const {
|
williamr@2
|
59 |
return t == rhs;
|
williamr@2
|
60 |
}
|
williamr@2
|
61 |
tracking_type & operator=(const tracking_type & rhs){
|
williamr@2
|
62 |
t = rhs.t;
|
williamr@2
|
63 |
return *this;
|
williamr@2
|
64 |
}
|
williamr@2
|
65 |
};
|
williamr@2
|
66 |
|
williamr@2
|
67 |
struct class_name_type : private boost::noncopyable {
|
williamr@2
|
68 |
char *t;
|
williamr@2
|
69 |
operator const char * & () const {
|
williamr@2
|
70 |
return const_cast<const char * &>(t);
|
williamr@2
|
71 |
}
|
williamr@2
|
72 |
operator char * () {
|
williamr@2
|
73 |
return t;
|
williamr@2
|
74 |
}
|
williamr@2
|
75 |
explicit class_name_type(const char *key_)
|
williamr@2
|
76 |
: t(const_cast<char *>(key_)){}
|
williamr@2
|
77 |
explicit class_name_type(char *key_)
|
williamr@2
|
78 |
: t(key_){}
|
williamr@2
|
79 |
class_name_type & operator=(const class_name_type & rhs){
|
williamr@2
|
80 |
t = rhs.t;
|
williamr@2
|
81 |
return *this;
|
williamr@2
|
82 |
}
|
williamr@2
|
83 |
};
|
williamr@2
|
84 |
|
williamr@2
|
85 |
enum archive_flags {
|
williamr@2
|
86 |
no_header = 1, // suppress archive header info
|
williamr@2
|
87 |
no_codecvt = 2, // suppress alteration of codecvt facet
|
williamr@2
|
88 |
no_xml_tag_checking = 4, // suppress checking of xml tags
|
williamr@2
|
89 |
no_tracking = 8 // suppress ALL tracking
|
williamr@2
|
90 |
// no_object_creation = 16 // don't create any new objects
|
williamr@2
|
91 |
};
|
williamr@2
|
92 |
|
williamr@2
|
93 |
#define NULL_POINTER_TAG class_id_type(-1)
|
williamr@2
|
94 |
|
williamr@2
|
95 |
BOOST_ARCHIVE_DECL(const char *)
|
williamr@2
|
96 |
ARCHIVE_SIGNATURE();
|
williamr@2
|
97 |
|
williamr@2
|
98 |
BOOST_ARCHIVE_DECL(unsigned char)
|
williamr@2
|
99 |
ARCHIVE_VERSION();
|
williamr@2
|
100 |
|
williamr@2
|
101 |
}// namespace archive
|
williamr@2
|
102 |
}// namespace boost
|
williamr@2
|
103 |
|
williamr@2
|
104 |
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
williamr@2
|
105 |
|
williamr@2
|
106 |
#include <boost/serialization/level.hpp>
|
williamr@2
|
107 |
|
williamr@2
|
108 |
// set implementation level to primitive for all types
|
williamr@2
|
109 |
// used internally by the serialization library
|
williamr@2
|
110 |
|
williamr@2
|
111 |
BOOST_CLASS_IMPLEMENTATION(boost::archive::version_type, primitive_type)
|
williamr@2
|
112 |
BOOST_CLASS_IMPLEMENTATION(boost::archive::class_id_type, primitive_type)
|
williamr@2
|
113 |
BOOST_CLASS_IMPLEMENTATION(boost::archive::class_id_reference_type, primitive_type)
|
williamr@2
|
114 |
BOOST_CLASS_IMPLEMENTATION(boost::archive::class_id_optional_type, primitive_type)
|
williamr@2
|
115 |
BOOST_CLASS_IMPLEMENTATION(boost::archive::class_name_type, primitive_type)
|
williamr@2
|
116 |
BOOST_CLASS_IMPLEMENTATION(boost::archive::object_id_type, primitive_type)
|
williamr@2
|
117 |
BOOST_CLASS_IMPLEMENTATION(boost::archive::object_reference_type, primitive_type)
|
williamr@2
|
118 |
BOOST_CLASS_IMPLEMENTATION(boost::archive::tracking_type, primitive_type)
|
williamr@2
|
119 |
|
williamr@2
|
120 |
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
williamr@2
|
121 |
// Make sure that the export.hpp header isn't included before any archive header
|
williamr@2
|
122 |
// Doing so would inhibit construction of correct mpl list of known archive
|
williamr@2
|
123 |
// types which in turn would inhibit instantiation of all combinations of
|
williamr@2
|
124 |
// serialization/archive types.
|
williamr@2
|
125 |
|
williamr@2
|
126 |
#ifdef BOOST_SERIALIZATION_EXPORT_HPP
|
williamr@2
|
127 |
#error "export.hpp must not be included before any archive header"
|
williamr@2
|
128 |
#endif
|
williamr@2
|
129 |
|
williamr@2
|
130 |
#endif //BOOST_ARCHIVE_BASIC_ARCHIVE_HPP
|