binary_iarchive_impl.hpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #ifndef BOOST_ARCHIVE_BINARY_IARCHIVE_IMPL_HPP
  2. #define BOOST_ARCHIVE_BINARY_IARCHIVE_IMPL_HPP
  3. // MS compatible compilers support #pragma once
  4. #if defined(_MSC_VER)
  5. # pragma once
  6. #endif
  7. /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
  8. // binary_iarchive_impl.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/basic_binary_iprimitive.hpp>
  16. #include <boost/archive/basic_binary_iarchive.hpp>
  17. #ifdef BOOST_MSVC
  18. # pragma warning(push)
  19. # pragma warning(disable : 4511 4512)
  20. #endif
  21. namespace boost {
  22. namespace archive {
  23. namespace detail {
  24. template<class Archive> class interface_iarchive;
  25. } // namespace detail
  26. template<class Archive, class Elem, class Tr>
  27. class BOOST_SYMBOL_VISIBLE binary_iarchive_impl :
  28. public basic_binary_iprimitive<Archive, Elem, Tr>,
  29. public basic_binary_iarchive<Archive>
  30. {
  31. #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
  32. public:
  33. #else
  34. protected:
  35. #if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
  36. // for some inexplicable reason insertion of "class" generates compile erro
  37. // on msvc 7.1
  38. friend detail::interface_iarchive<Archive>;
  39. friend basic_binary_iarchive<Archive>;
  40. friend load_access;
  41. #else
  42. friend class detail::interface_iarchive<Archive>;
  43. friend class basic_binary_iarchive<Archive>;
  44. friend class load_access;
  45. #endif
  46. #endif
  47. template<class T>
  48. void load_override(T & t){
  49. this->basic_binary_iarchive<Archive>::load_override(t);
  50. }
  51. void init(unsigned int flags){
  52. if(0 != (flags & no_header)){
  53. return;
  54. }
  55. #if ! defined(__MWERKS__)
  56. this->basic_binary_iarchive<Archive>::init();
  57. this->basic_binary_iprimitive<Archive, Elem, Tr>::init();
  58. #else
  59. basic_binary_iarchive<Archive>::init();
  60. basic_binary_iprimitive<Archive, Elem, Tr>::init();
  61. #endif
  62. }
  63. binary_iarchive_impl(
  64. std::basic_streambuf<Elem, Tr> & bsb,
  65. unsigned int flags
  66. ) :
  67. basic_binary_iprimitive<Archive, Elem, Tr>(
  68. bsb,
  69. 0 != (flags & no_codecvt)
  70. ),
  71. basic_binary_iarchive<Archive>(flags)
  72. {}
  73. binary_iarchive_impl(
  74. std::basic_istream<Elem, Tr> & is,
  75. unsigned int flags
  76. ) :
  77. basic_binary_iprimitive<Archive, Elem, Tr>(
  78. * is.rdbuf(),
  79. 0 != (flags & no_codecvt)
  80. ),
  81. basic_binary_iarchive<Archive>(flags)
  82. {}
  83. };
  84. } // namespace archive
  85. } // namespace boost
  86. #ifdef BOOST_MSVC
  87. #pragma warning(pop)
  88. #endif
  89. #endif // BOOST_ARCHIVE_BINARY_IARCHIVE_IMPL_HPP