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 // basic_text_iarchive.ipp:
0003 
0004 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . 
0005 // Use, modification and distribution is subject to the Boost Software
0006 // License, Version 1.0. (See 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 #include <string>
0011 #include <algorithm>
0012 #include <cstring>
0013 
0014 #include <boost/config.hpp>
0015 #if defined(BOOST_NO_STDC_NAMESPACE)
0016 namespace std{ 
0017     using ::memcpy; 
0018 }
0019 #endif
0020 
0021 #include <boost/detail/workaround.hpp>
0022 #include <boost/serialization/string.hpp>
0023 #include <boost/archive/basic_text_iarchive.hpp>
0024 
0025 namespace boost {
0026 namespace archive {
0027 
0028 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
0029 // implementation of text_text_archive
0030 
0031 template<class Archive>
0032 BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0033 basic_text_iarchive<Archive>::load_override(class_name_type & t){
0034     std::string cn;
0035     cn.reserve(BOOST_SERIALIZATION_MAX_KEY_SIZE);
0036     load_override(cn);
0037     if(cn.size() > (BOOST_SERIALIZATION_MAX_KEY_SIZE - 1))
0038         boost::serialization::throw_exception(
0039             archive_exception(archive_exception::invalid_class_name)
0040         );
0041     std::memcpy(t, cn.data(), cn.size());
0042     // borland tweak
0043     t.t[cn.size()] = '\0';
0044 }
0045 
0046 template<class Archive>
0047 BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0048 basic_text_iarchive<Archive>::init() {
0049     // read signature in an archive version independent manner
0050     std::string file_signature;
0051     * this->This() >> file_signature;
0052     if(file_signature != BOOST_ARCHIVE_SIGNATURE())
0053         boost::serialization::throw_exception(
0054             archive_exception(archive_exception::invalid_signature)
0055         );
0056 
0057     // make sure the version of the reading archive library can
0058     // support the format of the archive being read
0059     boost::serialization::library_version_type input_library_version;
0060     * this->This() >> input_library_version;
0061 
0062     #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205))
0063     this->set_library_version(input_library_version);
0064     #else
0065     detail::basic_iarchive::set_library_version(input_library_version);
0066     #endif
0067 
0068     // extra little .t is to get around borland quirk
0069     if(BOOST_ARCHIVE_VERSION() < input_library_version)
0070         boost::serialization::throw_exception(
0071             archive_exception(archive_exception::unsupported_version)
0072         );
0073 }
0074 
0075 } // namespace archive
0076 } // namespace boost