binary_iarchive.hpp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #ifndef BOOST_ARCHIVE_BINARY_IARCHIVE_HPP
  2. #define BOOST_ARCHIVE_BINARY_IARCHIVE_HPP
  3. // MS compatible compilers support #pragma once
  4. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  5. # pragma once
  6. #endif
  7. /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
  8. // binary_iarchive.hpp
  9. // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
  10. // Use, modification and distribution is subject to the Boost Software
  11. // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  12. // http://www.boost.org/LICENSE_1_0.txt)
  13. // See http://www.boost.org for updates, documentation, and revision history.
  14. #include <istream>
  15. #include <boost/archive/binary_iarchive_impl.hpp>
  16. #include <boost/archive/detail/register_archive.hpp>
  17. #ifdef BOOST_MSVC
  18. # pragma warning(push)
  19. # pragma warning(disable : 4511 4512)
  20. #endif
  21. namespace boost {
  22. namespace archive {
  23. // do not derive from the classes below. If you want to extend this functionality
  24. // via inhertance, derived from text_iarchive_impl instead. This will
  25. // preserve correct static polymorphism.
  26. // same as binary_iarchive below - without the shared_ptr_helper
  27. class naked_binary_iarchive :
  28. public binary_iarchive_impl<
  29. boost::archive::naked_binary_iarchive,
  30. std::istream::char_type,
  31. std::istream::traits_type
  32. >
  33. {
  34. public:
  35. naked_binary_iarchive(std::istream & is, unsigned int flags = 0) :
  36. binary_iarchive_impl<
  37. naked_binary_iarchive, std::istream::char_type, std::istream::traits_type
  38. >(is, flags)
  39. {}
  40. naked_binary_iarchive(std::streambuf & bsb, unsigned int flags = 0) :
  41. binary_iarchive_impl<
  42. naked_binary_iarchive, std::istream::char_type, std::istream::traits_type
  43. >(bsb, flags)
  44. {}
  45. };
  46. } // namespace archive
  47. } // namespace boost
  48. // note special treatment of shared_ptr. This type needs a special
  49. // structure associated with every archive. We created a "mix-in"
  50. // class to provide this functionality. Since shared_ptr holds a
  51. // special esteem in the boost library - we included it here by default.
  52. #include <boost/archive/shared_ptr_helper.hpp>
  53. namespace boost {
  54. namespace archive {
  55. // do not derive from this class. If you want to extend this functionality
  56. // via inhertance, derived from binary_iarchive_impl instead. This will
  57. // preserve correct static polymorphism.
  58. class binary_iarchive :
  59. public binary_iarchive_impl<
  60. boost::archive::binary_iarchive,
  61. std::istream::char_type,
  62. std::istream::traits_type
  63. >,
  64. public detail::shared_ptr_helper
  65. {
  66. public:
  67. binary_iarchive(std::istream & is, unsigned int flags = 0) :
  68. binary_iarchive_impl<
  69. binary_iarchive, std::istream::char_type, std::istream::traits_type
  70. >(is, flags)
  71. {}
  72. binary_iarchive(std::streambuf & bsb, unsigned int flags = 0) :
  73. binary_iarchive_impl<
  74. binary_iarchive, std::istream::char_type, std::istream::traits_type
  75. >(bsb, flags)
  76. {}
  77. };
  78. } // namespace archive
  79. } // namespace boost
  80. // required by export
  81. BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::binary_iarchive)
  82. BOOST_SERIALIZATION_USE_ARRAY_OPTIMIZATION(boost::archive::binary_iarchive)
  83. #ifdef BOOST_MSVC
  84. #pragma warning(pop)
  85. #endif
  86. #endif // BOOST_ARCHIVE_BINARY_IARCHIVE_HPP