1 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
2 // basic_xml_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.
11 #include <boost/assert.hpp>
12 #include <cstddef> // NULL
15 #include <boost/serialization/throw_exception.hpp>
16 #include <boost/archive/xml_archive_exception.hpp>
17 #include <boost/archive/basic_xml_iarchive.hpp>
18 #include <boost/serialization/tracking.hpp>
23 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
24 // implementation of xml_text_archive
26 template<class Archive>
27 BOOST_ARCHIVE_OR_WARCHIVE_DECL void
28 basic_xml_iarchive<Archive>::load_start(const char *name){
32 bool result = this->This()->gimpl->parse_start_tag(this->This()->get_is());
34 boost::serialization::throw_exception(
35 archive_exception(archive_exception::input_stream_error)
38 // don't check start tag at highest level
43 template<class Archive>
44 BOOST_ARCHIVE_OR_WARCHIVE_DECL void
45 basic_xml_iarchive<Archive>::load_end(const char *name){
49 bool result = this->This()->gimpl->parse_end_tag(this->This()->get_is());
51 boost::serialization::throw_exception(
52 archive_exception(archive_exception::input_stream_error)
56 // don't check start tag at highest level
60 if(0 == (this->get_flags() & no_xml_tag_checking)){
61 // double check that the tag matches what is expected - useful for debug
62 if(0 != name[this->This()->gimpl->rv.object_name.size()]
64 this->This()->gimpl->rv.object_name.begin(),
65 this->This()->gimpl->rv.object_name.end(),
69 boost::serialization::throw_exception(
70 xml_archive_exception(
71 xml_archive_exception::xml_archive_tag_mismatch,
79 template<class Archive>
80 BOOST_ARCHIVE_OR_WARCHIVE_DECL void
81 basic_xml_iarchive<Archive>::load_override(object_id_type & t){
82 t = object_id_type(this->This()->gimpl->rv.object_id);
85 template<class Archive>
86 BOOST_ARCHIVE_OR_WARCHIVE_DECL void
87 basic_xml_iarchive<Archive>::load_override(version_type & t){
88 t = version_type(this->This()->gimpl->rv.version);
91 template<class Archive>
92 BOOST_ARCHIVE_OR_WARCHIVE_DECL void
93 basic_xml_iarchive<Archive>::load_override(class_id_type & t){
94 t = class_id_type(this->This()->gimpl->rv.class_id);
97 template<class Archive>
98 BOOST_ARCHIVE_OR_WARCHIVE_DECL void
99 basic_xml_iarchive<Archive>::load_override(tracking_type & t){
100 t = this->This()->gimpl->rv.tracking_level;
103 template<class Archive>
104 BOOST_ARCHIVE_OR_WARCHIVE_DECL
105 basic_xml_iarchive<Archive>::basic_xml_iarchive(unsigned int flags) :
106 detail::common_iarchive<Archive>(flags),
109 template<class Archive>
110 BOOST_ARCHIVE_OR_WARCHIVE_DECL
111 basic_xml_iarchive<Archive>::~basic_xml_iarchive(){
114 } // namespace archive