|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r86614 - trunk/boost/detail
From: ramey_at_[hidden]
Date: 2013-11-10 21:25:58
Author: ramey
Date: 2013-11-10 21:25:58 EST (Sun, 10 Nov 2013)
New Revision: 86614
URL: http://svn.boost.org/trac/boost/changeset/86614
Log:
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.
Text files modified:
trunk/boost/detail/utf8_codecvt_facet.hpp | 39 +++++++++++++++++++++++++--------------
1 files changed, 25 insertions(+), 14 deletions(-)
Modified: trunk/boost/detail/utf8_codecvt_facet.hpp
==============================================================================
--- trunk/boost/detail/utf8_codecvt_facet.hpp Sun Nov 10 21:19:46 2013 (r86613)
+++ trunk/boost/detail/utf8_codecvt_facet.hpp 2013-11-10 21:25:58 EST (Sun, 10 Nov 2013) (r86614)
@@ -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 @@
}
#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 @@
}
// 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 @@
}
};
+
BOOST_UTF8_END_NAMESPACE
#endif // BOOST_UTF8_CODECVT_FACET_HPP
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk