Statistics
| Revision:

root / tmp / org.txm.statsengine.r.core.win32 / res / win32 / library / BH / include / boost / archive / basic_text_iprimitive.hpp @ 2486

History | View | Annotate | Download (3.6 kB)

1 2486 sjacqu01
#ifndef BOOST_ARCHIVE_BASIC_TEXT_IPRIMITIVE_HPP
2 2486 sjacqu01
#define BOOST_ARCHIVE_BASIC_TEXT_IPRIMITIVE_HPP
3 2486 sjacqu01
4 2486 sjacqu01
// MS compatible compilers support #pragma once
5 2486 sjacqu01
#if defined(_MSC_VER)
6 2486 sjacqu01
# pragma once
7 2486 sjacqu01
#endif
8 2486 sjacqu01
9 2486 sjacqu01
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10 2486 sjacqu01
// basic_text_iprimitive.hpp
11 2486 sjacqu01
12 2486 sjacqu01
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
13 2486 sjacqu01
// Use, modification and distribution is subject to the Boost Software
14 2486 sjacqu01
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
15 2486 sjacqu01
// http://www.boost.org/LICENSE_1_0.txt)
16 2486 sjacqu01
17 2486 sjacqu01
//  See http://www.boost.org for updates, documentation, and revision history.
18 2486 sjacqu01
19 2486 sjacqu01
// archives stored as text - note these are templated on the basic
20 2486 sjacqu01
// stream templates to accommodate wide (and other?) kind of characters
21 2486 sjacqu01
//
22 2486 sjacqu01
// Note the fact that on libraries without wide characters, ostream is
23 2486 sjacqu01
// not a specialization of basic_ostream which in fact is not defined
24 2486 sjacqu01
// in such cases.   So we can't use basic_ostream<IStream::char_type> but rather
25 2486 sjacqu01
// use two template parameters
26 2486 sjacqu01
27 2486 sjacqu01
#include <boost/assert.hpp>
28 2486 sjacqu01
#include <locale>
29 2486 sjacqu01
#include <cstddef> // size_t
30 2486 sjacqu01
31 2486 sjacqu01
#include <boost/config.hpp>
32 2486 sjacqu01
#if defined(BOOST_NO_STDC_NAMESPACE)
33 2486 sjacqu01
namespace std{
34 2486 sjacqu01
    using ::size_t;
35 2486 sjacqu01
    #if ! defined(BOOST_DINKUMWARE_STDLIB) && ! defined(__SGI_STL_PORT)
36 2486 sjacqu01
        using ::locale;
37 2486 sjacqu01
    #endif
38 2486 sjacqu01
} // namespace std
39 2486 sjacqu01
#endif
40 2486 sjacqu01
41 2486 sjacqu01
#include <boost/detail/workaround.hpp>
42 2486 sjacqu01
#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1)
43 2486 sjacqu01
#include <boost/archive/dinkumware.hpp>
44 2486 sjacqu01
#endif
45 2486 sjacqu01
46 2486 sjacqu01
#include <boost/limits.hpp>
47 2486 sjacqu01
#include <boost/io/ios_state.hpp>
48 2486 sjacqu01
#include <boost/scoped_ptr.hpp>
49 2486 sjacqu01
#include <boost/static_assert.hpp>
50 2486 sjacqu01
51 2486 sjacqu01
#include <boost/serialization/throw_exception.hpp>
52 2486 sjacqu01
#include <boost/archive/archive_exception.hpp>
53 2486 sjacqu01
#include <boost/archive/basic_streambuf_locale_saver.hpp>
54 2486 sjacqu01
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
55 2486 sjacqu01
56 2486 sjacqu01
namespace boost {
57 2486 sjacqu01
namespace archive {
58 2486 sjacqu01
59 2486 sjacqu01
/////////////////////////////////////////////////////////////////////////
60 2486 sjacqu01
// class basic_text_iarchive - load serialized objects from a input text stream
61 2486 sjacqu01
#if defined(_MSC_VER)
62 2486 sjacqu01
#pragma warning( push )
63 2486 sjacqu01
#pragma warning( disable : 4244 4267 )
64 2486 sjacqu01
#endif
65 2486 sjacqu01
66 2486 sjacqu01
template<class IStream>
67 2486 sjacqu01
class BOOST_SYMBOL_VISIBLE basic_text_iprimitive {
68 2486 sjacqu01
protected:
69 2486 sjacqu01
    IStream &is;
70 2486 sjacqu01
    io::ios_flags_saver flags_saver;
71 2486 sjacqu01
    io::ios_precision_saver precision_saver;
72 2486 sjacqu01
73 2486 sjacqu01
    #ifndef BOOST_NO_STD_LOCALE
74 2486 sjacqu01
    boost::scoped_ptr<std::locale> archive_locale;
75 2486 sjacqu01
    basic_streambuf_locale_saver<
76 2486 sjacqu01
        typename IStream::char_type,
77 2486 sjacqu01
        typename IStream::traits_type
78 2486 sjacqu01
    > locale_saver;
79 2486 sjacqu01
    #endif
80 2486 sjacqu01
81 2486 sjacqu01
    template<class T>
82 2486 sjacqu01
    void load(T & t)
83 2486 sjacqu01
    {
84 2486 sjacqu01
        if(is >> t)
85 2486 sjacqu01
            return;
86 2486 sjacqu01
        boost::serialization::throw_exception(
87 2486 sjacqu01
            archive_exception(archive_exception::input_stream_error)
88 2486 sjacqu01
        );
89 2486 sjacqu01
    }
90 2486 sjacqu01
91 2486 sjacqu01
    void load(char & t)
92 2486 sjacqu01
    {
93 2486 sjacqu01
        short int i;
94 2486 sjacqu01
        load(i);
95 2486 sjacqu01
        t = i;
96 2486 sjacqu01
    }
97 2486 sjacqu01
    void load(signed char & t)
98 2486 sjacqu01
    {
99 2486 sjacqu01
        short int i;
100 2486 sjacqu01
        load(i);
101 2486 sjacqu01
        t = i;
102 2486 sjacqu01
    }
103 2486 sjacqu01
    void load(unsigned char & t)
104 2486 sjacqu01
    {
105 2486 sjacqu01
        unsigned short int i;
106 2486 sjacqu01
        load(i);
107 2486 sjacqu01
        t = i;
108 2486 sjacqu01
    }
109 2486 sjacqu01
110 2486 sjacqu01
    #ifndef BOOST_NO_INTRINSIC_WCHAR_T
111 2486 sjacqu01
    void load(wchar_t & t)
112 2486 sjacqu01
    {
113 2486 sjacqu01
        BOOST_STATIC_ASSERT(sizeof(wchar_t) <= sizeof(int));
114 2486 sjacqu01
        int i;
115 2486 sjacqu01
        load(i);
116 2486 sjacqu01
        t = i;
117 2486 sjacqu01
    }
118 2486 sjacqu01
    #endif
119 2486 sjacqu01
    BOOST_ARCHIVE_OR_WARCHIVE_DECL
120 2486 sjacqu01
    basic_text_iprimitive(IStream  &is, bool no_codecvt);
121 2486 sjacqu01
    BOOST_ARCHIVE_OR_WARCHIVE_DECL
122 2486 sjacqu01
    ~basic_text_iprimitive();
123 2486 sjacqu01
public:
124 2486 sjacqu01
    BOOST_ARCHIVE_OR_WARCHIVE_DECL void
125 2486 sjacqu01
    load_binary(void *address, std::size_t count);
126 2486 sjacqu01
};
127 2486 sjacqu01
128 2486 sjacqu01
#if defined(_MSC_VER)
129 2486 sjacqu01
#pragma warning( pop )
130 2486 sjacqu01
#endif
131 2486 sjacqu01
132 2486 sjacqu01
} // namespace archive
133 2486 sjacqu01
} // namespace boost
134 2486 sjacqu01
135 2486 sjacqu01
#include <boost/archive/detail/abi_suffix.hpp> // pop pragmas
136 2486 sjacqu01
137 2486 sjacqu01
#endif // BOOST_ARCHIVE_BASIC_TEXT_IPRIMITIVE_HPP