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