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:
Robert Ramey
2013-11-11 02:25:58 +00:00
parent 8c689a1533
commit 55f85a4d1f

View File

@@ -85,6 +85,10 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/detail/workaround.hpp> #include <boost/detail/workaround.hpp>
#ifndef BOOST_NO_CXX11_HDR_CODECVT
#include <codecvt>
#endif
#if defined(BOOST_NO_STDC_NAMESPACE) #if defined(BOOST_NO_STDC_NAMESPACE)
namespace std { namespace std {
using ::mbstate_t; using ::mbstate_t;
@@ -92,13 +96,6 @@ namespace std {
} }
#endif #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 #define MB_LENGTH_MAX 8
BOOST_UTF8_BEGIN_NAMESPACE BOOST_UTF8_BEGIN_NAMESPACE
@@ -167,17 +164,30 @@ protected:
} }
// How many char objects can I process to get <= max_limit // 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( virtual int do_length(
BOOST_CODECVT_DO_LENGTH_CONST std::mbstate_t &, std::mbstate_t & state,
const char * from, const char * from,
const char * from_end, const char * from_end,
std::size_t max_limit std::size_t max_limit
#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) ) const
) const throw(); #if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
#else throw()
) const; #endif
#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. // Largest possible value do_length(state,from,from_end,1) could return.
virtual int do_max_length() const throw () { virtual int do_max_length() const throw () {
@@ -185,6 +195,7 @@ protected:
} }
}; };
BOOST_UTF8_END_NAMESPACE BOOST_UTF8_END_NAMESPACE
#endif // BOOST_UTF8_CODECVT_FACET_HPP #endif // BOOST_UTF8_CODECVT_FACET_HPP