epoc32/include/stdapis/boost/archive/basic_text_iprimitive.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_iprimitive.hpp	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,130 @@
     1.4 +#ifndef BOOST_ARCHIVE_BASIC_TEXT_IPRIMITIVE_HPP
     1.5 +#define BOOST_ARCHIVE_BASIC_TEXT_IPRIMITIVE_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_iprimitive.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<IStream::char_type> but rather
    1.28 +// use two template parameters
    1.29 +
    1.30 +#include <cassert>
    1.31 +#include <locale>
    1.32 +#include <cstddef> // size_t
    1.33 +
    1.34 +#include <boost/config.hpp>
    1.35 +#if defined(BOOST_NO_STDC_NAMESPACE)
    1.36 +namespace std{ 
    1.37 +    using ::size_t; 
    1.38 +    #if ! defined(BOOST_DINKUMWARE_STDLIB) && ! defined(__SGI_STL_PORT)
    1.39 +        using ::locale;
    1.40 +    #endif
    1.41 +} // namespace std
    1.42 +#endif
    1.43 +
    1.44 +#include <boost/detail/workaround.hpp>
    1.45 +#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1)
    1.46 +#include <boost/archive/dinkumware.hpp>
    1.47 +#endif
    1.48 +
    1.49 +#include <boost/throw_exception.hpp>
    1.50 +#include <boost/limits.hpp>
    1.51 +#include <boost/io/ios_state.hpp>
    1.52 +#include <boost/scoped_ptr.hpp>
    1.53 +
    1.54 +#include <boost/archive/archive_exception.hpp>
    1.55 +
    1.56 +#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
    1.57 +
    1.58 +namespace boost {
    1.59 +namespace archive {
    1.60 +
    1.61 +/////////////////////////////////////////////////////////////////////////
    1.62 +// class basic_text_iarchive - load serialized objects from a input text stream
    1.63 +template<class IStream>
    1.64 +class basic_text_iprimitive
    1.65 +{
    1.66 +#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
    1.67 +protected:
    1.68 +#else
    1.69 +public:
    1.70 +#endif
    1.71 +    IStream &is;
    1.72 +    io::ios_flags_saver flags_saver;
    1.73 +    io::ios_precision_saver precision_saver;
    1.74 +    boost::scoped_ptr<std::locale> archive_locale;
    1.75 +    io::basic_ios_locale_saver<
    1.76 +        BOOST_DEDUCED_TYPENAME IStream::char_type, BOOST_DEDUCED_TYPENAME IStream::traits_type
    1.77 +    > locale_saver;
    1.78 +    template<class T>
    1.79 +    void load(T & t)
    1.80 +    {
    1.81 +        if(is.fail())
    1.82 +            boost::throw_exception(archive_exception(archive_exception::stream_error));
    1.83 +        is >> t;
    1.84 +    }
    1.85 +    void load(unsigned char & t)
    1.86 +    {
    1.87 +        if(is.fail())
    1.88 +            boost::throw_exception(archive_exception(archive_exception::stream_error));
    1.89 +        unsigned short int i;
    1.90 +        is >> i;
    1.91 +        t = static_cast<unsigned char>(i);
    1.92 +    }
    1.93 +    void load(signed char & t)
    1.94 +    {
    1.95 +        if(is.fail())
    1.96 +            boost::throw_exception(archive_exception(archive_exception::stream_error));
    1.97 +        signed short int i;
    1.98 +        is >> i;
    1.99 +        t = static_cast<signed char>(i);
   1.100 +    }
   1.101 +    void load(char & t)
   1.102 +    {
   1.103 +        if(is.fail())
   1.104 +            boost::throw_exception(archive_exception(archive_exception::stream_error));
   1.105 +        short int i;
   1.106 +        is >> i;
   1.107 +        t = static_cast<char>(i);
   1.108 +    }
   1.109 +    #ifndef BOOST_NO_INTRINSIC_WCHAR_T
   1.110 +    void load(wchar_t & t)
   1.111 +    {
   1.112 +        if(is.fail())
   1.113 +            boost::throw_exception(archive_exception(archive_exception::stream_error));
   1.114 +        unsigned i;
   1.115 +        is >> i;
   1.116 +        t = static_cast<wchar_t>(i);
   1.117 +    }
   1.118 +    #endif
   1.119 +    BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) 
   1.120 +    basic_text_iprimitive(IStream  &is, bool no_codecvt);
   1.121 +    BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) 
   1.122 +    ~basic_text_iprimitive();
   1.123 +public:
   1.124 +    BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
   1.125 +    load_binary(void *address, std::size_t count);
   1.126 +};
   1.127 +
   1.128 +} // namespace archive
   1.129 +} // namespace boost
   1.130 +
   1.131 +#include <boost/archive/detail/abi_suffix.hpp> // pop pragams
   1.132 +
   1.133 +#endif // BOOST_ARCHIVE_BASIC_TEXT_IPRIMITIVE_HPP