|
cli11
|
Conversion between narrow and wide character encodings. More...
#include <clocale>import std;Classes | |
| struct | cli::detail::scope_guard_t< F > |
| Runs a closure when it goes out of scope. More... | |
Functions | |
| auto | cli::detail::set_unicode_locale () -> void |
| Installs the first available UTF-8 locale for every category. | |
| template<typename F> | |
| auto | cli::detail::scope_guard (F &&closure) -> scope_guard_t< F > |
| Builds a scope_guard_t deducing the closure type. | |
| auto | cli::detail::narrow_impl (const wchar_t *str, std::size_t str_size) -> std::string |
| Converts a null-terminated wide string to a narrow string. | |
| auto | cli::detail::widen_impl (const char *str, std::size_t str_size) -> std::wstring |
| Converts a null-terminated narrow string to a wide string. | |
| auto | cli::narrow (const wchar_t *str, std::size_t str_size) -> std::string |
| Converts a wide string to a narrow string. | |
| auto | cli::narrow (const std::wstring &str) -> std::string |
| Converts a wide string to a narrow string. | |
| auto | cli::narrow (const wchar_t *str) -> std::string |
| Converts a null-terminated wide string to a narrow string. | |
| auto | cli::narrow (std::wstring_view str) -> std::string |
| Converts a wide string view to a narrow string. | |
| auto | cli::widen (const char *str, std::size_t str_size) -> std::wstring |
| Converts a narrow string to a wide string. | |
| auto | cli::widen (const std::string &str) -> std::wstring |
| Converts a narrow string to a wide string. | |
| auto | cli::widen (const char *str) -> std::wstring |
| Converts a null-terminated narrow string to a wide string. | |
| auto | cli::widen (std::string_view str) -> std::wstring |
| Converts a narrow string view to a wide string. | |
| auto | cli::to_path (std::string_view str) -> std::filesystem::path |
| Builds a filesystem path from a narrow string. | |
Conversion between narrow and wide character encodings.
On Windows the wide forms are UTF-16 and the narrow forms are the active code page; elsewhere the conversion runs under a temporarily installed UTF-8 locale so that results do not depend on whatever locale the host program has set.
|
export |
Converts a wide string to a narrow string.
| [in] | str | The string to convert. |
|
export |
Converts a null-terminated wide string to a narrow string.
| [in] | str | The null-terminated string to convert. |
|
export |
Converts a wide string to a narrow string.
| [in] | str | The null-terminated string to convert. |
| [in] | str_size | Unused; the conversion stops at the null terminator. |
|
export |
Converts a wide string view to a narrow string.
| [in] | str | The string to convert. |
str must be null-terminated. See the notes accompanying this refactor. | auto cli::detail::narrow_impl | ( | const wchar_t * | str, |
| std::size_t | str_size ) -> std::string |
Converts a null-terminated wide string to a narrow string.
| [in] | str | The null-terminated string to convert. |
| [in] | str_size | Unused; the conversion stops at the null terminator. |
| std::runtime_error | If the input is not convertible. |
|
nodiscard |
Builds a scope_guard_t deducing the closure type.
| F | Any callable invocable with no arguments. |
| closure | The closure to run when the guard is destroyed. |
closure. | auto cli::detail::set_unicode_locale | ( | ) | -> void |
Installs the first available UTF-8 locale for every category.
| std::runtime_error | If no UTF-8 locale is available. |
|
export |
Builds a filesystem path from a narrow string.
On Windows the string is widened first, so that paths outside the active code page survive the round trip.
| [in] | str | The path, as a narrow string. |
|
export |
Converts a null-terminated narrow string to a wide string.
| [in] | str | The null-terminated string to convert. |
|
export |
Converts a narrow string to a wide string.
| [in] | str | The null-terminated string to convert. |
| [in] | str_size | Unused; the conversion stops at the null terminator. |
|
export |
Converts a narrow string to a wide string.
| [in] | str | The string to convert. |
|
export |
Converts a narrow string view to a wide string.
| [in] | str | The string to convert. |
str must be null-terminated. See the notes accompanying this refactor. | auto cli::detail::widen_impl | ( | const char * | str, |
| std::size_t | str_size ) -> std::wstring |
Converts a null-terminated narrow string to a wide string.
| [in] | str | The null-terminated string to convert. |
| [in] | str_size | Unused; the conversion stops at the null terminator. |
| std::runtime_error | If the input is not convertible. |