text_wiarchive.hpp 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. #ifndef BOOST_ARCHIVE_TEXT_WIARCHIVE_HPP
  2. #define BOOST_ARCHIVE_TEXT_WIARCHIVE_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. // text_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>
  19. #include <boost/archive/detail/auto_link_warchive.hpp>
  20. #include <boost/archive/basic_text_iprimitive.hpp>
  21. #include <boost/archive/basic_text_iarchive.hpp>
  22. #include <boost/archive/detail/register_archive.hpp>
  23. #include <boost/serialization/item_version_type.hpp>
  24. #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
  25. #ifdef BOOST_MSVC
  26. # pragma warning(push)
  27. # pragma warning(disable : 4511 4512)
  28. #endif
  29. namespace boost {
  30. namespace archive {
  31. namespace detail {
  32. template<class Archive> class interface_iarchive;
  33. } // namespace detail
  34. template<class Archive>
  35. class BOOST_SYMBOL_VISIBLE text_wiarchive_impl :
  36. public basic_text_iprimitive<std::wistream>,
  37. public basic_text_iarchive<Archive>
  38. {
  39. #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
  40. public:
  41. #else
  42. protected:
  43. #if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
  44. // for some inexplicable reason insertion of "class" generates compile erro
  45. // on msvc 7.1
  46. friend detail::interface_iarchive<Archive>;
  47. friend load_access;
  48. #else
  49. friend class detail::interface_iarchive<Archive>;
  50. friend class load_access;
  51. #endif
  52. #endif
  53. template<class T>
  54. void load(T & t){
  55. basic_text_iprimitive<std::wistream>::load(t);
  56. }
  57. void load(version_type & t){
  58. unsigned int v;
  59. load(v);
  60. t = version_type(v);
  61. }
  62. void load(boost::serialization::item_version_type & t){
  63. unsigned int v;
  64. load(v);
  65. t = boost::serialization::item_version_type(v);
  66. }
  67. BOOST_WARCHIVE_DECL void
  68. load(char * t);
  69. #ifndef BOOST_NO_INTRINSIC_WCHAR_T
  70. BOOST_WARCHIVE_DECL void
  71. load(wchar_t * t);
  72. #endif
  73. BOOST_WARCHIVE_DECL void
  74. load(std::string &s);
  75. #ifndef BOOST_NO_STD_WSTRING
  76. BOOST_WARCHIVE_DECL void
  77. load(std::wstring &ws);
  78. #endif
  79. template<class T>
  80. void load_override(T & t){
  81. basic_text_iarchive<Archive>::load_override(t);
  82. }
  83. BOOST_WARCHIVE_DECL
  84. text_wiarchive_impl(std::wistream & is, unsigned int flags);
  85. ~text_wiarchive_impl(){};
  86. };
  87. } // namespace archive
  88. } // namespace boost
  89. #ifdef BOOST_MSVC
  90. #pragma warning(pop)
  91. #endif
  92. #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
  93. #ifdef BOOST_MSVC
  94. # pragma warning(push)
  95. # pragma warning(disable : 4511 4512)
  96. #endif
  97. namespace boost {
  98. namespace archive {
  99. class BOOST_SYMBOL_VISIBLE text_wiarchive :
  100. public text_wiarchive_impl<text_wiarchive>{
  101. public:
  102. text_wiarchive(std::wistream & is, unsigned int flags = 0) :
  103. text_wiarchive_impl<text_wiarchive>(is, flags)
  104. {}
  105. ~text_wiarchive(){}
  106. };
  107. } // namespace archive
  108. } // namespace boost
  109. // required by export
  110. BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_wiarchive)
  111. #ifdef BOOST_MSVC
  112. #pragma warning(pop)
  113. #endif
  114. #endif // BOOST_NO_STD_WSTREAMBUF
  115. #endif // BOOST_ARCHIVE_TEXT_WIARCHIVE_HPP