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_iarchive_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 //////////////////////////////////////////////////////////////////////
0012 // implementation of basic_text_iprimitive overrides for the combination
0013 // of template parameters used to implement a text_iprimitive
0014 
0015 #include <cstddef> // size_t, NULL
0016 #include <boost/config.hpp>
0017 #if defined(BOOST_NO_STDC_NAMESPACE)
0018 namespace std{ 
0019     using ::size_t; 
0020 } // namespace std
0021 #endif
0022 
0023 #include <boost/detail/workaround.hpp> // RogueWave
0024 
0025 #include <boost/archive/text_iarchive.hpp>
0026 
0027 namespace boost {
0028 namespace archive {
0029 
0030 template<class Archive>
0031 BOOST_ARCHIVE_DECL void
0032 text_iarchive_impl<Archive>::load(char *s)
0033 {
0034     std::size_t size;
0035     * this->This() >> size;
0036     // skip separating space
0037     is.get();
0038     // Works on all tested platforms
0039     is.read(s, size);
0040     s[size] = '\0';
0041 }
0042 
0043 template<class Archive>
0044 BOOST_ARCHIVE_DECL void
0045 text_iarchive_impl<Archive>::load(std::string &s)
0046 {
0047     std::size_t size;
0048     * this->This() >> size;
0049     // skip separating space
0050     is.get();
0051     // borland de-allocator fixup
0052     #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101))
0053     if(NULL != s.data())
0054     #endif
0055         s.resize(size);
0056     if(0 < size)
0057         is.read(&(*s.begin()), size);
0058 }
0059 
0060 #ifndef BOOST_NO_CWCHAR
0061 #ifndef BOOST_NO_INTRINSIC_WCHAR_T
0062 template<class Archive>
0063 BOOST_ARCHIVE_DECL void
0064 text_iarchive_impl<Archive>::load(wchar_t *ws)
0065 {
0066     std::size_t size;
0067     * this->This() >> size;
0068     // skip separating space
0069     is.get();
0070     is.read((char *)ws, size * sizeof(wchar_t)/sizeof(char));
0071     ws[size] = L'\0';
0072 }
0073 #endif // BOOST_NO_INTRINSIC_WCHAR_T
0074 
0075 #ifndef BOOST_NO_STD_WSTRING
0076 template<class Archive>
0077 BOOST_ARCHIVE_DECL void
0078 text_iarchive_impl<Archive>::load(std::wstring &ws)
0079 {
0080     std::size_t size;
0081     * this->This() >> size;
0082     // borland de-allocator fixup
0083     #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101))
0084     if(NULL != ws.data())
0085     #endif
0086         ws.resize(size);
0087     // skip separating space
0088     is.get();
0089     is.read((char *)ws.data(), size * sizeof(wchar_t)/sizeof(char));
0090 }
0091 
0092 #endif // BOOST_NO_STD_WSTRING
0093 #endif // BOOST_NO_CWCHAR
0094 
0095 template<class Archive>
0096 BOOST_ARCHIVE_DECL void
0097 text_iarchive_impl<Archive>::load_override(class_name_type & t){
0098     basic_text_iarchive<Archive>::load_override(t);
0099 }
0100 
0101 template<class Archive>
0102 BOOST_ARCHIVE_DECL void
0103 text_iarchive_impl<Archive>::init(){
0104     basic_text_iarchive<Archive>::init();
0105 }
0106 
0107 template<class Archive>
0108 BOOST_ARCHIVE_DECL 
0109 text_iarchive_impl<Archive>::text_iarchive_impl(
0110     std::istream & is, 
0111     unsigned int flags
0112 ) :
0113     basic_text_iprimitive<std::istream>(
0114         is, 
0115         0 != (flags & no_codecvt)
0116     ),
0117     basic_text_iarchive<Archive>(flags)
0118 {}
0119 
0120 } // namespace archive
0121 } // namespace boost