void portable_binary_oarchive::init(util::binary_filter* filter, unsigned int flags_) { if ((this->flags() & (endian_big | endian_little)) == (endian_big | endian_little)) { // bail out if both flags are specified BOOST_THROW_EXCEPTION( portable_binary_oarchive_exception()); } if (!(flags_ & boost::archive::no_header)) { // write signature in an archive version independent manner const std::string file_signature( boost::archive::BOOST_ARCHIVE_SIGNATURE()); *this << file_signature; // write library version const boost::archive::version_type v( boost::archive::BOOST_ARCHIVE_VERSION()); *this << v; } save(static_cast<boost::uint16_t>(this->flags() >> CHAR_BIT)); // handle filter and compression in the archive separately bool has_filter = filter != 0; save(has_filter); if (has_filter && (this->flags() & enable_compression)) { *this << filter; this->set_filter(filter); } }
void portable_binary_oarchive::init(unsigned int flags) { if(m_flags == (endian_big | endian_little)){ boost::serialization::throw_exception( portable_binary_oarchive_exception() ); } if(0 == (flags & boost::archive::no_header)){ // write signature in an archive version independent manner const std::string file_signature( boost::archive::BOOST_ARCHIVE_SIGNATURE() ); * this << file_signature; // write library version const boost::archive::library_version_type v( boost::archive::BOOST_ARCHIVE_VERSION() ); * this << v; } save(static_cast<unsigned char>(m_flags >> CHAR_BIT)); }