os/ossrv/ossrv_pub/boost_apis/boost/archive/codecvt_null.hpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
#ifndef BOOST_ARCHIVE_CODECVT_NULL_HPP
sl@0
     2
#define BOOST_ARCHIVE_CODECVT_NULL_HPP
sl@0
     3
sl@0
     4
// MS compatible compilers support #pragma once
sl@0
     5
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
sl@0
     6
# pragma once
sl@0
     7
#endif
sl@0
     8
sl@0
     9
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
sl@0
    10
// codecvt_null.hpp:
sl@0
    11
sl@0
    12
// (C) Copyright 2004 Robert Ramey - http://www.rrsd.com .
sl@0
    13
// Use, modification and distribution is subject to the Boost Software
sl@0
    14
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
sl@0
    15
// http://www.boost.org/LICENSE_1_0.txt)
sl@0
    16
sl@0
    17
//  See http://www.boost.org for updates, documentation, and revision history.
sl@0
    18
sl@0
    19
#include <locale>
sl@0
    20
#include <cstddef>
sl@0
    21
sl@0
    22
#include <boost/config.hpp>
sl@0
    23
sl@0
    24
namespace std{
sl@0
    25
    #if defined(__LIBCOMO__)
sl@0
    26
        using ::mbstate_t;
sl@0
    27
    #elif defined(__QNXNTO__)
sl@0
    28
        using std::mbstate_t;
sl@0
    29
    #elif defined(BOOST_DINKUMWARE_STDLIB) && BOOST_DINKUMWARE_STDLIB == 1
sl@0
    30
        using ::mbstate_t;
sl@0
    31
    #elif defined(__SGI_STL_PORT)
sl@0
    32
    #elif defined(BOOST_NO_STDC_NAMESPACE)
sl@0
    33
        using ::codecvt;
sl@0
    34
        using ::mbstate_t;
sl@0
    35
    #endif
sl@0
    36
} // namespace std
sl@0
    37
sl@0
    38
namespace boost {
sl@0
    39
namespace archive {
sl@0
    40
sl@0
    41
template<class Ch>
sl@0
    42
class codecvt_null;
sl@0
    43
sl@0
    44
template<>
sl@0
    45
class codecvt_null<char> : public std::codecvt<char, char, std::mbstate_t>
sl@0
    46
{
sl@0
    47
    virtual bool do_always_noconv() const throw() {
sl@0
    48
        return true;
sl@0
    49
    }
sl@0
    50
public:
sl@0
    51
    explicit codecvt_null(std::size_t no_locale_manage = 0) :
sl@0
    52
        std::codecvt<char, char, std::mbstate_t>(no_locale_manage)
sl@0
    53
    {}
sl@0
    54
};
sl@0
    55
sl@0
    56
template<>
sl@0
    57
class codecvt_null<wchar_t> : public std::codecvt<wchar_t, char, std::mbstate_t>
sl@0
    58
{
sl@0
    59
    virtual std::codecvt_base::result
sl@0
    60
    do_out(
sl@0
    61
        std::mbstate_t & state,
sl@0
    62
        const wchar_t * first1,
sl@0
    63
        const wchar_t * last1,
sl@0
    64
        const wchar_t * & next1,
sl@0
    65
        char * first2,
sl@0
    66
        char * last2,
sl@0
    67
        char * & next2
sl@0
    68
    ) const;
sl@0
    69
    virtual std::codecvt_base::result
sl@0
    70
    do_in(
sl@0
    71
        std::mbstate_t & state,
sl@0
    72
        const char * first1,
sl@0
    73
        const char * last1,
sl@0
    74
        const char * & next1,
sl@0
    75
        wchar_t * first2,
sl@0
    76
        wchar_t * last2,
sl@0
    77
        wchar_t * & next2
sl@0
    78
    ) const;
sl@0
    79
    virtual int do_encoding( ) const throw( ){
sl@0
    80
        return sizeof(wchar_t) / sizeof(char);
sl@0
    81
    }
sl@0
    82
    virtual int do_max_length( ) const throw( ){
sl@0
    83
        return do_encoding();
sl@0
    84
    }
sl@0
    85
};
sl@0
    86
sl@0
    87
} // namespace archive
sl@0
    88
} // namespace boost
sl@0
    89
sl@0
    90
#endif //BOOST_ARCHIVE_CODECVT_NULL_HPP