An implementation of RFC 3492 Punycode. More...
Classes | |
| class | sourcemeta::core::PunycodeError |
Functions | |
| SOURCEMETA_CORE_PUNYCODE_EXPORT auto | sourcemeta::core::utf32_to_punycode (std::u32string_view input, std::size_t maximum_code_points=PUNYCODE_MAXIMUM_CODE_POINTS) -> std::string |
| SOURCEMETA_CORE_PUNYCODE_EXPORT auto | sourcemeta::core::utf8_to_punycode (std::istream &input, std::ostream &output, std::size_t maximum_code_points=PUNYCODE_MAXIMUM_CODE_POINTS) -> void |
| SOURCEMETA_CORE_PUNYCODE_EXPORT auto | sourcemeta::core::utf8_to_punycode (const std::string_view input, std::size_t maximum_code_points=PUNYCODE_MAXIMUM_CODE_POINTS) -> std::string |
| SOURCEMETA_CORE_PUNYCODE_EXPORT auto | sourcemeta::core::punycode_to_utf32 (const std::string_view input, std::size_t maximum_encoded_bytes=PUNYCODE_MAXIMUM_ENCODED_BYTES) -> std::u32string |
| SOURCEMETA_CORE_PUNYCODE_EXPORT auto | sourcemeta::core::punycode_to_utf8 (std::istream &input, std::ostream &output, std::size_t maximum_encoded_bytes=PUNYCODE_MAXIMUM_ENCODED_BYTES) -> void |
| SOURCEMETA_CORE_PUNYCODE_EXPORT auto | sourcemeta::core::punycode_to_utf8 (const std::string_view input, std::size_t maximum_encoded_bytes=PUNYCODE_MAXIMUM_ENCODED_BYTES) -> std::string |
Variables | |
| constexpr std::size_t | sourcemeta::core::PUNYCODE_MAXIMUM_CODE_POINTS |
| constexpr std::size_t | sourcemeta::core::PUNYCODE_MAXIMUM_ENCODED_BYTES |
An implementation of RFC 3492 Punycode.
This functionality is included as follows:
| class sourcemeta::core::PunycodeError |
An error that represents a Punycode encoding or decoding failure
Public Member Functions | |
|---|---|
| PunycodeError (const StaticString message) noexcept | |
| Construct an error with the given message. | |
| Public Member Functions inherited from sourcemeta::core::Error | |
| auto | message () const noexcept -> StaticString |
Additional Inherited Members | |
| Protected Member Functions inherited from sourcemeta::core::Error | |
| Error (const StaticString message) noexcept | |
| Construct the error given its message. | |
| SOURCEMETA_CORE_PUNYCODE_EXPORT auto sourcemeta::core::punycode_to_utf32 | ( | const std::string_view | input, |
| std::size_t | maximum_encoded_bytes = PUNYCODE_MAXIMUM_ENCODED_BYTES ) -> std::u32string |
Decode Punycode to Unicode code points (UTF-32). For example:
Note that stream-based overloads for UTF-32 are not provided because the C++ standard library does not define the required locale facets (std::ctype<char32_t>) for std::basic_istream<char32_t> and std::basic_ostream<char32_t> to function properly.
A bound smaller than the default refuses a larger input.
| SOURCEMETA_CORE_PUNYCODE_EXPORT auto sourcemeta::core::punycode_to_utf8 | ( | const std::string_view | input, |
| std::size_t | maximum_encoded_bytes = PUNYCODE_MAXIMUM_ENCODED_BYTES ) -> std::string |
Decode Punycode to UTF-8. For example:
A bound smaller than the default refuses a larger input.
| SOURCEMETA_CORE_PUNYCODE_EXPORT auto sourcemeta::core::punycode_to_utf8 | ( | std::istream & | input, |
| std::ostream & | output, | ||
| std::size_t | maximum_encoded_bytes = PUNYCODE_MAXIMUM_ENCODED_BYTES ) -> void |
Decode Punycode to UTF-8 using streams. For example:
A bound smaller than the default refuses a larger input.
| SOURCEMETA_CORE_PUNYCODE_EXPORT auto sourcemeta::core::utf32_to_punycode | ( | std::u32string_view | input, |
| std::size_t | maximum_code_points = PUNYCODE_MAXIMUM_CODE_POINTS ) -> std::string |
Encode Unicode code points (UTF-32) to Punycode. For example:
Note that stream-based overloads for UTF-32 are not provided because the C++ standard library does not define the required locale facets (std::ctype<char32_t>) for std::basic_istream<char32_t> and std::basic_ostream<char32_t> to function properly.
A bound smaller than the default refuses a larger input.
| SOURCEMETA_CORE_PUNYCODE_EXPORT auto sourcemeta::core::utf8_to_punycode | ( | const std::string_view | input, |
| std::size_t | maximum_code_points = PUNYCODE_MAXIMUM_CODE_POINTS ) -> std::string |
Encode UTF-8 to Punycode. For example:
A bound smaller than the default refuses a larger input.
| SOURCEMETA_CORE_PUNYCODE_EXPORT auto sourcemeta::core::utf8_to_punycode | ( | std::istream & | input, |
| std::ostream & | output, | ||
| std::size_t | maximum_code_points = PUNYCODE_MAXIMUM_CODE_POINTS ) -> void |
Encode UTF-8 to Punycode using streams. For example:
A bound smaller than the default refuses a larger input.
|
inlineconstexpr |
The most code points an encode accepts when a caller names no bound of its own. RFC 3492 Section 6.4 offers bounding the input as one way of keeping the position counters from wrapping, which is the ceiling this stands at, so a caller may name a smaller bound but never a larger one.
|
inlineconstexpr |
The most bytes a decode accepts when a caller names no bound of its own, which stands at the same ceiling the encode bound does and may likewise only be tightened.