mirror of
https://github.com/boostorg/locale.git
synced 2026-01-19 04:22:08 +00:00
Use the C++11 cstdint header instead of the boost fallback
This commit is contained in:
committed by
Alexander Grund
parent
0bf6ba514d
commit
458aeee83c
@@ -11,9 +11,9 @@
|
||||
#include <boost/locale/boundary/facets.hpp>
|
||||
#include <boost/locale/boundary/segment.hpp>
|
||||
#include <boost/locale/boundary/types.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <iterator>
|
||||
#include <locale>
|
||||
#include <memory>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#define BOOST_LOCALE_BOUNDARY_TYPES_HPP_INCLUDED
|
||||
|
||||
#include <boost/locale/config.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <boost/locale/config.hpp>
|
||||
#include <boost/locale/detail/facet_id.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <cstdint>
|
||||
#include <locale>
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
#include <boost/locale/time_zone.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/utility/string_view.hpp>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#define BOOST_LOCALE_GENERATOR_HPP
|
||||
|
||||
#include <boost/locale/hold_ptr.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <cstdint>
|
||||
#include <locale>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#define BOOST_LOCALE_GENERIC_CODECVT_HPP
|
||||
|
||||
#include <boost/locale/utf.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <cstdint>
|
||||
#include <locale>
|
||||
|
||||
namespace boost { namespace locale {
|
||||
@@ -187,7 +187,7 @@ namespace boost { namespace locale {
|
||||
implementation().initial_state(generic_codecvt_base::to_unicode_state);
|
||||
while(max > 0 && from < from_end) {
|
||||
const char* prev_from = from;
|
||||
boost::uint32_t ch = implementation().to_unicode(cvt_state, from, from_end);
|
||||
std::uint32_t ch = implementation().to_unicode(cvt_state, from, from_end);
|
||||
if(ch == boost::locale::utf::incomplete || ch == boost::locale::utf::illegal) {
|
||||
from = prev_from;
|
||||
break;
|
||||
@@ -250,8 +250,8 @@ namespace boost { namespace locale {
|
||||
// once again and then we would consume our input together with writing
|
||||
// second surrogate pair
|
||||
ch -= 0x10000;
|
||||
boost::uint16_t w1 = static_cast<boost::uint16_t>(0xD800 | (ch >> 10));
|
||||
boost::uint16_t w2 = static_cast<boost::uint16_t>(0xDC00 | (ch & 0x3FF));
|
||||
std::uint16_t w1 = static_cast<std::uint16_t>(0xD800 | (ch >> 10));
|
||||
std::uint16_t w2 = static_cast<std::uint16_t>(0xDC00 | (ch & 0x3FF));
|
||||
if(!state) {
|
||||
from = from_saved;
|
||||
*to++ = w1;
|
||||
@@ -283,22 +283,22 @@ namespace boost { namespace locale {
|
||||
//
|
||||
// State: state!=0 - a first surrogate pair was observed (state = first pair),
|
||||
// we expect the second one to come and then zero the state
|
||||
boost::uint16_t state = detail::read_state(std_state);
|
||||
std::uint16_t state = detail::read_state(std_state);
|
||||
typename CodecvtImpl::state_type cvt_state =
|
||||
implementation().initial_state(generic_codecvt_base::from_unicode_state);
|
||||
while(to < to_end && from < from_end) {
|
||||
boost::uint32_t ch = 0;
|
||||
std::uint32_t ch = 0;
|
||||
if(state != 0) {
|
||||
// if the state indicates that 1st surrogate pair was written
|
||||
// we should make sure that the second one that comes is actually
|
||||
// second surrogate
|
||||
boost::uint16_t w1 = state;
|
||||
boost::uint16_t w2 = *from;
|
||||
std::uint16_t w1 = state;
|
||||
std::uint16_t w2 = *from;
|
||||
// we don't forward from as writing may fail to incomplete or
|
||||
// partial conversion
|
||||
if(0xDC00 <= w2 && w2 <= 0xDFFF) {
|
||||
boost::uint16_t vh = w1 - 0xD800;
|
||||
boost::uint16_t vl = w2 - 0xDC00;
|
||||
std::uint16_t vh = w1 - 0xD800;
|
||||
std::uint16_t vl = w2 - 0xDC00;
|
||||
ch = ((uint32_t(vh) << 10) | vl) + 0x10000;
|
||||
} else {
|
||||
// Invalid surrogate
|
||||
@@ -327,7 +327,7 @@ namespace boost { namespace locale {
|
||||
r = std::codecvt_base::error;
|
||||
break;
|
||||
}
|
||||
boost::uint32_t len = implementation().from_unicode(cvt_state, ch, to, to_end);
|
||||
std::uint32_t len = implementation().from_unicode(cvt_state, ch, to, to_end);
|
||||
if(len == boost::locale::utf::incomplete) {
|
||||
r = std::codecvt_base::partial;
|
||||
break;
|
||||
@@ -380,7 +380,7 @@ namespace boost { namespace locale {
|
||||
implementation().initial_state(generic_codecvt_base::to_unicode_state);
|
||||
while(max > 0 && from < from_end) {
|
||||
const char* save_from = from;
|
||||
boost::uint32_t ch = implementation().to_unicode(cvt_state, from, from_end);
|
||||
std::uint32_t ch = implementation().to_unicode(cvt_state, from, from_end);
|
||||
if(ch == boost::locale::utf::incomplete || ch == boost::locale::utf::illegal) {
|
||||
from = save_from;
|
||||
break;
|
||||
@@ -442,13 +442,13 @@ namespace boost { namespace locale {
|
||||
std::codecvt_base::result r = std::codecvt_base::ok;
|
||||
auto cvt_state = implementation().initial_state(generic_codecvt_base::from_unicode_state);
|
||||
while(to < to_end && from < from_end) {
|
||||
boost::uint32_t ch = 0;
|
||||
std::uint32_t ch = 0;
|
||||
ch = *from;
|
||||
if(!boost::locale::utf::is_valid_codepoint(ch)) {
|
||||
r = std::codecvt_base::error;
|
||||
break;
|
||||
}
|
||||
boost::uint32_t len = implementation().from_unicode(cvt_state, ch, to, to_end);
|
||||
std::uint32_t len = implementation().from_unicode(cvt_state, ch, to, to_end);
|
||||
if(len == boost::locale::utf::incomplete) {
|
||||
r = std::codecvt_base::partial;
|
||||
break;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#define BOOST_LOCALE_UTF_HPP_INCLUDED
|
||||
|
||||
#include <boost/locale/config.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
namespace boost { namespace locale {
|
||||
/// \brief Namespace that holds basic operations on UTF encoded sequences
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <boost/locale/generic_codecvt.hpp>
|
||||
#include <boost/locale/utf.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <cstdint>
|
||||
#include <locale>
|
||||
|
||||
namespace boost { namespace locale {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <boost/locale/generator.hpp>
|
||||
#include <boost/locale/utf.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <cstdint>
|
||||
#include <locale>
|
||||
#include <memory>
|
||||
#include <typeinfo>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#define BOOST_LOCALE_FORMATTER_HPP_INCLUDED
|
||||
|
||||
#include <boost/locale/config.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <unicode/locid.h>
|
||||
|
||||
@@ -9,9 +9,7 @@
|
||||
#define BOOST_SRC_ICU_UTIL_HPP
|
||||
|
||||
#include <boost/locale/config.hpp>
|
||||
#ifdef BOOST_HAS_STDINT_H
|
||||
# include <stdint.h> // Avoid ICU defining e.g. INT8_MIN causing macro redefinition warnings
|
||||
#endif
|
||||
#include <cstdint> // Avoid ICU defining e.g. INT8_MIN causing macro redefinition warnings
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <unicode/utypes.h>
|
||||
|
||||
@@ -8,9 +8,7 @@
|
||||
#define BOOST_LOCALE_IMPL_ICU_GET_TIME_ZONE_HPP
|
||||
|
||||
#include <boost/locale/config.hpp>
|
||||
#ifdef BOOST_HAS_STDINT_H
|
||||
# include <stdint.h> // Avoid ICU defining e.g. INT8_MIN causing macro redefinition warnings
|
||||
#endif
|
||||
#include <cstdint> // Avoid ICU defining e.g. INT8_MIN causing macro redefinition warnings
|
||||
#include <string>
|
||||
#include <unicode/timezone.h>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
namespace boost { namespace locale { namespace gnu_gettext {
|
||||
|
||||
|
||||
@@ -13,32 +13,32 @@
|
||||
|
||||
using namespace boost::locale::utf;
|
||||
|
||||
const boost::uint32_t* u32_seq(boost::uint32_t a)
|
||||
const std::uint32_t* u32_seq(std::uint32_t a)
|
||||
{
|
||||
static boost::uint32_t buf[2];
|
||||
static std::uint32_t buf[2];
|
||||
buf[0] = a;
|
||||
buf[1] = 0;
|
||||
return buf;
|
||||
}
|
||||
|
||||
const boost::uint16_t* u16_seq(boost::uint16_t a)
|
||||
const std::uint16_t* u16_seq(std::uint16_t a)
|
||||
{
|
||||
static boost::uint16_t buf[2];
|
||||
static std::uint16_t buf[2];
|
||||
buf[0] = a;
|
||||
buf[1] = 0;
|
||||
return buf;
|
||||
}
|
||||
|
||||
const boost::uint16_t* u16_seq(boost::uint16_t a, boost::uint16_t b)
|
||||
const std::uint16_t* u16_seq(std::uint16_t a, std::uint16_t b)
|
||||
{
|
||||
static boost::uint16_t buf[3];
|
||||
static std::uint16_t buf[3];
|
||||
buf[0] = a;
|
||||
buf[1] = b;
|
||||
buf[2] = 0;
|
||||
return buf;
|
||||
}
|
||||
|
||||
const char16_t* c16_seq(boost::uint16_t a)
|
||||
const char16_t* c16_seq(std::uint16_t a)
|
||||
{
|
||||
static char16_t buf[2];
|
||||
buf[0] = static_cast<char16_t>(a);
|
||||
@@ -46,7 +46,7 @@ const char16_t* c16_seq(boost::uint16_t a)
|
||||
return buf;
|
||||
}
|
||||
|
||||
const char32_t* c32_seq(boost::uint32_t a)
|
||||
const char32_t* c32_seq(std::uint32_t a)
|
||||
{
|
||||
static char32_t buf[2];
|
||||
buf[0] = static_cast<char32_t>(a);
|
||||
|
||||
Reference in New Issue
Block a user