epoc32/include/stdapis/boost/archive/basic_text_oarchive.hpp
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/stdapis/boost/archive/basic_text_oarchive.hpp	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,131 @@
     1.4 +#ifndef BOOST_ARCHIVE_BASIC_TEXT_OARCHIVE_HPP
     1.5 +#define BOOST_ARCHIVE_BASIC_TEXT_OARCHIVE_HPP
     1.6 +
     1.7 +// MS compatible compilers support #pragma once
     1.8 +#if defined(_MSC_VER) && (_MSC_VER >= 1020)
     1.9 +# pragma once
    1.10 +#endif
    1.11 +
    1.12 +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
    1.13 +// basic_text_oarchive.hpp
    1.14 +
    1.15 +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . 
    1.16 +// Use, modification and distribution is subject to the Boost Software
    1.17 +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
    1.18 +// http://www.boost.org/LICENSE_1_0.txt)
    1.19 +
    1.20 +//  See http://www.boost.org for updates, documentation, and revision history.
    1.21 +
    1.22 +// archives stored as text - note these ar templated on the basic
    1.23 +// stream templates to accommodate wide (and other?) kind of characters
    1.24 +//
    1.25 +// note the fact that on libraries without wide characters, ostream is
    1.26 +// is not a specialization of basic_ostream which in fact is not defined
    1.27 +// in such cases.   So we can't use basic_ostream<OStream::char_type> but rather
    1.28 +// use two template parameters
    1.29 +
    1.30 +#include <cassert>
    1.31 +#include <boost/config.hpp>
    1.32 +#include <boost/pfto.hpp>
    1.33 +#include <boost/detail/workaround.hpp>
    1.34 +
    1.35 +#include <boost/archive/detail/common_oarchive.hpp>
    1.36 +#include <boost/serialization/string.hpp>
    1.37 +
    1.38 +#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
    1.39 +
    1.40 +namespace boost {
    1.41 +namespace archive {
    1.42 +
    1.43 +/////////////////////////////////////////////////////////////////////////
    1.44 +// class basic_text_iarchive - read serialized objects from a input text stream
    1.45 +template<class Archive>
    1.46 +class basic_text_oarchive : 
    1.47 +    public detail::common_oarchive<Archive>
    1.48 +{
    1.49 +protected:
    1.50 +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \
    1.51 +|| BOOST_WORKAROUND(__BORLANDC__,BOOST_TESTED_AT(0x560))
    1.52 +public:
    1.53 +#elif defined(BOOST_MSVC)
    1.54 +    // for some inexplicable reason insertion of "class" generates compile erro
    1.55 +    // on msvc 7.1
    1.56 +    friend detail::interface_oarchive<Archive>;
    1.57 +#else
    1.58 +    friend class detail::interface_oarchive<Archive>;
    1.59 +#endif
    1.60 +    enum {
    1.61 +        none,
    1.62 +        eol,
    1.63 +        space
    1.64 +    } delimiter;
    1.65 +
    1.66 +    BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
    1.67 +    newtoken();
    1.68 +
    1.69 +    void newline(){
    1.70 +        delimiter = eol;
    1.71 +    }
    1.72 +
    1.73 +    // default processing - kick back to base class.  Note the
    1.74 +    // extra stuff to get it passed borland compilers
    1.75 +    typedef detail::common_oarchive<Archive> detail_common_oarchive;
    1.76 +    template<class T>
    1.77 +    void save_override(T & t, BOOST_PFTO int){
    1.78 +        this->detail_common_oarchive::save_override(t, 0);
    1.79 +    }
    1.80 +
    1.81 +    // start new objects on a new line
    1.82 +    void save_override(const object_id_type & t, int){
    1.83 +        this->This()->newline();
    1.84 +        // and and invoke prmitive to underlying value
    1.85 +        this->This()->save(t.t);
    1.86 +    }
    1.87 +
    1.88 +    void save_override(const object_reference_type & t, int){
    1.89 +        this->This()->newline();
    1.90 +        // and and invoke prmitive to underlying value
    1.91 +        this->This()->save(t.t);
    1.92 +    }
    1.93 +
    1.94 +    // text file don't include the optional information 
    1.95 +    void save_override(const class_id_optional_type & /* t */, int){}
    1.96 +
    1.97 +    // note the following four overrides are necessary for some borland
    1.98 +    // compilers which don't handle BOOST_STRONG_TYPE properly.
    1.99 +    void save_override(const version_type & t, int){
   1.100 +        // note:t.t resolves borland ambguity
   1.101 +        unsigned int x = t.t;
   1.102 +        * this->This() << x;
   1.103 +    }
   1.104 +    void save_override(const class_id_type & t, int){
   1.105 +        // note:t.t resolves borland ambguity
   1.106 +        int x = t.t;
   1.107 +        * this->This() << x;
   1.108 +    }
   1.109 +    void save_override(const class_id_reference_type & t, int){
   1.110 +        // note:t.t resolves borland ambguity
   1.111 +        int x = t.t;
   1.112 +        * this->This() << x;
   1.113 +    }
   1.114 +    void save_override(const class_name_type & t, int){
   1.115 +        const std::string s(t);
   1.116 +        * this->This() << s;
   1.117 +    }
   1.118 +
   1.119 +    BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
   1.120 +    init();
   1.121 +
   1.122 +    basic_text_oarchive(unsigned int flags) :
   1.123 +        detail::common_oarchive<Archive>(flags),
   1.124 +        delimiter(none)
   1.125 +    {}
   1.126 +    ~basic_text_oarchive(){}
   1.127 +};
   1.128 +
   1.129 +} // namespace archive
   1.130 +} // namespace boost
   1.131 +
   1.132 +#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
   1.133 +
   1.134 +#endif // BOOST_ARCHIVE_BASIC_TEXT_OARCHIVE_HPP