]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/archive/codecvt_null.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / archive / codecvt_null.hpp
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 #ifndef BOOST_NO_CWCHAR
22 #include <cwchar> // for mbstate_t
23 #endif
24 #include <boost/config.hpp>
25 #include <boost/serialization/force_include.hpp>
26 #include <boost/archive/detail/auto_link_archive.hpp>
27 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
28
29 #if defined(BOOST_NO_STDC_NAMESPACE)
30 namespace std {
31 // For STLport on WinCE, BOOST_NO_STDC_NAMESPACE can get defined if STLport is putting symbols in its own namespace.
32 // In the case of codecvt, however, this does not mean that codecvt is in the global namespace (it will be in STLport's namespace)
33 # if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
34 using ::codecvt;
35 # endif
36 using ::mbstate_t;
37 using ::size_t;
38 } // namespace
39 #endif
40
41 #ifdef BOOST_MSVC
42 # pragma warning(push)
43 # pragma warning(disable : 4511 4512)
44 #endif
45
46 namespace boost {
47 namespace archive {
48
49 template<class Ch>
50 class codecvt_null;
51
52 template<>
53 class codecvt_null<char> : public std::codecvt<char, char, std::mbstate_t>
54 {
55 virtual bool do_always_noconv() const throw() {
56 return true;
57 }
58 public:
59 explicit codecvt_null(std::size_t no_locale_manage = 0) :
60 std::codecvt<char, char, std::mbstate_t>(no_locale_manage)
61 {}
62 virtual ~codecvt_null(){};
63 };
64
65 template<>
66 class BOOST_WARCHIVE_DECL codecvt_null<wchar_t> :
67 public std::codecvt<wchar_t, char, std::mbstate_t>
68 {
69 virtual std::codecvt_base::result
70 do_out(
71 std::mbstate_t & state,
72 const wchar_t * first1,
73 const wchar_t * last1,
74 const wchar_t * & next1,
75 char * first2,
76 char * last2,
77 char * & next2
78 ) const;
79 virtual std::codecvt_base::result
80 do_in(
81 std::mbstate_t & state,
82 const char * first1,
83 const char * last1,
84 const char * & next1,
85 wchar_t * first2,
86 wchar_t * last2,
87 wchar_t * & next2
88 ) const;
89 virtual int do_encoding( ) const throw( ){
90 return sizeof(wchar_t) / sizeof(char);
91 }
92 virtual int do_max_length( ) const throw( ){
93 return do_encoding();
94 }
95 public:
96 explicit codecvt_null(std::size_t no_locale_manage = 0) :
97 std::codecvt<wchar_t, char, std::mbstate_t>(no_locale_manage)
98 {}
99 //virtual ~codecvt_null(){};
100 };
101
102 } // namespace archive
103 } // namespace boost
104
105 #ifdef BOOST_MSVC
106 # pragma warning(pop)
107 #endif
108 #include <boost/archive/detail/abi_suffix.hpp> // pop pragmas
109
110 #endif //BOOST_ARCHIVE_CODECVT_NULL_HPP