File indexing completed on 2025-01-18 09:28:28
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include <boost/assert.hpp>
0012 #include <cstddef> // NULL
0013 #include <cstring> // strlen
0014 #include <algorithm>
0015
0016 #include <boost/serialization/throw_exception.hpp>
0017 #include <boost/archive/xml_archive_exception.hpp>
0018 #include <boost/archive/basic_xml_iarchive.hpp>
0019 #include <boost/serialization/tracking.hpp>
0020
0021 namespace boost {
0022 namespace archive {
0023
0024
0025
0026
0027 template<class Archive>
0028 BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0029 basic_xml_iarchive<Archive>::load_start(const char *name){
0030
0031 if(NULL == name)
0032 return;
0033 bool result = this->This()->gimpl->parse_start_tag(this->This()->get_is());
0034 if(true != result){
0035 boost::serialization::throw_exception(
0036 archive_exception(archive_exception::input_stream_error)
0037 );
0038 }
0039
0040 ++depth;
0041 }
0042
0043 template<class Archive>
0044 BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0045 basic_xml_iarchive<Archive>::load_end(const char *name){
0046
0047 if(NULL == name)
0048 return;
0049 bool result = this->This()->gimpl->parse_end_tag(this->This()->get_is());
0050 if(true != result){
0051 boost::serialization::throw_exception(
0052 archive_exception(archive_exception::input_stream_error)
0053 );
0054 }
0055
0056
0057 if(0 == --depth)
0058 return;
0059
0060 if(0 == (this->get_flags() & no_xml_tag_checking)){
0061
0062 std::size_t parameter_name_length = std::strlen(name);
0063 std::size_t object_name_length = this->This()->gimpl->rv.object_name.size();
0064
0065 if(parameter_name_length != object_name_length
0066 || ! std::equal(
0067 this->This()->gimpl->rv.object_name.begin(),
0068 this->This()->gimpl->rv.object_name.end(),
0069 name
0070 )
0071 ){
0072 boost::serialization::throw_exception(
0073 xml_archive_exception(
0074 xml_archive_exception::xml_archive_tag_mismatch,
0075 name
0076 )
0077 );
0078 }
0079 }
0080 }
0081
0082 template<class Archive>
0083 BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0084 basic_xml_iarchive<Archive>::load_override(object_id_type & t){
0085 t = object_id_type(this->This()->gimpl->rv.object_id);
0086 }
0087
0088 template<class Archive>
0089 BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0090 basic_xml_iarchive<Archive>::load_override(version_type & t){
0091 t = version_type(this->This()->gimpl->rv.version);
0092 }
0093
0094 template<class Archive>
0095 BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0096 basic_xml_iarchive<Archive>::load_override(class_id_type & t){
0097 t = class_id_type(this->This()->gimpl->rv.class_id);
0098 }
0099
0100 template<class Archive>
0101 BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0102 basic_xml_iarchive<Archive>::load_override(tracking_type & t){
0103 t = this->This()->gimpl->rv.tracking_level;
0104 }
0105
0106 template<class Archive>
0107 BOOST_ARCHIVE_OR_WARCHIVE_DECL
0108 basic_xml_iarchive<Archive>::basic_xml_iarchive(unsigned int flags) :
0109 detail::common_iarchive<Archive>(flags),
0110 depth(0)
0111 {}
0112 template<class Archive>
0113 BOOST_ARCHIVE_OR_WARCHIVE_DECL
0114 basic_xml_iarchive<Archive>::~basic_xml_iarchive(){
0115 }
0116
0117 }
0118 }