1 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
\r
2 // basic_text_oprimitive.ipp:
\r
4 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
\r
5 // Use, modification and distribution is subject to the Boost Software
\r
6 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
\r
7 // http://www.boost.org/LICENSE_1_0.txt)
\r
9 // See http://www.boost.org for updates, documentation, and revision history.
\r
11 #include <cstddef> // NULL
\r
12 #include <boost/serialization/pfto.hpp>
\r
14 #include <boost/archive/basic_text_oprimitive.hpp>
\r
15 #include <boost/archive/codecvt_null.hpp>
\r
16 #include <boost/archive/add_facet.hpp>
\r
18 #include <boost/archive/iterators/base64_from_binary.hpp>
\r
19 #include <boost/archive/iterators/insert_linebreaks.hpp>
\r
20 #include <boost/archive/iterators/transform_width.hpp>
\r
21 #include <boost/archive/iterators/ostream_iterator.hpp>
\r
26 // translate to base64 and copy in to buffer.
\r
27 template<class OStream>
\r
28 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
\r
29 basic_text_oprimitive<OStream>::save_binary(
\r
30 const void *address,
\r
33 typedef BOOST_DEDUCED_TYPENAME OStream::char_type CharType;
\r
39 boost::serialization::throw_exception(
\r
40 archive_exception(archive_exception::output_stream_error)
\r
46 boost::archive::iterators::insert_linebreaks<
\r
47 boost::archive::iterators::base64_from_binary<
\r
48 boost::archive::iterators::transform_width<
\r
55 ,const char // cwpro8 needs this
\r
59 boost::archive::iterators::ostream_iterator<CharType> oi(os);
\r
61 base64_text(BOOST_MAKE_PFTO_WRAPPER(static_cast<const char *>(address))),
\r
63 BOOST_MAKE_PFTO_WRAPPER(static_cast<const char *>(address) + count)
\r
68 std::size_t tail = count % 3;
\r
76 template<class OStream>
\r
77 BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
\r
78 basic_text_oprimitive<OStream>::basic_text_oprimitive(
\r
82 #ifndef BOOST_NO_STD_LOCALE
\r
85 precision_saver(os_),
\r
86 archive_locale(NULL),
\r
87 locale_saver(* os_.rdbuf())
\r
90 archive_locale.reset(
\r
92 std::locale::classic(),
\r
93 new codecvt_null<BOOST_DEDUCED_TYPENAME OStream::char_type>
\r
96 os.imbue(* archive_locale);
\r
98 os << std::noboolalpha;
\r
103 precision_saver(os_)
\r
107 template<class OStream>
\r
108 BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
\r
109 basic_text_oprimitive<OStream>::~basic_text_oprimitive(){
\r
113 } //namespace boost
\r
114 } //namespace archive
\r