binary_wiarchive.hpp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #ifndef BOOST_ARCHIVE_BINARY_WIARCHIVE_HPP
  2. #define BOOST_ARCHIVE_BINARY_WIARCHIVE_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_wiarchive.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 <boost/config.hpp>
  15. #ifdef BOOST_NO_STD_WSTREAMBUF
  16. #error "wide char i/o not supported on this platform"
  17. #else
  18. #include <istream> // wistream
  19. #include <boost/archive/binary_iarchive_impl.hpp>
  20. #include <boost/archive/detail/register_archive.hpp>
  21. namespace boost {
  22. namespace archive {
  23. // same as binary_wiarchive below - without the shared_ptr_helper
  24. class naked_binary_wiarchive :
  25. public binary_iarchive_impl<
  26. boost::archive::naked_binary_wiarchive,
  27. std::wistream::char_type,
  28. std::wistream::traits_type
  29. >
  30. {
  31. public:
  32. naked_binary_wiarchive(std::wistream & is, unsigned int flags = 0) :
  33. binary_iarchive_impl<
  34. naked_binary_wiarchive,
  35. std::wistream::char_type,
  36. std::wistream::traits_type
  37. >(is, flags)
  38. {}
  39. naked_binary_wiarchive(std::wstreambuf & bsb, unsigned int flags = 0) :
  40. binary_iarchive_impl<
  41. naked_binary_wiarchive,
  42. std::wistream::char_type,
  43. std::wistream::traits_type
  44. >(bsb, flags)
  45. {}
  46. };
  47. } // namespace archive
  48. } // namespace boost
  49. // note special treatment of shared_ptr. This type needs a special
  50. // structure associated with every archive. We created a "mix-in"
  51. // class to provide this functionality. Since shared_ptr holds a
  52. // special esteem in the boost library - we included it here by default.
  53. #include <boost/archive/shared_ptr_helper.hpp>
  54. namespace boost {
  55. namespace archive {
  56. class binary_wiarchive :
  57. public binary_iarchive_impl<
  58. binary_wiarchive, std::wistream::char_type, std::wistream::traits_type
  59. >
  60. {
  61. public:
  62. binary_wiarchive(std::wistream & is, unsigned int flags = 0) :
  63. binary_iarchive_impl<
  64. binary_wiarchive, std::wistream::char_type, std::wistream::traits_type
  65. >(is, flags)
  66. {}
  67. binary_wiarchive(std::wstreambuf & bsb, unsigned int flags = 0) :
  68. binary_iarchive_impl<
  69. binary_wiarchive, std::wistream::char_type, std::wistream::traits_type
  70. >(bsb, flags)
  71. {}
  72. };
  73. } // namespace archive
  74. } // namespace boost
  75. // required by export
  76. BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::binary_wiarchive)
  77. #endif // BOOST_NO_STD_WSTREAMBUF
  78. #endif // BOOST_ARCHIVE_BINARY_WIARCHIVE_HPP