File indexing completed on 2025-01-18 09:28:28
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include <string>
0012 #include <boost/config.hpp>
0013 #include <cstddef> // size_t
0014
0015 #include <boost/config.hpp>
0016 #if defined(BOOST_NO_STDC_NAMESPACE)
0017 namespace std{
0018 using ::size_t;
0019 }
0020 #endif
0021
0022 #ifndef BOOST_NO_CWCHAR
0023 #include <cwchar>
0024 #ifdef BOOST_NO_STDC_NAMESPACE
0025 namespace std{ using ::wcslen; }
0026 #endif
0027 #endif
0028
0029 #include <boost/archive/text_oarchive.hpp>
0030
0031 namespace boost {
0032 namespace archive {
0033
0034
0035
0036
0037
0038 template<class Archive>
0039 BOOST_ARCHIVE_DECL void
0040 text_oarchive_impl<Archive>::save(const char * s)
0041 {
0042 const std::size_t len = std::ostream::traits_type::length(s);
0043 *this->This() << len;
0044 this->This()->newtoken();
0045 os << s;
0046 }
0047
0048 template<class Archive>
0049 BOOST_ARCHIVE_DECL void
0050 text_oarchive_impl<Archive>::save(const std::string &s)
0051 {
0052 const std::size_t size = s.size();
0053 *this->This() << size;
0054 this->This()->newtoken();
0055 os << s;
0056 }
0057
0058 #ifndef BOOST_NO_CWCHAR
0059 #ifndef BOOST_NO_INTRINSIC_WCHAR_T
0060 template<class Archive>
0061 BOOST_ARCHIVE_DECL void
0062 text_oarchive_impl<Archive>::save(const wchar_t * ws)
0063 {
0064 const std::size_t l = std::wcslen(ws);
0065 * this->This() << l;
0066 this->This()->newtoken();
0067 os.write((const char *)ws, l * sizeof(wchar_t)/sizeof(char));
0068 }
0069 #endif
0070
0071 #ifndef BOOST_NO_STD_WSTRING
0072 template<class Archive>
0073 BOOST_ARCHIVE_DECL void
0074 text_oarchive_impl<Archive>::save(const std::wstring &ws)
0075 {
0076 const std::size_t l = ws.size();
0077 * this->This() << l;
0078 this->This()->newtoken();
0079 os.write((const char *)(ws.data()), l * sizeof(wchar_t)/sizeof(char));
0080 }
0081 #endif
0082 #endif
0083
0084 template<class Archive>
0085 BOOST_ARCHIVE_DECL
0086 text_oarchive_impl<Archive>::text_oarchive_impl(
0087 std::ostream & os,
0088 unsigned int flags
0089 ) :
0090 basic_text_oprimitive<std::ostream>(
0091 os,
0092 0 != (flags & no_codecvt)
0093 ),
0094 basic_text_oarchive<Archive>(flags)
0095 {
0096 }
0097
0098 template<class Archive>
0099 BOOST_ARCHIVE_DECL void
0100 text_oarchive_impl<Archive>::save_binary(const void *address, std::size_t count){
0101 put('\n');
0102 this->end_preamble();
0103 #if ! defined(__MWERKS__)
0104 this->basic_text_oprimitive<std::ostream>::save_binary(
0105 #else
0106 this->basic_text_oprimitive::save_binary(
0107 #endif
0108 address,
0109 count
0110 );
0111 this->delimiter = this->eol;
0112 }
0113
0114 }
0115 }
0116