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 {
do_always_noconv() const55     bool do_always_noconv() const throw() BOOST_OVERRIDE {
56         return true;
57     }
58 public:
codecvt_null(std::size_t no_locale_manage=0)59     explicit codecvt_null(std::size_t no_locale_manage = 0) :
60         std::codecvt<char, char, std::mbstate_t>(no_locale_manage)
61     {}
~codecvt_null()62     ~codecvt_null() BOOST_OVERRIDE {}
63 };
64 
65 template<>
66 class BOOST_SYMBOL_VISIBLE codecvt_null<wchar_t> :
67     public std::codecvt<wchar_t, char, std::mbstate_t>
68 {
69     BOOST_SYMBOL_EXPORT 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 BOOST_OVERRIDE;
79 
80     BOOST_SYMBOL_EXPORT std::codecvt_base::result
81     do_in(
82         std::mbstate_t & state,
83         const char * first1,
84         const char * last1,
85         const char * & next1,
86         wchar_t * first2,
87         wchar_t * last2,
88         wchar_t * & next2
89     ) const BOOST_OVERRIDE;
90 
do_encoding() const91     BOOST_SYMBOL_EXPORT int do_encoding( ) const throw( ) BOOST_OVERRIDE {
92         return sizeof(wchar_t) / sizeof(char);
93     }
94 
do_always_noconv() const95     BOOST_SYMBOL_EXPORT bool do_always_noconv() const throw() BOOST_OVERRIDE {
96         return false;
97     }
98 
do_max_length() const99     BOOST_SYMBOL_EXPORT int do_max_length( ) const throw( ) BOOST_OVERRIDE {
100         return do_encoding();
101     }
102 public:
103     BOOST_SYMBOL_EXPORT explicit codecvt_null(std::size_t no_locale_manage = 0);
104 
105     BOOST_SYMBOL_EXPORT ~codecvt_null() BOOST_OVERRIDE ;
106 };
107 
108 } // namespace archive
109 } // namespace boost
110 
111 #ifdef BOOST_MSVC
112 #  pragma warning(pop)
113 #endif
114 //#include <boost/archive/detail/abi_suffix.hpp> // pop pragmas
115 
116 #endif //BOOST_ARCHIVE_CODECVT_NULL_HPP
117