williamr@2: #ifndef BOOST_ARCHIVE_BASIC_TEXT_OARCHIVE_HPP williamr@2: #define BOOST_ARCHIVE_BASIC_TEXT_OARCHIVE_HPP williamr@2: williamr@2: // MS compatible compilers support #pragma once williamr@2: #if defined(_MSC_VER) && (_MSC_VER >= 1020) williamr@2: # pragma once williamr@2: #endif williamr@2: williamr@2: /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 williamr@2: // basic_text_oarchive.hpp williamr@2: williamr@2: // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . williamr@2: // Use, modification and distribution is subject to the Boost Software williamr@2: // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at williamr@2: // http://www.boost.org/LICENSE_1_0.txt) williamr@2: williamr@2: // See http://www.boost.org for updates, documentation, and revision history. williamr@2: williamr@2: // archives stored as text - note these ar templated on the basic williamr@2: // stream templates to accommodate wide (and other?) kind of characters williamr@2: // williamr@2: // note the fact that on libraries without wide characters, ostream is williamr@2: // is not a specialization of basic_ostream which in fact is not defined williamr@2: // in such cases. So we can't use basic_ostream but rather williamr@2: // use two template parameters williamr@2: williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: williamr@2: #include williamr@2: #include williamr@2: williamr@2: #include // must be the last header williamr@2: williamr@2: namespace boost { williamr@2: namespace archive { williamr@2: williamr@2: ///////////////////////////////////////////////////////////////////////// williamr@2: // class basic_text_iarchive - read serialized objects from a input text stream williamr@2: template williamr@2: class basic_text_oarchive : williamr@2: public detail::common_oarchive williamr@2: { williamr@2: protected: williamr@2: #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \ williamr@2: || BOOST_WORKAROUND(__BORLANDC__,BOOST_TESTED_AT(0x560)) williamr@2: public: williamr@2: #elif defined(BOOST_MSVC) williamr@2: // for some inexplicable reason insertion of "class" generates compile erro williamr@2: // on msvc 7.1 williamr@2: friend detail::interface_oarchive; williamr@2: #else williamr@2: friend class detail::interface_oarchive; williamr@2: #endif williamr@2: enum { williamr@2: none, williamr@2: eol, williamr@2: space williamr@2: } delimiter; williamr@2: williamr@2: BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) williamr@2: newtoken(); williamr@2: williamr@2: void newline(){ williamr@2: delimiter = eol; williamr@2: } williamr@2: williamr@2: // default processing - kick back to base class. Note the williamr@2: // extra stuff to get it passed borland compilers williamr@2: typedef detail::common_oarchive detail_common_oarchive; williamr@2: template williamr@2: void save_override(T & t, BOOST_PFTO int){ williamr@2: this->detail_common_oarchive::save_override(t, 0); williamr@2: } williamr@2: williamr@2: // start new objects on a new line williamr@2: void save_override(const object_id_type & t, int){ williamr@2: this->This()->newline(); williamr@2: // and and invoke prmitive to underlying value williamr@2: this->This()->save(t.t); williamr@2: } williamr@2: williamr@2: void save_override(const object_reference_type & t, int){ williamr@2: this->This()->newline(); williamr@2: // and and invoke prmitive to underlying value williamr@2: this->This()->save(t.t); williamr@2: } williamr@2: williamr@2: // text file don't include the optional information williamr@2: void save_override(const class_id_optional_type & /* t */, int){} williamr@2: williamr@2: // note the following four overrides are necessary for some borland williamr@2: // compilers which don't handle BOOST_STRONG_TYPE properly. williamr@2: void save_override(const version_type & t, int){ williamr@2: // note:t.t resolves borland ambguity williamr@2: unsigned int x = t.t; williamr@2: * this->This() << x; williamr@2: } williamr@2: void save_override(const class_id_type & t, int){ williamr@2: // note:t.t resolves borland ambguity williamr@2: int x = t.t; williamr@2: * this->This() << x; williamr@2: } williamr@2: void save_override(const class_id_reference_type & t, int){ williamr@2: // note:t.t resolves borland ambguity williamr@2: int x = t.t; williamr@2: * this->This() << x; williamr@2: } williamr@2: void save_override(const class_name_type & t, int){ williamr@2: const std::string s(t); williamr@2: * this->This() << s; williamr@2: } williamr@2: williamr@2: BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) williamr@2: init(); williamr@2: williamr@2: basic_text_oarchive(unsigned int flags) : williamr@2: detail::common_oarchive(flags), williamr@2: delimiter(none) williamr@2: {} williamr@2: ~basic_text_oarchive(){} williamr@2: }; williamr@2: williamr@2: } // namespace archive williamr@2: } // namespace boost williamr@2: williamr@2: #include // pops abi_suffix.hpp pragmas williamr@2: williamr@2: #endif // BOOST_ARCHIVE_BASIC_TEXT_OARCHIVE_HPP