Statistics
| Revision:

root / tmp / org.txm.statsengine.r.core.win32 / res / win32 / library / BH / include / boost / archive / basic_text_oarchive.hpp @ 2486

History | View | Annotate | Download (3.3 kB)

1
#ifndef BOOST_ARCHIVE_BASIC_TEXT_OARCHIVE_HPP
2
#define BOOST_ARCHIVE_BASIC_TEXT_OARCHIVE_HPP
3

    
4
// MS compatible compilers support #pragma once
5
#if defined(_MSC_VER)
6
# pragma once
7
#endif
8

    
9
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10
// basic_text_oarchive.hpp
11

    
12
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . 
13
// Use, modification and distribution is subject to the Boost Software
14
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
15
// http://www.boost.org/LICENSE_1_0.txt)
16

    
17
//  See http://www.boost.org for updates, documentation, and revision history.
18

    
19
// archives stored as text - note these ar templated on the basic
20
// stream templates to accommodate wide (and other?) kind of characters
21
//
22
// note the fact that on libraries without wide characters, ostream is
23
// is not a specialization of basic_ostream which in fact is not defined
24
// in such cases.   So we can't use basic_ostream<OStream::char_type> but rather
25
// use two template parameters
26

    
27
#include <boost/config.hpp>
28
#include <boost/detail/workaround.hpp>
29
#include <boost/archive/detail/common_oarchive.hpp>
30
#include <boost/serialization/string.hpp>
31

    
32
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
33

    
34
#ifdef BOOST_MSVC
35
#  pragma warning(push)
36
#  pragma warning(disable : 4511 4512)
37
#endif
38

    
39
namespace boost {
40
namespace archive {
41

    
42
namespace detail {
43
    template<class Archive> class interface_oarchive;
44
} // namespace detail
45

    
46
/////////////////////////////////////////////////////////////////////////
47
// class basic_text_oarchive 
48
template<class Archive>
49
class BOOST_SYMBOL_VISIBLE basic_text_oarchive : 
50
    public detail::common_oarchive<Archive>
51
{
52
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
53
public:
54
#else
55
protected:
56
    #if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
57
        // for some inexplicable reason insertion of "class" generates compile erro
58
        // on msvc 7.1
59
        friend detail::interface_oarchive<Archive>;
60
    #else
61
        friend class detail::interface_oarchive<Archive>;
62
    #endif
63
#endif
64

    
65
    enum {
66
        none,
67
        eol,
68
        space
69
    } delimiter;
70

    
71
    BOOST_ARCHIVE_OR_WARCHIVE_DECL void
72
    newtoken();
73

    
74
    void newline(){
75
        delimiter = eol;
76
    }
77

    
78
    // default processing - kick back to base class.  Note the
79
    // extra stuff to get it passed borland compilers
80
    typedef detail::common_oarchive<Archive> detail_common_oarchive;
81
    template<class T>
82
    void save_override(T & t){
83
        this->detail_common_oarchive::save_override(t);
84
    }
85

    
86
    // start new objects on a new line
87
    void save_override(const object_id_type & t){
88
        this->This()->newline();
89
        this->detail_common_oarchive::save_override(t);
90
    }
91

    
92
    // text file don't include the optional information 
93
    void save_override(const class_id_optional_type & /* t */){}
94

    
95
    void save_override(const class_name_type & t){
96
        const std::string s(t);
97
        * this->This() << s;
98
    }
99

    
100
    BOOST_ARCHIVE_OR_WARCHIVE_DECL void
101
    init();
102

    
103
    basic_text_oarchive(unsigned int flags) :
104
        detail::common_oarchive<Archive>(flags),
105
        delimiter(none)
106
    {}
107
    ~basic_text_oarchive(){}
108
};
109

    
110
} // namespace archive
111
} // namespace boost
112

    
113
#ifdef BOOST_MSVC
114
#pragma warning(pop)
115
#endif
116

    
117
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
118

    
119
#endif // BOOST_ARCHIVE_BASIC_TEXT_OARCHIVE_HPP