Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:28:29

0001 #ifndef BOOST_ARCHIVE_BASIC_TEXT_OARCHIVE_HPP
0002 #define BOOST_ARCHIVE_BASIC_TEXT_OARCHIVE_HPP
0003 
0004 // MS compatible compilers support #pragma once
0005 #if defined(_MSC_VER)
0006 # pragma once
0007 #endif
0008 
0009 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
0010 // basic_text_oarchive.hpp
0011 
0012 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
0013 // Use, modification and distribution is subject to the Boost Software
0014 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0015 // http://www.boost.org/LICENSE_1_0.txt)
0016 
0017 //  See http://www.boost.org for updates, documentation, and revision history.
0018 
0019 // archives stored as text - note these ar templated on the basic
0020 // stream templates to accommodate wide (and other?) kind of characters
0021 //
0022 // note the fact that on libraries without wide characters, ostream is
0023 // is not a specialization of basic_ostream which in fact is not defined
0024 // in such cases.   So we can't use basic_ostream<OStream::char_type> but rather
0025 // use two template parameters
0026 
0027 #include <boost/config.hpp>
0028 #include <boost/detail/workaround.hpp>
0029 #include <boost/archive/detail/common_oarchive.hpp>
0030 #include <boost/serialization/string.hpp>
0031 
0032 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
0033 
0034 #ifdef BOOST_MSVC
0035 #  pragma warning(push)
0036 #  pragma warning(disable : 4511 4512)
0037 #endif
0038 
0039 namespace boost {
0040 namespace archive {
0041 
0042 namespace detail {
0043     template<class Archive> class interface_oarchive;
0044 } // namespace detail
0045 
0046 /////////////////////////////////////////////////////////////////////////
0047 // class basic_text_oarchive
0048 template<class Archive>
0049 class BOOST_SYMBOL_VISIBLE basic_text_oarchive :
0050     public detail::common_oarchive<Archive>
0051 {
0052 #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
0053 public:
0054 #else
0055 protected:
0056     #if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
0057         // for some inexplicable reason insertion of "class" generates compile erro
0058         // on msvc 7.1
0059         friend detail::interface_oarchive<Archive>;
0060     #else
0061         friend class detail::interface_oarchive<Archive>;
0062     #endif
0063 #endif
0064 
0065     enum {
0066         none,
0067         eol,
0068         space
0069     } delimiter;
0070 
0071     BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0072     newtoken();
0073 
0074     void newline(){
0075         delimiter = eol;
0076     }
0077 
0078     // default processing - kick back to base class.  Note the
0079     // extra stuff to get it passed borland compilers
0080     typedef detail::common_oarchive<Archive> detail_common_oarchive;
0081     template<class T>
0082     void save_override(T & t){
0083         this->detail_common_oarchive::save_override(t);
0084     }
0085 
0086     // start new objects on a new line
0087     void save_override(const object_id_type & t){
0088         this->This()->newline();
0089         this->detail_common_oarchive::save_override(t);
0090     }
0091 
0092     // text file don't include the optional information
0093     void save_override(const class_id_optional_type & /* t */){}
0094 
0095     void save_override(const class_name_type & t){
0096         const std::string s(t);
0097         * this->This() << s;
0098     }
0099 
0100     BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0101     init();
0102 
0103     basic_text_oarchive(unsigned int flags) :
0104         detail::common_oarchive<Archive>(flags),
0105         delimiter(none)
0106     {}
0107     ~basic_text_oarchive() BOOST_OVERRIDE {}
0108 };
0109 
0110 } // namespace archive
0111 } // namespace boost
0112 
0113 #ifdef BOOST_MSVC
0114 #pragma warning(pop)
0115 #endif
0116 
0117 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
0118 
0119 #endif // BOOST_ARCHIVE_BASIC_TEXT_OARCHIVE_HPP