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

http://hadesmem.googlecode.com/ · C++ Header · 152 lines · 109 code · 24 blank · 19 comment · 1 complexity · b48b801d619caffa030128ea6c2539b6 MD5 · raw file

  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) && (_MSC_VER >= 1020)
  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. template<class Archive>
  32. class text_wiarchive_impl :
  33. public basic_text_iprimitive<std::wistream>,
  34. public basic_text_iarchive<Archive>
  35. {
  36. #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
  37. public:
  38. #else
  39. friend class detail::interface_iarchive<Archive>;
  40. friend class basic_text_iarchive<Archive>;
  41. friend class load_access;
  42. protected:
  43. #endif
  44. template<class T>
  45. void load(T & t){
  46. basic_text_iprimitive<std::wistream>::load(t);
  47. }
  48. void load(version_type & t){
  49. unsigned int v;
  50. load(v);
  51. t = version_type(v);
  52. }
  53. void load(boost::serialization::item_version_type & t){
  54. unsigned int v;
  55. load(v);
  56. t = boost::serialization::item_version_type(v);
  57. }
  58. BOOST_WARCHIVE_DECL(void)
  59. load(char * t);
  60. #ifndef BOOST_NO_INTRINSIC_WCHAR_T
  61. BOOST_WARCHIVE_DECL(void)
  62. load(wchar_t * t);
  63. #endif
  64. BOOST_WARCHIVE_DECL(void)
  65. load(std::string &s);
  66. #ifndef BOOST_NO_STD_WSTRING
  67. BOOST_WARCHIVE_DECL(void)
  68. load(std::wstring &ws);
  69. #endif
  70. // note: the following should not needed - but one compiler (vc 7.1)
  71. // fails to compile one test (test_shared_ptr) without it !!!
  72. template<class T>
  73. void load_override(T & t, BOOST_PFTO int){
  74. basic_text_iarchive<Archive>::load_override(t, 0);
  75. }
  76. BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY())
  77. text_wiarchive_impl(std::wistream & is, unsigned int flags);
  78. ~text_wiarchive_impl(){};
  79. };
  80. // do not derive from the classes below. If you want to extend this functionality
  81. // via inhertance, derived from text_iarchive_impl instead. This will
  82. // preserve correct static polymorphism.
  83. // same as text_wiarchive below - without the shared_ptr_helper
  84. class naked_text_wiarchive :
  85. public text_wiarchive_impl<naked_text_wiarchive>
  86. {
  87. public:
  88. naked_text_wiarchive(std::wistream & is, unsigned int flags = 0) :
  89. text_wiarchive_impl<naked_text_wiarchive>(is, flags)
  90. {}
  91. ~naked_text_wiarchive(){}
  92. };
  93. } // namespace archive
  94. } // namespace boost
  95. #ifdef BOOST_MSVC
  96. #pragma warning(pop)
  97. #endif
  98. #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
  99. // note special treatment of shared_ptr. This type needs a special
  100. // structure associated with every archive. We created a "mix-in"
  101. // class to provide this functionality. Since shared_ptr holds a
  102. // special esteem in the boost library - we included it here by default.
  103. #include <boost/archive/shared_ptr_helper.hpp>
  104. #ifdef BOOST_MSVC
  105. # pragma warning(push)
  106. # pragma warning(disable : 4511 4512)
  107. #endif
  108. namespace boost {
  109. namespace archive {
  110. class text_wiarchive :
  111. public text_wiarchive_impl<text_wiarchive>,
  112. public detail::shared_ptr_helper
  113. {
  114. public:
  115. text_wiarchive(std::wistream & is, unsigned int flags = 0) :
  116. text_wiarchive_impl<text_wiarchive>(is, flags)
  117. {}
  118. ~text_wiarchive(){}
  119. };
  120. } // namespace archive
  121. } // namespace boost
  122. // required by export
  123. BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_wiarchive)
  124. #ifdef BOOST_MSVC
  125. #pragma warning(pop)
  126. #endif
  127. #endif // BOOST_NO_STD_WSTREAMBUF
  128. #endif // BOOST_ARCHIVE_TEXT_WIARCHIVE_HPP