Boost-Geometry-Utils
view release on metacpan or search on metacpan
src/boost/archive/impl/xml_wiarchive_impl.ipp view on Meta::CPAN
BOOST_WARCHIVE_DECL(void)
xml_wiarchive_impl<Archive>::load(char * s){
std::wstring ws;
bool result = gimpl->parse_string(is, ws);
if(! result)
boost::serialization::throw_exception(
xml_archive_exception(xml_archive_exception::xml_archive_parsing_error)
);
copy_to_ptr(s, ws);
}
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
template<class Archive>
BOOST_WARCHIVE_DECL(void)
xml_wiarchive_impl<Archive>::load(wchar_t * ws){
std::wstring twstring;
bool result = gimpl->parse_string(is, twstring);
if(! result)
boost::serialization::throw_exception(
xml_archive_exception(xml_archive_exception::xml_archive_parsing_error)
);
std::memcpy(ws, twstring.c_str(), twstring.size());
ws[twstring.size()] = L'\0';
}
#endif
template<class Archive>
BOOST_WARCHIVE_DECL(void)
xml_wiarchive_impl<Archive>::load_override(class_name_type & t, int){
const std::wstring & ws = gimpl->rv.class_name;
if(ws.size() > BOOST_SERIALIZATION_MAX_KEY_SIZE - 1)
boost::serialization::throw_exception(
archive_exception(archive_exception::invalid_class_name)
);
copy_to_ptr(t, ws);
}
template<class Archive>
BOOST_WARCHIVE_DECL(void)
xml_wiarchive_impl<Archive>::init(){
gimpl->init(is);
this->set_library_version(
library_version_type(gimpl->rv.version)
);
}
template<class Archive>
BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY())
xml_wiarchive_impl<Archive>::xml_wiarchive_impl(
std::wistream &is_,
unsigned int flags
) :
basic_text_iprimitive<std::wistream>(
is_,
true // don't change the codecvt - use the one below
),
basic_xml_iarchive<Archive>(flags),
gimpl(new xml_wgrammar())
{
if(0 == (flags & no_codecvt)){
archive_locale.reset(
add_facet(
std::locale::classic(),
new boost::archive::detail::utf8_codecvt_facet
)
);
is.imbue(* archive_locale);
}
if(0 == (flags & no_header)){
BOOST_TRY{
this->init();
}
BOOST_CATCH(...){
delete gimpl;
#ifndef BOOST_NO_EXCEPTIONS
throw; // re-throw
#endif
}
BOOST_CATCH_END
}
}
template<class Archive>
BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY())
xml_wiarchive_impl<Archive>::~xml_wiarchive_impl(){
if(0 == (this->get_flags() & no_header)){
BOOST_TRY{
gimpl->windup(is);
}
BOOST_CATCH(...){}
BOOST_CATCH_END
}
delete gimpl;
}
} // namespace archive
} // namespace boost
#endif // BOOST_NO_STD_WSTREAMBUF
( run in 1.369 second using v1.01-cache-2.11-cpan-ceb78f64989 )