1 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
2 // basic_text_iarchive.ipp:
4 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
5 // Use, modification and distribution is subject to the Boost Software
6 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 // See http://www.boost.org for updates, documentation, and revision history.
14 #include <boost/config.hpp>
15 #if defined(BOOST_NO_STDC_NAMESPACE)
21 #include <boost/detail/workaround.hpp>
22 #include <boost/serialization/string.hpp>
23 #include <boost/archive/basic_text_iarchive.hpp>
28 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
29 // implementation of text_text_archive
31 template<class Archive>
32 BOOST_ARCHIVE_OR_WARCHIVE_DECL void
33 basic_text_iarchive<Archive>::load_override(class_name_type & t){
35 cn.reserve(BOOST_SERIALIZATION_MAX_KEY_SIZE);
37 if(cn.size() > (BOOST_SERIALIZATION_MAX_KEY_SIZE - 1))
38 boost::serialization::throw_exception(
39 archive_exception(archive_exception::invalid_class_name)
41 std::memcpy(t, cn.data(), cn.size());
43 t.t[cn.size()] = '\0';
46 template<class Archive>
47 BOOST_ARCHIVE_OR_WARCHIVE_DECL void
48 basic_text_iarchive<Archive>::init(void){
49 // read signature in an archive version independent manner
50 std::string file_signature;
51 * this->This() >> file_signature;
52 if(file_signature != BOOST_ARCHIVE_SIGNATURE())
53 boost::serialization::throw_exception(
54 archive_exception(archive_exception::invalid_signature)
57 // make sure the version of the reading archive library can
58 // support the format of the archive being read
59 library_version_type input_library_version;
60 * this->This() >> input_library_version;
62 #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205))
63 this->set_library_version(input_library_version);
65 detail::basic_iarchive::set_library_version(input_library_version);
68 // extra little .t is to get around borland quirk
69 if(BOOST_ARCHIVE_VERSION() < input_library_version)
70 boost::serialization::throw_exception(
71 archive_exception(archive_exception::unsupported_version)
75 } // namespace archive