basic_text_iarchive.hpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #ifndef BOOST_ARCHIVE_BASIC_TEXT_IARCHIVE_HPP
  2. #define BOOST_ARCHIVE_BASIC_TEXT_IARCHIVE_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. // basic_text_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. // archives stored as text - note these ar templated on the basic
  15. // stream templates to accommodate wide (and other?) kind of characters
  16. //
  17. // note the fact that on libraries without wide characters, ostream is
  18. // is not a specialization of basic_ostream which in fact is not defined
  19. // in such cases. So we can't use basic_istream<IStream::char_type> but rather
  20. // use two template parameters
  21. #include <boost/config.hpp>
  22. #include <boost/detail/workaround.hpp>
  23. #include <boost/archive/detail/common_iarchive.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. /////////////////////////////////////////////////////////////////////////
  35. // class basic_text_iarchive - read serialized objects from a input text stream
  36. template<class Archive>
  37. class BOOST_SYMBOL_VISIBLE basic_text_iarchive :
  38. public detail::common_iarchive<Archive>
  39. {
  40. #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
  41. public:
  42. #else
  43. protected:
  44. #if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
  45. // for some inexplicable reason insertion of "class" generates compile erro
  46. // on msvc 7.1
  47. friend detail::interface_iarchive<Archive>;
  48. #else
  49. friend class detail::interface_iarchive<Archive>;
  50. #endif
  51. #endif
  52. // intermediate level to support override of operators
  53. // fot templates in the absence of partial function
  54. // template ordering
  55. typedef detail::common_iarchive<Archive> detail_common_iarchive;
  56. template<class T>
  57. void load_override(T & t){
  58. this->detail_common_iarchive::load_override(t);
  59. }
  60. // text file don't include the optional information
  61. void load_override(class_id_optional_type & /*t*/){}
  62. BOOST_ARCHIVE_OR_WARCHIVE_DECL void
  63. load_override(class_name_type & t);
  64. BOOST_ARCHIVE_OR_WARCHIVE_DECL void
  65. init(void);
  66. basic_text_iarchive(unsigned int flags) :
  67. detail::common_iarchive<Archive>(flags)
  68. {}
  69. ~basic_text_iarchive(){}
  70. };
  71. } // namespace archive
  72. } // namespace boost
  73. #ifdef BOOST_MSVC
  74. #pragma warning(pop)
  75. #endif
  76. #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
  77. #endif // BOOST_ARCHIVE_BASIC_TEXT_IARCHIVE_HPP