123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- #include <cstddef> // size_t, NULL
- #include <boost/config.hpp>
- #if defined(BOOST_NO_STDC_NAMESPACE)
- namespace std{
- using ::size_t;
- }
- #endif
- #include <boost/detail/workaround.hpp> // fixup for RogueWave
- #ifndef BOOST_NO_STD_WSTREAMBUF
- #include <boost/archive/basic_text_iprimitive.hpp>
- namespace boost {
- namespace archive {
- template<class Archive>
- BOOST_WARCHIVE_DECL void
- text_wiarchive_impl<Archive>::load(char *s)
- {
- std::size_t size;
- * this->This() >> size;
-
- is.get();
- while(size-- > 0){
- *s++ = is.narrow(is.get(), '\0');
- }
- *s = '\0';
- }
- template<class Archive>
- BOOST_WARCHIVE_DECL void
- text_wiarchive_impl<Archive>::load(std::string &s)
- {
- std::size_t size;
- * this->This() >> size;
-
- is.get();
- #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101))
- if(NULL != s.data())
- #endif
- s.resize(0);
- s.reserve(size);
- while(size-- > 0){
- char x = is.narrow(is.get(), '\0');
- s += x;
- }
- }
- #ifndef BOOST_NO_INTRINSIC_WCHAR_T
- template<class Archive>
- BOOST_WARCHIVE_DECL void
- text_wiarchive_impl<Archive>::load(wchar_t *s)
- {
- std::size_t size;
- * this->This() >> size;
-
- is.get();
-
- is.read(s, size);
- s[size] = L'\0';
- }
- #endif
- #ifndef BOOST_NO_STD_WSTRING
- template<class Archive>
- BOOST_WARCHIVE_DECL void
- text_wiarchive_impl<Archive>::load(std::wstring &ws)
- {
- std::size_t size;
- * this->This() >> size;
-
- is.get();
-
-
- #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101))
- if(NULL != ws.data())
- #endif
- ws.resize(size);
-
- is.read(const_cast<wchar_t *>(ws.data()), size);
- }
- #endif
- template<class Archive>
- BOOST_WARCHIVE_DECL
- text_wiarchive_impl<Archive>::text_wiarchive_impl(
- std::wistream & is,
- unsigned int flags
- ) :
- basic_text_iprimitive<std::wistream>(
- is,
- 0 != (flags & no_codecvt)
- ),
- basic_text_iarchive<Archive>(flags)
- {
- }
- }
- }
- #endif
|