fix doc example typo
[boost.git] / boost / archive / codecvt_null.hpp
blob9732ad9f3f7dbf155b93c1f1e0e03399b7753101
1 #ifndef BOOST_ARCHIVE_CODECVT_NULL_HPP
2 #define BOOST_ARCHIVE_CODECVT_NULL_HPP
4 // MS compatible compilers support #pragma once
5 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
6 # pragma once
7 #endif
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10 // codecvt_null.hpp:
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)
17 // See http://www.boost.org for updates, documentation, and revision history.
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
26 #if defined(BOOST_NO_STDC_NAMESPACE)
27 // For STLport on WinCE, BOOST_NO_STDC_NAMESPACE can get defined if STLport is putting symbols in its own namespace.
28 // In the case of codecvt, however, this does not mean that codecvt is in the global namespace (it will be in STLport's namespace)
29 # if !defined(UNDER_CE) || (!defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION))
30 using ::codecvt;
31 # endif
32 using ::mbstate_t;
33 using ::size_t;
34 #endif
36 namespace boost {
37 namespace archive {
39 template<class Ch>
40 class codecvt_null;
42 template<>
43 class codecvt_null<char> : public std::codecvt<char, char, std::mbstate_t>
45 virtual bool do_always_noconv() const throw() {
46 return true;
48 public:
49 explicit codecvt_null(std::size_t no_locale_manage = 0) :
50 std::codecvt<char, char, std::mbstate_t>(no_locale_manage)
54 template<>
55 class codecvt_null<wchar_t> : public std::codecvt<wchar_t, char, std::mbstate_t>
57 virtual BOOST_WARCHIVE_DECL(std::codecvt_base::result)
58 do_out(
59 std::mbstate_t & state,
60 const wchar_t * first1,
61 const wchar_t * last1,
62 const wchar_t * & next1,
63 char * first2,
64 char * last2,
65 char * & next2
66 ) const;
67 virtual BOOST_WARCHIVE_DECL(std::codecvt_base::result)
68 do_in(
69 std::mbstate_t & state,
70 const char * first1,
71 const char * last1,
72 const char * & next1,
73 wchar_t * first2,
74 wchar_t * last2,
75 wchar_t * & next2
76 ) const;
77 virtual int do_encoding( ) const throw( ){
78 return sizeof(wchar_t) / sizeof(char);
80 virtual int do_max_length( ) const throw( ){
81 return do_encoding();
85 } // namespace archive
86 } // namespace boost
88 #include <boost/archive/detail/abi_suffix.hpp> // pop pragmas
90 #endif //BOOST_ARCHIVE_CODECVT_NULL_HPP