/Src/Dependencies/Boost/boost/archive/text_iarchive.hpp

http://hadesmem.googlecode.com/ · C++ Header · 156 lines · 109 code · 23 blank · 24 comment · 1 complexity · bb67888d8e985434cba596dfaa0e8bae MD5 · raw file

  1. #ifndef BOOST_ARCHIVE_TEXT_IARCHIVE_HPP
  2. #define BOOST_ARCHIVE_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. // 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. #include <istream>
  15. #include <boost/config.hpp>
  16. #include <boost/archive/detail/auto_link_archive.hpp>
  17. #include <boost/archive/basic_text_iprimitive.hpp>
  18. #include <boost/archive/basic_text_iarchive.hpp>
  19. #include <boost/archive/detail/register_archive.hpp>
  20. #include <boost/serialization/item_version_type.hpp>
  21. #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
  22. #ifdef BOOST_MSVC
  23. # pragma warning(push)
  24. # pragma warning(disable : 4511 4512)
  25. #endif
  26. namespace boost {
  27. namespace archive {
  28. template<class Archive>
  29. class text_iarchive_impl :
  30. public basic_text_iprimitive<std::istream>,
  31. public basic_text_iarchive<Archive>
  32. {
  33. #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
  34. public:
  35. #else
  36. friend class detail::interface_iarchive<Archive>;
  37. friend class basic_text_iarchive<Archive>;
  38. friend class load_access;
  39. protected:
  40. #endif
  41. template<class T>
  42. void load(T & t){
  43. basic_text_iprimitive<std::istream>::load(t);
  44. }
  45. void load(version_type & t){
  46. unsigned int v;
  47. load(v);
  48. t = version_type(v);
  49. }
  50. void load(boost::serialization::item_version_type & t){
  51. unsigned int v;
  52. load(v);
  53. t = boost::serialization::item_version_type(v);
  54. }
  55. BOOST_ARCHIVE_DECL(void)
  56. load(char * t);
  57. #ifndef BOOST_NO_INTRINSIC_WCHAR_T
  58. BOOST_ARCHIVE_DECL(void)
  59. load(wchar_t * t);
  60. #endif
  61. BOOST_ARCHIVE_DECL(void)
  62. load(std::string &s);
  63. #ifndef BOOST_NO_STD_WSTRING
  64. BOOST_ARCHIVE_DECL(void)
  65. load(std::wstring &ws);
  66. #endif
  67. // note: the following should not needed - but one compiler (vc 7.1)
  68. // fails to compile one test (test_shared_ptr) without it !!!
  69. // make this protected so it can be called from a derived archive
  70. template<class T>
  71. void load_override(T & t, BOOST_PFTO int){
  72. basic_text_iarchive<Archive>::load_override(t, 0);
  73. }
  74. BOOST_ARCHIVE_DECL(void)
  75. load_override(class_name_type & t, int);
  76. BOOST_ARCHIVE_DECL(void)
  77. init();
  78. BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
  79. text_iarchive_impl(std::istream & is, unsigned int flags);
  80. // don't import inline definitions! leave this as a reminder.
  81. //BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
  82. ~text_iarchive_impl(){};
  83. };
  84. // do not derive from the classes below. If you want to extend this functionality
  85. // via inhertance, derived from text_iarchive_impl instead. This will
  86. // preserve correct static polymorphism.
  87. // same as text_iarchive below - without the shared_ptr_helper
  88. class naked_text_iarchive :
  89. public text_iarchive_impl<naked_text_iarchive>
  90. {
  91. public:
  92. naked_text_iarchive(std::istream & is_, unsigned int flags = 0) :
  93. // note: added _ to suppress useless gcc warning
  94. text_iarchive_impl<naked_text_iarchive>(is_, flags)
  95. {}
  96. ~naked_text_iarchive(){}
  97. };
  98. } // namespace archive
  99. } // namespace boost
  100. #ifdef BOOST_MSVC
  101. #pragma warning(pop)
  102. #endif
  103. #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
  104. // note special treatment of shared_ptr. This type needs a special
  105. // structure associated with every archive. We created a "mix-in"
  106. // class to provide this functionality. Since shared_ptr holds a
  107. // special esteem in the boost library - we included it here by default.
  108. #include <boost/archive/shared_ptr_helper.hpp>
  109. #ifdef BOOST_MSVC
  110. # pragma warning(push)
  111. # pragma warning(disable : 4511 4512)
  112. #endif
  113. namespace boost {
  114. namespace archive {
  115. class text_iarchive :
  116. public text_iarchive_impl<text_iarchive>,
  117. public detail::shared_ptr_helper
  118. {
  119. public:
  120. text_iarchive(std::istream & is_, unsigned int flags = 0) :
  121. // note: added _ to suppress useless gcc warning
  122. text_iarchive_impl<text_iarchive>(is_, flags)
  123. {}
  124. ~text_iarchive(){}
  125. };
  126. } // namespace archive
  127. } // namespace boost
  128. // required by export
  129. BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_iarchive)
  130. #ifdef BOOST_MSVC
  131. #pragma warning(pop)
  132. #endif
  133. #endif // BOOST_ARCHIVE_TEXT_IARCHIVE_HPP