Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:28:28

0001 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
0002 // text_woarchive_impl.ipp:
0003 
0004 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
0005 // Distributed under the Boost Software License, Version 1.0. (See
0006 // accompanying file LICENSE_1_0.txt or copy at
0007 // http://www.boost.org/LICENSE_1_0.txt)
0008 
0009 //  See http://www.boost.org for updates, documentation, and revision history.
0010 
0011 #include <boost/config.hpp>
0012 #ifndef BOOST_NO_STD_WSTREAMBUF
0013 
0014 #include <cstring>
0015 #include <cstddef> // size_t
0016 #if defined(BOOST_NO_STDC_NAMESPACE) && ! defined(__LIBCOMO__)
0017 namespace std{ 
0018     using ::strlen;
0019     using ::size_t; 
0020 } // namespace std
0021 #endif
0022 
0023 #include <ostream>
0024 
0025 #include <boost/archive/text_woarchive.hpp>
0026 
0027 namespace boost {
0028 namespace archive {
0029 
0030 //////////////////////////////////////////////////////////////////////
0031 // implementation of woarchive functions
0032 //
0033 template<class Archive>
0034 BOOST_WARCHIVE_DECL void
0035 text_woarchive_impl<Archive>::save(const char *s)
0036 {
0037     // note: superfluous local variable fixes borland warning
0038     const std::size_t size = std::strlen(s);
0039     * this->This() << size;
0040     this->This()->newtoken();
0041     while(*s != '\0')
0042         os.put(os.widen(*s++));
0043 }
0044 
0045 template<class Archive>
0046 BOOST_WARCHIVE_DECL void
0047 text_woarchive_impl<Archive>::save(const std::string &s)
0048 {
0049     const std::size_t size = s.size();
0050     * this->This() << size;
0051     this->This()->newtoken();
0052     const char * cptr = s.data();
0053     for(std::size_t i = size; i-- > 0;)
0054         os.put(os.widen(*cptr++));
0055 }
0056 
0057 #ifndef BOOST_NO_INTRINSIC_WCHAR_T
0058 template<class Archive>
0059 BOOST_WARCHIVE_DECL void
0060 text_woarchive_impl<Archive>::save(const wchar_t *ws)
0061 {
0062     const std::size_t size = std::wostream::traits_type::length(ws);
0063     * this->This() << size;
0064     this->This()->newtoken();
0065     os.write(ws, size);
0066 }
0067 #endif
0068 
0069 #ifndef BOOST_NO_STD_WSTRING
0070 template<class Archive>
0071 BOOST_WARCHIVE_DECL void
0072 text_woarchive_impl<Archive>::save(const std::wstring &ws)
0073 {
0074     const std::size_t size = ws.length();
0075     * this->This() << size;
0076     this->This()->newtoken();
0077     os.write(ws.data(), size);
0078 }
0079 #endif
0080 
0081 } // namespace archive
0082 } // namespace boost
0083 
0084 #endif
0085