mirror of
https://github.com/boostorg/detail.git
synced 2025-07-30 12:27:15 +02:00
eliminated MACRO for do length by providing both const and non-const versions
This commit is contained in:
@ -93,12 +93,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
|
// maximum lenght of a multibyte string
|
||||||
#define MB_LENGTH_MAX 8
|
#define MB_LENGTH_MAX 8
|
||||||
|
|
||||||
@ -183,7 +177,7 @@ 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?
|
||||||
virtual int do_length(
|
virtual int do_length(
|
||||||
BOOST_CODECVT_DO_LENGTH_CONST std::mbstate_t &,
|
const std::mbstate_t &,
|
||||||
const char * from,
|
const char * from,
|
||||||
const char * from_end,
|
const char * from_end,
|
||||||
std::size_t max_limit
|
std::size_t max_limit
|
||||||
@ -192,7 +186,23 @@ protected:
|
|||||||
throw()
|
throw()
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
virtual int do_length(
|
||||||
|
std::mbstate_t & s,
|
||||||
|
const char * from,
|
||||||
|
const char * from_end,
|
||||||
|
std::size_t max_limit
|
||||||
|
) const
|
||||||
|
#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
|
||||||
|
throw()
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return do_length(
|
||||||
|
const_cast<const std::mbstate_t &>(s),
|
||||||
|
from,
|
||||||
|
from_end,
|
||||||
|
max_limit
|
||||||
|
);
|
||||||
|
}
|
||||||
// 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 BOOST_NOEXCEPT_OR_NOTHROW {
|
virtual int do_max_length() const BOOST_NOEXCEPT_OR_NOTHROW {
|
||||||
return 6; // largest UTF-8 encoding of a UCS-4 character
|
return 6; // largest UTF-8 encoding of a UCS-4 character
|
||||||
|
@ -171,7 +171,7 @@ std::codecvt_base::result utf8_codecvt_facet::do_out(
|
|||||||
// 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?
|
||||||
int utf8_codecvt_facet::do_length(
|
int utf8_codecvt_facet::do_length(
|
||||||
BOOST_CODECVT_DO_LENGTH_CONST std::mbstate_t &,
|
const std::mbstate_t &,
|
||||||
const char * from,
|
const char * from,
|
||||||
const char * from_end,
|
const char * from_end,
|
||||||
std::size_t max_limit
|
std::size_t max_limit
|
||||||
|
Reference in New Issue
Block a user