Chris@16: /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 Chris@16: // basic_xml_iarchive.ipp: Chris@16: Chris@16: // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . Chris@16: // Use, modification and distribution is subject to the Boost Software Chris@16: // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: // See http://www.boost.org for updates, documentation, and revision history. Chris@16: Chris@16: #include Chris@16: #include // NULL Chris@16: #include Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: namespace boost { Chris@16: namespace archive { Chris@16: Chris@16: /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 Chris@16: // implementation of xml_text_archive Chris@16: Chris@16: template Chris@16: BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) Chris@16: basic_xml_iarchive::load_start(const char *name){ Chris@16: // if there's no name Chris@16: if(NULL == name) Chris@16: return; Chris@16: bool result = this->This()->gimpl->parse_start_tag(this->This()->get_is()); Chris@16: if(true != result){ Chris@16: boost::serialization::throw_exception( Chris@16: archive_exception(archive_exception::input_stream_error) Chris@16: ); Chris@16: } Chris@16: // don't check start tag at highest level Chris@16: ++depth; Chris@16: return; Chris@16: } Chris@16: Chris@16: template Chris@16: BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) Chris@16: basic_xml_iarchive::load_end(const char *name){ Chris@16: // if there's no name Chris@16: if(NULL == name) Chris@16: return; Chris@16: bool result = this->This()->gimpl->parse_end_tag(this->This()->get_is()); Chris@16: if(true != result){ Chris@16: boost::serialization::throw_exception( Chris@16: archive_exception(archive_exception::input_stream_error) Chris@16: ); Chris@16: } Chris@16: Chris@16: // don't check start tag at highest level Chris@16: if(0 == --depth) Chris@16: return; Chris@16: Chris@16: if(0 == (this->get_flags() & no_xml_tag_checking)){ Chris@16: // double check that the tag matches what is expected - useful for debug Chris@16: if(0 != name[this->This()->gimpl->rv.object_name.size()] Chris@16: || ! std::equal( Chris@16: this->This()->gimpl->rv.object_name.begin(), Chris@16: this->This()->gimpl->rv.object_name.end(), Chris@16: name Chris@16: ) Chris@16: ){ Chris@16: boost::serialization::throw_exception( Chris@16: xml_archive_exception( Chris@16: xml_archive_exception::xml_archive_tag_mismatch, Chris@16: name Chris@16: ) Chris@16: ); Chris@16: } Chris@16: } Chris@16: } Chris@16: Chris@16: template Chris@16: BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) Chris@16: basic_xml_iarchive::load_override(object_id_type & t, int){ Chris@16: t = object_id_type(this->This()->gimpl->rv.object_id); Chris@16: } Chris@16: Chris@16: template Chris@16: BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) Chris@16: basic_xml_iarchive::load_override(version_type & t, int){ Chris@16: t = version_type(this->This()->gimpl->rv.version); Chris@16: } Chris@16: Chris@16: template Chris@16: BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) Chris@16: basic_xml_iarchive::load_override(class_id_type & t, int){ Chris@16: t = class_id_type(this->This()->gimpl->rv.class_id); Chris@16: } Chris@16: Chris@16: template Chris@16: BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) Chris@16: basic_xml_iarchive::load_override(tracking_type & t, int){ Chris@16: t = this->This()->gimpl->rv.tracking_level; Chris@16: } Chris@16: Chris@16: template Chris@16: BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) Chris@16: basic_xml_iarchive::basic_xml_iarchive(unsigned int flags) : Chris@16: detail::common_iarchive(flags), Chris@16: depth(0) Chris@16: {} Chris@16: template Chris@16: BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) Chris@16: basic_xml_iarchive::~basic_xml_iarchive(){} Chris@16: Chris@16: } // namespace archive Chris@16: } // namespace boost