1 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
2 // basic_text_oprimitive.ipp:
4 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
5 // Use, modification and distribution is subject to the Boost Software
6 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 // See http://www.boost.org for updates, documentation, and revision history.
11 #include <cstddef> // NULL
12 #include <algorithm> // std::copy
13 #include <exception> // std::uncaught_exception
14 #include <boost/config.hpp>
15 #if defined(BOOST_NO_STDC_NAMESPACE)
21 #include <boost/archive/basic_text_oprimitive.hpp>
23 #include <boost/archive/iterators/base64_from_binary.hpp>
24 #include <boost/archive/iterators/insert_linebreaks.hpp>
25 #include <boost/archive/iterators/transform_width.hpp>
26 #include <boost/archive/iterators/ostream_iterator.hpp>
31 // translate to base64 and copy in to buffer.
32 template<class OStream>
33 BOOST_ARCHIVE_OR_WARCHIVE_DECL void
34 basic_text_oprimitive<OStream>::save_binary(
38 typedef typename OStream::char_type CharType;
44 boost::serialization::throw_exception(
45 archive_exception(archive_exception::output_stream_error)
51 boost::archive::iterators::insert_linebreaks<
52 boost::archive::iterators::base64_from_binary<
53 boost::archive::iterators::transform_width<
60 ,const char // cwpro8 needs this
64 boost::archive::iterators::ostream_iterator<CharType> oi(os);
66 base64_text(static_cast<const char *>(address)),
68 static_cast<const char *>(address) + count
73 std::size_t tail = count % 3;
81 template<class OStream>
82 BOOST_ARCHIVE_OR_WARCHIVE_DECL
83 basic_text_oprimitive<OStream>::basic_text_oprimitive(
90 #ifndef BOOST_NO_STD_LOCALE
91 codecvt_null_facet(1),
92 archive_locale(os.getloc(), & codecvt_null_facet),
97 os_.imbue(archive_locale);
99 os_ << std::noboolalpha;
106 template<class OStream>
107 BOOST_ARCHIVE_OR_WARCHIVE_DECL
108 basic_text_oprimitive<OStream>::~basic_text_oprimitive(){
109 if(std::uncaught_exception())
115 } //namespace archive