epoc32/include/stdapis/boost/archive/detail/interface_iarchive.hpp
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
     1 #ifndef BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP
     2 #define BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_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 // interface_iarchive.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 #include <string>
    19 #include <boost/cstdint.hpp>
    20 #include <boost/mpl/bool.hpp>
    21 #include <boost/archive/detail/auto_link_archive.hpp>
    22 #include <boost/archive/detail/iserializer.hpp>
    23 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
    24 
    25 namespace boost {
    26 template<class T>
    27 class shared_ptr;
    28 namespace serialization {
    29     class extended_type_info;
    30 } // namespace serialization
    31 namespace archive {
    32 namespace detail {
    33 
    34 class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_iserializer;
    35 
    36 template<class Archive>
    37 class interface_iarchive 
    38 {
    39 protected:
    40     interface_iarchive(){};
    41 public:
    42     /////////////////////////////////////////////////////////
    43     // archive public interface
    44     typedef mpl::bool_<true> is_loading;
    45     typedef mpl::bool_<false> is_saving;
    46 
    47     // return a pointer to the most derived class
    48     Archive * This(){
    49         return static_cast<Archive *>(this);
    50     }
    51 
    52     template<class T>
    53     const basic_pointer_iserializer * register_type(T * = NULL){
    54         const basic_pointer_iserializer & bpis =
    55             instantiate_pointer_iserializer(
    56                 static_cast<Archive *>(NULL),
    57                 static_cast<T *>(NULL)
    58             );
    59         this->This()->register_basic_serializer(bpis.get_basic_serializer());
    60         return & bpis;
    61     }
    62     void lookup_helper(
    63         const boost::serialization::extended_type_info * const eti,
    64         boost::shared_ptr<void> & sph
    65     ){
    66         this->This()->lookup_basic_helper(eti, sph);
    67     }
    68 
    69     void insert_helper(
    70         const boost::serialization::extended_type_info * const eti,
    71         shared_ptr<void> & sph
    72     ){
    73         this->This()->insert_basic_helper(eti, sph);
    74     }
    75     template<class T>
    76     Archive & operator>>(T & t){
    77         this->This()->load_override(t, 0);
    78         return * this->This();
    79     }
    80 
    81     // the & operator 
    82     template<class T>
    83     Archive & operator&(T & t){
    84         return *(this->This()) >> t;
    85     }
    86 };
    87 
    88 } // namespace detail
    89 } // namespace archive
    90 } // namespace boost
    91 
    92 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
    93 
    94 #endif // BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP