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

http://hadesmem.googlecode.com/ · C++ Header · 171 lines · 125 code · 25 blank · 21 comment · 1 complexity · 2e887532fc80c01cf821835e78433996 MD5 · raw file

  1. #ifndef BOOST_ARCHIVE_XML_WIARCHIVE_HPP
  2. #define BOOST_ARCHIVE_XML_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. // xml_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/scoped_ptr.hpp>
  20. #include <boost/archive/detail/auto_link_warchive.hpp>
  21. #include <boost/archive/basic_text_iprimitive.hpp>
  22. #include <boost/archive/basic_xml_iarchive.hpp>
  23. #include <boost/archive/detail/register_archive.hpp>
  24. #include <boost/serialization/item_version_type.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. template<class CharType>
  33. class basic_xml_grammar;
  34. typedef basic_xml_grammar<wchar_t> xml_wgrammar;
  35. template<class Archive>
  36. class xml_wiarchive_impl :
  37. public basic_text_iprimitive<std::wistream>,
  38. public basic_xml_iarchive<Archive>
  39. {
  40. #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
  41. public:
  42. #else
  43. friend class detail::interface_iarchive<Archive>;
  44. friend class basic_xml_iarchive<Archive>;
  45. friend class load_access;
  46. protected:
  47. #endif
  48. // instances of micro xml parser to parse start preambles
  49. // scoped_ptr doesn't play nice with borland - so use a naked pointer
  50. // scoped_ptr<xml_wgrammar> gimpl;
  51. xml_wgrammar *gimpl;
  52. std::wistream & get_is(){
  53. return is;
  54. }
  55. template<class T>
  56. void
  57. load(T & t){
  58. basic_text_iprimitive<std::wistream>::load(t);
  59. }
  60. void
  61. load(version_type & t){
  62. unsigned int v;
  63. load(v);
  64. t = version_type(v);
  65. }
  66. void
  67. load(boost::serialization::item_version_type & t){
  68. unsigned int v;
  69. load(v);
  70. t = boost::serialization::item_version_type(v);
  71. }
  72. BOOST_WARCHIVE_DECL(void)
  73. load(char * t);
  74. #ifndef BOOST_NO_INTRINSIC_WCHAR_T
  75. BOOST_WARCHIVE_DECL(void)
  76. load(wchar_t * t);
  77. #endif
  78. BOOST_WARCHIVE_DECL(void)
  79. load(std::string &s);
  80. #ifndef BOOST_NO_STD_WSTRING
  81. BOOST_WARCHIVE_DECL(void)
  82. load(std::wstring &ws);
  83. #endif
  84. template<class T>
  85. void load_override(T & t, BOOST_PFTO int){
  86. basic_xml_iarchive<Archive>::load_override(t, 0);
  87. }
  88. BOOST_WARCHIVE_DECL(void)
  89. load_override(class_name_type & t, int);
  90. BOOST_WARCHIVE_DECL(void)
  91. init();
  92. BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY())
  93. xml_wiarchive_impl(std::wistream & is, unsigned int flags) ;
  94. BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY())
  95. ~xml_wiarchive_impl();
  96. };
  97. // do not derive from the classes below. If you want to extend this functionality
  98. // via inhertance, derived from xml_wiarchive_impl instead. This will
  99. // preserve correct static polymorphism.
  100. // same as xml_wiarchive below - without the shared_ptr_helper
  101. class naked_xml_wiarchive :
  102. public xml_wiarchive_impl<naked_xml_wiarchive>
  103. {
  104. public:
  105. naked_xml_wiarchive(std::wistream & is, unsigned int flags = 0) :
  106. xml_wiarchive_impl<naked_xml_wiarchive>(is, flags)
  107. {}
  108. ~naked_xml_wiarchive(){}
  109. };
  110. } // namespace archive
  111. } // namespace boost
  112. #ifdef BOOST_MSVC
  113. # pragma warning(push)
  114. # pragma warning(disable : 4511 4512)
  115. #endif
  116. #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
  117. // note special treatment of shared_ptr. This type needs a special
  118. // structure associated with every archive. We created a "mix-in"
  119. // class to provide this functionality. Since shared_ptr holds a
  120. // special esteem in the boost library - we included it here by default.
  121. #include <boost/archive/shared_ptr_helper.hpp>
  122. #ifdef BOOST_MSVC
  123. # pragma warning(push)
  124. # pragma warning(disable : 4511 4512)
  125. #endif
  126. namespace boost {
  127. namespace archive {
  128. class xml_wiarchive :
  129. public xml_wiarchive_impl<xml_wiarchive>,
  130. public detail::shared_ptr_helper
  131. {
  132. public:
  133. xml_wiarchive(std::wistream & is, unsigned int flags = 0) :
  134. xml_wiarchive_impl<xml_wiarchive>(is, flags)
  135. {}
  136. ~xml_wiarchive(){}
  137. };
  138. } // namespace archive
  139. } // namespace boost
  140. // required by export
  141. BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_wiarchive)
  142. #ifdef BOOST_MSVC
  143. #pragma warning(pop)
  144. #endif
  145. #endif // BOOST_NO_STD_WSTREAMBUF
  146. #endif // BOOST_ARCHIVE_XML_WIARCHIVE_HPP