basic_text_iarchive.hpp 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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) && (_MSC_VER >= 1020)
  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_ostream<IStream::char_type> but rather
  20. // use two template parameters
  21. #include <boost/config.hpp>
  22. #include <boost/serialization/pfto.hpp>
  23. #include <boost/detail/workaround.hpp>
  24. #include <boost/archive/detail/common_iarchive.hpp>
  25. #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
  26. #ifdef BOOST_MSVC
  27. # pragma warning(push)
  28. # pragma warning(disable : 4511 4512)
  29. #endif
  30. namespace boost {
  31. namespace archive {
  32. /////////////////////////////////////////////////////////////////////////
  33. // class basic_text_iarchive - read serialized objects from a input text stream
  34. template<class Archive>
  35. class basic_text_iarchive :
  36. public detail::common_iarchive<Archive>
  37. {
  38. protected:
  39. #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
  40. public:
  41. #elif defined(BOOST_MSVC)
  42. // for some inexplicable reason insertion of "class" generates compile erro
  43. // on msvc 7.1
  44. friend detail::interface_iarchive<Archive>;
  45. #else
  46. friend class detail::interface_iarchive<Archive>;
  47. #endif
  48. // intermediate level to support override of operators
  49. // fot templates in the absence of partial function
  50. // template ordering
  51. typedef detail::common_iarchive<Archive> detail_common_iarchive;
  52. template<class T>
  53. void load_override(T & t, BOOST_PFTO int){
  54. this->detail_common_iarchive::load_override(t, 0);
  55. }
  56. // text file don't include the optional information
  57. void load_override(class_id_optional_type & /*t*/, int){}
  58. BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
  59. load_override(class_name_type & t, int);
  60. BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
  61. init(void);
  62. basic_text_iarchive(unsigned int flags) :
  63. detail::common_iarchive<Archive>(flags)
  64. {}
  65. ~basic_text_iarchive(){}
  66. };
  67. } // namespace archive
  68. } // namespace boost
  69. #ifdef BOOST_MSVC
  70. #pragma warning(pop)
  71. #endif
  72. #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
  73. #endif // BOOST_ARCHIVE_BASIC_TEXT_IARCHIVE_HPP