File indexing completed on 2025-01-18 09:28:28
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include <cstddef> // size_t, NULL
0012
0013 #include <boost/config.hpp>
0014 #if defined(BOOST_NO_STDC_NAMESPACE)
0015 namespace std{
0016 using ::size_t;
0017 }
0018 #endif
0019
0020 #include <boost/detail/workaround.hpp> // fixup for RogueWave
0021
0022 #ifndef BOOST_NO_STD_WSTREAMBUF
0023 #include <boost/archive/basic_text_iprimitive.hpp>
0024
0025 namespace boost {
0026 namespace archive {
0027
0028
0029
0030
0031 template<class Archive>
0032 BOOST_WARCHIVE_DECL void
0033 text_wiarchive_impl<Archive>::load(char *s)
0034 {
0035 std::size_t size;
0036 * this->This() >> size;
0037
0038 is.get();
0039 while(size-- > 0){
0040 *s++ = is.narrow(is.get(), '\0');
0041 }
0042 *s = '\0';
0043 }
0044
0045 template<class Archive>
0046 BOOST_WARCHIVE_DECL void
0047 text_wiarchive_impl<Archive>::load(std::string &s)
0048 {
0049 std::size_t size;
0050 * this->This() >> size;
0051
0052 is.get();
0053 #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101))
0054 if(NULL != s.data())
0055 #endif
0056 s.resize(0);
0057 s.reserve(size);
0058 while(size-- > 0){
0059 char x = is.narrow(is.get(), '\0');
0060 s += x;
0061 }
0062 }
0063
0064 #ifndef BOOST_NO_INTRINSIC_WCHAR_T
0065 template<class Archive>
0066 BOOST_WARCHIVE_DECL void
0067 text_wiarchive_impl<Archive>::load(wchar_t *s)
0068 {
0069 std::size_t size;
0070 * this->This() >> size;
0071
0072 is.get();
0073
0074 is.read(s, size);
0075 s[size] = L'\0';
0076 }
0077 #endif
0078
0079 #ifndef BOOST_NO_STD_WSTRING
0080 template<class Archive>
0081 BOOST_WARCHIVE_DECL void
0082 text_wiarchive_impl<Archive>::load(std::wstring &ws)
0083 {
0084 std::size_t size;
0085 * this->This() >> size;
0086
0087 is.get();
0088
0089
0090 #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101))
0091 if(NULL != ws.data())
0092 #endif
0093 ws.resize(size);
0094
0095 is.read(const_cast<wchar_t *>(ws.data()), size);
0096 }
0097 #endif
0098
0099 template<class Archive>
0100 BOOST_WARCHIVE_DECL
0101 text_wiarchive_impl<Archive>::text_wiarchive_impl(
0102 std::wistream & is,
0103 unsigned int flags
0104 ) :
0105 basic_text_iprimitive<std::wistream>(
0106 is,
0107 0 != (flags & no_codecvt)
0108 ),
0109 basic_text_iarchive<Archive>(flags)
0110 {
0111 }
0112
0113 }
0114 }
0115
0116 #endif