Statistics
| Revision:

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

History | View | Annotate | Download (2.9 kB)

1
#ifndef BOOST_ARCHIVE_CODECVT_NULL_HPP
2
#define BOOST_ARCHIVE_CODECVT_NULL_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
// codecvt_null.hpp:
11

    
12
// (C) Copyright 2004 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
#include <locale>
20
#include <cstddef> // NULL, size_t
21
#include <cwchar>   // for mbstate_t
22
#include <boost/config.hpp>
23
#include <boost/archive/detail/auto_link_archive.hpp>
24
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
25

    
26
#if defined(BOOST_NO_STDC_NAMESPACE)
27
namespace std {
28
// For STLport on WinCE, BOOST_NO_STDC_NAMESPACE can get defined if STLport is putting symbols in its own namespace.
29
// In the case of codecvt, however, this does not mean that codecvt is in the global namespace (it will be in STLport's namespace)
30
#  if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
31
    using ::codecvt;
32
#  endif
33
    using ::mbstate_t;
34
    using ::size_t;
35
} // namespace
36
#endif
37

    
38
#ifdef BOOST_MSVC
39
#  pragma warning(push)
40
#  pragma warning(disable : 4511 4512)
41
#endif
42

    
43
namespace boost {
44
namespace archive {
45

    
46
template<class Ch>
47
class codecvt_null;
48

    
49
template<>
50
class codecvt_null<char> : public std::codecvt<char, char, std::mbstate_t>
51
{
52
    virtual bool do_always_noconv() const throw() {
53
        return true;
54
    }
55
public:
56
    explicit codecvt_null(std::size_t no_locale_manage = 0) :
57
        std::codecvt<char, char, std::mbstate_t>(no_locale_manage)
58
    {}
59
};
60

    
61
template<>
62
class codecvt_null<wchar_t> : public std::codecvt<wchar_t, char, std::mbstate_t>
63
{
64
    virtual BOOST_WARCHIVE_DECL std::codecvt_base::result
65
    do_out(
66
        std::mbstate_t & state,
67
        const wchar_t * first1,
68
        const wchar_t * last1,
69
        const wchar_t * & next1,
70
        char * first2,
71
        char * last2,
72
        char * & next2
73
    ) const;
74
    virtual BOOST_WARCHIVE_DECL std::codecvt_base::result
75
    do_in(
76
        std::mbstate_t & state,
77
        const char * first1,
78
        const char * last1,
79
        const char * & next1,
80
        wchar_t * first2,
81
        wchar_t * last2,
82
        wchar_t * & next2
83
    ) const;
84
    virtual int do_encoding( ) const throw( ){
85
        return sizeof(wchar_t) / sizeof(char);
86
    }
87
    virtual int do_max_length( ) const throw( ){
88
        return do_encoding();
89
    }
90
public:
91
    explicit codecvt_null(std::size_t no_locale_manage = 0) :
92
        std::codecvt<wchar_t, char, std::mbstate_t>(no_locale_manage)
93
    {}
94
};
95

    
96
} // namespace archive
97
} // namespace boost
98

    
99
#ifdef BOOST_MSVC
100
#  pragma warning(pop)
101
#endif
102
#include <boost/archive/detail/abi_suffix.hpp> // pop pragmas
103

    
104
#endif //BOOST_ARCHIVE_CODECVT_NULL_HPP