basic_oarchive.hpp 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #ifndef BOOST_ARCHIVE_BASIC_OARCHIVE_HPP
  2. #define BOOST_ARCHIVE_BASIC_OARCHIVE_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_oarchive.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 <cstddef> // NULL
  15. #include <boost/config.hpp>
  16. #include <boost/noncopyable.hpp>
  17. #include <boost/type_traits/broken_compiler_spec.hpp>
  18. // can't use this - much as I'd like to as borland doesn't support it
  19. // #include <boost/scoped_ptr.hpp>
  20. #include <boost/archive/basic_archive.hpp>
  21. #include <boost/serialization/tracking_enum.hpp>
  22. #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
  23. namespace boost {
  24. namespace serialization {
  25. class extended_type_info;
  26. } // namespace serialization
  27. namespace archive {
  28. namespace detail {
  29. class basic_oarchive_impl;
  30. class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oserializer;
  31. class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_oserializer;
  32. //////////////////////////////////////////////////////////////////////
  33. // class basic_oarchive - write serialized objects to an output stream
  34. class BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oarchive :
  35. private boost::noncopyable
  36. {
  37. friend class basic_oarchive_impl;
  38. // hide implementation of this class to minimize header conclusion
  39. // in client code. note: borland can't use scoped_ptr
  40. //boost::scoped_ptr<basic_oarchive_impl> pimpl;
  41. basic_oarchive_impl * pimpl;
  42. // overload these to bracket object attributes. Used to implement
  43. // xml archives
  44. virtual void vsave(const version_type t) = 0;
  45. virtual void vsave(const object_id_type t) = 0;
  46. virtual void vsave(const object_reference_type t) = 0;
  47. virtual void vsave(const class_id_type t) = 0;
  48. virtual void vsave(const class_id_optional_type t) = 0;
  49. virtual void vsave(const class_id_reference_type t) = 0;
  50. virtual void vsave(const class_name_type & t) = 0;
  51. virtual void vsave(const tracking_type t) = 0;
  52. protected:
  53. basic_oarchive(unsigned int flags = 0);
  54. // account for bogus gcc warning
  55. #if defined(__GNUC__)
  56. virtual
  57. #endif
  58. ~basic_oarchive();
  59. public:
  60. // note: NOT part of the public interface
  61. void register_basic_serializer(
  62. const basic_oserializer & bos
  63. );
  64. void save_object(
  65. const void *x,
  66. const basic_oserializer & bos
  67. );
  68. void save_pointer(
  69. const void * t,
  70. const basic_pointer_oserializer * bpos_ptr
  71. );
  72. void save_null_pointer(){
  73. vsave(NULL_POINTER_TAG);
  74. }
  75. // real public interface starts here
  76. void end_preamble(); // default implementation does nothing
  77. library_version_type get_library_version() const;
  78. unsigned int get_flags() const;
  79. };
  80. } // namespace detail
  81. } // namespace archive
  82. } // namespace boost
  83. // required by smart_cast for compilers not implementing
  84. // partial template specialization
  85. BOOST_TT_BROKEN_COMPILER_SPEC(
  86. boost::archive::detail::basic_oarchive
  87. )
  88. #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
  89. #endif //BOOST_ARCHIVE_BASIC_OARCHIVE_HPP