Statistics
| Revision:

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

History | View | Annotate | Download (3.1 kB)

1 2486 sjacqu01
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
2 2486 sjacqu01
// text_oarchive_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
#include <string>
12 2486 sjacqu01
#include <boost/config.hpp>
13 2486 sjacqu01
#include <locale>
14 2486 sjacqu01
#include <cstddef> // size_t
15 2486 sjacqu01
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
#ifndef BOOST_NO_CWCHAR
24 2486 sjacqu01
#include <cwchar>
25 2486 sjacqu01
#ifdef BOOST_NO_STDC_NAMESPACE
26 2486 sjacqu01
namespace std{ using ::wcslen; }
27 2486 sjacqu01
#endif
28 2486 sjacqu01
#endif
29 2486 sjacqu01
30 2486 sjacqu01
#include <boost/archive/add_facet.hpp>
31 2486 sjacqu01
#include <boost/archive/text_oarchive.hpp>
32 2486 sjacqu01
33 2486 sjacqu01
namespace boost {
34 2486 sjacqu01
namespace archive {
35 2486 sjacqu01
36 2486 sjacqu01
//////////////////////////////////////////////////////////////////////
37 2486 sjacqu01
// implementation of basic_text_oprimitive overrides for the combination
38 2486 sjacqu01
// of template parameters used to create a text_oprimitive
39 2486 sjacqu01
40 2486 sjacqu01
template<class Archive>
41 2486 sjacqu01
BOOST_ARCHIVE_DECL void
42 2486 sjacqu01
text_oarchive_impl<Archive>::save(const char * s)
43 2486 sjacqu01
{
44 2486 sjacqu01
    const std::size_t len = std::ostream::traits_type::length(s);
45 2486 sjacqu01
    *this->This() << len;
46 2486 sjacqu01
    this->This()->newtoken();
47 2486 sjacqu01
    os << s;
48 2486 sjacqu01
}
49 2486 sjacqu01
50 2486 sjacqu01
template<class Archive>
51 2486 sjacqu01
BOOST_ARCHIVE_DECL void
52 2486 sjacqu01
text_oarchive_impl<Archive>::save(const std::string &s)
53 2486 sjacqu01
{
54 2486 sjacqu01
    const std::size_t size = s.size();
55 2486 sjacqu01
    *this->This() << size;
56 2486 sjacqu01
    this->This()->newtoken();
57 2486 sjacqu01
    os << s;
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_oarchive_impl<Archive>::save(const wchar_t * ws)
65 2486 sjacqu01
{
66 2486 sjacqu01
    const std::size_t l = std::wcslen(ws);
67 2486 sjacqu01
    * this->This() << l;
68 2486 sjacqu01
    this->This()->newtoken();
69 2486 sjacqu01
    os.write((const char *)ws, l * sizeof(wchar_t)/sizeof(char));
70 2486 sjacqu01
}
71 2486 sjacqu01
#endif
72 2486 sjacqu01
73 2486 sjacqu01
#ifndef BOOST_NO_STD_WSTRING
74 2486 sjacqu01
template<class Archive>
75 2486 sjacqu01
BOOST_ARCHIVE_DECL void
76 2486 sjacqu01
text_oarchive_impl<Archive>::save(const std::wstring &ws)
77 2486 sjacqu01
{
78 2486 sjacqu01
    const std::size_t l = ws.size();
79 2486 sjacqu01
    * this->This() << l;
80 2486 sjacqu01
    this->This()->newtoken();
81 2486 sjacqu01
    os.write((const char *)(ws.data()), l * sizeof(wchar_t)/sizeof(char));
82 2486 sjacqu01
}
83 2486 sjacqu01
#endif
84 2486 sjacqu01
#endif // BOOST_NO_CWCHAR
85 2486 sjacqu01
86 2486 sjacqu01
template<class Archive>
87 2486 sjacqu01
BOOST_ARCHIVE_DECL
88 2486 sjacqu01
text_oarchive_impl<Archive>::text_oarchive_impl(
89 2486 sjacqu01
    std::ostream & os,
90 2486 sjacqu01
    unsigned int flags
91 2486 sjacqu01
) :
92 2486 sjacqu01
    basic_text_oprimitive<std::ostream>(
93 2486 sjacqu01
        os,
94 2486 sjacqu01
        0 != (flags & no_codecvt)
95 2486 sjacqu01
    ),
96 2486 sjacqu01
    basic_text_oarchive<Archive>(flags)
97 2486 sjacqu01
{
98 2486 sjacqu01
    if(0 == (flags & no_header))
99 2486 sjacqu01
        #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205))
100 2486 sjacqu01
        this->init();
101 2486 sjacqu01
        #else
102 2486 sjacqu01
        this->basic_text_oarchive<Archive>::init();
103 2486 sjacqu01
        #endif
104 2486 sjacqu01
}
105 2486 sjacqu01
106 2486 sjacqu01
template<class Archive>
107 2486 sjacqu01
BOOST_ARCHIVE_DECL void
108 2486 sjacqu01
text_oarchive_impl<Archive>::save_binary(const void *address, std::size_t count){
109 2486 sjacqu01
    put('\n');
110 2486 sjacqu01
    this->end_preamble();
111 2486 sjacqu01
    #if ! defined(__MWERKS__)
112 2486 sjacqu01
    this->basic_text_oprimitive<std::ostream>::save_binary(
113 2486 sjacqu01
    #else
114 2486 sjacqu01
    this->basic_text_oprimitive::save_binary(
115 2486 sjacqu01
    #endif
116 2486 sjacqu01
        address,
117 2486 sjacqu01
        count
118 2486 sjacqu01
    );
119 2486 sjacqu01
    this->delimiter = this->eol;
120 2486 sjacqu01
}
121 2486 sjacqu01
122 2486 sjacqu01
} // namespace archive
123 2486 sjacqu01
} // namespace boost