mirror of
https://github.com/boostorg/detail.git
synced 2025-07-29 20:07:15 +02:00
changed codecvt_utf8 so that serialization uses the standard one if available. If there is no standard one available, it uses the one in boost/utility.
[SVN r86614]
This commit is contained in:
@ -85,6 +85,10 @@
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#ifndef BOOST_NO_CXX11_HDR_CODECVT
|
||||
#include <codecvt>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std {
|
||||
using ::mbstate_t;
|
||||
@ -92,13 +96,6 @@ namespace std {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_CPPLIB_VER) && (_CPPLIB_VER < 540)
|
||||
#define BOOST_CODECVT_DO_LENGTH_CONST const
|
||||
#else
|
||||
#define BOOST_CODECVT_DO_LENGTH_CONST
|
||||
#endif
|
||||
|
||||
// maximum lenght of a multibyte string
|
||||
#define MB_LENGTH_MAX 8
|
||||
|
||||
BOOST_UTF8_BEGIN_NAMESPACE
|
||||
@ -167,17 +164,30 @@ protected:
|
||||
}
|
||||
|
||||
// How many char objects can I process to get <= max_limit
|
||||
// wchar_t objects?
|
||||
// wchar_t objects?
|
||||
// This is the "official version which implements the standar
|
||||
// library interface
|
||||
virtual int do_length(
|
||||
BOOST_CODECVT_DO_LENGTH_CONST std::mbstate_t &,
|
||||
std::mbstate_t & state,
|
||||
const char * from,
|
||||
const char * from_end,
|
||||
std::size_t max_limit
|
||||
#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
|
||||
) const throw();
|
||||
#else
|
||||
) const;
|
||||
#endif
|
||||
) const
|
||||
#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
|
||||
throw()
|
||||
#endif
|
||||
{
|
||||
return do_length(const_cast<const std::mbstate_t &>(state), from, from_end, max_limit);
|
||||
}
|
||||
|
||||
// this version handles versions of the standard library which pass
|
||||
// the state with a "const". This means early dinkumware standard library
|
||||
virtual int do_length(
|
||||
const std::mbstate_t & state,
|
||||
const char * from,
|
||||
const char * from_end,
|
||||
std::size_t max_limit
|
||||
) const;
|
||||
|
||||
// Largest possible value do_length(state,from,from_end,1) could return.
|
||||
virtual int do_max_length() const throw () {
|
||||
@ -185,6 +195,7 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
BOOST_UTF8_END_NAMESPACE
|
||||
|
||||
#endif // BOOST_UTF8_CODECVT_FACET_HPP
|
||||
|
Reference in New Issue
Block a user