unicode: extend charset_from_name
Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
97014df244
commit
d9e04170ac
@ -62,6 +62,11 @@ namespace stdex
|
|||||||
constexpr charset_id system_charset = charset_id::system;
|
constexpr charset_id system_charset = charset_id::system;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Parses charset name and returns matching charset code
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">Charset name</param>
|
||||||
|
/// <returns>Charset code or `charset_id::system` if match not found</returns>
|
||||||
inline charset_id charset_from_name(_In_z_ const char* name)
|
inline charset_id charset_from_name(_In_z_ const char* name)
|
||||||
{
|
{
|
||||||
struct charset_less {
|
struct charset_less {
|
||||||
@ -109,6 +114,17 @@ namespace stdex
|
|||||||
return charset_id::system;
|
return charset_id::system;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Parses charset name and returns matching charset code
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">Charset name</param>
|
||||||
|
/// <returns>Charset code or `charset_id::system` if match not found</returns>
|
||||||
|
template <class _Traits = std::char_traits<char>, class _Alloc = std::allocator<char>>
|
||||||
|
inline charset_id charset_from_name(_In_ const std::basic_string<char, _Traits, _Alloc>& name)
|
||||||
|
{
|
||||||
|
return charset_from_name(name.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Encoding converter context
|
/// Encoding converter context
|
||||||
///
|
///
|
||||||
|
Loading…
x
Reference in New Issue
Block a user