Statistics
| Revision:

root / tmp / org.txm.statsengine.r.core.win32 / res / win32 / library / BH / include / boost / archive / impl / text_iarchive_impl.ipp @ 2486

History | View | Annotate | Download (3.2 kB)

1 2486 sjacqu01
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
2 2486 sjacqu01
// text_iarchive_impl.ipp:
3 2486 sjacqu01
4 2486 sjacqu01
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
5 2486 sjacqu01
// Distributed under the Boost Software License, Version 1.0. (See
6 2486 sjacqu01
// accompanying file LICENSE_1_0.txt or copy at
7 2486 sjacqu01
// http://www.boost.org/LICENSE_1_0.txt)
8 2486 sjacqu01
9 2486 sjacqu01
//  See http://www.boost.org for updates, documentation, and revision history.
10 2486 sjacqu01
11 2486 sjacqu01
//////////////////////////////////////////////////////////////////////
12 2486 sjacqu01
// implementation of basic_text_iprimitive overrides for the combination
13 2486 sjacqu01
// of template parameters used to implement a text_iprimitive
14 2486 sjacqu01
15 2486 sjacqu01
#include <cstddef> // size_t, NULL
16 2486 sjacqu01
#include <boost/config.hpp>
17 2486 sjacqu01
#if defined(BOOST_NO_STDC_NAMESPACE)
18 2486 sjacqu01
namespace std{
19 2486 sjacqu01
    using ::size_t;
20 2486 sjacqu01
} // namespace std
21 2486 sjacqu01
#endif
22 2486 sjacqu01
23 2486 sjacqu01
#include <boost/detail/workaround.hpp> // RogueWave
24 2486 sjacqu01
25 2486 sjacqu01
#include <boost/archive/text_iarchive.hpp>
26 2486 sjacqu01
27 2486 sjacqu01
namespace boost {
28 2486 sjacqu01
namespace archive {
29 2486 sjacqu01
30 2486 sjacqu01
template<class Archive>
31 2486 sjacqu01
BOOST_ARCHIVE_DECL void
32 2486 sjacqu01
text_iarchive_impl<Archive>::load(char *s)
33 2486 sjacqu01
{
34 2486 sjacqu01
    std::size_t size;
35 2486 sjacqu01
    * this->This() >> size;
36 2486 sjacqu01
    // skip separating space
37 2486 sjacqu01
    is.get();
38 2486 sjacqu01
    // Works on all tested platforms
39 2486 sjacqu01
    is.read(s, size);
40 2486 sjacqu01
    s[size] = '\0';
41 2486 sjacqu01
}
42 2486 sjacqu01
43 2486 sjacqu01
template<class Archive>
44 2486 sjacqu01
BOOST_ARCHIVE_DECL void
45 2486 sjacqu01
text_iarchive_impl<Archive>::load(std::string &s)
46 2486 sjacqu01
{
47 2486 sjacqu01
    std::size_t size;
48 2486 sjacqu01
    * this->This() >> size;
49 2486 sjacqu01
    // skip separating space
50 2486 sjacqu01
    is.get();
51 2486 sjacqu01
    // borland de-allocator fixup
52 2486 sjacqu01
    #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101))
53 2486 sjacqu01
    if(NULL != s.data())
54 2486 sjacqu01
    #endif
55 2486 sjacqu01
        s.resize(size);
56 2486 sjacqu01
    if(0 < size)
57 2486 sjacqu01
        is.read(&(*s.begin()), size);
58 2486 sjacqu01
}
59 2486 sjacqu01
60 2486 sjacqu01
#ifndef BOOST_NO_CWCHAR
61 2486 sjacqu01
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
62 2486 sjacqu01
template<class Archive>
63 2486 sjacqu01
BOOST_ARCHIVE_DECL void
64 2486 sjacqu01
text_iarchive_impl<Archive>::load(wchar_t *ws)
65 2486 sjacqu01
{
66 2486 sjacqu01
    std::size_t size;
67 2486 sjacqu01
    * this->This() >> size;
68 2486 sjacqu01
    // skip separating space
69 2486 sjacqu01
    is.get();
70 2486 sjacqu01
    is.read((char *)ws, size * sizeof(wchar_t)/sizeof(char));
71 2486 sjacqu01
    ws[size] = L'\0';
72 2486 sjacqu01
}
73 2486 sjacqu01
#endif // BOOST_NO_INTRINSIC_WCHAR_T
74 2486 sjacqu01
75 2486 sjacqu01
#ifndef BOOST_NO_STD_WSTRING
76 2486 sjacqu01
template<class Archive>
77 2486 sjacqu01
BOOST_ARCHIVE_DECL void
78 2486 sjacqu01
text_iarchive_impl<Archive>::load(std::wstring &ws)
79 2486 sjacqu01
{
80 2486 sjacqu01
    std::size_t size;
81 2486 sjacqu01
    * this->This() >> size;
82 2486 sjacqu01
    // borland de-allocator fixup
83 2486 sjacqu01
    #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101))
84 2486 sjacqu01
    if(NULL != ws.data())
85 2486 sjacqu01
    #endif
86 2486 sjacqu01
        ws.resize(size);
87 2486 sjacqu01
    // skip separating space
88 2486 sjacqu01
    is.get();
89 2486 sjacqu01
    is.read((char *)ws.data(), size * sizeof(wchar_t)/sizeof(char));
90 2486 sjacqu01
}
91 2486 sjacqu01
92 2486 sjacqu01
#endif // BOOST_NO_STD_WSTRING
93 2486 sjacqu01
#endif // BOOST_NO_CWCHAR
94 2486 sjacqu01
95 2486 sjacqu01
template<class Archive>
96 2486 sjacqu01
BOOST_ARCHIVE_DECL void
97 2486 sjacqu01
text_iarchive_impl<Archive>::load_override(class_name_type & t){
98 2486 sjacqu01
    basic_text_iarchive<Archive>::load_override(t);
99 2486 sjacqu01
}
100 2486 sjacqu01
101 2486 sjacqu01
template<class Archive>
102 2486 sjacqu01
BOOST_ARCHIVE_DECL void
103 2486 sjacqu01
text_iarchive_impl<Archive>::init(){
104 2486 sjacqu01
    basic_text_iarchive<Archive>::init();
105 2486 sjacqu01
}
106 2486 sjacqu01
107 2486 sjacqu01
template<class Archive>
108 2486 sjacqu01
BOOST_ARCHIVE_DECL
109 2486 sjacqu01
text_iarchive_impl<Archive>::text_iarchive_impl(
110 2486 sjacqu01
    std::istream & is,
111 2486 sjacqu01
    unsigned int flags
112 2486 sjacqu01
) :
113 2486 sjacqu01
    basic_text_iprimitive<std::istream>(
114 2486 sjacqu01
        is,
115 2486 sjacqu01
        0 != (flags & no_codecvt)
116 2486 sjacqu01
    ),
117 2486 sjacqu01
    basic_text_iarchive<Archive>(flags)
118 2486 sjacqu01
{
119 2486 sjacqu01
    if(0 == (flags & no_header))
120 2486 sjacqu01
        #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205))
121 2486 sjacqu01
        this->init();
122 2486 sjacqu01
        #else
123 2486 sjacqu01
        this->basic_text_iarchive<Archive>::init();
124 2486 sjacqu01
        #endif
125 2486 sjacqu01
}
126 2486 sjacqu01
127 2486 sjacqu01
} // namespace archive
128 2486 sjacqu01
} // namespace boost