Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/boost/archive/basic_archive.hpp @ 56

Last change on this file since 56 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 4.1 KB
Line 
1#ifndef BOOST_ARCHIVE_BASIC_ARCHIVE_HPP
2#define BOOST_ARCHIVE_BASIC_ARCHIVE_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_archive.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 <boost/config.hpp>
20#include <boost/strong_typedef.hpp>
21#include <boost/noncopyable.hpp>
22
23#include <boost/archive/detail/auto_link_archive.hpp>
24#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
25
26namespace boost {
27namespace archive {
28
29BOOST_STRONG_TYPEDEF(unsigned int, version_type)
30BOOST_STRONG_TYPEDEF(int, class_id_type)
31BOOST_STRONG_TYPEDEF(int, class_id_optional_type)
32BOOST_STRONG_TYPEDEF(int, class_id_reference_type)
33BOOST_STRONG_TYPEDEF(unsigned int, object_id_type)
34BOOST_STRONG_TYPEDEF(unsigned int, object_reference_type)
35
36struct tracking_type {
37    typedef bool value_type;
38    bool t;
39    explicit tracking_type(const bool t_ = false)
40        : t(t_)
41    {};
42    tracking_type(const tracking_type & t_)
43        : t(t_.t)
44    {}
45    operator bool () const {
46        return t;
47    };
48    operator bool & () {
49        return t;
50    };
51    tracking_type & operator=(const bool t_){
52        t = t_;
53        return *this;
54    }
55    bool operator==(const tracking_type & rhs) const {
56        return t == rhs.t;
57    }
58    bool operator==(const bool & rhs) const {
59        return t == rhs;
60    }
61    tracking_type & operator=(const tracking_type & rhs){
62        t = rhs.t;
63        return *this;
64    }
65};
66
67struct class_name_type : private boost::noncopyable {
68    char *t;
69    operator const char * & () const {
70        return const_cast<const char * &>(t);
71    }
72    operator char * () {
73        return t;
74    }
75    explicit class_name_type(const char *key_) 
76    : t(const_cast<char *>(key_)){}
77    explicit class_name_type(char *key_) 
78    : t(key_){}
79    class_name_type & operator=(const class_name_type & rhs){
80        t = rhs.t;
81        return *this;
82    }
83};
84
85enum archive_flags {
86    no_header = 1,  // suppress archive header info
87    no_codecvt = 2,  // suppress alteration of codecvt facet
88    no_xml_tag_checking = 4,   // suppress checking of xml tags
89    no_tracking = 8           // suppress ALL tracking
90//    no_object_creation = 16    // don't create any new objects
91};
92
93#define NULL_POINTER_TAG class_id_type(-1)
94
95BOOST_ARCHIVE_DECL(const char *)
96ARCHIVE_SIGNATURE();
97
98BOOST_ARCHIVE_DECL(unsigned char)
99ARCHIVE_VERSION();
100
101}// namespace archive
102}// namespace boost
103
104#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
105
106#include <boost/serialization/level.hpp>
107
108// set implementation level to primitive for all types
109// used internally by the serialization library
110
111BOOST_CLASS_IMPLEMENTATION(boost::archive::version_type, primitive_type)
112BOOST_CLASS_IMPLEMENTATION(boost::archive::class_id_type, primitive_type)
113BOOST_CLASS_IMPLEMENTATION(boost::archive::class_id_reference_type, primitive_type)
114BOOST_CLASS_IMPLEMENTATION(boost::archive::class_id_optional_type, primitive_type)
115BOOST_CLASS_IMPLEMENTATION(boost::archive::class_name_type, primitive_type)
116BOOST_CLASS_IMPLEMENTATION(boost::archive::object_id_type, primitive_type)
117BOOST_CLASS_IMPLEMENTATION(boost::archive::object_reference_type, primitive_type)
118BOOST_CLASS_IMPLEMENTATION(boost::archive::tracking_type, primitive_type)
119
120/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
121// Make sure that the export.hpp header isn't included before any archive header
122// Doing so would inhibit construction of correct mpl list of known archive
123// types which in turn would inhibit instantiation of all combinations of
124// serialization/archive types.
125
126#ifdef BOOST_SERIALIZATION_EXPORT_HPP
127#error "export.hpp must not be included before any archive header"
128#endif
129
130#endif //BOOST_ARCHIVE_BASIC_ARCHIVE_HPP
Note: See TracBrowser for help on using the repository browser.