mirror of
https://github.com/matrix-construct/construct
synced 2024-06-11 14:38:57 +02:00
ircd::icu: Use better namespace name; export to ircd.
This commit is contained in:
parent
1c9ee622e5
commit
71eba6bf45
|
@ -37,7 +37,7 @@ namespace ircd::icu
|
|||
extern const info::versions unicode_version_api, unicode_version_abi;
|
||||
}
|
||||
|
||||
namespace ircd::icu::u8
|
||||
namespace ircd::icu::utf8
|
||||
{
|
||||
bool lead(const char &) noexcept;
|
||||
bool trail(const char &) noexcept;
|
||||
|
@ -50,7 +50,7 @@ namespace ircd::icu::u8
|
|||
size_t transform(char32_t *const &out, const size_t &max, const string_view &in);
|
||||
}
|
||||
|
||||
namespace ircd::icu::u16
|
||||
namespace ircd::icu::utf16
|
||||
{
|
||||
bool lead(const char &) noexcept;
|
||||
bool trail(const char &) noexcept;
|
||||
|
@ -61,3 +61,9 @@ namespace ircd::icu::u16
|
|||
char32_t get_or_fffd(const string_view &) noexcept; // error = U+FFFD
|
||||
char32_t get_unsafe(const string_view &) noexcept; // error undefined
|
||||
}
|
||||
|
||||
namespace ircd
|
||||
{
|
||||
namespace utf8 = icu::utf8;
|
||||
namespace utf16 = icu::utf16;
|
||||
}
|
||||
|
|
42
ircd/icu.cc
42
ircd/icu.cc
|
@ -208,7 +208,7 @@ noexcept
|
|||
#if __has_include(<unicode/utf16.h>)
|
||||
|
||||
char32_t
|
||||
ircd::icu::u16::get_unsafe(const string_view &in)
|
||||
ircd::icu::utf16::get_unsafe(const string_view &in)
|
||||
noexcept
|
||||
{
|
||||
UChar32 ret;
|
||||
|
@ -218,7 +218,7 @@ noexcept
|
|||
}
|
||||
|
||||
char32_t
|
||||
ircd::icu::u16::get_or_fffd(const string_view &in_)
|
||||
ircd::icu::utf16::get_or_fffd(const string_view &in_)
|
||||
noexcept
|
||||
{
|
||||
UChar32 ret;
|
||||
|
@ -229,7 +229,7 @@ noexcept
|
|||
}
|
||||
|
||||
char32_t
|
||||
ircd::icu::u16::get(const string_view &in_)
|
||||
ircd::icu::utf16::get(const string_view &in_)
|
||||
noexcept
|
||||
{
|
||||
UChar32 ret;
|
||||
|
@ -240,35 +240,35 @@ noexcept
|
|||
}
|
||||
|
||||
size_t
|
||||
ircd::icu::u16::length(const string_view &in)
|
||||
ircd::icu::utf16::length(const string_view &in)
|
||||
noexcept
|
||||
{
|
||||
return u16::length(u16::get(in));
|
||||
return utf16::length(utf16::get(in));
|
||||
}
|
||||
|
||||
size_t
|
||||
ircd::icu::u16::length(const char32_t &ch)
|
||||
ircd::icu::utf16::length(const char32_t &ch)
|
||||
noexcept
|
||||
{
|
||||
return U16_LENGTH(ch);
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::icu::u16::single(const char &ch)
|
||||
ircd::icu::utf16::single(const char &ch)
|
||||
noexcept
|
||||
{
|
||||
return U16_IS_SINGLE(ch);
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::icu::u16::trail(const char &ch)
|
||||
ircd::icu::utf16::trail(const char &ch)
|
||||
noexcept
|
||||
{
|
||||
return U16_IS_TRAIL(ch);
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::icu::u16::lead(const char &ch)
|
||||
ircd::icu::utf16::lead(const char &ch)
|
||||
noexcept
|
||||
{
|
||||
return U16_IS_LEAD(ch);
|
||||
|
@ -283,9 +283,9 @@ noexcept
|
|||
#if __has_include(<unicode/utf8.h>)
|
||||
|
||||
size_t
|
||||
ircd::icu::u8::transform(char32_t *const &out,
|
||||
const size_t &max,
|
||||
const string_view &in)
|
||||
ircd::icu::utf8::transform(char32_t *const &out,
|
||||
const size_t &max,
|
||||
const string_view &in)
|
||||
{
|
||||
const auto &_in
|
||||
{
|
||||
|
@ -302,7 +302,7 @@ ircd::icu::u8::transform(char32_t *const &out,
|
|||
}
|
||||
|
||||
char32_t
|
||||
ircd::icu::u8::get_unsafe(const string_view &in)
|
||||
ircd::icu::utf8::get_unsafe(const string_view &in)
|
||||
noexcept
|
||||
{
|
||||
UChar32 ret;
|
||||
|
@ -312,7 +312,7 @@ noexcept
|
|||
}
|
||||
|
||||
char32_t
|
||||
ircd::icu::u8::get_or_fffd(const string_view &in_)
|
||||
ircd::icu::utf8::get_or_fffd(const string_view &in_)
|
||||
noexcept
|
||||
{
|
||||
UChar32 ret;
|
||||
|
@ -323,7 +323,7 @@ noexcept
|
|||
}
|
||||
|
||||
char32_t
|
||||
ircd::icu::u8::get(const string_view &in_)
|
||||
ircd::icu::utf8::get(const string_view &in_)
|
||||
noexcept
|
||||
{
|
||||
UChar32 ret;
|
||||
|
@ -334,35 +334,35 @@ noexcept
|
|||
}
|
||||
|
||||
size_t
|
||||
ircd::icu::u8::length(const string_view &in)
|
||||
ircd::icu::utf8::length(const string_view &in)
|
||||
noexcept
|
||||
{
|
||||
return u8::length(u8::get(in));
|
||||
return utf8::length(utf8::get(in));
|
||||
}
|
||||
|
||||
size_t
|
||||
ircd::icu::u8::length(const char32_t &ch)
|
||||
ircd::icu::utf8::length(const char32_t &ch)
|
||||
noexcept
|
||||
{
|
||||
return U8_LENGTH(ch);
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::icu::u8::single(const char &ch)
|
||||
ircd::icu::utf8::single(const char &ch)
|
||||
noexcept
|
||||
{
|
||||
return U8_IS_SINGLE(ch);
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::icu::u8::trail(const char &ch)
|
||||
ircd::icu::utf8::trail(const char &ch)
|
||||
noexcept
|
||||
{
|
||||
return U8_IS_TRAIL(ch);
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::icu::u8::lead(const char &ch)
|
||||
ircd::icu::utf8::lead(const char &ch)
|
||||
noexcept
|
||||
{
|
||||
return U8_IS_LEAD(ch);
|
||||
|
|
|
@ -15750,15 +15750,15 @@ console_cmd__icu(opt &out, const string_view &line)
|
|||
|
||||
const size_t count
|
||||
{
|
||||
icu::u8::transform(ch, size(line), line)
|
||||
utf8::transform(ch, size(line), line)
|
||||
};
|
||||
|
||||
char namebuf[64]; size_t li(0);
|
||||
for(size_t i(0); i < count; ++i, li += icu::u8::length(ch[i]))
|
||||
for(size_t i(0); i < count; ++i, li += utf8::length(ch[i]))
|
||||
out
|
||||
<< ' ' << std::dec << std::right << std::setw(6) << int(icu::block(ch[i]))
|
||||
<< ' ' << std::dec << std::right << std::setw(4) << int(icu::category(ch[i]))
|
||||
<< ' ' << std::dec << std::right << std::setw(2) << int(icu::u8::length(ch[i]))
|
||||
<< ' ' << std::dec << std::right << std::setw(2) << int(icu::utf8::length(ch[i]))
|
||||
<< ' ' << "U+" << std::hex << std::right << std::setw(6) << std::setfill('0') << uint32_t(ch[i]) << std::setfill(' ')
|
||||
<< ' ' << ' ' << icu::name(namebuf, ch[i])
|
||||
<< std::endl;
|
||||
|
|
Loading…
Reference in a new issue