Sourcemeta Core 0.0.0
Loading...
Searching...
No Matches
idna.h
1#ifndef SOURCEMETA_CORE_IDNA_H_
2#define SOURCEMETA_CORE_IDNA_H_
3
4#ifndef SOURCEMETA_CORE_IDNA_EXPORT
5#include <sourcemeta/core/idna_export.h>
6#endif
7
8#include <sourcemeta/core/idna_ucd.h>
9
10#include <cstddef> // std::size_t
11#include <cstdint> // std::uint8_t
12#include <optional> // std::optional
13#include <string> // std::u32string
14#include <string_view> // std::string_view, std::u32string_view
15
24
25namespace sourcemeta::core {
26
29enum class IDNALabelKind : std::uint8_t {
32 Ascii = 0,
34 ALabel = 1,
36 ULabel = 2,
37};
38
57SOURCEMETA_CORE_IDNA_EXPORT
58auto idna_classify_label(const std::u32string_view label,
59 std::u32string &decoded)
60 -> std::optional<IDNALabelKind>;
61
76SOURCEMETA_CORE_IDNA_EXPORT
77auto idna_property(const char32_t codepoint) noexcept -> IDNAProperty;
78
94SOURCEMETA_CORE_IDNA_EXPORT
95auto idna_passes_contexto(const std::u32string_view label,
96 const std::size_t position) noexcept -> bool;
97
117SOURCEMETA_CORE_IDNA_EXPORT
118auto idna_passes_contextj(const std::u32string_view label,
119 const std::size_t position) noexcept -> bool;
120
138SOURCEMETA_CORE_IDNA_EXPORT
139auto idna_passes_bidi_rule(const std::u32string_view label) noexcept -> bool;
140
158SOURCEMETA_CORE_IDNA_EXPORT
159auto idna_is_valid_u_label(const std::u32string_view label) -> bool;
160
183SOURCEMETA_CORE_IDNA_EXPORT
184auto idna_is_valid_a_label(const std::string_view label) -> bool;
185
210SOURCEMETA_CORE_IDNA_EXPORT
211auto idna_uts46_map(const std::u32string_view input) -> std::u32string;
212
213} // namespace sourcemeta::core
214
215#endif
SOURCEMETA_CORE_IDNA_EXPORT auto idna_property(const char32_t codepoint) noexcept -> IDNAProperty
IDNAProperty
Definition idna_ucd.h:20
SOURCEMETA_CORE_IDNA_EXPORT auto idna_is_valid_a_label(const std::string_view label) -> bool
SOURCEMETA_CORE_IDNA_EXPORT auto idna_classify_label(const std::u32string_view label, std::u32string &decoded) -> std::optional< IDNALabelKind >
SOURCEMETA_CORE_IDNA_EXPORT auto idna_uts46_map(const std::u32string_view input) -> std::u32string
SOURCEMETA_CORE_IDNA_EXPORT auto idna_is_valid_u_label(const std::u32string_view label) -> bool
SOURCEMETA_CORE_IDNA_EXPORT auto idna_passes_bidi_rule(const std::u32string_view label) noexcept -> bool
SOURCEMETA_CORE_IDNA_EXPORT auto idna_passes_contexto(const std::u32string_view label, const std::size_t position) noexcept -> bool
SOURCEMETA_CORE_IDNA_EXPORT auto idna_passes_contextj(const std::u32string_view label, const std::size_t position) noexcept -> bool
IDNALabelKind
Definition idna.h:29
@ ALabel
An RFC 5890 §2.3.2.1 A-label (ACE form), validated per RFC 5891 §4.
Definition idna.h:34
@ Ascii
Definition idna.h:32
@ ULabel
An RFC 5890 §2.3.2.2 U-label (Unicode form), validated per RFC 5891 §4.
Definition idna.h:36